diff --git a/common/autoware_component_interface_specs/CMakeLists.txt b/common/autoware_component_interface_specs/CMakeLists.txt new file mode 100644 index 0000000000..c514afb3dc --- /dev/null +++ b/common/autoware_component_interface_specs/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.14) +project(autoware_component_interface_specs) + +find_package(autoware_cmake REQUIRED) +autoware_package() + +if(BUILD_TESTING) + ament_auto_add_gtest(gtest_${PROJECT_NAME} + test/gtest_main.cpp + test/test_planning.cpp + test/test_control.cpp + test/test_localization.cpp + test/test_map.cpp + test/test_perception.cpp + test/test_vehicle.cpp + ) +endif() + +ament_auto_package() diff --git a/common/autoware_component_interface_specs/README.md b/common/autoware_component_interface_specs/README.md new file mode 100644 index 0000000000..3770f3a567 --- /dev/null +++ b/common/autoware_component_interface_specs/README.md @@ -0,0 +1,47 @@ +# autoware_component_interface_specs + +This package defines the standardized component interface specifications for Autoware Core, ensuring consistent communication and interaction between various components in the Autoware autonomous driving stack. + +## Purpose + +The purpose of this package is to: + +- Provide a single source of truth for component interface definitions +- Ensure consistency across different implementations +- Facilitate modular development and component interchangeability +- Document the communication protocols between Autoware Core components + +## Structure + +The package contains interface specifications for various components, including: + +- Message definitions +- Service interfaces +- Action interfaces + +## Usage + +To use these interface specifications in your component: + +1. Add this package as a dependency in your package.xml: + + ```xml + autoware_component_interface_specs + ``` + +2. Use the provided interfaces in your component code. + + ```cpp + #include + // Example: Creating a publisher using the interface specs + using KinematicState = autoware::component_interface_specs::localization::KinematicState; + rclcpp::Publisher::SharedPtr publisher_ = + create_publisher( + KinematicState::name, + autoware::component_interface_specs::get_qos(KinematicState)); + // Example: Creating a subscription using the interface specs + auto subscriber_ = create_subscription( + KinematicState::name, + autoware::component_interface_specs::get_qos(KinematicState), + std::bind(&YourClass::callback, this, std::placeholders::1)); + ``` diff --git a/common/autoware_component_interface_specs/include/autoware/component_interface_specs/control.hpp b/common/autoware_component_interface_specs/include/autoware/component_interface_specs/control.hpp new file mode 100644 index 0000000000..24e6c64e4b --- /dev/null +++ b/common/autoware_component_interface_specs/include/autoware/component_interface_specs/control.hpp @@ -0,0 +1,37 @@ +// Copyright 2022 TIER IV, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef AUTOWARE__COMPONENT_INTERFACE_SPECS__CONTROL_HPP_ +#define AUTOWARE__COMPONENT_INTERFACE_SPECS__CONTROL_HPP_ + +#include +#include + +#include + +namespace autoware::component_interface_specs::control +{ + +struct ControlCommand +{ + using Message = autoware_control_msgs::msg::Control; + static constexpr char name[] = "/control/command/control_cmd"; + static constexpr size_t depth = 1; + static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE; + static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL; +}; + +} // namespace autoware::component_interface_specs::control + +#endif // AUTOWARE__COMPONENT_INTERFACE_SPECS__CONTROL_HPP_ diff --git a/common/autoware_component_interface_specs/include/autoware/component_interface_specs/localization.hpp b/common/autoware_component_interface_specs/include/autoware/component_interface_specs/localization.hpp new file mode 100644 index 0000000000..744d5d28ab --- /dev/null +++ b/common/autoware_component_interface_specs/include/autoware/component_interface_specs/localization.hpp @@ -0,0 +1,47 @@ +// Copyright 2022 TIER IV, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef AUTOWARE__COMPONENT_INTERFACE_SPECS__LOCALIZATION_HPP_ +#define AUTOWARE__COMPONENT_INTERFACE_SPECS__LOCALIZATION_HPP_ + +#include +#include + +#include +#include + +namespace autoware::component_interface_specs::localization +{ + +struct KinematicState +{ + using Message = nav_msgs::msg::Odometry; + static constexpr char name[] = "/localization/kinematic_state"; + static constexpr size_t depth = 1; + static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE; + static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_VOLATILE; +}; + +struct Acceleration +{ + using Message = geometry_msgs::msg::AccelWithCovarianceStamped; + static constexpr char name[] = "/localization/acceleration"; + static constexpr size_t depth = 1; + static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE; + static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_VOLATILE; +}; + +} // namespace autoware::component_interface_specs::localization + +#endif // AUTOWARE__COMPONENT_INTERFACE_SPECS__LOCALIZATION_HPP_ diff --git a/common/autoware_component_interface_specs/include/autoware/component_interface_specs/map.hpp b/common/autoware_component_interface_specs/include/autoware/component_interface_specs/map.hpp new file mode 100644 index 0000000000..8cb4d8ee82 --- /dev/null +++ b/common/autoware_component_interface_specs/include/autoware/component_interface_specs/map.hpp @@ -0,0 +1,57 @@ +// Copyright 2023 TIER IV, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef AUTOWARE__COMPONENT_INTERFACE_SPECS__MAP_HPP_ +#define AUTOWARE__COMPONENT_INTERFACE_SPECS__MAP_HPP_ + +#include +#include + +#include +#include +#include + +namespace autoware::component_interface_specs::map +{ + +struct MapProjectorInfo +{ + using Message = autoware_map_msgs::msg::MapProjectorInfo; + static constexpr char name[] = "/map/map_projector_info"; + static constexpr size_t depth = 1; + static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE; + static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL; +}; + +struct PointCloudMap +{ + using Message = sensor_msgs::msg::PointCloud2; + static constexpr char name[] = "/map/point_cloud_map"; + static constexpr size_t depth = 1; + static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE; + static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL; +}; + +struct VectorMap +{ + using Message = autoware_map_msgs::msg::LaneletMapBin; + static constexpr char name[] = "/map/vector_map"; + static constexpr size_t depth = 1; + static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE; + static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL; +}; + +} // namespace autoware::component_interface_specs::map + +#endif // AUTOWARE__COMPONENT_INTERFACE_SPECS__MAP_HPP_ diff --git a/common/autoware_component_interface_specs/include/autoware/component_interface_specs/perception.hpp b/common/autoware_component_interface_specs/include/autoware/component_interface_specs/perception.hpp new file mode 100644 index 0000000000..2d5d3f3106 --- /dev/null +++ b/common/autoware_component_interface_specs/include/autoware/component_interface_specs/perception.hpp @@ -0,0 +1,37 @@ +// Copyright 2022 TIER IV, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef AUTOWARE__COMPONENT_INTERFACE_SPECS__PERCEPTION_HPP_ +#define AUTOWARE__COMPONENT_INTERFACE_SPECS__PERCEPTION_HPP_ + +#include +#include + +#include + +namespace autoware::component_interface_specs::perception +{ + +struct ObjectRecognition +{ + using Message = autoware_perception_msgs::msg::PredictedObjects; + static constexpr char name[] = "/perception/object_recognition/objects"; + static constexpr size_t depth = 1; + static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE; + static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_VOLATILE; +}; + +} // namespace autoware::component_interface_specs::perception + +#endif // AUTOWARE__COMPONENT_INTERFACE_SPECS__PERCEPTION_HPP_ diff --git a/common/autoware_component_interface_specs/include/autoware/component_interface_specs/planning.hpp b/common/autoware_component_interface_specs/include/autoware/component_interface_specs/planning.hpp new file mode 100644 index 0000000000..9f3d7d508a --- /dev/null +++ b/common/autoware_component_interface_specs/include/autoware/component_interface_specs/planning.hpp @@ -0,0 +1,47 @@ +// Copyright 2022 TIER IV, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef AUTOWARE__COMPONENT_INTERFACE_SPECS__PLANNING_HPP_ +#define AUTOWARE__COMPONENT_INTERFACE_SPECS__PLANNING_HPP_ + +#include +#include + +#include +#include + +namespace autoware::component_interface_specs::planning +{ + +struct LaneletRoute +{ + using Message = autoware_planning_msgs::msg::LaneletRoute; + static constexpr char name[] = "/planning/mission_planning/route_selector/main/route"; + static constexpr size_t depth = 1; + static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE; + static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL; +}; + +struct Trajectory +{ + using Message = autoware_planning_msgs::msg::Trajectory; + static constexpr char name[] = "/planning/scenario_planning/trajectory"; + static constexpr size_t depth = 1; + static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE; + static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_VOLATILE; +}; + +} // namespace autoware::component_interface_specs::planning + +#endif // AUTOWARE__COMPONENT_INTERFACE_SPECS__PLANNING_HPP_ diff --git a/common/autoware_component_interface_specs/include/autoware/component_interface_specs/utils.hpp b/common/autoware_component_interface_specs/include/autoware/component_interface_specs/utils.hpp new file mode 100644 index 0000000000..b01e356131 --- /dev/null +++ b/common/autoware_component_interface_specs/include/autoware/component_interface_specs/utils.hpp @@ -0,0 +1,37 @@ +// Copyright 2023 TIER IV, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef AUTOWARE__COMPONENT_INTERFACE_SPECS__UTILS_HPP_ +#define AUTOWARE__COMPONENT_INTERFACE_SPECS__UTILS_HPP_ + +#include + +#include +#include +#include + +namespace autoware::component_interface_specs +{ + +template +rclcpp::QoS get_qos(T interface) +{ + return rclcpp::QoS{interface.depth} + .reliability(interface.reliability) + .durability(interface.durability); +} + +} // namespace autoware::component_interface_specs + +#endif // AUTOWARE__COMPONENT_INTERFACE_SPECS__UTILS_HPP_ diff --git a/common/autoware_component_interface_specs/include/autoware/component_interface_specs/vehicle.hpp b/common/autoware_component_interface_specs/include/autoware/component_interface_specs/vehicle.hpp new file mode 100644 index 0000000000..fed8d6a186 --- /dev/null +++ b/common/autoware_component_interface_specs/include/autoware/component_interface_specs/vehicle.hpp @@ -0,0 +1,69 @@ +// Copyright 2023 TIER IV, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef AUTOWARE__COMPONENT_INTERFACE_SPECS__VEHICLE_HPP_ +#define AUTOWARE__COMPONENT_INTERFACE_SPECS__VEHICLE_HPP_ + +#include "utils.hpp" + +#include +#include + +#include +#include +#include +#include + +namespace autoware::component_interface_specs::vehicle +{ + +struct SteeringStatus +{ + using Message = autoware_vehicle_msgs::msg::SteeringReport; + static constexpr char name[] = "/vehicle/status/steering_status"; + static constexpr size_t depth = 1; + static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE; + static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_VOLATILE; +}; + +struct GearStatus +{ + using Message = autoware_vehicle_msgs::msg::GearReport; + static constexpr char name[] = "/vehicle/status/gear_status"; + static constexpr size_t depth = 1; + static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE; + static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_VOLATILE; +}; + +struct TurnIndicatorStatus +{ + using Message = autoware_vehicle_msgs::msg::TurnIndicatorsReport; + static constexpr char name[] = "/vehicle/status/turn_indicators_status"; + static constexpr size_t depth = 1; + static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE; + static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_VOLATILE; +}; + +struct HazardLightStatus +{ + using Message = autoware_vehicle_msgs::msg::HazardLightsReport; + static constexpr char name[] = "/vehicle/status/hazard_lights_status"; + static constexpr size_t depth = 1; + static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE; + static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_VOLATILE; +}; + +} // namespace autoware::component_interface_specs::vehicle + +#endif // AUTOWARE__COMPONENT_INTERFACE_SPECS__VEHICLE_HPP_ diff --git a/common/autoware_component_interface_specs/package.xml b/common/autoware_component_interface_specs/package.xml new file mode 100644 index 0000000000..0b831476c6 --- /dev/null +++ b/common/autoware_component_interface_specs/package.xml @@ -0,0 +1,34 @@ + + + + autoware_component_interface_specs + 0.0.0 + The autoware_component_interface_specs package + Takagi, Isamu + Yukihiro Saito + Ryohsuke Mitsudome + Apache License 2.0 + + ament_cmake_auto + autoware_cmake + + autoware_control_msgs + autoware_localization_msgs + autoware_map_msgs + autoware_perception_msgs + autoware_planning_msgs + autoware_vehicle_msgs + nav_msgs + rcl + rclcpp + rosidl_runtime_cpp + sensor_msgs + + ament_cmake_gtest + ament_lint_auto + autoware_lint_common + + + ament_cmake + + diff --git a/common/autoware_component_interface_specs/test/gtest_main.cpp b/common/autoware_component_interface_specs/test/gtest_main.cpp new file mode 100644 index 0000000000..81d9d53452 --- /dev/null +++ b/common/autoware_component_interface_specs/test/gtest_main.cpp @@ -0,0 +1,21 @@ +// Copyright 2023 The Autoware Contributors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "gtest/gtest.h" + +int main(int argc, char * argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/common/autoware_component_interface_specs/test/test_control.cpp b/common/autoware_component_interface_specs/test/test_control.cpp new file mode 100644 index 0000000000..dc66f14170 --- /dev/null +++ b/common/autoware_component_interface_specs/test/test_control.cpp @@ -0,0 +1,31 @@ +// Copyright 2023 The Autoware Contributors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "autoware/component_interface_specs/control.hpp" +#include "gtest/gtest.h" + +TEST(control, interface) +{ + using autoware::component_interface_specs::control::ControlCommand; + ControlCommand control_command; + size_t depth = 1; + EXPECT_EQ(control_command.depth, depth); + EXPECT_EQ(control_command.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE); + EXPECT_EQ(control_command.durability, RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL); + + const auto qos = autoware::component_interface_specs::get_qos(control_command); + EXPECT_EQ(qos.depth(), depth); + EXPECT_EQ(qos.reliability(), rclcpp::ReliabilityPolicy::Reliable); + EXPECT_EQ(qos.durability(), rclcpp::DurabilityPolicy::TransientLocal); +} diff --git a/common/autoware_component_interface_specs/test/test_localization.cpp b/common/autoware_component_interface_specs/test/test_localization.cpp new file mode 100644 index 0000000000..9f1c4fb9e8 --- /dev/null +++ b/common/autoware_component_interface_specs/test/test_localization.cpp @@ -0,0 +1,47 @@ +// Copyright 2023 The Autoware Contributors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "autoware/component_interface_specs/localization.hpp" +#include "gtest/gtest.h" + +TEST(localization, interface) +{ + { + using autoware::component_interface_specs::localization::KinematicState; + KinematicState kinematic_state; + size_t depth = 1; + EXPECT_EQ(kinematic_state.depth, depth); + EXPECT_EQ(kinematic_state.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE); + EXPECT_EQ(kinematic_state.durability, RMW_QOS_POLICY_DURABILITY_VOLATILE); + + const auto qos = autoware::component_interface_specs::get_qos(kinematic_state); + EXPECT_EQ(qos.depth(), depth); + EXPECT_EQ(qos.reliability(), rclcpp::ReliabilityPolicy::Reliable); + EXPECT_EQ(qos.durability(), rclcpp::DurabilityPolicy::Volatile); + } + + { + using autoware::component_interface_specs::localization::Acceleration; + Acceleration acceleration; + size_t depth = 1; + EXPECT_EQ(acceleration.depth, depth); + EXPECT_EQ(acceleration.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE); + EXPECT_EQ(acceleration.durability, RMW_QOS_POLICY_DURABILITY_VOLATILE); + + const auto qos = autoware::component_interface_specs::get_qos(acceleration); + EXPECT_EQ(qos.depth(), depth); + EXPECT_EQ(qos.reliability(), rclcpp::ReliabilityPolicy::Reliable); + EXPECT_EQ(qos.durability(), rclcpp::DurabilityPolicy::Volatile); + } +} diff --git a/common/autoware_component_interface_specs/test/test_map.cpp b/common/autoware_component_interface_specs/test/test_map.cpp new file mode 100644 index 0000000000..41a11a18bb --- /dev/null +++ b/common/autoware_component_interface_specs/test/test_map.cpp @@ -0,0 +1,61 @@ +// Copyright 2023 The Autoware Contributors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "autoware/component_interface_specs/map.hpp" +#include "gtest/gtest.h" + +TEST(map, interface) +{ + { + using autoware::component_interface_specs::map::MapProjectorInfo; + MapProjectorInfo map_projector; + size_t depth = 1; + EXPECT_EQ(map_projector.depth, depth); + EXPECT_EQ(map_projector.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE); + EXPECT_EQ(map_projector.durability, RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL); + + const auto qos = autoware::component_interface_specs::get_qos(map_projector); + EXPECT_EQ(qos.depth(), depth); + EXPECT_EQ(qos.reliability(), rclcpp::ReliabilityPolicy::Reliable); + EXPECT_EQ(qos.durability(), rclcpp::DurabilityPolicy::TransientLocal); + } + + { + using autoware::component_interface_specs::map::PointCloudMap; + PointCloudMap point_cloud_map; + size_t depth = 1; + EXPECT_EQ(point_cloud_map.depth, depth); + EXPECT_EQ(point_cloud_map.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE); + EXPECT_EQ(point_cloud_map.durability, RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL); + + const auto qos = autoware::component_interface_specs::get_qos(point_cloud_map); + EXPECT_EQ(qos.depth(), depth); + EXPECT_EQ(qos.reliability(), rclcpp::ReliabilityPolicy::Reliable); + EXPECT_EQ(qos.durability(), rclcpp::DurabilityPolicy::TransientLocal); + } + + { + using autoware::component_interface_specs::map::VectorMap; + VectorMap vector_map; + size_t depth = 1; + EXPECT_EQ(vector_map.depth, depth); + EXPECT_EQ(vector_map.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE); + EXPECT_EQ(vector_map.durability, RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL); + + const auto qos = autoware::component_interface_specs::get_qos(vector_map); + EXPECT_EQ(qos.depth(), depth); + EXPECT_EQ(qos.reliability(), rclcpp::ReliabilityPolicy::Reliable); + EXPECT_EQ(qos.durability(), rclcpp::DurabilityPolicy::TransientLocal); + } +} diff --git a/common/autoware_component_interface_specs/test/test_perception.cpp b/common/autoware_component_interface_specs/test/test_perception.cpp new file mode 100644 index 0000000000..452c349c8d --- /dev/null +++ b/common/autoware_component_interface_specs/test/test_perception.cpp @@ -0,0 +1,33 @@ +// Copyright 2023 The Autoware Contributors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "autoware/component_interface_specs/perception.hpp" +#include "gtest/gtest.h" + +TEST(perception, interface) +{ + { + using autoware::component_interface_specs::perception::ObjectRecognition; + ObjectRecognition object_recognition; + size_t depth = 1; + EXPECT_EQ(object_recognition.depth, depth); + EXPECT_EQ(object_recognition.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE); + EXPECT_EQ(object_recognition.durability, RMW_QOS_POLICY_DURABILITY_VOLATILE); + + const auto qos = autoware::component_interface_specs::get_qos(object_recognition); + EXPECT_EQ(qos.depth(), depth); + EXPECT_EQ(qos.reliability(), rclcpp::ReliabilityPolicy::Reliable); + EXPECT_EQ(qos.durability(), rclcpp::DurabilityPolicy::Volatile); + } +} diff --git a/common/autoware_component_interface_specs/test/test_planning.cpp b/common/autoware_component_interface_specs/test/test_planning.cpp new file mode 100644 index 0000000000..083741a97f --- /dev/null +++ b/common/autoware_component_interface_specs/test/test_planning.cpp @@ -0,0 +1,47 @@ +// Copyright 2023 The Autoware Contributors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "autoware/component_interface_specs/planning.hpp" +#include "gtest/gtest.h" + +TEST(planning, interface) +{ + { + using autoware::component_interface_specs::planning::LaneletRoute; + LaneletRoute route; + size_t depth = 1; + EXPECT_EQ(route.depth, depth); + EXPECT_EQ(route.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE); + EXPECT_EQ(route.durability, RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL); + + const auto qos = autoware::component_interface_specs::get_qos(route); + EXPECT_EQ(qos.depth(), depth); + EXPECT_EQ(qos.reliability(), rclcpp::ReliabilityPolicy::Reliable); + EXPECT_EQ(qos.durability(), rclcpp::DurabilityPolicy::TransientLocal); + } + + { + using autoware::component_interface_specs::planning::Trajectory; + Trajectory trajectory; + size_t depth = 1; + EXPECT_EQ(trajectory.depth, depth); + EXPECT_EQ(trajectory.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE); + EXPECT_EQ(trajectory.durability, RMW_QOS_POLICY_DURABILITY_VOLATILE); + + const auto qos = autoware::component_interface_specs::get_qos(trajectory); + EXPECT_EQ(qos.depth(), depth); + EXPECT_EQ(qos.reliability(), rclcpp::ReliabilityPolicy::Reliable); + EXPECT_EQ(qos.durability(), rclcpp::DurabilityPolicy::Volatile); + } +} diff --git a/common/autoware_component_interface_specs/test/test_vehicle.cpp b/common/autoware_component_interface_specs/test/test_vehicle.cpp new file mode 100644 index 0000000000..f1f67dbb91 --- /dev/null +++ b/common/autoware_component_interface_specs/test/test_vehicle.cpp @@ -0,0 +1,75 @@ +// Copyright 2023 The Autoware Contributors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "autoware/component_interface_specs/vehicle.hpp" +#include "gtest/gtest.h" + +TEST(vehicle, interface) +{ + { + using autoware::component_interface_specs::vehicle::SteeringStatus; + SteeringStatus status; + size_t depth = 1; + EXPECT_EQ(status.depth, depth); + EXPECT_EQ(status.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE); + EXPECT_EQ(status.durability, RMW_QOS_POLICY_DURABILITY_VOLATILE); + + const auto qos = autoware::component_interface_specs::get_qos(status); + EXPECT_EQ(qos.depth(), depth); + EXPECT_EQ(qos.reliability(), rclcpp::ReliabilityPolicy::Reliable); + EXPECT_EQ(qos.durability(), rclcpp::DurabilityPolicy::Volatile); + } + + { + using autoware::component_interface_specs::vehicle::GearStatus; + GearStatus status; + size_t depth = 1; + EXPECT_EQ(status.depth, depth); + EXPECT_EQ(status.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE); + EXPECT_EQ(status.durability, RMW_QOS_POLICY_DURABILITY_VOLATILE); + + const auto qos = autoware::component_interface_specs::get_qos(status); + EXPECT_EQ(qos.depth(), depth); + EXPECT_EQ(qos.reliability(), rclcpp::ReliabilityPolicy::Reliable); + EXPECT_EQ(qos.durability(), rclcpp::DurabilityPolicy::Volatile); + } + + { + using autoware::component_interface_specs::vehicle::TurnIndicatorStatus; + TurnIndicatorStatus status; + size_t depth = 1; + EXPECT_EQ(status.depth, depth); + EXPECT_EQ(status.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE); + EXPECT_EQ(status.durability, RMW_QOS_POLICY_DURABILITY_VOLATILE); + + const auto qos = autoware::component_interface_specs::get_qos(status); + EXPECT_EQ(qos.depth(), depth); + EXPECT_EQ(qos.reliability(), rclcpp::ReliabilityPolicy::Reliable); + EXPECT_EQ(qos.durability(), rclcpp::DurabilityPolicy::Volatile); + } + + { + using autoware::component_interface_specs::vehicle::HazardLightStatus; + HazardLightStatus status; + size_t depth = 1; + EXPECT_EQ(status.depth, depth); + EXPECT_EQ(status.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE); + EXPECT_EQ(status.durability, RMW_QOS_POLICY_DURABILITY_VOLATILE); + + const auto qos = autoware::component_interface_specs::get_qos(status); + EXPECT_EQ(qos.depth(), depth); + EXPECT_EQ(qos.reliability(), rclcpp::ReliabilityPolicy::Reliable); + EXPECT_EQ(qos.durability(), rclcpp::DurabilityPolicy::Volatile); + } +}