|
14 | 14 |
|
15 | 15 | #include "autoware/pid_longitudinal_controller/pid_longitudinal_controller.hpp"
|
16 | 16 |
|
| 17 | +#include "autoware/motion_utils/marker/marker_helper.hpp" |
17 | 18 | #include "autoware/motion_utils/trajectory/trajectory.hpp"
|
18 | 19 | #include "autoware/universe_utils/geometry/geometry.hpp"
|
19 | 20 | #include "autoware/universe_utils/math/normalization.hpp"
|
@@ -215,7 +216,7 @@ PidLongitudinalController::PidLongitudinalController(
|
215 | 216 | "~/output/slope_angle", rclcpp::QoS{1});
|
216 | 217 | m_pub_debug = node.create_publisher<tier4_debug_msgs::msg::Float32MultiArrayStamped>(
|
217 | 218 | "~/output/longitudinal_diagnostic", rclcpp::QoS{1});
|
218 |
| - m_pub_stop_reason_marker = node.create_publisher<Marker>("~/output/stop_reason", rclcpp::QoS{1}); |
| 219 | + m_pub_virtual_wall_marker = node.create_publisher<MarkerArray>("~/virtual_wall", 1); |
219 | 220 |
|
220 | 221 | // set parameter callback
|
221 | 222 | m_set_param_res = node.add_on_set_parameters_callback(
|
@@ -521,8 +522,8 @@ PidLongitudinalController::ControlData PidLongitudinalController::getControlData
|
521 | 522 |
|
522 | 523 | // distance to stopline
|
523 | 524 | control_data.stop_dist = longitudinal_utils::calcStopDistance(
|
524 |
| - control_data.interpolated_traj.points.at(control_data.nearest_idx).pose, |
525 |
| - control_data.interpolated_traj, m_ego_nearest_dist_threshold, m_ego_nearest_yaw_threshold); |
| 525 | + current_pose, control_data.interpolated_traj, m_ego_nearest_dist_threshold, |
| 526 | + m_ego_nearest_yaw_threshold); |
526 | 527 |
|
527 | 528 | // pitch
|
528 | 529 | // NOTE: getPitchByTraj() calculates the pitch angle as defined in
|
@@ -576,6 +577,11 @@ PidLongitudinalController::Motion PidLongitudinalController::calcEmergencyCtrlCm
|
576 | 577 | longitudinal_utils::applyDiffLimitFilter(raw_ctrl_cmd.acc, m_prev_raw_ctrl_cmd.acc, dt, p.jerk);
|
577 | 578 | m_debug_values.setValues(DebugValues::TYPE::ACC_CMD_JERK_LIMITED, raw_ctrl_cmd.acc);
|
578 | 579 |
|
| 580 | + const auto virtual_wall_marker = autoware::motion_utils::createStopVirtualWallMarker( |
| 581 | + m_current_kinematic_state.pose.pose, "velocity control\n (emergency)", clock_->now(), 0, |
| 582 | + m_wheel_base + m_front_overhang); |
| 583 | + m_pub_virtual_wall_marker->publish(virtual_wall_marker); |
| 584 | + |
579 | 585 | return raw_ctrl_cmd;
|
580 | 586 | }
|
581 | 587 |
|
@@ -740,14 +746,12 @@ void PidLongitudinalController::updateControlState(const ControlData & control_d
|
740 | 746 | }
|
741 | 747 |
|
742 | 748 | // publish debug marker
|
743 |
| - auto marker = createDefaultMarker( |
744 |
| - "map", clock_->now(), "stop_reason", 0, Marker::TEXT_VIEW_FACING, |
745 |
| - createMarkerScale(0.0, 0.0, 1.0), createMarkerColor(1.0, 1.0, 1.0, 0.999)); |
746 |
| - marker.pose = autoware::universe_utils::calcOffsetPose( |
747 |
| - m_current_kinematic_state.pose.pose, m_wheel_base + m_front_overhang, |
748 |
| - m_vehicle_width / 2 + 2.0, 1.5); |
749 |
| - marker.text = "steering not\nconverged"; |
750 |
| - m_pub_stop_reason_marker->publish(marker); |
| 749 | + if (is_under_control) { |
| 750 | + const auto virtual_wall_marker = autoware::motion_utils::createStopVirtualWallMarker( |
| 751 | + m_current_kinematic_state.pose.pose, "velocity control\n(steering not converged)", |
| 752 | + clock_->now(), 0, m_wheel_base + m_front_overhang); |
| 753 | + m_pub_virtual_wall_marker->publish(virtual_wall_marker); |
| 754 | + } |
751 | 755 |
|
752 | 756 | // keep STOPPED
|
753 | 757 | return;
|
|
0 commit comments