Skip to content

Commit

Permalink
feat: port remaining autoware_auto_msgs to autoware_msgs (#32)
Browse files Browse the repository at this point in the history
* feat: port remaining autoware_auto_msgs to autoware_msgs

Signed-off-by: Ryohsuke Mitsudome <[email protected]>

* style(pre-commit): autofix

---------

Signed-off-by: Ryohsuke Mitsudome <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
mitsudome-r and pre-commit-ci[bot] committed Jun 4, 2024
1 parent 25da3b9 commit cf89a2a
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 61 deletions.
22 changes: 11 additions & 11 deletions common/tier4_control_rviz_plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ This package is to mimic external control for simulation.

### Input

| Name | Type | Description |
| --------------------------------- | ------------------------------------------------- | ----------------------- |
| `/control/current_gate_mode` | `tier4_control_msgs::msg::GateMode` | Current GATE mode |
| `/vehicle/status/velocity_status` | `autoware_auto_vehicle_msgs::msg::VelocityReport` | Current velocity status |
| `/api/autoware/get/engage` | `tier4_external_api_msgs::srv::Engage` | Getting Engage |
| `/vehicle/status/gear_status` | `autoware_auto_vehicle_msgs::msg::GearReport` | The state of GEAR |
| Name | Type | Description |
| --------------------------------- | -------------------------------------------- | ----------------------- |
| `/control/current_gate_mode` | `tier4_control_msgs::msg::GateMode` | Current GATE mode |
| `/vehicle/status/velocity_status` | `autoware_vehicle_msgs::msg::VelocityReport` | Current velocity status |
| `/api/autoware/get/engage` | `tier4_external_api_msgs::srv::Engage` | Getting Engage |
| `/vehicle/status/gear_status` | `autoware_vehicle_msgs::msg::GearReport` | The state of GEAR |

### Output

| Name | Type | Description |
| -------------------------------- | ---------------------------------------------------------- | ----------------------- |
| `/control/gate_mode_cmd` | `tier4_control_msgs::msg::GateMode` | GATE mode |
| `/external/selected/control_cmd` | `autoware_auto_control_msgs::msg::AckermannControlCommand` | AckermannControlCommand |
| `/external/selected/gear_cmd` | `autoware_auto_vehicle_msgs::msg::GearCommand` | GEAR |
| Name | Type | Description |
| -------------------------------- | -------------------------------------------- | --------------- |
| `/control/gate_mode_cmd` | `tier4_control_msgs::msg::GateMode` | GATE mode |
| `/external/selected/control_cmd` | `autoware_control_msgs::msg::ControlCommand` | Control command |
| `/external/selected/gear_cmd` | `autoware_vehicle_msgs::msg::GearCommand` | GEAR |

## Usage

Expand Down
4 changes: 2 additions & 2 deletions common/tier4_control_rviz_plugin/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<buildtool_depend>ament_cmake_auto</buildtool_depend>
<buildtool_depend>autoware_cmake</buildtool_depend>

<depend>autoware_auto_control_msgs</depend>
<depend>autoware_auto_vehicle_msgs</depend>
<depend>autoware_control_msgs</depend>
<depend>autoware_vehicle_msgs</depend>
<depend>libqt5-core</depend>
<depend>libqt5-gui</depend>
<depend>libqt5-widgets</depend>
Expand Down
22 changes: 11 additions & 11 deletions common/tier4_control_rviz_plugin/src/tools/manual_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ ManualController::ManualController(QWidget * parent) : rviz_common::Panel(parent
void ManualController::update()
{
if (!raw_node_) return;
AckermannControlCommand ackermann;
Control control_cmd;
{
ackermann.stamp = raw_node_->get_clock()->now();
ackermann.lateral.steering_tire_angle = steering_angle_;
ackermann.longitudinal.speed = cruise_velocity_;
control_cmd.stamp = raw_node_->get_clock()->now();
control_cmd.lateral.steering_tire_angle = steering_angle_;
control_cmd.longitudinal.velocity = cruise_velocity_;
/**
* @brief Calculate desired acceleration by simple BackSteppingControl
* V = 0.5*(v-v_des)^2 >= 0
Expand All @@ -118,21 +118,21 @@ void ManualController::update()
const double v_des = cruise_velocity_;
const double a = current_acceleration_;
const double a_des = k * (v - v_des) + a;
ackermann.longitudinal.acceleration = std::clamp(a_des, -1.0, 1.0);
control_cmd.longitudinal.acceleration = std::clamp(a_des, -1.0, 1.0);
}
GearCommand gear_cmd;
{
const double eps = 0.001;
if (ackermann.longitudinal.speed > eps && current_velocity_ > -eps) {
if (control_cmd.longitudinal.velocity > eps && current_velocity_ > -eps) {
gear_cmd.command = GearCommand::DRIVE;
} else if (ackermann.longitudinal.speed < -eps && current_velocity_ < eps) {
} else if (control_cmd.longitudinal.velocity < -eps && current_velocity_ < eps) {
gear_cmd.command = GearCommand::REVERSE;
ackermann.longitudinal.acceleration *= -1.0;
control_cmd.longitudinal.acceleration *= -1.0;
} else {
gear_cmd.command = GearCommand::PARK;
}
}
pub_control_command_->publish(ackermann);
pub_control_command_->publish(control_cmd);
pub_gear_cmd_->publish(gear_cmd);
}

Expand Down Expand Up @@ -170,8 +170,8 @@ void ManualController::onInitialize()

pub_gate_mode_ = raw_node_->create_publisher<GateMode>("/control/gate_mode_cmd", rclcpp::QoS(1));

pub_control_command_ = raw_node_->create_publisher<AckermannControlCommand>(
"/external/selected/control_cmd", rclcpp::QoS(1));
pub_control_command_ =
raw_node_->create_publisher<Control>("/external/selected/control_cmd", rclcpp::QoS(1));

pub_gear_cmd_ = raw_node_->create_publisher<GearCommand>("/external/selected/gear_cmd", 1);
}
Expand Down
22 changes: 11 additions & 11 deletions common/tier4_control_rviz_plugin/src/tools/manual_controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,29 @@
#include <rclcpp/rclcpp.hpp>
#include <rviz_common/panel.hpp>

#include "autoware_auto_vehicle_msgs/msg/velocity_report.hpp"
#include "autoware_vehicle_msgs/msg/velocity_report.hpp"
#include "geometry_msgs/msg/accel_with_covariance_stamped.hpp"
#include "geometry_msgs/msg/twist.hpp"
#include <autoware_auto_control_msgs/msg/ackermann_control_command.hpp>
#include <autoware_auto_vehicle_msgs/msg/engage.hpp>
#include <autoware_auto_vehicle_msgs/msg/gear_command.hpp>
#include <autoware_auto_vehicle_msgs/msg/gear_report.hpp>
#include <autoware_control_msgs/msg/control.hpp>
#include <autoware_vehicle_msgs/msg/engage.hpp>
#include <autoware_vehicle_msgs/msg/gear_command.hpp>
#include <autoware_vehicle_msgs/msg/gear_report.hpp>
#include <tier4_control_msgs/msg/gate_mode.hpp>
#include <tier4_external_api_msgs/srv/engage.hpp>

#include <memory>

namespace rviz_plugins
{
using autoware_auto_control_msgs::msg::AckermannControlCommand;
using autoware_auto_vehicle_msgs::msg::GearCommand;
using autoware_auto_vehicle_msgs::msg::VelocityReport;
using autoware_control_msgs::msg::Control;
using autoware_vehicle_msgs::msg::GearCommand;
using autoware_vehicle_msgs::msg::VelocityReport;
using geometry_msgs::msg::AccelWithCovarianceStamped;
using geometry_msgs::msg::Twist;
using tier4_control_msgs::msg::GateMode;
using EngageSrv = tier4_external_api_msgs::srv::Engage;
using autoware_auto_vehicle_msgs::msg::Engage;
using autoware_auto_vehicle_msgs::msg::GearReport;
using autoware_vehicle_msgs::msg::Engage;
using autoware_vehicle_msgs::msg::GearReport;

class ManualController : public rviz_common::Panel
{
Expand Down Expand Up @@ -77,7 +77,7 @@ public Q_SLOTS: // NOLINT for Qt
rclcpp::Subscription<VelocityReport>::SharedPtr sub_velocity_;
rclcpp::Subscription<Engage>::SharedPtr sub_engage_;
rclcpp::Publisher<tier4_control_msgs::msg::GateMode>::SharedPtr pub_gate_mode_;
rclcpp::Publisher<AckermannControlCommand>::SharedPtr pub_control_command_;
rclcpp::Publisher<Control>::SharedPtr pub_control_command_;
rclcpp::Publisher<GearCommand>::SharedPtr pub_gear_cmd_;
rclcpp::Client<EngageSrv>::SharedPtr client_engage_;
rclcpp::Subscription<GearReport>::SharedPtr sub_gear_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class AnalyzerCore
odd_raw_data_ = getRawData(timestamp);
}

void setMap(const HADMapBin & msg) { route_handler_.setMap(msg); }
void setMap(const LaneletMapBin & msg) { route_handler_.setMap(msg); }

void clearData() { odd_raw_data_ = std::nullopt; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ class DrivingEnvironmentAnalyzerNode : public rclcpp::Node
explicit DrivingEnvironmentAnalyzerNode(const rclcpp::NodeOptions & node_options);

private:
void onMap(const HADMapBin::ConstSharedPtr map_msg);
void onMap(const LaneletMapBin::ConstSharedPtr map_msg);
void analyze();

std::shared_ptr<analyzer_core::AnalyzerCore> analyzer_;

rclcpp::Subscription<HADMapBin>::SharedPtr sub_map_;
rclcpp::Subscription<LaneletMapBin>::SharedPtr sub_map_;
rclcpp::TimerBase::SharedPtr timer_;
rosbag2_cpp::Reader reader_;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public Q_SLOTS:
void onClickAnalyzeDynamicODDFactor();

private:
void onMap(const HADMapBin::ConstSharedPtr map_msg);
void onMap(const LaneletMapBin::ConstSharedPtr map_msg);

std::shared_ptr<analyzer_core::AnalyzerCore> analyzer_;

Expand All @@ -75,7 +75,7 @@ public Q_SLOTS:
QPushButton * set_timestamp_btn_;

rclcpp::Node::SharedPtr raw_node_;
rclcpp::Subscription<HADMapBin>::SharedPtr sub_map_;
rclcpp::Subscription<LaneletMapBin>::SharedPtr sub_map_;
rclcpp::Publisher<Odometry>::SharedPtr pub_odometry_;
rclcpp::Publisher<PredictedObjects>::SharedPtr pub_objects_;
rclcpp::Publisher<TFMessage>::SharedPtr pub_tf_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#include "tier4_rtc_msgs/msg/command.hpp"
#include "tier4_rtc_msgs/msg/cooperate_status_array.hpp"
#include "tier4_rtc_msgs/msg/module.hpp"
#include <autoware_auto_mapping_msgs/msg/had_map_bin.hpp>
#include <autoware_auto_perception_msgs/msg/predicted_objects.hpp>
#include <autoware_map_msgs/msg/lanelet_map_bin.hpp>
#include <autoware_perception_msgs/msg/predicted_objects.hpp>
#include <autoware_planning_msgs/msg/lanelet_route.hpp>
#include <nav_msgs/msg/odometry.hpp>
#include <tf2_msgs/msg/tf_message.hpp>
Expand All @@ -40,9 +40,9 @@ using nav_msgs::msg::Odometry;
using tf2_msgs::msg::TFMessage;

// autoware
using autoware_auto_mapping_msgs::msg::HADMapBin;
using autoware_auto_perception_msgs::msg::ObjectClassification;
using autoware_auto_perception_msgs::msg::PredictedObjects;
using autoware_map_msgs::msg::LaneletMapBin;
using autoware_perception_msgs::msg::ObjectClassification;
using autoware_perception_msgs::msg::PredictedObjects;
using autoware_planning_msgs::msg::LaneletRoute;
using tier4_rtc_msgs::msg::Command;
using tier4_rtc_msgs::msg::CooperateStatusArray;
Expand Down
2 changes: 1 addition & 1 deletion driving_environment_analyzer/src/analyzer_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void AnalyzerCore::setBagFile(const std::string & file_name)
route_handler_.setRoute(opt_route.value());
}

const auto opt_map = getLastTopic<HADMapBin>("/map/vector_map");
const auto opt_map = getLastTopic<LaneletMapBin>("/map/vector_map");
if (opt_map.has_value()) {
route_handler_.setMap(opt_map.value());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ DrivingEnvironmentAnalyzerNode::DrivingEnvironmentAnalyzerNode(
timer_ = rclcpp::create_timer(
this, get_clock(), 100ms, std::bind(&DrivingEnvironmentAnalyzerNode::analyze, this));

sub_map_ = create_subscription<HADMapBin>(
sub_map_ = create_subscription<LaneletMapBin>(
"input/lanelet2_map", rclcpp::QoS{1}.transient_local(),
std::bind(&DrivingEnvironmentAnalyzerNode::onMap, this, _1));

Expand All @@ -42,7 +42,7 @@ DrivingEnvironmentAnalyzerNode::DrivingEnvironmentAnalyzerNode(
analyzer_->setBagFile(declare_parameter<std::string>("bag_path"));
}

void DrivingEnvironmentAnalyzerNode::onMap(const HADMapBin::ConstSharedPtr msg)
void DrivingEnvironmentAnalyzerNode::onMap(const LaneletMapBin::ConstSharedPtr msg)
{
analyzer_->setMap(*msg);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void DrivingEnvironmentAnalyzerPanel::onInitialize()

raw_node_ = this->getDisplayContext()->getRosNodeAbstraction().lock()->get_raw_node();

sub_map_ = raw_node_->create_subscription<HADMapBin>(
sub_map_ = raw_node_->create_subscription<LaneletMapBin>(
"/map/vector_map", rclcpp::QoS{1}.transient_local(),
std::bind(&DrivingEnvironmentAnalyzerPanel::onMap, this, _1));

Expand All @@ -126,7 +126,7 @@ void DrivingEnvironmentAnalyzerPanel::onInitialize()
analyzer_ = std::make_shared<analyzer_core::AnalyzerCore>(*raw_node_);
}

void DrivingEnvironmentAnalyzerPanel::onMap(const HADMapBin::ConstSharedPtr msg)
void DrivingEnvironmentAnalyzerPanel::onMap(const LaneletMapBin::ConstSharedPtr msg)
{
analyzer_->setMap(*msg);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import time

from autoware_control_msgs.msg import Control
from autoware_control_msgs.msg import Control as AckermannControlCommand
from autoware_planning_msgs.msg import Path
from autoware_planning_msgs.msg import Trajectory
from autoware_vehicle_msgs.msg import Engage
Expand Down
14 changes: 7 additions & 7 deletions simulator/simulator_compatibility_test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ Detailed process

### Output

| Name | Type | Description |
| -------------------------------------- | ----------------------------------------------- | ---------------------- |
| `/control/command/control_mode_cmd` | `autoware_vehicle_msgs/ControlModeCommand` | for [Test Case #1] |
| `/control/command/gear_cmd` | `autoware_vehicle_msgs/GearCommand` | for [Test Case #2] |
| `/control/command/control_cmd` | `autoware_vehicle_msgs/AckermannControlCommand` | for [Test Case #3, #4] |
| `/vehicle/status/steering_status` | `autoware_vehicle_msgs/TurnIndicatorsCommand` | for [Test Case #5] |
| `/control/command/turn_indicators_cmd` | `autoware_vehicle_msgs/HazardLightsCommand` | for [Test Case #6] |
| Name | Type | Description |
| -------------------------------------- | --------------------------------------------- | ---------------------- |
| `/control/command/control_cmd` | `autoware_control_msgs/Control` | for [Test Case #3, #4] |
| `/control/command/control_mode_cmd` | `autoware_vehicle_msgs/ControlModeCommand` | for [Test Case #1] |
| `/control/command/gear_cmd` | `autoware_vehicle_msgs/GearCommand` | for [Test Case #2] |
| `/vehicle/status/steering_status` | `autoware_vehicle_msgs/TurnIndicatorsCommand` | for [Test Case #5] |
| `/control/command/turn_indicators_cmd` | `autoware_vehicle_msgs/HazardLightsCommand` | for [Test Case #6] |

## Parameters

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from autoware_control_msgs.msg import Control as ControlCommand
from autoware_control_msgs.msg import Control as AckermannControlCommand
from autoware_control_msgs.msg import Lateral as LateralCommand
from autoware_control_msgs.msg import Longitudinal as LongitudinalCommand
import rclpy
Expand All @@ -23,11 +23,11 @@ def __init__(self):
durability=QoSDurabilityPolicy.TRANSIENT_LOCAL,
)
self.topic = "/control/command/control_cmd"
self.publisher_ = self.create_publisher(ControlCommand, self.topic, QOS_RKL10TL)
self.publisher_ = self.create_publisher(AckermannControlCommand, self.topic, QOS_RKL10TL)

def publish_msg(self, control_cmd):
stamp = self.get_clock().now().to_msg()
msg = ControlCommand()
msg = AckermannControlCommand()
lateral_cmd = LateralCommand()
longitudinal_cmd = LongitudinalCommand()
lateral_cmd.stamp.sec = stamp.sec
Expand Down

0 comments on commit cf89a2a

Please sign in to comment.