From c35fafdae615d817581b3dd4686c91a31f336c02 Mon Sep 17 00:00:00 2001 From: "Takagi, Isamu" Date: Wed, 10 Aug 2022 16:39:21 +0900 Subject: [PATCH 1/3] feat(autoware_ad_api_msgs): define routing interface Signed-off-by: Takagi, Isamu --- common/autoware_ad_api_msgs/CMakeLists.txt | 8 +++ common/autoware_ad_api_msgs/README.md | 5 ++ .../routing/msg/Route.msg | 2 + .../routing/msg/RouteBody.msg | 3 + .../routing/msg/RoutePrimitive.msg | 2 + .../routing/msg/RouteSegment.msg | 2 + .../routing/msg/RouteState.msg | 8 +++ .../routing/srv/ClearRoute.srv | 2 + .../routing/srv/SetRoute.srv | 6 ++ .../routing/srv/SetRoutePoints.srv | 8 +++ common/autoware_ad_api_specs/CMakeLists.txt | 7 ++ .../include/autoware_ad_api_specs/routing.hpp | 67 +++++++++++++++++++ common/autoware_ad_api_specs/package.xml | 20 ++++++ .../component_interface_specs/CMakeLists.txt | 7 ++ .../component_interface_specs/planning.hpp | 67 +++++++++++++++++++ common/component_interface_specs/package.xml | 20 ++++++ .../component_interface_utils/rclcpp.hpp | 4 +- 17 files changed, 235 insertions(+), 3 deletions(-) create mode 100644 common/autoware_ad_api_msgs/routing/msg/Route.msg create mode 100644 common/autoware_ad_api_msgs/routing/msg/RouteBody.msg create mode 100644 common/autoware_ad_api_msgs/routing/msg/RoutePrimitive.msg create mode 100644 common/autoware_ad_api_msgs/routing/msg/RouteSegment.msg create mode 100644 common/autoware_ad_api_msgs/routing/msg/RouteState.msg create mode 100644 common/autoware_ad_api_msgs/routing/srv/ClearRoute.srv create mode 100644 common/autoware_ad_api_msgs/routing/srv/SetRoute.srv create mode 100644 common/autoware_ad_api_msgs/routing/srv/SetRoutePoints.srv create mode 100644 common/autoware_ad_api_specs/CMakeLists.txt create mode 100644 common/autoware_ad_api_specs/include/autoware_ad_api_specs/routing.hpp create mode 100644 common/autoware_ad_api_specs/package.xml create mode 100644 common/component_interface_specs/CMakeLists.txt create mode 100644 common/component_interface_specs/include/component_interface_specs/planning.hpp create mode 100644 common/component_interface_specs/package.xml diff --git a/common/autoware_ad_api_msgs/CMakeLists.txt b/common/autoware_ad_api_msgs/CMakeLists.txt index 031134af5a5de..c3f772dcb0d7e 100644 --- a/common/autoware_ad_api_msgs/CMakeLists.txt +++ b/common/autoware_ad_api_msgs/CMakeLists.txt @@ -7,6 +7,14 @@ autoware_package() rosidl_generate_interfaces(${PROJECT_NAME} common/msg/ResponseStatus.msg interface/srv/InterfaceVersion.srv + routing/msg/RouteState.msg + routing/msg/Route.msg + routing/msg/RouteBody.msg + routing/msg/RoutePrimitive.msg + routing/msg/RouteSegment.msg + routing/srv/ClearRoute.srv + routing/srv/SetRoute.srv + routing/srv/SetRoutePoints.srv DEPENDENCIES builtin_interfaces std_msgs diff --git a/common/autoware_ad_api_msgs/README.md b/common/autoware_ad_api_msgs/README.md index 85235275ad689..58ccb8bbf2d2b 100644 --- a/common/autoware_ad_api_msgs/README.md +++ b/common/autoware_ad_api_msgs/README.md @@ -21,6 +21,11 @@ Considering the product life cycle, there may be multiple vehicles using differe In that situation, the AD API users such as developers of a web service have to switch the application behavior based on the version that each vehicle uses. The version of AD API follows [Semantic Versioning][semver] in order to provide an intuitive understanding of the changes between versions. +## Routing + +The routing service support two formats. One uses pose and the other uses map dependent data directly. +The body part of the route message is optional, since the route does not exist when it is cleared by the service. + [semver]: https://semver.org/ diff --git a/common/autoware_ad_api_msgs/routing/msg/Route.msg b/common/autoware_ad_api_msgs/routing/msg/Route.msg new file mode 100644 index 0000000000000..dffbfa8a77e6a --- /dev/null +++ b/common/autoware_ad_api_msgs/routing/msg/Route.msg @@ -0,0 +1,2 @@ +std_msgs/Header header +autoware_ad_api_msgs/RouteBody[<=1] body diff --git a/common/autoware_ad_api_msgs/routing/msg/RouteBody.msg b/common/autoware_ad_api_msgs/routing/msg/RouteBody.msg new file mode 100644 index 0000000000000..e5d03efb14008 --- /dev/null +++ b/common/autoware_ad_api_msgs/routing/msg/RouteBody.msg @@ -0,0 +1,3 @@ +geometry_msgs/Pose start +geometry_msgs/Pose goal +autoware_ad_api_msgs/RouteSegment[] segments diff --git a/common/autoware_ad_api_msgs/routing/msg/RoutePrimitive.msg b/common/autoware_ad_api_msgs/routing/msg/RoutePrimitive.msg new file mode 100644 index 0000000000000..f7d9312611e51 --- /dev/null +++ b/common/autoware_ad_api_msgs/routing/msg/RoutePrimitive.msg @@ -0,0 +1,2 @@ +int64 id +string type # The same id may be used for each type. diff --git a/common/autoware_ad_api_msgs/routing/msg/RouteSegment.msg b/common/autoware_ad_api_msgs/routing/msg/RouteSegment.msg new file mode 100644 index 0000000000000..a3f3d12d3872d --- /dev/null +++ b/common/autoware_ad_api_msgs/routing/msg/RouteSegment.msg @@ -0,0 +1,2 @@ +autoware_ad_api_msgs/RoutePrimitive preferred +autoware_ad_api_msgs/RoutePrimitive[] alternatives # Does not include the preferred primitive. diff --git a/common/autoware_ad_api_msgs/routing/msg/RouteState.msg b/common/autoware_ad_api_msgs/routing/msg/RouteState.msg new file mode 100644 index 0000000000000..9dfe77ddee175 --- /dev/null +++ b/common/autoware_ad_api_msgs/routing/msg/RouteState.msg @@ -0,0 +1,8 @@ +uint16 UNKNOWN = 0 +uint16 UNSET = 1 +uint16 SET = 2 +uint16 ARRIVED = 3 +uint16 CHANGING = 4 + +builtin_interfaces/Time stamp +uint16 state diff --git a/common/autoware_ad_api_msgs/routing/srv/ClearRoute.srv b/common/autoware_ad_api_msgs/routing/srv/ClearRoute.srv new file mode 100644 index 0000000000000..38a3199e9d091 --- /dev/null +++ b/common/autoware_ad_api_msgs/routing/srv/ClearRoute.srv @@ -0,0 +1,2 @@ +--- +autoware_ad_api_msgs/ResponseStatus status diff --git a/common/autoware_ad_api_msgs/routing/srv/SetRoute.srv b/common/autoware_ad_api_msgs/routing/srv/SetRoute.srv new file mode 100644 index 0000000000000..7299b12fe8141 --- /dev/null +++ b/common/autoware_ad_api_msgs/routing/srv/SetRoute.srv @@ -0,0 +1,6 @@ +std_msgs/Header header +geometry_msgs/Pose goal +autoware_ad_api_msgs/RouteSegment[] segments +--- +uint16 ERROR_ROUTE_EXISTS = 1 +autoware_ad_api_msgs/ResponseStatus status diff --git a/common/autoware_ad_api_msgs/routing/srv/SetRoutePoints.srv b/common/autoware_ad_api_msgs/routing/srv/SetRoutePoints.srv new file mode 100644 index 0000000000000..c05a211fae4fb --- /dev/null +++ b/common/autoware_ad_api_msgs/routing/srv/SetRoutePoints.srv @@ -0,0 +1,8 @@ +std_msgs/Header header +geometry_msgs/Pose goal +geometry_msgs/Pose[] waypoints +--- +uint16 ERROR_ROUTE_EXISTS = 1 +uint16 ERROR_PLANNER_UNREADY = 2 +uint16 ERROR_PLANNER_FAILED = 3 +autoware_ad_api_msgs/ResponseStatus status diff --git a/common/autoware_ad_api_specs/CMakeLists.txt b/common/autoware_ad_api_specs/CMakeLists.txt new file mode 100644 index 0000000000000..5f02e45a9c6b2 --- /dev/null +++ b/common/autoware_ad_api_specs/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.14) +project(autoware_ad_api_specs) + +find_package(autoware_cmake REQUIRED) +autoware_package() + +ament_auto_package() diff --git a/common/autoware_ad_api_specs/include/autoware_ad_api_specs/routing.hpp b/common/autoware_ad_api_specs/include/autoware_ad_api_specs/routing.hpp new file mode 100644 index 0000000000000..336ea670c0c8b --- /dev/null +++ b/common/autoware_ad_api_specs/include/autoware_ad_api_specs/routing.hpp @@ -0,0 +1,67 @@ +// 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_AD_API_SPECS__ROUTING_HPP_ +#define AUTOWARE_AD_API_SPECS__ROUTING_HPP_ + +#include + +#include +#include +#include +#include +#include + +namespace autoware_ad_api::routing +{ + +struct SetRoutePoints +{ + using Service = autoware_ad_api_msgs::srv::SetRoutePoints; + static constexpr char name[] = "/api/routing/set_route_points"; +}; + +struct SetRoute +{ + using Service = autoware_ad_api_msgs::srv::SetRoute; + static constexpr char name[] = "/api/routing/set_route"; +}; + +struct ClearRoute +{ + using Service = autoware_ad_api_msgs::srv::ClearRoute; + static constexpr char name[] = "/api/routing/clear_route"; +}; + +struct RouteState +{ + using Message = autoware_ad_api_msgs::msg::RouteState; + static constexpr char name[] = "/api/routing/state"; + static constexpr size_t depth = 3; + static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE; + static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL; +}; + +struct Route +{ + using Message = autoware_ad_api_msgs::msg::Route; + static constexpr char name[] = "/api/routing/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; +}; + +} // namespace autoware_ad_api::routing + +#endif // AUTOWARE_AD_API_SPECS__ROUTING_HPP_ diff --git a/common/autoware_ad_api_specs/package.xml b/common/autoware_ad_api_specs/package.xml new file mode 100644 index 0000000000000..cc6b46b9c7210 --- /dev/null +++ b/common/autoware_ad_api_specs/package.xml @@ -0,0 +1,20 @@ + + + + autoware_ad_api_specs + 0.0.0 + The autoware_ad_api_specs package + Takagi, Isamu + Apache License 2.0 + + ament_cmake_auto + + autoware_cmake + + ament_lint_auto + autoware_lint_common + + + ament_cmake + + diff --git a/common/component_interface_specs/CMakeLists.txt b/common/component_interface_specs/CMakeLists.txt new file mode 100644 index 0000000000000..31c723600183f --- /dev/null +++ b/common/component_interface_specs/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.14) +project(component_interface_specs) + +find_package(autoware_cmake REQUIRED) +autoware_package() + +ament_auto_package() diff --git a/common/component_interface_specs/include/component_interface_specs/planning.hpp b/common/component_interface_specs/include/component_interface_specs/planning.hpp new file mode 100644 index 0000000000000..5de0c7c5bdaeb --- /dev/null +++ b/common/component_interface_specs/include/component_interface_specs/planning.hpp @@ -0,0 +1,67 @@ +// 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 COMPONENT_INTERFACE_SPECS__PLANNING_HPP_ +#define COMPONENT_INTERFACE_SPECS__PLANNING_HPP_ + +#include + +#include +#include +#include +#include +#include + +namespace planning_interface +{ + +struct SetRoutePoints +{ + using Service = autoware_ad_api_msgs::srv::SetRoutePoints; + static constexpr char name[] = "/planning/mission_planning/set_route_points"; +}; + +struct SetRoute +{ + using Service = autoware_ad_api_msgs::srv::SetRoute; + static constexpr char name[] = "/planning/mission_planning/set_route"; +}; + +struct ClearRoute +{ + using Service = autoware_ad_api_msgs::srv::ClearRoute; + static constexpr char name[] = "/planning/mission_planning/clear_route"; +}; + +struct RouteState +{ + using Message = autoware_ad_api_msgs::msg::RouteState; + static constexpr char name[] = "/planning/mission_planning/state"; + static constexpr size_t depth = 3; + static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE; + static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL; +}; + +struct Route +{ + using Message = autoware_ad_api_msgs::msg::Route; + static constexpr char name[] = "/planning/mission_planning/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; +}; + +} // namespace planning_interface + +#endif // COMPONENT_INTERFACE_SPECS__PLANNING_HPP_ diff --git a/common/component_interface_specs/package.xml b/common/component_interface_specs/package.xml new file mode 100644 index 0000000000000..d0c12c83c2379 --- /dev/null +++ b/common/component_interface_specs/package.xml @@ -0,0 +1,20 @@ + + + + component_interface_specs + 0.0.0 + The component_interface_specs package + Takagi, Isamu + Apache License 2.0 + + ament_cmake_auto + + autoware_cmake + + ament_lint_auto + autoware_lint_common + + + ament_cmake + + diff --git a/common/component_interface_utils/include/component_interface_utils/rclcpp.hpp b/common/component_interface_utils/include/component_interface_utils/rclcpp.hpp index e295173ac6e52..11f343cd2a900 100644 --- a/common/component_interface_utils/include/component_interface_utils/rclcpp.hpp +++ b/common/component_interface_utils/include/component_interface_utils/rclcpp.hpp @@ -87,11 +87,9 @@ class NodeAdaptor void relay_service( C & cli, S & srv, CallbackGroup group, std::optional timeout = std::nullopt) const { - using ReqT = typename C::element_type::SpecType::Service::Request::SharedPtr; - using ResT = typename C::element_type::SpecType::Service::Response::SharedPtr; init_cli(cli); init_srv( - srv, [cli, timeout](ReqT req, ResT res) { *res = *cli->call(req, timeout); }, group); + srv, [cli, timeout](auto req, auto res) { *res = *cli->call(req, timeout); }, group); } /// Create a service wrapper for logging. From a5e08d83dc5ac8935d49feb961365234860ebd37 Mon Sep 17 00:00:00 2001 From: "Takagi, Isamu" Date: Wed, 24 Aug 2022 18:25:24 +0900 Subject: [PATCH 2/3] feat: rename route body message Signed-off-by: Takagi, Isamu --- common/autoware_ad_api_msgs/CMakeLists.txt | 2 +- common/autoware_ad_api_msgs/routing/msg/Route.msg | 2 +- .../routing/msg/{RouteBody.msg => RouteData.msg} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename common/autoware_ad_api_msgs/routing/msg/{RouteBody.msg => RouteData.msg} (100%) diff --git a/common/autoware_ad_api_msgs/CMakeLists.txt b/common/autoware_ad_api_msgs/CMakeLists.txt index c3f772dcb0d7e..b79f9de2b47b0 100644 --- a/common/autoware_ad_api_msgs/CMakeLists.txt +++ b/common/autoware_ad_api_msgs/CMakeLists.txt @@ -9,7 +9,7 @@ rosidl_generate_interfaces(${PROJECT_NAME} interface/srv/InterfaceVersion.srv routing/msg/RouteState.msg routing/msg/Route.msg - routing/msg/RouteBody.msg + routing/msg/RouteData.msg routing/msg/RoutePrimitive.msg routing/msg/RouteSegment.msg routing/srv/ClearRoute.srv diff --git a/common/autoware_ad_api_msgs/routing/msg/Route.msg b/common/autoware_ad_api_msgs/routing/msg/Route.msg index dffbfa8a77e6a..3e6ff3a06e18b 100644 --- a/common/autoware_ad_api_msgs/routing/msg/Route.msg +++ b/common/autoware_ad_api_msgs/routing/msg/Route.msg @@ -1,2 +1,2 @@ std_msgs/Header header -autoware_ad_api_msgs/RouteBody[<=1] body +autoware_ad_api_msgs/RouteData[<=1] data diff --git a/common/autoware_ad_api_msgs/routing/msg/RouteBody.msg b/common/autoware_ad_api_msgs/routing/msg/RouteData.msg similarity index 100% rename from common/autoware_ad_api_msgs/routing/msg/RouteBody.msg rename to common/autoware_ad_api_msgs/routing/msg/RouteData.msg From cc37ba6ae986c75f2ae8d938742b53dba79850a3 Mon Sep 17 00:00:00 2001 From: "Takagi, Isamu" Date: Thu, 25 Aug 2022 21:50:31 +0900 Subject: [PATCH 3/3] feat: rename route state Signed-off-by: Takagi, Isamu --- .../include/component_interface_specs/planning.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/component_interface_specs/include/component_interface_specs/planning.hpp b/common/component_interface_specs/include/component_interface_specs/planning.hpp index 5de0c7c5bdaeb..08ba456976804 100644 --- a/common/component_interface_specs/include/component_interface_specs/planning.hpp +++ b/common/component_interface_specs/include/component_interface_specs/planning.hpp @@ -47,7 +47,7 @@ struct ClearRoute struct RouteState { using Message = autoware_ad_api_msgs::msg::RouteState; - static constexpr char name[] = "/planning/mission_planning/state"; + static constexpr char name[] = "/planning/mission_planning/route_state"; static constexpr size_t depth = 3; static constexpr auto reliability = RMW_QOS_POLICY_RELIABILITY_RELIABLE; static constexpr auto durability = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL;