@@ -39,6 +39,8 @@ PidLongitudinalController::PidLongitudinalController(rclcpp::Node & node)
39
39
m_longitudinal_ctrl_period = node.get_parameter (" ctrl_period" ).as_double ();
40
40
41
41
m_wheel_base = vehicle_info_util::VehicleInfoUtil (node).getVehicleInfo ().wheel_base_m ;
42
+ m_vehicle_width = vehicle_info_util::VehicleInfoUtil (node).getVehicleInfo ().vehicle_width_m ;
43
+ m_front_overhang = vehicle_info_util::VehicleInfoUtil (node).getVehicleInfo ().front_overhang_m ;
42
44
43
45
// parameters for delay compensation
44
46
m_delay_compensation_time = node.declare_parameter <double >(" delay_compensation_time" ); // [s]
@@ -189,6 +191,7 @@ PidLongitudinalController::PidLongitudinalController(rclcpp::Node & node)
189
191
" ~/output/slope_angle" , rclcpp::QoS{1 });
190
192
m_pub_debug = node.create_publisher <tier4_debug_msgs::msg::Float32MultiArrayStamped>(
191
193
" ~/output/longitudinal_diagnostic" , rclcpp::QoS{1 });
194
+ m_pub_stop_reason_marker = node.create_publisher <Marker>(" ~/output/stop_reason" , rclcpp::QoS{1 });
192
195
193
196
// set parameter callback
194
197
m_set_param_res = node.add_on_set_parameters_callback (
@@ -510,6 +513,16 @@ void PidLongitudinalController::updateControlState(const ControlData & control_d
510
513
const bool keep_stopped_condition = std::fabs (current_vel) < vel_epsilon &&
511
514
m_enable_keep_stopped_until_steer_convergence &&
512
515
!lateral_sync_data_.is_steer_converged ;
516
+ if (keep_stopped_condition) {
517
+ auto marker = createDefaultMarker (
518
+ " map" , clock_->now (), " stop_reason" , 0 , Marker::TEXT_VIEW_FACING,
519
+ createMarkerScale (0.0 , 0.0 , 1.0 ), createMarkerColor (1.0 , 1.0 , 1.0 , 0.999 ));
520
+ marker.pose = tier4_autoware_utils::calcOffsetPose (
521
+ m_current_kinematic_state.pose .pose , m_wheel_base + m_front_overhang,
522
+ m_vehicle_width / 2 + 2.0 , 1.5 );
523
+ marker.text = " steering not\n converged" ;
524
+ m_pub_stop_reason_marker->publish (marker);
525
+ }
513
526
514
527
const bool stopping_condition = stop_dist < p.stopping_state_stop_dist ;
515
528
@@ -571,7 +584,6 @@ void PidLongitudinalController::updateControlState(const ControlData & control_d
571
584
if (emergency_condition) {
572
585
return changeState (ControlState::EMERGENCY);
573
586
}
574
-
575
587
if (!is_under_control && stopped_condition && keep_stopped_condition) {
576
588
// NOTE: When the ego is stopped on manual driving, since the driving state may transit to
577
589
// autonomous, keep_stopped_condition should be checked.
@@ -602,7 +614,6 @@ void PidLongitudinalController::updateControlState(const ControlData & control_d
602
614
if (emergency_condition) {
603
615
return changeState (ControlState::EMERGENCY);
604
616
}
605
-
606
617
if (stopped_condition) {
607
618
return changeState (ControlState::STOPPED);
608
619
}
0 commit comments