Skip to content

Commit 58a513e

Browse files
shulanbushangshupre-commit-ci[bot]isamu-takagi
authored
feat: add common interface specs test (autowarefoundation#5034)
* add interface specs test Signed-off-by: jack.song <jack.song@autocore.ai> * add interface specs test Signed-off-by: jack.song <jack.song@autocore.ai> * add interface specs test Signed-off-by: jack.song <jack.song@autocore.ai> * add interface specs test Signed-off-by: jack.song <jack.song@autocore.ai> * add interface specs test Signed-off-by: jack.song <jack.song@autocore.ai> * add interface specs test Signed-off-by: jack.song <jack.song@autocore.ai> * add interface specs test Signed-off-by: jack.song <jack.song@autocore.ai> * add interface specs test Signed-off-by: jack.song <jack.song@autocore.ai> * add interface specs test Signed-off-by: jack.song <jack.song@autocore.ai> * add interface specs test Signed-off-by: jack.song <jack.song@autocore.ai> * add interface specs test Signed-off-by: jack.song <jack.song@autocore.ai> * style(pre-commit): autofix * fix copyright Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> --------- Signed-off-by: jack.song <jack.song@autocore.ai> Signed-off-by: Takagi, Isamu <isamu.takagi@tier4.jp> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Takagi, Isamu <43976882+isamu-takagi@users.noreply.github.com> Co-authored-by: Takagi, Isamu <isamu.takagi@tier4.jp>
1 parent 8c38126 commit 58a513e

10 files changed

+384
-1
lines changed

common/component_interface_specs/CMakeLists.txt

+34
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,38 @@ project(component_interface_specs)
44
find_package(autoware_cmake REQUIRED)
55
autoware_package()
66

7+
include_directories(
8+
include
9+
SYSTEM
10+
${rclcpp_INCLUDE_DIRS}
11+
${rosidl_runtime_cpp_INCLUDE_DIRS}
12+
${rcl_INCLUDE_DIRS}
13+
${autoware_adapi_v1_msgs_INCLUDE_DIRS}
14+
${autoware_auto_planning_msgs_INCLUDE_DIRS}
15+
${autoware_planning_msgs_INCLUDE_DIRS}
16+
${autoware_auto_vehicle_msgs_INCLUDE_DIRS}
17+
${tier4_control_msgs_INCLUDE_DIRS}
18+
${nav_msgs_INCLUDE_DIRS}
19+
${tier4_system_msgs_INCLUDE_DIRS}
20+
${tier4_vehicle_msgs_INCLUDE_DIRS}
21+
${autoware_auto_perception_msgs_INCLUDE_DIRS}
22+
${tier4_map_msgs_INCLUDE_DIRS}
23+
)
24+
25+
if(BUILD_TESTING)
26+
ament_add_ros_isolated_gtest(test_component_interface_specs
27+
test/gtest_main.cpp
28+
test/test_planning.cpp
29+
test/test_control.cpp
30+
test/test_localization.cpp
31+
test/test_system.cpp
32+
test/test_map.cpp
33+
test/test_perception.cpp
34+
test/test_vehicle.cpp
35+
)
36+
target_include_directories(test_component_interface_specs
37+
PRIVATE include
38+
)
39+
endif()
40+
741
ament_auto_package()

common/component_interface_specs/package.xml

+16-1
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,28 @@
1111
<license>Apache License 2.0</license>
1212

1313
<buildtool_depend>ament_cmake_auto</buildtool_depend>
14+
<buildtool_depend>ament_cmake_core</buildtool_depend>
15+
<buildtool_depend>ament_cmake_export_dependencies</buildtool_depend>
16+
<buildtool_depend>ament_cmake_test</buildtool_depend>
1417
<buildtool_depend>autoware_cmake</buildtool_depend>
1518

19+
<buildtool_export_depend>ament_cmake_core</buildtool_export_depend>
20+
<buildtool_export_depend>ament_cmake_test</buildtool_export_depend>
21+
1622
<depend>autoware_adapi_v1_msgs</depend>
23+
<depend>autoware_auto_perception_msgs</depend>
24+
<depend>autoware_auto_planning_msgs</depend>
1725
<depend>autoware_auto_vehicle_msgs</depend>
26+
<depend>autoware_planning_msgs</depend>
27+
<depend>nav_msgs</depend>
28+
<depend>rcl</depend>
29+
<depend>rclcpp</depend>
30+
<depend>rosidl_runtime_cpp</depend>
31+
<depend>tier4_control_msgs</depend>
1832
<depend>tier4_map_msgs</depend>
33+
<depend>tier4_system_msgs</depend>
1934
<depend>tier4_vehicle_msgs</depend>
20-
35+
<test_depend>ament_cmake_ros</test_depend>
2136
<test_depend>ament_lint_auto</test_depend>
2237
<test_depend>autoware_lint_common</test_depend>
2338

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2023 The Autoware Contributors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "gtest/gtest.h"
16+
17+
int main(int argc, char * argv[])
18+
{
19+
::testing::InitGoogleTest(&argc, argv);
20+
return RUN_ALL_TESTS();
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Copyright 2023 The Autoware Contributors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "component_interface_specs/control.hpp"
16+
#include "gtest/gtest.h"
17+
18+
TEST(control, interface)
19+
{
20+
{
21+
using control_interface::IsPaused;
22+
IsPaused is_paused;
23+
size_t depth = 1;
24+
EXPECT_EQ(is_paused.depth, depth);
25+
EXPECT_EQ(is_paused.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE);
26+
EXPECT_EQ(is_paused.durability, RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL);
27+
}
28+
29+
{
30+
using control_interface::IsStartRequested;
31+
IsStartRequested is_start_requested;
32+
size_t depth = 1;
33+
EXPECT_EQ(is_start_requested.depth, depth);
34+
EXPECT_EQ(is_start_requested.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE);
35+
EXPECT_EQ(is_start_requested.durability, RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL);
36+
}
37+
38+
{
39+
using control_interface::IsStopped;
40+
IsStopped is_stopped;
41+
size_t depth = 1;
42+
EXPECT_EQ(is_stopped.depth, depth);
43+
EXPECT_EQ(is_stopped.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE);
44+
EXPECT_EQ(is_stopped.durability, RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL);
45+
}
46+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Copyright 2023 The Autoware Contributors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "component_interface_specs/localization.hpp"
16+
#include "gtest/gtest.h"
17+
18+
TEST(localization, interface)
19+
{
20+
{
21+
using localization_interface::InitializationState;
22+
InitializationState initialization_state;
23+
size_t depth = 1;
24+
EXPECT_EQ(initialization_state.depth, depth);
25+
EXPECT_EQ(initialization_state.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE);
26+
EXPECT_EQ(initialization_state.durability, RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL);
27+
}
28+
29+
{
30+
using localization_interface::KinematicState;
31+
KinematicState kinematic_state;
32+
size_t depth = 1;
33+
EXPECT_EQ(kinematic_state.depth, depth);
34+
EXPECT_EQ(kinematic_state.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE);
35+
EXPECT_EQ(kinematic_state.durability, RMW_QOS_POLICY_DURABILITY_VOLATILE);
36+
}
37+
38+
{
39+
using localization_interface::Acceleration;
40+
Acceleration acceleration;
41+
size_t depth = 1;
42+
EXPECT_EQ(acceleration.depth, depth);
43+
EXPECT_EQ(acceleration.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE);
44+
EXPECT_EQ(acceleration.durability, RMW_QOS_POLICY_DURABILITY_VOLATILE);
45+
}
46+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2023 The Autoware Contributors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "component_interface_specs/map.hpp"
16+
#include "gtest/gtest.h"
17+
18+
TEST(map, interface)
19+
{
20+
{
21+
using map_interface::MapProjectorInfo;
22+
MapProjectorInfo map_projector;
23+
size_t depth = 1;
24+
EXPECT_EQ(map_projector.depth, depth);
25+
EXPECT_EQ(map_projector.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE);
26+
EXPECT_EQ(map_projector.durability, RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL);
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2023 The Autoware Contributors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "component_interface_specs/perception.hpp"
16+
#include "gtest/gtest.h"
17+
18+
TEST(perception, interface)
19+
{
20+
{
21+
using perception_interface::ObjectRecognition;
22+
ObjectRecognition object_recognition;
23+
size_t depth = 1;
24+
EXPECT_EQ(object_recognition.depth, depth);
25+
EXPECT_EQ(object_recognition.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE);
26+
EXPECT_EQ(object_recognition.durability, RMW_QOS_POLICY_DURABILITY_VOLATILE);
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Copyright 2023 The Autoware Contributors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "component_interface_specs/planning.hpp"
16+
#include "gtest/gtest.h"
17+
18+
TEST(planning, interface)
19+
{
20+
{
21+
using planning_interface::RouteState;
22+
RouteState state;
23+
size_t depth = 1;
24+
EXPECT_EQ(state.depth, depth);
25+
EXPECT_EQ(state.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE);
26+
EXPECT_EQ(state.durability, RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL);
27+
}
28+
29+
{
30+
using planning_interface::Route;
31+
Route route;
32+
size_t depth = 1;
33+
EXPECT_EQ(route.depth, depth);
34+
EXPECT_EQ(route.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE);
35+
EXPECT_EQ(route.durability, RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL);
36+
}
37+
38+
{
39+
using planning_interface::NormalRoute;
40+
NormalRoute route;
41+
size_t depth = 1;
42+
EXPECT_EQ(route.depth, depth);
43+
EXPECT_EQ(route.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE);
44+
EXPECT_EQ(route.durability, RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL);
45+
}
46+
47+
{
48+
using planning_interface::MrmRoute;
49+
MrmRoute route;
50+
size_t depth = 1;
51+
EXPECT_EQ(route.depth, depth);
52+
EXPECT_EQ(route.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE);
53+
EXPECT_EQ(route.durability, RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL);
54+
}
55+
56+
{
57+
using planning_interface::Trajectory;
58+
Trajectory trajectory;
59+
size_t depth = 1;
60+
EXPECT_EQ(trajectory.depth, depth);
61+
EXPECT_EQ(trajectory.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE);
62+
EXPECT_EQ(trajectory.durability, RMW_QOS_POLICY_DURABILITY_VOLATILE);
63+
}
64+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright 2023 The Autoware Contributors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#include "component_interface_specs/system.hpp"
16+
#include "gtest/gtest.h"
17+
18+
TEST(system, interface)
19+
{
20+
{
21+
using system_interface::MrmState;
22+
MrmState state;
23+
size_t depth = 1;
24+
EXPECT_EQ(state.depth, depth);
25+
EXPECT_EQ(state.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE);
26+
EXPECT_EQ(state.durability, RMW_QOS_POLICY_DURABILITY_VOLATILE);
27+
}
28+
29+
{
30+
using system_interface::OperationModeState;
31+
OperationModeState state;
32+
size_t depth = 1;
33+
EXPECT_EQ(state.depth, depth);
34+
EXPECT_EQ(state.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE);
35+
EXPECT_EQ(state.durability, RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL);
36+
}
37+
}

0 commit comments

Comments
 (0)