Skip to content

Commit

Permalink
fix: change the output of ControlMode to autoware_auto_msgs (#116)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryohsuke Mitsudome <[email protected]>
  • Loading branch information
mitsudome-r authored Jun 10, 2024
1 parent 15bfd74 commit c15cc1e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions autoware_iv_internal_api_adaptor/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<buildtool_depend>autoware_cmake</buildtool_depend>

<depend>autoware_adapi_v1_msgs</depend>
<depend>autoware_auto_vehicle_msgs</depend>
<depend>autoware_perception_msgs</depend>
<depend>autoware_planning_msgs</depend>
<depend>autoware_system_msgs</depend>
Expand Down
9 changes: 6 additions & 3 deletions autoware_iv_internal_api_adaptor/src/iv_msgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ IVMsgs::IVMsgs(const rclcpp::NodeOptions & options) : Node("external_api_iv_msgs

pub_control_mode_ =
create_publisher<ControlModeAuto>("/api/iv_msgs/vehicle/status/control_mode", rclcpp::QoS(1));
sub_control_mode_ = create_subscription<ControlModeAuto>(
sub_control_mode_ = create_subscription<ControlMode>(
"/vehicle/status/control_mode", rclcpp::QoS(1), std::bind(&IVMsgs::onControlMode, this, _1));

pub_trajectory_ = create_publisher<TrajectoryIV>(
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions autoware_iv_internal_api_adaptor/src/iv_msgs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <rclcpp/rclcpp.hpp>

#include <autoware_adapi_v1_msgs/msg/mrm_state.hpp>
#include <autoware_auto_vehicle_msgs/msg/control_mode_report.hpp>
#include <autoware_perception_msgs/msg/tracked_objects.hpp>
#include <autoware_planning_msgs/msg/trajectory.hpp>
#include <autoware_system_msgs/msg/autoware_state.hpp>
Expand All @@ -42,7 +43,8 @@ class IVMsgs : public rclcpp::Node
rclcpp::Publisher<AutowareStateIV>::SharedPtr pub_state_;

using ControlModeAuto = autoware_vehicle_msgs::msg::ControlModeReport;
rclcpp::Subscription<ControlModeAuto>::SharedPtr sub_control_mode_;
using ControlMode = autoware_auto_vehicle_msgs::msg::ControlModeReport;
rclcpp::Subscription<ControlMode>::SharedPtr sub_control_mode_;
rclcpp::Publisher<ControlModeAuto>::SharedPtr pub_control_mode_;

using TrajectoryAuto = autoware_planning_msgs::msg::Trajectory;
Expand All @@ -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);

Expand Down

0 comments on commit c15cc1e

Please sign in to comment.