From c15cc1e3c6f224ba0f8cfcef3f66dbb6e5f3ada9 Mon Sep 17 00:00:00 2001 From: Ryohsuke Mitsudome <43976834+mitsudome-r@users.noreply.github.com> Date: Mon, 10 Jun 2024 15:21:46 +0900 Subject: [PATCH] fix: change the output of ControlMode to autoware_auto_msgs (#116) Signed-off-by: Ryohsuke Mitsudome --- autoware_iv_internal_api_adaptor/package.xml | 1 + autoware_iv_internal_api_adaptor/src/iv_msgs.cpp | 9 ++++++--- autoware_iv_internal_api_adaptor/src/iv_msgs.hpp | 6 ++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/autoware_iv_internal_api_adaptor/package.xml b/autoware_iv_internal_api_adaptor/package.xml index df10b0a..e950fdc 100644 --- a/autoware_iv_internal_api_adaptor/package.xml +++ b/autoware_iv_internal_api_adaptor/package.xml @@ -11,6 +11,7 @@ autoware_cmake autoware_adapi_v1_msgs + autoware_auto_vehicle_msgs autoware_perception_msgs autoware_planning_msgs autoware_system_msgs diff --git a/autoware_iv_internal_api_adaptor/src/iv_msgs.cpp b/autoware_iv_internal_api_adaptor/src/iv_msgs.cpp index 5e17e56..356c17f 100644 --- a/autoware_iv_internal_api_adaptor/src/iv_msgs.cpp +++ b/autoware_iv_internal_api_adaptor/src/iv_msgs.cpp @@ -30,7 +30,7 @@ IVMsgs::IVMsgs(const rclcpp::NodeOptions & options) : Node("external_api_iv_msgs pub_control_mode_ = create_publisher("/api/iv_msgs/vehicle/status/control_mode", rclcpp::QoS(1)); - sub_control_mode_ = create_subscription( + sub_control_mode_ = create_subscription( "/vehicle/status/control_mode", rclcpp::QoS(1), std::bind(&IVMsgs::onControlMode, this, _1)); pub_trajectory_ = create_publisher( @@ -62,9 +62,12 @@ void IVMsgs::onEmergency(const EmergencyStateAuto::ConstSharedPtr message) is_emergency_ = message->state != EmergencyStateAuto::NORMAL; } -void IVMsgs::onControlMode(const ControlModeAuto::ConstSharedPtr message) +void IVMsgs::onControlMode(const ControlMode::ConstSharedPtr message) { - pub_control_mode_->publish(*message); + ControlModeAuto control_mode_auto; + control_mode_auto.stamp = message->stamp; + control_mode_auto.mode = message->mode; + pub_control_mode_->publish(control_mode_auto); } void IVMsgs::onTrajectory(const TrajectoryAuto::ConstSharedPtr message) diff --git a/autoware_iv_internal_api_adaptor/src/iv_msgs.hpp b/autoware_iv_internal_api_adaptor/src/iv_msgs.hpp index 5d41135..37a6cc7 100644 --- a/autoware_iv_internal_api_adaptor/src/iv_msgs.hpp +++ b/autoware_iv_internal_api_adaptor/src/iv_msgs.hpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -42,7 +43,8 @@ class IVMsgs : public rclcpp::Node rclcpp::Publisher::SharedPtr pub_state_; using ControlModeAuto = autoware_vehicle_msgs::msg::ControlModeReport; - rclcpp::Subscription::SharedPtr sub_control_mode_; + using ControlMode = autoware_auto_vehicle_msgs::msg::ControlModeReport; + rclcpp::Subscription::SharedPtr sub_control_mode_; rclcpp::Publisher::SharedPtr pub_control_mode_; using TrajectoryAuto = autoware_planning_msgs::msg::Trajectory; @@ -57,7 +59,7 @@ class IVMsgs : public rclcpp::Node void onState(const AutowareStateAuto::ConstSharedPtr message); void onEmergency(const EmergencyStateAuto::ConstSharedPtr message); - void onControlMode(const ControlModeAuto::ConstSharedPtr message); + void onControlMode(const ControlMode::ConstSharedPtr message); void onTrajectory(const TrajectoryAuto::ConstSharedPtr message); void onTrackedObjects(const TrackedObjectsAuto::ConstSharedPtr message);