No version for distro humble showing github. Known supported distros are highlighted in the buttons above.
Package symbol

autoware_pid_longitudinal_controller package from autoware_universe repo

autoware_boundary_departure_checker autoware_component_interface_specs_universe autoware_cuda_dependency_meta autoware_deprecated_boundary_departure_checker autoware_fake_test_node autoware_glog_component autoware_goal_distance_calculator autoware_grid_map_utils autoware_obstacle_proximity_checker autoware_path_distance_calculator autoware_time_utils autoware_traffic_light_compliance_checker autoware_traffic_light_recognition_marker_publisher autoware_traffic_light_utils autoware_universe_utils tier4_api_utils autoware_autonomous_emergency_braking autoware_collision_detector autoware_control_command_gate autoware_control_performance_analysis autoware_control_validator autoware_external_cmd_selector autoware_joy_controller autoware_lane_departure_checker autoware_mpc_lateral_controller autoware_obstacle_collision_checker autoware_operation_mode_transition_manager autoware_pid_longitudinal_controller autoware_predicted_path_checker autoware_pure_pursuit autoware_shift_decider autoware_smart_mpc_trajectory_follower autoware_spheric_collision_detector autoware_stop_mode_operator autoware_trajectory_follower_base autoware_trajectory_follower_node autoware_vehicle_cmd_gate autoware_tensorrt_vad autoware_control_evaluator autoware_evaluation_adapter autoware_kinematic_evaluator autoware_localization_evaluator autoware_perception_online_evaluator autoware_planning_evaluator autoware_scenario_simulator_v2_adapter autoware_diagnostic_graph_test_examples autoware_geo_pose_projector autoware_ar_tag_based_localizer autoware_landmark_manager autoware_lidar_marker_localizer autoware_localization_error_monitor autoware_pose_covariance_modifier autoware_pose_estimator_arbiter autoware_pose_initialization_requester autoware_pose_instability_detector yabloc_common yabloc_image_processing yabloc_monitor yabloc_particle_filter yabloc_pose_initializer autoware_map_tf_generator autoware_bevfusion autoware_bytetrack autoware_camera_streampetr autoware_cluster_merger autoware_compare_map_segmentation autoware_crosswalk_traffic_light_estimator autoware_detected_object_feature_remover autoware_detected_object_validation autoware_detection_by_tracker autoware_elevation_map_loader autoware_euclidean_cluster autoware_ground_segmentation autoware_ground_segmentation_cuda autoware_image_object_locator autoware_image_projection_based_fusion autoware_lidar_apollo_instance_segmentation autoware_lidar_centerpoint autoware_lidar_frnet autoware_lidar_transfusion autoware_map_based_prediction autoware_multi_object_tracker autoware_object_merger autoware_object_sorter autoware_occupancy_grid_map_outlier_filter autoware_predicted_path_postprocessor autoware_probabilistic_occupancy_grid_map autoware_ptv3 autoware_radar_fusion_to_detected_object autoware_radar_object_tracker autoware_radar_tracks_msgs_converter autoware_raindrop_cluster_filter autoware_shape_estimation autoware_simpl_prediction autoware_simple_object_merger autoware_tensorrt_bevdet autoware_tensorrt_bevformer autoware_tensorrt_classifier autoware_tensorrt_common autoware_tensorrt_plugins autoware_tensorrt_yolox autoware_tracking_object_merger autoware_traffic_light_arbiter autoware_traffic_light_category_merger autoware_traffic_light_classifier autoware_traffic_light_fine_detector autoware_traffic_light_map_based_detector autoware_traffic_light_multi_camera_fusion autoware_traffic_light_occlusion_predictor autoware_traffic_light_pipeline autoware_traffic_light_selector autoware_traffic_light_visualization perception_utils autoware_costmap_generator autoware_diffusion_planner autoware_external_velocity_limit_selector autoware_freespace_planner autoware_freespace_planning_algorithms autoware_hazard_lights_selector autoware_in_lane_mrm_planner autoware_manual_lane_change_handler autoware_minimum_rule_based_planner autoware_mission_planner_universe autoware_path_optimizer autoware_path_smoother autoware_remaining_distance_time_calculator autoware_rtc_interface autoware_scenario_selector autoware_surround_obstacle_checker autoware_trajectory_adapter autoware_trajectory_concatenator autoware_trajectory_gate autoware_trajectory_modifier autoware_trajectory_ranker autoware_trajectory_selector autoware_trajectory_validator autoware_behavior_path_avoidance_by_lane_change_module autoware_behavior_path_bidirectional_traffic_module autoware_behavior_path_direction_change_module autoware_behavior_path_dynamic_obstacle_avoidance_module autoware_behavior_path_external_request_lane_change_module autoware_behavior_path_goal_planner_module autoware_behavior_path_lane_change_module autoware_behavior_path_planner autoware_behavior_path_planner_common autoware_behavior_path_sampling_planner_module autoware_behavior_path_side_shift_module autoware_behavior_path_start_planner_module autoware_behavior_path_static_obstacle_avoidance_module autoware_behavior_velocity_blind_spot_module autoware_behavior_velocity_crosswalk_module autoware_behavior_velocity_detection_area_module autoware_behavior_velocity_intersection_module autoware_behavior_velocity_no_drivable_lane_module autoware_behavior_velocity_no_stopping_area_module autoware_behavior_velocity_occlusion_spot_module autoware_behavior_velocity_roundabout_module autoware_behavior_velocity_rtc_interface autoware_behavior_velocity_speed_bump_module autoware_behavior_velocity_template_module autoware_behavior_velocity_traffic_light_module autoware_behavior_velocity_virtual_traffic_light_module autoware_behavior_velocity_walkway_module autoware_motion_velocity_boundary_departure_prevention_module autoware_motion_velocity_dynamic_obstacle_stop_module autoware_motion_velocity_obstacle_cruise_module autoware_motion_velocity_obstacle_slow_down_module autoware_motion_velocity_obstacle_velocity_limiter_module autoware_motion_velocity_out_of_lane_module autoware_motion_velocity_road_user_stop_module autoware_motion_velocity_run_out_module autoware_planning_validator autoware_planning_validator_intersection_collision_checker autoware_planning_validator_latency_checker autoware_planning_validator_rear_collision_checker autoware_planning_validator_test_utils autoware_planning_validator_trajectory_checker autoware_bezier_sampler autoware_frenet_planner autoware_path_sampler autoware_sampler_common autoware_calibration_status_classifier autoware_cuda_pointcloud_preprocessor autoware_cuda_utils autoware_image_transport_decompressor autoware_imu_corrector autoware_pcl_extensions autoware_pointcloud_preprocessor autoware_radar_objects_adapter autoware_radar_scan_to_pointcloud2 autoware_radar_static_pointcloud_filter autoware_radar_threshold_filter autoware_radar_tracks_noise_filter autoware_carla_interface autoware_dummy_diag_publisher autoware_dummy_infrastructure autoware_dummy_traffic_light_publisher autoware_fault_injection autoware_redundancy_command_selector autoware_vehicle_door_simulator tier4_dummy_object_rviz_plugin autoware_command_mode_decider autoware_command_mode_decider_plugins autoware_command_mode_switcher autoware_command_mode_switcher_plugins autoware_command_mode_types autoware_component_state_monitor autoware_adapi_visualizers autoware_default_adapi_universe autoware_diagnostic_graph_aggregator autoware_diagnostic_graph_merger autoware_diagnostic_graph_utils autoware_driving_mode_manager autoware_duplicated_node_checker autoware_generic_service_divider autoware_hazard_status_converter autoware_mrm_comfortable_stop_operator autoware_mrm_emergency_stop_operator autoware_mrm_handler autoware_mrm_in_lane_stop_operator autoware_mrm_reset_manager autoware_mrm_steering_hold_stop_operator autoware_pipeline_latency_monitor autoware_processing_time_checker autoware_redundancy_adapi_switcher autoware_redundancy_switcher_interface autoware_redundancy_switcher_interface_plugins autoware_system_monitor autoware_topic_relay_controller autoware_topic_state_monitor autoware_velodyne_monitor autoware_accel_brake_map_calibrator autoware_external_cmd_converter autoware_raw_vehicle_cmd_converter autoware_steer_offset_estimator autoware_bag_time_manager_rviz_plugin autoware_traffic_light_rviz_plugin tier4_active_generator_rviz_plugin tier4_adapi_rviz_plugin tier4_camera_view_rviz_plugin tier4_control_mode_rviz_plugin tier4_manual_lane_change_rviz_plugin tier4_perception_rviz_plugin tier4_planning_factor_rviz_plugin tier4_state_rviz_plugin tier4_traffic_light_rviz_plugin tier4_vehicle_rviz_plugin

ROS Distro
github

Package Summary

Version 0.53.0
License Apache 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/autowarefoundation/autoware_universe.git
VCS Type git
VCS Version main
Last Updated 2026-10-23
Dev Status UNKNOWN
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

PID-based longitudinal controller

Maintainers

  • Yuki Takagi
  • Kyoichi Sugahara
  • Arjun Ram
  • Takumi Odashima

Authors

  • Takamasa Horibe
  • Maxime CLEMENT
  • Takayuki Murooka

PID Longitudinal Controller

Purpose / Use cases

The longitudinal_controller computes the target acceleration to achieve the target velocity set at each point of the target trajectory using a feed-forward/back control.

It also contains a slope force correction that takes into account road slope information, and a delay compensation function. It is assumed that the target acceleration calculated here will be properly realized by the vehicle interface.

Note that the use of this module is not mandatory for Autoware if the vehicle supports the “target speed” interface.

Design / Inner-workings / Algorithms

States

This module has four state transitions as shown below in order to handle special processing in a specific situation.

  • DRIVE
    • Executes target velocity tracking by PID control.
    • It also applies the delay compensation and slope compensation.
  • STOPPING
    • Controls the motion just before stopping.
    • Special sequence is performed to achieve accurate and smooth stopping.
  • STOPPED
    • Performs operations in the stopped state (e.g. brake hold)
  • EMERGENCY.
    • Enters an emergency state when certain conditions are met (e.g., when the vehicle has crossed a certain distance of a stop line).
    • The recovery condition (whether or not to keep emergency state until the vehicle completely stops) or the deceleration in the emergency state are defined by parameters.

The state transition diagram is shown below.

LongitudinalControllerStateTransition

Logics

Control Block Diagram

LongitudinalControllerDiagram

FeedForward (FF)

The reference acceleration set in the trajectory and slope compensation terms are output as a feedforward. Under ideal conditions with no modeling error, this FF term alone should be sufficient for velocity tracking.

Tracking errors causing modeling or discretization errors are removed by the feedback control (now using PID).

Brake keeping

From the viewpoint of ride comfort, stopping with 0 acceleration is important because it reduces the impact of braking. However, if the target acceleration when stopping is 0, the vehicle may cross over the stop line or accelerate a little in front of the stop line due to vehicle model error or gradient estimation error.

For reliable stopping, the target acceleration calculated by the FeedForward system is limited to a negative acceleration when stopping.

BrakeKeepingDiagram

Slope compensation

Based on the slope information, a compensation term is added to the target acceleration.

There are two sources of the slope information, which can be switched by a parameter.

  • Pitch of the estimated ego-pose (default)
    • Calculates the current slope from the pitch angle of the estimated ego-pose
    • Pros: Easily available
    • Cons: Cannot extract accurate slope information due to the influence of vehicle vibration.
  • Z coordinate on the trajectory
    • Calculates the road slope from the difference of z-coordinates between the front and rear wheel positions in the target trajectory
    • Pros: More accurate than pitch information, if the z-coordinates of the route are properly maintained
    • Pros: Can be used in combination with delay compensation (not yet implemented)
    • Cons: z-coordinates of high-precision map is needed.
    • Cons: Does not support free space planning (for now)

We also offer the options to switch between these, depending on driving conditions.

Notation: This function works correctly only in a vehicle system that does not have acceleration feedback in the low-level control system.

This compensation adds gravity correction to the target acceleration, resulting in an output value that is no longer equal to the target acceleration that the autonomous driving system desires. Therefore, it conflicts with the role of the acceleration feedback in the low-level controller. For instance, if the vehicle is attempting to start with an acceleration of 1.0 m/s^2 and a gravity correction of -1.0 m/s^2 is applied, the output value will be 0. If this output value is mistakenly treated as the target acceleration, the vehicle will not start.

A suitable example of a vehicle system for the slope compensation function is one in which the output acceleration from the longitudinal_controller is converted into target accel/brake pedal input without any feedbacks. In this case, the output acceleration is just used as a feedforward term to calculate the target pedal, and hence the issue mentioned above does not arise.

Note: The angle of the slope is defined as positive for an uphill slope, while the pitch angle of the ego pose is defined as negative when facing upward. They have an opposite definition.

slope_definition

PID control

For deviations that cannot be handled by FeedForward control, such as model errors, PID control is used to construct a feedback system.

This PID control calculates the target acceleration from the deviation between the current ego-velocity and the target velocity.

This PID logic has a maximum value for the output of each term. This is to prevent the following:

  • Large integral terms may cause unintended behavior by users.
  • Unintended noise may cause the output of the derivative term to be very large.

Note: by default, the integral term in the control system is not accumulated when the vehicle is stationary. This precautionary measure aims to prevent unintended accumulation of the integral term in scenarios where Autoware assumes the vehicle is engaged, but an external system has immobilized the vehicle to initiate startup procedures.

However, certain situations may arise, such as when the vehicle encounters a depression in the road surface during startup or if the slope compensation is inaccurately estimated (lower than necessary), leading to a failure to initiate motion. To address these scenarios, it is possible to activate error integration even when the vehicle is at rest by setting the enable_integration_at_low_speed parameter to true.

When enable_integration_at_low_speed is set to true, the PID controller will initiate integration of the acceleration error after a specified duration defined by the time_threshold_before_pid_integration parameter has elapsed without the vehicle surpassing a minimum velocity set by the current_vel_threshold_pid_integration parameter.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package autoware_pid_longitudinal_controller

0.53.0 (2026-09-29)

  • Merge remote-tracking branch 'origin/main' into prepare-0.53.0-changelog

  • fix(pid_long): fix slope sign (#13247)

  • refactor(pid_logitudinal_controller): cleanup core logic (#13071)

    * refactor(autoware_pid_longitudinal_controller): remove unused m_current_time member m_current_time was assigned once per run() but never read anywhere in the class.

    * refactor(autoware_pid_longitudinal_controller): remove unused m_prev_nearest_time member m_prev_nearest_time was only ever written to (set or reset) and never read, so it had no effect on behavior.

    * refactor(autoware_pid_longitudinal_controller): pass is_steer_converged as parameter is_steer_converged was cached as a member for one control cycle only to be read inside updateControlState(), the sole function that used it. Pass it as a parameter to updateControlState() instead of holding it as class state.

    * refactor(autoware_pid_longitudinal_controller): remove unimplemented member function declarations getCurrentMotion() and calcFilteredAcc() were declared in the header but never defined or called anywhere in the class.

    * refactor(autoware_pid_longitudinal_controller): remove redundant m_received_invalid_trajectory member The value was only set and read within a single run() call, so it can be a local variable derived directly from is_valid_trajectory() instead of a persistent member.

    * refactor(autoware_pid_longitudinal_controller): extract debug/slope message creation into free helper functions Move the inline debug_message and slope_message construction in run() into createDebugMessage() and createSlopeMessage() free functions.

    * refactor(autoware_pid_longitudinal_controller): return emergency stop reason from updateControlState Have changeControlState() and updateControlState() return the emergency stop reason instead of writing it to the m_emergency_stop_reason member, removing the member variable and the reset-before-use pattern in run().

    * refactor(autoware_pid_longitudinal_controller): add const to side-effect-free member functions Moves the m_prev_ctrl_cmd update out of createCtrlCmdMsg (which should only format the output message) and into calcCtrlCmd where the state transition belongs, allowing createCtrlCmdMsg and getTimeUnderControl to be marked const.

    * refactor(autoware_pid_longitudinal_controller): make createCtrlCmdMsg a free helper function Converts createCtrlCmdMsg into a free function in the anonymous namespace, matching createDebugMessage/createSlopeMessage, since it does not need access to any member state. Argument order places current_time first to align with the other message-creation helpers.

    * fix(autoware_pid_longitudinal_controller): avoid clock-type mismatch in delay-compensation time arithmetic PidLongitudinalController compared current_time (whose clock type is caller-supplied) against timestamps implicitly converted from builtin_interfaces::msg::Time, which defaults to RCL_ROS_TIME. When current_time used a different clock type, rclcpp::Time subtraction threw "can't subtract times with different time sources". Replace the ROS-message-backed m_ctrl_cmd_vec with a dedicated TimestampedAcceleration struct that stores rclcpp::Time directly, so stored stamps always share current_time's clock type without needing an explicit conversion. The remaining message-derived timestamp (trajectory header stamp) is now converted using current_time.get_clock_type() instead of the implicit RCL_ROS_TIME default.

    * test(autoware_pid_longitudinal_controller): drop clock-type overrides now that current_time flows through unchanged make_time() no longer needs an rcl_clock_type_t parameter, and no test needs to force RCL_ROS_TIME, since PidLongitudinalController no longer implicitly assumes RCL_ROS_TIME for message-derived timestamps. ---------Co-authored-by: Takahisa.Ishikawa <<takahisa.ishikawa@tier4.jp>>

  • test(pid_longitudinal_controller): add unit tests (#13064)

    • test(autoware_pid_longitudinal_controller): add unit tests for PidLongitudinalController

    * test(autoware_pid_longitudinal_controller): trim redundant PidLongitudinalController test cases Removes several overlapping/redundant test cases while keeping the temporal-trajectory coverage (TemporalTrajectoryProducesValidCommand and its make_temporal_trajectory helper), which exercises the use_temporal_trajectory branch in getControlData.

    * test(autoware_pid_longitudinal_controller): assert control_cmd

File truncated at 100 lines see the full file

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged autoware_pid_longitudinal_controller at Robotics Stack Exchange

No version for distro jazzy showing github. Known supported distros are highlighted in the buttons above.
Package symbol

autoware_pid_longitudinal_controller package from autoware_universe repo

autoware_boundary_departure_checker autoware_component_interface_specs_universe autoware_cuda_dependency_meta autoware_deprecated_boundary_departure_checker autoware_fake_test_node autoware_glog_component autoware_goal_distance_calculator autoware_grid_map_utils autoware_obstacle_proximity_checker autoware_path_distance_calculator autoware_time_utils autoware_traffic_light_compliance_checker autoware_traffic_light_recognition_marker_publisher autoware_traffic_light_utils autoware_universe_utils tier4_api_utils autoware_autonomous_emergency_braking autoware_collision_detector autoware_control_command_gate autoware_control_performance_analysis autoware_control_validator autoware_external_cmd_selector autoware_joy_controller autoware_lane_departure_checker autoware_mpc_lateral_controller autoware_obstacle_collision_checker autoware_operation_mode_transition_manager autoware_pid_longitudinal_controller autoware_predicted_path_checker autoware_pure_pursuit autoware_shift_decider autoware_smart_mpc_trajectory_follower autoware_spheric_collision_detector autoware_stop_mode_operator autoware_trajectory_follower_base autoware_trajectory_follower_node autoware_vehicle_cmd_gate autoware_tensorrt_vad autoware_control_evaluator autoware_evaluation_adapter autoware_kinematic_evaluator autoware_localization_evaluator autoware_perception_online_evaluator autoware_planning_evaluator autoware_scenario_simulator_v2_adapter autoware_diagnostic_graph_test_examples autoware_geo_pose_projector autoware_ar_tag_based_localizer autoware_landmark_manager autoware_lidar_marker_localizer autoware_localization_error_monitor autoware_pose_covariance_modifier autoware_pose_estimator_arbiter autoware_pose_initialization_requester autoware_pose_instability_detector yabloc_common yabloc_image_processing yabloc_monitor yabloc_particle_filter yabloc_pose_initializer autoware_map_tf_generator autoware_bevfusion autoware_bytetrack autoware_camera_streampetr autoware_cluster_merger autoware_compare_map_segmentation autoware_crosswalk_traffic_light_estimator autoware_detected_object_feature_remover autoware_detected_object_validation autoware_detection_by_tracker autoware_elevation_map_loader autoware_euclidean_cluster autoware_ground_segmentation autoware_ground_segmentation_cuda autoware_image_object_locator autoware_image_projection_based_fusion autoware_lidar_apollo_instance_segmentation autoware_lidar_centerpoint autoware_lidar_frnet autoware_lidar_transfusion autoware_map_based_prediction autoware_multi_object_tracker autoware_object_merger autoware_object_sorter autoware_occupancy_grid_map_outlier_filter autoware_predicted_path_postprocessor autoware_probabilistic_occupancy_grid_map autoware_ptv3 autoware_radar_fusion_to_detected_object autoware_radar_object_tracker autoware_radar_tracks_msgs_converter autoware_raindrop_cluster_filter autoware_shape_estimation autoware_simpl_prediction autoware_simple_object_merger autoware_tensorrt_bevdet autoware_tensorrt_bevformer autoware_tensorrt_classifier autoware_tensorrt_common autoware_tensorrt_plugins autoware_tensorrt_yolox autoware_tracking_object_merger autoware_traffic_light_arbiter autoware_traffic_light_category_merger autoware_traffic_light_classifier autoware_traffic_light_fine_detector autoware_traffic_light_map_based_detector autoware_traffic_light_multi_camera_fusion autoware_traffic_light_occlusion_predictor autoware_traffic_light_pipeline autoware_traffic_light_selector autoware_traffic_light_visualization perception_utils autoware_costmap_generator autoware_diffusion_planner autoware_external_velocity_limit_selector autoware_freespace_planner autoware_freespace_planning_algorithms autoware_hazard_lights_selector autoware_in_lane_mrm_planner autoware_manual_lane_change_handler autoware_minimum_rule_based_planner autoware_mission_planner_universe autoware_path_optimizer autoware_path_smoother autoware_remaining_distance_time_calculator autoware_rtc_interface autoware_scenario_selector autoware_surround_obstacle_checker autoware_trajectory_adapter autoware_trajectory_concatenator autoware_trajectory_gate autoware_trajectory_modifier autoware_trajectory_ranker autoware_trajectory_selector autoware_trajectory_validator autoware_behavior_path_avoidance_by_lane_change_module autoware_behavior_path_bidirectional_traffic_module autoware_behavior_path_direction_change_module autoware_behavior_path_dynamic_obstacle_avoidance_module autoware_behavior_path_external_request_lane_change_module autoware_behavior_path_goal_planner_module autoware_behavior_path_lane_change_module autoware_behavior_path_planner autoware_behavior_path_planner_common autoware_behavior_path_sampling_planner_module autoware_behavior_path_side_shift_module autoware_behavior_path_start_planner_module autoware_behavior_path_static_obstacle_avoidance_module autoware_behavior_velocity_blind_spot_module autoware_behavior_velocity_crosswalk_module autoware_behavior_velocity_detection_area_module autoware_behavior_velocity_intersection_module autoware_behavior_velocity_no_drivable_lane_module autoware_behavior_velocity_no_stopping_area_module autoware_behavior_velocity_occlusion_spot_module autoware_behavior_velocity_roundabout_module autoware_behavior_velocity_rtc_interface autoware_behavior_velocity_speed_bump_module autoware_behavior_velocity_template_module autoware_behavior_velocity_traffic_light_module autoware_behavior_velocity_virtual_traffic_light_module autoware_behavior_velocity_walkway_module autoware_motion_velocity_boundary_departure_prevention_module autoware_motion_velocity_dynamic_obstacle_stop_module autoware_motion_velocity_obstacle_cruise_module autoware_motion_velocity_obstacle_slow_down_module autoware_motion_velocity_obstacle_velocity_limiter_module autoware_motion_velocity_out_of_lane_module autoware_motion_velocity_road_user_stop_module autoware_motion_velocity_run_out_module autoware_planning_validator autoware_planning_validator_intersection_collision_checker autoware_planning_validator_latency_checker autoware_planning_validator_rear_collision_checker autoware_planning_validator_test_utils autoware_planning_validator_trajectory_checker autoware_bezier_sampler autoware_frenet_planner autoware_path_sampler autoware_sampler_common autoware_calibration_status_classifier autoware_cuda_pointcloud_preprocessor autoware_cuda_utils autoware_image_transport_decompressor autoware_imu_corrector autoware_pcl_extensions autoware_pointcloud_preprocessor autoware_radar_objects_adapter autoware_radar_scan_to_pointcloud2 autoware_radar_static_pointcloud_filter autoware_radar_threshold_filter autoware_radar_tracks_noise_filter autoware_carla_interface autoware_dummy_diag_publisher autoware_dummy_infrastructure autoware_dummy_traffic_light_publisher autoware_fault_injection autoware_redundancy_command_selector autoware_vehicle_door_simulator tier4_dummy_object_rviz_plugin autoware_command_mode_decider autoware_command_mode_decider_plugins autoware_command_mode_switcher autoware_command_mode_switcher_plugins autoware_command_mode_types autoware_component_state_monitor autoware_adapi_visualizers autoware_default_adapi_universe autoware_diagnostic_graph_aggregator autoware_diagnostic_graph_merger autoware_diagnostic_graph_utils autoware_driving_mode_manager autoware_duplicated_node_checker autoware_generic_service_divider autoware_hazard_status_converter autoware_mrm_comfortable_stop_operator autoware_mrm_emergency_stop_operator autoware_mrm_handler autoware_mrm_in_lane_stop_operator autoware_mrm_reset_manager autoware_mrm_steering_hold_stop_operator autoware_pipeline_latency_monitor autoware_processing_time_checker autoware_redundancy_adapi_switcher autoware_redundancy_switcher_interface autoware_redundancy_switcher_interface_plugins autoware_system_monitor autoware_topic_relay_controller autoware_topic_state_monitor autoware_velodyne_monitor autoware_accel_brake_map_calibrator autoware_external_cmd_converter autoware_raw_vehicle_cmd_converter autoware_steer_offset_estimator autoware_bag_time_manager_rviz_plugin autoware_traffic_light_rviz_plugin tier4_active_generator_rviz_plugin tier4_adapi_rviz_plugin tier4_camera_view_rviz_plugin tier4_control_mode_rviz_plugin tier4_manual_lane_change_rviz_plugin tier4_perception_rviz_plugin tier4_planning_factor_rviz_plugin tier4_state_rviz_plugin tier4_traffic_light_rviz_plugin tier4_vehicle_rviz_plugin

ROS Distro
github

Package Summary

Version 0.53.0
License Apache 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/autowarefoundation/autoware_universe.git
VCS Type git
VCS Version main
Last Updated 2026-10-23
Dev Status UNKNOWN
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

PID-based longitudinal controller

Maintainers

  • Yuki Takagi
  • Kyoichi Sugahara
  • Arjun Ram
  • Takumi Odashima

Authors

  • Takamasa Horibe
  • Maxime CLEMENT
  • Takayuki Murooka

PID Longitudinal Controller

Purpose / Use cases

The longitudinal_controller computes the target acceleration to achieve the target velocity set at each point of the target trajectory using a feed-forward/back control.

It also contains a slope force correction that takes into account road slope information, and a delay compensation function. It is assumed that the target acceleration calculated here will be properly realized by the vehicle interface.

Note that the use of this module is not mandatory for Autoware if the vehicle supports the “target speed” interface.

Design / Inner-workings / Algorithms

States

This module has four state transitions as shown below in order to handle special processing in a specific situation.

  • DRIVE
    • Executes target velocity tracking by PID control.
    • It also applies the delay compensation and slope compensation.
  • STOPPING
    • Controls the motion just before stopping.
    • Special sequence is performed to achieve accurate and smooth stopping.
  • STOPPED
    • Performs operations in the stopped state (e.g. brake hold)
  • EMERGENCY.
    • Enters an emergency state when certain conditions are met (e.g., when the vehicle has crossed a certain distance of a stop line).
    • The recovery condition (whether or not to keep emergency state until the vehicle completely stops) or the deceleration in the emergency state are defined by parameters.

The state transition diagram is shown below.

LongitudinalControllerStateTransition

Logics

Control Block Diagram

LongitudinalControllerDiagram

FeedForward (FF)

The reference acceleration set in the trajectory and slope compensation terms are output as a feedforward. Under ideal conditions with no modeling error, this FF term alone should be sufficient for velocity tracking.

Tracking errors causing modeling or discretization errors are removed by the feedback control (now using PID).

Brake keeping

From the viewpoint of ride comfort, stopping with 0 acceleration is important because it reduces the impact of braking. However, if the target acceleration when stopping is 0, the vehicle may cross over the stop line or accelerate a little in front of the stop line due to vehicle model error or gradient estimation error.

For reliable stopping, the target acceleration calculated by the FeedForward system is limited to a negative acceleration when stopping.

BrakeKeepingDiagram

Slope compensation

Based on the slope information, a compensation term is added to the target acceleration.

There are two sources of the slope information, which can be switched by a parameter.

  • Pitch of the estimated ego-pose (default)
    • Calculates the current slope from the pitch angle of the estimated ego-pose
    • Pros: Easily available
    • Cons: Cannot extract accurate slope information due to the influence of vehicle vibration.
  • Z coordinate on the trajectory
    • Calculates the road slope from the difference of z-coordinates between the front and rear wheel positions in the target trajectory
    • Pros: More accurate than pitch information, if the z-coordinates of the route are properly maintained
    • Pros: Can be used in combination with delay compensation (not yet implemented)
    • Cons: z-coordinates of high-precision map is needed.
    • Cons: Does not support free space planning (for now)

We also offer the options to switch between these, depending on driving conditions.

Notation: This function works correctly only in a vehicle system that does not have acceleration feedback in the low-level control system.

This compensation adds gravity correction to the target acceleration, resulting in an output value that is no longer equal to the target acceleration that the autonomous driving system desires. Therefore, it conflicts with the role of the acceleration feedback in the low-level controller. For instance, if the vehicle is attempting to start with an acceleration of 1.0 m/s^2 and a gravity correction of -1.0 m/s^2 is applied, the output value will be 0. If this output value is mistakenly treated as the target acceleration, the vehicle will not start.

A suitable example of a vehicle system for the slope compensation function is one in which the output acceleration from the longitudinal_controller is converted into target accel/brake pedal input without any feedbacks. In this case, the output acceleration is just used as a feedforward term to calculate the target pedal, and hence the issue mentioned above does not arise.

Note: The angle of the slope is defined as positive for an uphill slope, while the pitch angle of the ego pose is defined as negative when facing upward. They have an opposite definition.

slope_definition

PID control

For deviations that cannot be handled by FeedForward control, such as model errors, PID control is used to construct a feedback system.

This PID control calculates the target acceleration from the deviation between the current ego-velocity and the target velocity.

This PID logic has a maximum value for the output of each term. This is to prevent the following:

  • Large integral terms may cause unintended behavior by users.
  • Unintended noise may cause the output of the derivative term to be very large.

Note: by default, the integral term in the control system is not accumulated when the vehicle is stationary. This precautionary measure aims to prevent unintended accumulation of the integral term in scenarios where Autoware assumes the vehicle is engaged, but an external system has immobilized the vehicle to initiate startup procedures.

However, certain situations may arise, such as when the vehicle encounters a depression in the road surface during startup or if the slope compensation is inaccurately estimated (lower than necessary), leading to a failure to initiate motion. To address these scenarios, it is possible to activate error integration even when the vehicle is at rest by setting the enable_integration_at_low_speed parameter to true.

When enable_integration_at_low_speed is set to true, the PID controller will initiate integration of the acceleration error after a specified duration defined by the time_threshold_before_pid_integration parameter has elapsed without the vehicle surpassing a minimum velocity set by the current_vel_threshold_pid_integration parameter.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package autoware_pid_longitudinal_controller

0.53.0 (2026-09-29)

  • Merge remote-tracking branch 'origin/main' into prepare-0.53.0-changelog

  • fix(pid_long): fix slope sign (#13247)

  • refactor(pid_logitudinal_controller): cleanup core logic (#13071)

    * refactor(autoware_pid_longitudinal_controller): remove unused m_current_time member m_current_time was assigned once per run() but never read anywhere in the class.

    * refactor(autoware_pid_longitudinal_controller): remove unused m_prev_nearest_time member m_prev_nearest_time was only ever written to (set or reset) and never read, so it had no effect on behavior.

    * refactor(autoware_pid_longitudinal_controller): pass is_steer_converged as parameter is_steer_converged was cached as a member for one control cycle only to be read inside updateControlState(), the sole function that used it. Pass it as a parameter to updateControlState() instead of holding it as class state.

    * refactor(autoware_pid_longitudinal_controller): remove unimplemented member function declarations getCurrentMotion() and calcFilteredAcc() were declared in the header but never defined or called anywhere in the class.

    * refactor(autoware_pid_longitudinal_controller): remove redundant m_received_invalid_trajectory member The value was only set and read within a single run() call, so it can be a local variable derived directly from is_valid_trajectory() instead of a persistent member.

    * refactor(autoware_pid_longitudinal_controller): extract debug/slope message creation into free helper functions Move the inline debug_message and slope_message construction in run() into createDebugMessage() and createSlopeMessage() free functions.

    * refactor(autoware_pid_longitudinal_controller): return emergency stop reason from updateControlState Have changeControlState() and updateControlState() return the emergency stop reason instead of writing it to the m_emergency_stop_reason member, removing the member variable and the reset-before-use pattern in run().

    * refactor(autoware_pid_longitudinal_controller): add const to side-effect-free member functions Moves the m_prev_ctrl_cmd update out of createCtrlCmdMsg (which should only format the output message) and into calcCtrlCmd where the state transition belongs, allowing createCtrlCmdMsg and getTimeUnderControl to be marked const.

    * refactor(autoware_pid_longitudinal_controller): make createCtrlCmdMsg a free helper function Converts createCtrlCmdMsg into a free function in the anonymous namespace, matching createDebugMessage/createSlopeMessage, since it does not need access to any member state. Argument order places current_time first to align with the other message-creation helpers.

    * fix(autoware_pid_longitudinal_controller): avoid clock-type mismatch in delay-compensation time arithmetic PidLongitudinalController compared current_time (whose clock type is caller-supplied) against timestamps implicitly converted from builtin_interfaces::msg::Time, which defaults to RCL_ROS_TIME. When current_time used a different clock type, rclcpp::Time subtraction threw "can't subtract times with different time sources". Replace the ROS-message-backed m_ctrl_cmd_vec with a dedicated TimestampedAcceleration struct that stores rclcpp::Time directly, so stored stamps always share current_time's clock type without needing an explicit conversion. The remaining message-derived timestamp (trajectory header stamp) is now converted using current_time.get_clock_type() instead of the implicit RCL_ROS_TIME default.

    * test(autoware_pid_longitudinal_controller): drop clock-type overrides now that current_time flows through unchanged make_time() no longer needs an rcl_clock_type_t parameter, and no test needs to force RCL_ROS_TIME, since PidLongitudinalController no longer implicitly assumes RCL_ROS_TIME for message-derived timestamps. ---------Co-authored-by: Takahisa.Ishikawa <<takahisa.ishikawa@tier4.jp>>

  • test(pid_longitudinal_controller): add unit tests (#13064)

    • test(autoware_pid_longitudinal_controller): add unit tests for PidLongitudinalController

    * test(autoware_pid_longitudinal_controller): trim redundant PidLongitudinalController test cases Removes several overlapping/redundant test cases while keeping the temporal-trajectory coverage (TemporalTrajectoryProducesValidCommand and its make_temporal_trajectory helper), which exercises the use_temporal_trajectory branch in getControlData.

    * test(autoware_pid_longitudinal_controller): assert control_cmd

File truncated at 100 lines see the full file

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged autoware_pid_longitudinal_controller at Robotics Stack Exchange

No version for distro kilted showing github. Known supported distros are highlighted in the buttons above.
Package symbol

autoware_pid_longitudinal_controller package from autoware_universe repo

autoware_boundary_departure_checker autoware_component_interface_specs_universe autoware_cuda_dependency_meta autoware_deprecated_boundary_departure_checker autoware_fake_test_node autoware_glog_component autoware_goal_distance_calculator autoware_grid_map_utils autoware_obstacle_proximity_checker autoware_path_distance_calculator autoware_time_utils autoware_traffic_light_compliance_checker autoware_traffic_light_recognition_marker_publisher autoware_traffic_light_utils autoware_universe_utils tier4_api_utils autoware_autonomous_emergency_braking autoware_collision_detector autoware_control_command_gate autoware_control_performance_analysis autoware_control_validator autoware_external_cmd_selector autoware_joy_controller autoware_lane_departure_checker autoware_mpc_lateral_controller autoware_obstacle_collision_checker autoware_operation_mode_transition_manager autoware_pid_longitudinal_controller autoware_predicted_path_checker autoware_pure_pursuit autoware_shift_decider autoware_smart_mpc_trajectory_follower autoware_spheric_collision_detector autoware_stop_mode_operator autoware_trajectory_follower_base autoware_trajectory_follower_node autoware_vehicle_cmd_gate autoware_tensorrt_vad autoware_control_evaluator autoware_evaluation_adapter autoware_kinematic_evaluator autoware_localization_evaluator autoware_perception_online_evaluator autoware_planning_evaluator autoware_scenario_simulator_v2_adapter autoware_diagnostic_graph_test_examples autoware_geo_pose_projector autoware_ar_tag_based_localizer autoware_landmark_manager autoware_lidar_marker_localizer autoware_localization_error_monitor autoware_pose_covariance_modifier autoware_pose_estimator_arbiter autoware_pose_initialization_requester autoware_pose_instability_detector yabloc_common yabloc_image_processing yabloc_monitor yabloc_particle_filter yabloc_pose_initializer autoware_map_tf_generator autoware_bevfusion autoware_bytetrack autoware_camera_streampetr autoware_cluster_merger autoware_compare_map_segmentation autoware_crosswalk_traffic_light_estimator autoware_detected_object_feature_remover autoware_detected_object_validation autoware_detection_by_tracker autoware_elevation_map_loader autoware_euclidean_cluster autoware_ground_segmentation autoware_ground_segmentation_cuda autoware_image_object_locator autoware_image_projection_based_fusion autoware_lidar_apollo_instance_segmentation autoware_lidar_centerpoint autoware_lidar_frnet autoware_lidar_transfusion autoware_map_based_prediction autoware_multi_object_tracker autoware_object_merger autoware_object_sorter autoware_occupancy_grid_map_outlier_filter autoware_predicted_path_postprocessor autoware_probabilistic_occupancy_grid_map autoware_ptv3 autoware_radar_fusion_to_detected_object autoware_radar_object_tracker autoware_radar_tracks_msgs_converter autoware_raindrop_cluster_filter autoware_shape_estimation autoware_simpl_prediction autoware_simple_object_merger autoware_tensorrt_bevdet autoware_tensorrt_bevformer autoware_tensorrt_classifier autoware_tensorrt_common autoware_tensorrt_plugins autoware_tensorrt_yolox autoware_tracking_object_merger autoware_traffic_light_arbiter autoware_traffic_light_category_merger autoware_traffic_light_classifier autoware_traffic_light_fine_detector autoware_traffic_light_map_based_detector autoware_traffic_light_multi_camera_fusion autoware_traffic_light_occlusion_predictor autoware_traffic_light_pipeline autoware_traffic_light_selector autoware_traffic_light_visualization perception_utils autoware_costmap_generator autoware_diffusion_planner autoware_external_velocity_limit_selector autoware_freespace_planner autoware_freespace_planning_algorithms autoware_hazard_lights_selector autoware_in_lane_mrm_planner autoware_manual_lane_change_handler autoware_minimum_rule_based_planner autoware_mission_planner_universe autoware_path_optimizer autoware_path_smoother autoware_remaining_distance_time_calculator autoware_rtc_interface autoware_scenario_selector autoware_surround_obstacle_checker autoware_trajectory_adapter autoware_trajectory_concatenator autoware_trajectory_gate autoware_trajectory_modifier autoware_trajectory_ranker autoware_trajectory_selector autoware_trajectory_validator autoware_behavior_path_avoidance_by_lane_change_module autoware_behavior_path_bidirectional_traffic_module autoware_behavior_path_direction_change_module autoware_behavior_path_dynamic_obstacle_avoidance_module autoware_behavior_path_external_request_lane_change_module autoware_behavior_path_goal_planner_module autoware_behavior_path_lane_change_module autoware_behavior_path_planner autoware_behavior_path_planner_common autoware_behavior_path_sampling_planner_module autoware_behavior_path_side_shift_module autoware_behavior_path_start_planner_module autoware_behavior_path_static_obstacle_avoidance_module autoware_behavior_velocity_blind_spot_module autoware_behavior_velocity_crosswalk_module autoware_behavior_velocity_detection_area_module autoware_behavior_velocity_intersection_module autoware_behavior_velocity_no_drivable_lane_module autoware_behavior_velocity_no_stopping_area_module autoware_behavior_velocity_occlusion_spot_module autoware_behavior_velocity_roundabout_module autoware_behavior_velocity_rtc_interface autoware_behavior_velocity_speed_bump_module autoware_behavior_velocity_template_module autoware_behavior_velocity_traffic_light_module autoware_behavior_velocity_virtual_traffic_light_module autoware_behavior_velocity_walkway_module autoware_motion_velocity_boundary_departure_prevention_module autoware_motion_velocity_dynamic_obstacle_stop_module autoware_motion_velocity_obstacle_cruise_module autoware_motion_velocity_obstacle_slow_down_module autoware_motion_velocity_obstacle_velocity_limiter_module autoware_motion_velocity_out_of_lane_module autoware_motion_velocity_road_user_stop_module autoware_motion_velocity_run_out_module autoware_planning_validator autoware_planning_validator_intersection_collision_checker autoware_planning_validator_latency_checker autoware_planning_validator_rear_collision_checker autoware_planning_validator_test_utils autoware_planning_validator_trajectory_checker autoware_bezier_sampler autoware_frenet_planner autoware_path_sampler autoware_sampler_common autoware_calibration_status_classifier autoware_cuda_pointcloud_preprocessor autoware_cuda_utils autoware_image_transport_decompressor autoware_imu_corrector autoware_pcl_extensions autoware_pointcloud_preprocessor autoware_radar_objects_adapter autoware_radar_scan_to_pointcloud2 autoware_radar_static_pointcloud_filter autoware_radar_threshold_filter autoware_radar_tracks_noise_filter autoware_carla_interface autoware_dummy_diag_publisher autoware_dummy_infrastructure autoware_dummy_traffic_light_publisher autoware_fault_injection autoware_redundancy_command_selector autoware_vehicle_door_simulator tier4_dummy_object_rviz_plugin autoware_command_mode_decider autoware_command_mode_decider_plugins autoware_command_mode_switcher autoware_command_mode_switcher_plugins autoware_command_mode_types autoware_component_state_monitor autoware_adapi_visualizers autoware_default_adapi_universe autoware_diagnostic_graph_aggregator autoware_diagnostic_graph_merger autoware_diagnostic_graph_utils autoware_driving_mode_manager autoware_duplicated_node_checker autoware_generic_service_divider autoware_hazard_status_converter autoware_mrm_comfortable_stop_operator autoware_mrm_emergency_stop_operator autoware_mrm_handler autoware_mrm_in_lane_stop_operator autoware_mrm_reset_manager autoware_mrm_steering_hold_stop_operator autoware_pipeline_latency_monitor autoware_processing_time_checker autoware_redundancy_adapi_switcher autoware_redundancy_switcher_interface autoware_redundancy_switcher_interface_plugins autoware_system_monitor autoware_topic_relay_controller autoware_topic_state_monitor autoware_velodyne_monitor autoware_accel_brake_map_calibrator autoware_external_cmd_converter autoware_raw_vehicle_cmd_converter autoware_steer_offset_estimator autoware_bag_time_manager_rviz_plugin autoware_traffic_light_rviz_plugin tier4_active_generator_rviz_plugin tier4_adapi_rviz_plugin tier4_camera_view_rviz_plugin tier4_control_mode_rviz_plugin tier4_manual_lane_change_rviz_plugin tier4_perception_rviz_plugin tier4_planning_factor_rviz_plugin tier4_state_rviz_plugin tier4_traffic_light_rviz_plugin tier4_vehicle_rviz_plugin

ROS Distro
github

Package Summary

Version 0.53.0
License Apache 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/autowarefoundation/autoware_universe.git
VCS Type git
VCS Version main
Last Updated 2026-10-23
Dev Status UNKNOWN
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

PID-based longitudinal controller

Maintainers

  • Yuki Takagi
  • Kyoichi Sugahara
  • Arjun Ram
  • Takumi Odashima

Authors

  • Takamasa Horibe
  • Maxime CLEMENT
  • Takayuki Murooka

PID Longitudinal Controller

Purpose / Use cases

The longitudinal_controller computes the target acceleration to achieve the target velocity set at each point of the target trajectory using a feed-forward/back control.

It also contains a slope force correction that takes into account road slope information, and a delay compensation function. It is assumed that the target acceleration calculated here will be properly realized by the vehicle interface.

Note that the use of this module is not mandatory for Autoware if the vehicle supports the “target speed” interface.

Design / Inner-workings / Algorithms

States

This module has four state transitions as shown below in order to handle special processing in a specific situation.

  • DRIVE
    • Executes target velocity tracking by PID control.
    • It also applies the delay compensation and slope compensation.
  • STOPPING
    • Controls the motion just before stopping.
    • Special sequence is performed to achieve accurate and smooth stopping.
  • STOPPED
    • Performs operations in the stopped state (e.g. brake hold)
  • EMERGENCY.
    • Enters an emergency state when certain conditions are met (e.g., when the vehicle has crossed a certain distance of a stop line).
    • The recovery condition (whether or not to keep emergency state until the vehicle completely stops) or the deceleration in the emergency state are defined by parameters.

The state transition diagram is shown below.

LongitudinalControllerStateTransition

Logics

Control Block Diagram

LongitudinalControllerDiagram

FeedForward (FF)

The reference acceleration set in the trajectory and slope compensation terms are output as a feedforward. Under ideal conditions with no modeling error, this FF term alone should be sufficient for velocity tracking.

Tracking errors causing modeling or discretization errors are removed by the feedback control (now using PID).

Brake keeping

From the viewpoint of ride comfort, stopping with 0 acceleration is important because it reduces the impact of braking. However, if the target acceleration when stopping is 0, the vehicle may cross over the stop line or accelerate a little in front of the stop line due to vehicle model error or gradient estimation error.

For reliable stopping, the target acceleration calculated by the FeedForward system is limited to a negative acceleration when stopping.

BrakeKeepingDiagram

Slope compensation

Based on the slope information, a compensation term is added to the target acceleration.

There are two sources of the slope information, which can be switched by a parameter.

  • Pitch of the estimated ego-pose (default)
    • Calculates the current slope from the pitch angle of the estimated ego-pose
    • Pros: Easily available
    • Cons: Cannot extract accurate slope information due to the influence of vehicle vibration.
  • Z coordinate on the trajectory
    • Calculates the road slope from the difference of z-coordinates between the front and rear wheel positions in the target trajectory
    • Pros: More accurate than pitch information, if the z-coordinates of the route are properly maintained
    • Pros: Can be used in combination with delay compensation (not yet implemented)
    • Cons: z-coordinates of high-precision map is needed.
    • Cons: Does not support free space planning (for now)

We also offer the options to switch between these, depending on driving conditions.

Notation: This function works correctly only in a vehicle system that does not have acceleration feedback in the low-level control system.

This compensation adds gravity correction to the target acceleration, resulting in an output value that is no longer equal to the target acceleration that the autonomous driving system desires. Therefore, it conflicts with the role of the acceleration feedback in the low-level controller. For instance, if the vehicle is attempting to start with an acceleration of 1.0 m/s^2 and a gravity correction of -1.0 m/s^2 is applied, the output value will be 0. If this output value is mistakenly treated as the target acceleration, the vehicle will not start.

A suitable example of a vehicle system for the slope compensation function is one in which the output acceleration from the longitudinal_controller is converted into target accel/brake pedal input without any feedbacks. In this case, the output acceleration is just used as a feedforward term to calculate the target pedal, and hence the issue mentioned above does not arise.

Note: The angle of the slope is defined as positive for an uphill slope, while the pitch angle of the ego pose is defined as negative when facing upward. They have an opposite definition.

slope_definition

PID control

For deviations that cannot be handled by FeedForward control, such as model errors, PID control is used to construct a feedback system.

This PID control calculates the target acceleration from the deviation between the current ego-velocity and the target velocity.

This PID logic has a maximum value for the output of each term. This is to prevent the following:

  • Large integral terms may cause unintended behavior by users.
  • Unintended noise may cause the output of the derivative term to be very large.

Note: by default, the integral term in the control system is not accumulated when the vehicle is stationary. This precautionary measure aims to prevent unintended accumulation of the integral term in scenarios where Autoware assumes the vehicle is engaged, but an external system has immobilized the vehicle to initiate startup procedures.

However, certain situations may arise, such as when the vehicle encounters a depression in the road surface during startup or if the slope compensation is inaccurately estimated (lower than necessary), leading to a failure to initiate motion. To address these scenarios, it is possible to activate error integration even when the vehicle is at rest by setting the enable_integration_at_low_speed parameter to true.

When enable_integration_at_low_speed is set to true, the PID controller will initiate integration of the acceleration error after a specified duration defined by the time_threshold_before_pid_integration parameter has elapsed without the vehicle surpassing a minimum velocity set by the current_vel_threshold_pid_integration parameter.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package autoware_pid_longitudinal_controller

0.53.0 (2026-09-29)

  • Merge remote-tracking branch 'origin/main' into prepare-0.53.0-changelog

  • fix(pid_long): fix slope sign (#13247)

  • refactor(pid_logitudinal_controller): cleanup core logic (#13071)

    * refactor(autoware_pid_longitudinal_controller): remove unused m_current_time member m_current_time was assigned once per run() but never read anywhere in the class.

    * refactor(autoware_pid_longitudinal_controller): remove unused m_prev_nearest_time member m_prev_nearest_time was only ever written to (set or reset) and never read, so it had no effect on behavior.

    * refactor(autoware_pid_longitudinal_controller): pass is_steer_converged as parameter is_steer_converged was cached as a member for one control cycle only to be read inside updateControlState(), the sole function that used it. Pass it as a parameter to updateControlState() instead of holding it as class state.

    * refactor(autoware_pid_longitudinal_controller): remove unimplemented member function declarations getCurrentMotion() and calcFilteredAcc() were declared in the header but never defined or called anywhere in the class.

    * refactor(autoware_pid_longitudinal_controller): remove redundant m_received_invalid_trajectory member The value was only set and read within a single run() call, so it can be a local variable derived directly from is_valid_trajectory() instead of a persistent member.

    * refactor(autoware_pid_longitudinal_controller): extract debug/slope message creation into free helper functions Move the inline debug_message and slope_message construction in run() into createDebugMessage() and createSlopeMessage() free functions.

    * refactor(autoware_pid_longitudinal_controller): return emergency stop reason from updateControlState Have changeControlState() and updateControlState() return the emergency stop reason instead of writing it to the m_emergency_stop_reason member, removing the member variable and the reset-before-use pattern in run().

    * refactor(autoware_pid_longitudinal_controller): add const to side-effect-free member functions Moves the m_prev_ctrl_cmd update out of createCtrlCmdMsg (which should only format the output message) and into calcCtrlCmd where the state transition belongs, allowing createCtrlCmdMsg and getTimeUnderControl to be marked const.

    * refactor(autoware_pid_longitudinal_controller): make createCtrlCmdMsg a free helper function Converts createCtrlCmdMsg into a free function in the anonymous namespace, matching createDebugMessage/createSlopeMessage, since it does not need access to any member state. Argument order places current_time first to align with the other message-creation helpers.

    * fix(autoware_pid_longitudinal_controller): avoid clock-type mismatch in delay-compensation time arithmetic PidLongitudinalController compared current_time (whose clock type is caller-supplied) against timestamps implicitly converted from builtin_interfaces::msg::Time, which defaults to RCL_ROS_TIME. When current_time used a different clock type, rclcpp::Time subtraction threw "can't subtract times with different time sources". Replace the ROS-message-backed m_ctrl_cmd_vec with a dedicated TimestampedAcceleration struct that stores rclcpp::Time directly, so stored stamps always share current_time's clock type without needing an explicit conversion. The remaining message-derived timestamp (trajectory header stamp) is now converted using current_time.get_clock_type() instead of the implicit RCL_ROS_TIME default.

    * test(autoware_pid_longitudinal_controller): drop clock-type overrides now that current_time flows through unchanged make_time() no longer needs an rcl_clock_type_t parameter, and no test needs to force RCL_ROS_TIME, since PidLongitudinalController no longer implicitly assumes RCL_ROS_TIME for message-derived timestamps. ---------Co-authored-by: Takahisa.Ishikawa <<takahisa.ishikawa@tier4.jp>>

  • test(pid_longitudinal_controller): add unit tests (#13064)

    • test(autoware_pid_longitudinal_controller): add unit tests for PidLongitudinalController

    * test(autoware_pid_longitudinal_controller): trim redundant PidLongitudinalController test cases Removes several overlapping/redundant test cases while keeping the temporal-trajectory coverage (TemporalTrajectoryProducesValidCommand and its make_temporal_trajectory helper), which exercises the use_temporal_trajectory branch in getControlData.

    * test(autoware_pid_longitudinal_controller): assert control_cmd

File truncated at 100 lines see the full file

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged autoware_pid_longitudinal_controller at Robotics Stack Exchange

No version for distro lyrical showing github. Known supported distros are highlighted in the buttons above.
Package symbol

autoware_pid_longitudinal_controller package from autoware_universe repo

autoware_boundary_departure_checker autoware_component_interface_specs_universe autoware_cuda_dependency_meta autoware_deprecated_boundary_departure_checker autoware_fake_test_node autoware_glog_component autoware_goal_distance_calculator autoware_grid_map_utils autoware_obstacle_proximity_checker autoware_path_distance_calculator autoware_time_utils autoware_traffic_light_compliance_checker autoware_traffic_light_recognition_marker_publisher autoware_traffic_light_utils autoware_universe_utils tier4_api_utils autoware_autonomous_emergency_braking autoware_collision_detector autoware_control_command_gate autoware_control_performance_analysis autoware_control_validator autoware_external_cmd_selector autoware_joy_controller autoware_lane_departure_checker autoware_mpc_lateral_controller autoware_obstacle_collision_checker autoware_operation_mode_transition_manager autoware_pid_longitudinal_controller autoware_predicted_path_checker autoware_pure_pursuit autoware_shift_decider autoware_smart_mpc_trajectory_follower autoware_spheric_collision_detector autoware_stop_mode_operator autoware_trajectory_follower_base autoware_trajectory_follower_node autoware_vehicle_cmd_gate autoware_tensorrt_vad autoware_control_evaluator autoware_evaluation_adapter autoware_kinematic_evaluator autoware_localization_evaluator autoware_perception_online_evaluator autoware_planning_evaluator autoware_scenario_simulator_v2_adapter autoware_diagnostic_graph_test_examples autoware_geo_pose_projector autoware_ar_tag_based_localizer autoware_landmark_manager autoware_lidar_marker_localizer autoware_localization_error_monitor autoware_pose_covariance_modifier autoware_pose_estimator_arbiter autoware_pose_initialization_requester autoware_pose_instability_detector yabloc_common yabloc_image_processing yabloc_monitor yabloc_particle_filter yabloc_pose_initializer autoware_map_tf_generator autoware_bevfusion autoware_bytetrack autoware_camera_streampetr autoware_cluster_merger autoware_compare_map_segmentation autoware_crosswalk_traffic_light_estimator autoware_detected_object_feature_remover autoware_detected_object_validation autoware_detection_by_tracker autoware_elevation_map_loader autoware_euclidean_cluster autoware_ground_segmentation autoware_ground_segmentation_cuda autoware_image_object_locator autoware_image_projection_based_fusion autoware_lidar_apollo_instance_segmentation autoware_lidar_centerpoint autoware_lidar_frnet autoware_lidar_transfusion autoware_map_based_prediction autoware_multi_object_tracker autoware_object_merger autoware_object_sorter autoware_occupancy_grid_map_outlier_filter autoware_predicted_path_postprocessor autoware_probabilistic_occupancy_grid_map autoware_ptv3 autoware_radar_fusion_to_detected_object autoware_radar_object_tracker autoware_radar_tracks_msgs_converter autoware_raindrop_cluster_filter autoware_shape_estimation autoware_simpl_prediction autoware_simple_object_merger autoware_tensorrt_bevdet autoware_tensorrt_bevformer autoware_tensorrt_classifier autoware_tensorrt_common autoware_tensorrt_plugins autoware_tensorrt_yolox autoware_tracking_object_merger autoware_traffic_light_arbiter autoware_traffic_light_category_merger autoware_traffic_light_classifier autoware_traffic_light_fine_detector autoware_traffic_light_map_based_detector autoware_traffic_light_multi_camera_fusion autoware_traffic_light_occlusion_predictor autoware_traffic_light_pipeline autoware_traffic_light_selector autoware_traffic_light_visualization perception_utils autoware_costmap_generator autoware_diffusion_planner autoware_external_velocity_limit_selector autoware_freespace_planner autoware_freespace_planning_algorithms autoware_hazard_lights_selector autoware_in_lane_mrm_planner autoware_manual_lane_change_handler autoware_minimum_rule_based_planner autoware_mission_planner_universe autoware_path_optimizer autoware_path_smoother autoware_remaining_distance_time_calculator autoware_rtc_interface autoware_scenario_selector autoware_surround_obstacle_checker autoware_trajectory_adapter autoware_trajectory_concatenator autoware_trajectory_gate autoware_trajectory_modifier autoware_trajectory_ranker autoware_trajectory_selector autoware_trajectory_validator autoware_behavior_path_avoidance_by_lane_change_module autoware_behavior_path_bidirectional_traffic_module autoware_behavior_path_direction_change_module autoware_behavior_path_dynamic_obstacle_avoidance_module autoware_behavior_path_external_request_lane_change_module autoware_behavior_path_goal_planner_module autoware_behavior_path_lane_change_module autoware_behavior_path_planner autoware_behavior_path_planner_common autoware_behavior_path_sampling_planner_module autoware_behavior_path_side_shift_module autoware_behavior_path_start_planner_module autoware_behavior_path_static_obstacle_avoidance_module autoware_behavior_velocity_blind_spot_module autoware_behavior_velocity_crosswalk_module autoware_behavior_velocity_detection_area_module autoware_behavior_velocity_intersection_module autoware_behavior_velocity_no_drivable_lane_module autoware_behavior_velocity_no_stopping_area_module autoware_behavior_velocity_occlusion_spot_module autoware_behavior_velocity_roundabout_module autoware_behavior_velocity_rtc_interface autoware_behavior_velocity_speed_bump_module autoware_behavior_velocity_template_module autoware_behavior_velocity_traffic_light_module autoware_behavior_velocity_virtual_traffic_light_module autoware_behavior_velocity_walkway_module autoware_motion_velocity_boundary_departure_prevention_module autoware_motion_velocity_dynamic_obstacle_stop_module autoware_motion_velocity_obstacle_cruise_module autoware_motion_velocity_obstacle_slow_down_module autoware_motion_velocity_obstacle_velocity_limiter_module autoware_motion_velocity_out_of_lane_module autoware_motion_velocity_road_user_stop_module autoware_motion_velocity_run_out_module autoware_planning_validator autoware_planning_validator_intersection_collision_checker autoware_planning_validator_latency_checker autoware_planning_validator_rear_collision_checker autoware_planning_validator_test_utils autoware_planning_validator_trajectory_checker autoware_bezier_sampler autoware_frenet_planner autoware_path_sampler autoware_sampler_common autoware_calibration_status_classifier autoware_cuda_pointcloud_preprocessor autoware_cuda_utils autoware_image_transport_decompressor autoware_imu_corrector autoware_pcl_extensions autoware_pointcloud_preprocessor autoware_radar_objects_adapter autoware_radar_scan_to_pointcloud2 autoware_radar_static_pointcloud_filter autoware_radar_threshold_filter autoware_radar_tracks_noise_filter autoware_carla_interface autoware_dummy_diag_publisher autoware_dummy_infrastructure autoware_dummy_traffic_light_publisher autoware_fault_injection autoware_redundancy_command_selector autoware_vehicle_door_simulator tier4_dummy_object_rviz_plugin autoware_command_mode_decider autoware_command_mode_decider_plugins autoware_command_mode_switcher autoware_command_mode_switcher_plugins autoware_command_mode_types autoware_component_state_monitor autoware_adapi_visualizers autoware_default_adapi_universe autoware_diagnostic_graph_aggregator autoware_diagnostic_graph_merger autoware_diagnostic_graph_utils autoware_driving_mode_manager autoware_duplicated_node_checker autoware_generic_service_divider autoware_hazard_status_converter autoware_mrm_comfortable_stop_operator autoware_mrm_emergency_stop_operator autoware_mrm_handler autoware_mrm_in_lane_stop_operator autoware_mrm_reset_manager autoware_mrm_steering_hold_stop_operator autoware_pipeline_latency_monitor autoware_processing_time_checker autoware_redundancy_adapi_switcher autoware_redundancy_switcher_interface autoware_redundancy_switcher_interface_plugins autoware_system_monitor autoware_topic_relay_controller autoware_topic_state_monitor autoware_velodyne_monitor autoware_accel_brake_map_calibrator autoware_external_cmd_converter autoware_raw_vehicle_cmd_converter autoware_steer_offset_estimator autoware_bag_time_manager_rviz_plugin autoware_traffic_light_rviz_plugin tier4_active_generator_rviz_plugin tier4_adapi_rviz_plugin tier4_camera_view_rviz_plugin tier4_control_mode_rviz_plugin tier4_manual_lane_change_rviz_plugin tier4_perception_rviz_plugin tier4_planning_factor_rviz_plugin tier4_state_rviz_plugin tier4_traffic_light_rviz_plugin tier4_vehicle_rviz_plugin

ROS Distro
github

Package Summary

Version 0.53.0
License Apache 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/autowarefoundation/autoware_universe.git
VCS Type git
VCS Version main
Last Updated 2026-10-23
Dev Status UNKNOWN
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

PID-based longitudinal controller

Maintainers

  • Yuki Takagi
  • Kyoichi Sugahara
  • Arjun Ram
  • Takumi Odashima

Authors

  • Takamasa Horibe
  • Maxime CLEMENT
  • Takayuki Murooka

PID Longitudinal Controller

Purpose / Use cases

The longitudinal_controller computes the target acceleration to achieve the target velocity set at each point of the target trajectory using a feed-forward/back control.

It also contains a slope force correction that takes into account road slope information, and a delay compensation function. It is assumed that the target acceleration calculated here will be properly realized by the vehicle interface.

Note that the use of this module is not mandatory for Autoware if the vehicle supports the “target speed” interface.

Design / Inner-workings / Algorithms

States

This module has four state transitions as shown below in order to handle special processing in a specific situation.

  • DRIVE
    • Executes target velocity tracking by PID control.
    • It also applies the delay compensation and slope compensation.
  • STOPPING
    • Controls the motion just before stopping.
    • Special sequence is performed to achieve accurate and smooth stopping.
  • STOPPED
    • Performs operations in the stopped state (e.g. brake hold)
  • EMERGENCY.
    • Enters an emergency state when certain conditions are met (e.g., when the vehicle has crossed a certain distance of a stop line).
    • The recovery condition (whether or not to keep emergency state until the vehicle completely stops) or the deceleration in the emergency state are defined by parameters.

The state transition diagram is shown below.

LongitudinalControllerStateTransition

Logics

Control Block Diagram

LongitudinalControllerDiagram

FeedForward (FF)

The reference acceleration set in the trajectory and slope compensation terms are output as a feedforward. Under ideal conditions with no modeling error, this FF term alone should be sufficient for velocity tracking.

Tracking errors causing modeling or discretization errors are removed by the feedback control (now using PID).

Brake keeping

From the viewpoint of ride comfort, stopping with 0 acceleration is important because it reduces the impact of braking. However, if the target acceleration when stopping is 0, the vehicle may cross over the stop line or accelerate a little in front of the stop line due to vehicle model error or gradient estimation error.

For reliable stopping, the target acceleration calculated by the FeedForward system is limited to a negative acceleration when stopping.

BrakeKeepingDiagram

Slope compensation

Based on the slope information, a compensation term is added to the target acceleration.

There are two sources of the slope information, which can be switched by a parameter.

  • Pitch of the estimated ego-pose (default)
    • Calculates the current slope from the pitch angle of the estimated ego-pose
    • Pros: Easily available
    • Cons: Cannot extract accurate slope information due to the influence of vehicle vibration.
  • Z coordinate on the trajectory
    • Calculates the road slope from the difference of z-coordinates between the front and rear wheel positions in the target trajectory
    • Pros: More accurate than pitch information, if the z-coordinates of the route are properly maintained
    • Pros: Can be used in combination with delay compensation (not yet implemented)
    • Cons: z-coordinates of high-precision map is needed.
    • Cons: Does not support free space planning (for now)

We also offer the options to switch between these, depending on driving conditions.

Notation: This function works correctly only in a vehicle system that does not have acceleration feedback in the low-level control system.

This compensation adds gravity correction to the target acceleration, resulting in an output value that is no longer equal to the target acceleration that the autonomous driving system desires. Therefore, it conflicts with the role of the acceleration feedback in the low-level controller. For instance, if the vehicle is attempting to start with an acceleration of 1.0 m/s^2 and a gravity correction of -1.0 m/s^2 is applied, the output value will be 0. If this output value is mistakenly treated as the target acceleration, the vehicle will not start.

A suitable example of a vehicle system for the slope compensation function is one in which the output acceleration from the longitudinal_controller is converted into target accel/brake pedal input without any feedbacks. In this case, the output acceleration is just used as a feedforward term to calculate the target pedal, and hence the issue mentioned above does not arise.

Note: The angle of the slope is defined as positive for an uphill slope, while the pitch angle of the ego pose is defined as negative when facing upward. They have an opposite definition.

slope_definition

PID control

For deviations that cannot be handled by FeedForward control, such as model errors, PID control is used to construct a feedback system.

This PID control calculates the target acceleration from the deviation between the current ego-velocity and the target velocity.

This PID logic has a maximum value for the output of each term. This is to prevent the following:

  • Large integral terms may cause unintended behavior by users.
  • Unintended noise may cause the output of the derivative term to be very large.

Note: by default, the integral term in the control system is not accumulated when the vehicle is stationary. This precautionary measure aims to prevent unintended accumulation of the integral term in scenarios where Autoware assumes the vehicle is engaged, but an external system has immobilized the vehicle to initiate startup procedures.

However, certain situations may arise, such as when the vehicle encounters a depression in the road surface during startup or if the slope compensation is inaccurately estimated (lower than necessary), leading to a failure to initiate motion. To address these scenarios, it is possible to activate error integration even when the vehicle is at rest by setting the enable_integration_at_low_speed parameter to true.

When enable_integration_at_low_speed is set to true, the PID controller will initiate integration of the acceleration error after a specified duration defined by the time_threshold_before_pid_integration parameter has elapsed without the vehicle surpassing a minimum velocity set by the current_vel_threshold_pid_integration parameter.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package autoware_pid_longitudinal_controller

0.53.0 (2026-09-29)

  • Merge remote-tracking branch 'origin/main' into prepare-0.53.0-changelog

  • fix(pid_long): fix slope sign (#13247)

  • refactor(pid_logitudinal_controller): cleanup core logic (#13071)

    * refactor(autoware_pid_longitudinal_controller): remove unused m_current_time member m_current_time was assigned once per run() but never read anywhere in the class.

    * refactor(autoware_pid_longitudinal_controller): remove unused m_prev_nearest_time member m_prev_nearest_time was only ever written to (set or reset) and never read, so it had no effect on behavior.

    * refactor(autoware_pid_longitudinal_controller): pass is_steer_converged as parameter is_steer_converged was cached as a member for one control cycle only to be read inside updateControlState(), the sole function that used it. Pass it as a parameter to updateControlState() instead of holding it as class state.

    * refactor(autoware_pid_longitudinal_controller): remove unimplemented member function declarations getCurrentMotion() and calcFilteredAcc() were declared in the header but never defined or called anywhere in the class.

    * refactor(autoware_pid_longitudinal_controller): remove redundant m_received_invalid_trajectory member The value was only set and read within a single run() call, so it can be a local variable derived directly from is_valid_trajectory() instead of a persistent member.

    * refactor(autoware_pid_longitudinal_controller): extract debug/slope message creation into free helper functions Move the inline debug_message and slope_message construction in run() into createDebugMessage() and createSlopeMessage() free functions.

    * refactor(autoware_pid_longitudinal_controller): return emergency stop reason from updateControlState Have changeControlState() and updateControlState() return the emergency stop reason instead of writing it to the m_emergency_stop_reason member, removing the member variable and the reset-before-use pattern in run().

    * refactor(autoware_pid_longitudinal_controller): add const to side-effect-free member functions Moves the m_prev_ctrl_cmd update out of createCtrlCmdMsg (which should only format the output message) and into calcCtrlCmd where the state transition belongs, allowing createCtrlCmdMsg and getTimeUnderControl to be marked const.

    * refactor(autoware_pid_longitudinal_controller): make createCtrlCmdMsg a free helper function Converts createCtrlCmdMsg into a free function in the anonymous namespace, matching createDebugMessage/createSlopeMessage, since it does not need access to any member state. Argument order places current_time first to align with the other message-creation helpers.

    * fix(autoware_pid_longitudinal_controller): avoid clock-type mismatch in delay-compensation time arithmetic PidLongitudinalController compared current_time (whose clock type is caller-supplied) against timestamps implicitly converted from builtin_interfaces::msg::Time, which defaults to RCL_ROS_TIME. When current_time used a different clock type, rclcpp::Time subtraction threw "can't subtract times with different time sources". Replace the ROS-message-backed m_ctrl_cmd_vec with a dedicated TimestampedAcceleration struct that stores rclcpp::Time directly, so stored stamps always share current_time's clock type without needing an explicit conversion. The remaining message-derived timestamp (trajectory header stamp) is now converted using current_time.get_clock_type() instead of the implicit RCL_ROS_TIME default.

    * test(autoware_pid_longitudinal_controller): drop clock-type overrides now that current_time flows through unchanged make_time() no longer needs an rcl_clock_type_t parameter, and no test needs to force RCL_ROS_TIME, since PidLongitudinalController no longer implicitly assumes RCL_ROS_TIME for message-derived timestamps. ---------Co-authored-by: Takahisa.Ishikawa <<takahisa.ishikawa@tier4.jp>>

  • test(pid_longitudinal_controller): add unit tests (#13064)

    • test(autoware_pid_longitudinal_controller): add unit tests for PidLongitudinalController

    * test(autoware_pid_longitudinal_controller): trim redundant PidLongitudinalController test cases Removes several overlapping/redundant test cases while keeping the temporal-trajectory coverage (TemporalTrajectoryProducesValidCommand and its make_temporal_trajectory helper), which exercises the use_temporal_trajectory branch in getControlData.

    * test(autoware_pid_longitudinal_controller): assert control_cmd

File truncated at 100 lines see the full file

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged autoware_pid_longitudinal_controller at Robotics Stack Exchange

No version for distro rolling showing github. Known supported distros are highlighted in the buttons above.
Package symbol

autoware_pid_longitudinal_controller package from autoware_universe repo

autoware_boundary_departure_checker autoware_component_interface_specs_universe autoware_cuda_dependency_meta autoware_deprecated_boundary_departure_checker autoware_fake_test_node autoware_glog_component autoware_goal_distance_calculator autoware_grid_map_utils autoware_obstacle_proximity_checker autoware_path_distance_calculator autoware_time_utils autoware_traffic_light_compliance_checker autoware_traffic_light_recognition_marker_publisher autoware_traffic_light_utils autoware_universe_utils tier4_api_utils autoware_autonomous_emergency_braking autoware_collision_detector autoware_control_command_gate autoware_control_performance_analysis autoware_control_validator autoware_external_cmd_selector autoware_joy_controller autoware_lane_departure_checker autoware_mpc_lateral_controller autoware_obstacle_collision_checker autoware_operation_mode_transition_manager autoware_pid_longitudinal_controller autoware_predicted_path_checker autoware_pure_pursuit autoware_shift_decider autoware_smart_mpc_trajectory_follower autoware_spheric_collision_detector autoware_stop_mode_operator autoware_trajectory_follower_base autoware_trajectory_follower_node autoware_vehicle_cmd_gate autoware_tensorrt_vad autoware_control_evaluator autoware_evaluation_adapter autoware_kinematic_evaluator autoware_localization_evaluator autoware_perception_online_evaluator autoware_planning_evaluator autoware_scenario_simulator_v2_adapter autoware_diagnostic_graph_test_examples autoware_geo_pose_projector autoware_ar_tag_based_localizer autoware_landmark_manager autoware_lidar_marker_localizer autoware_localization_error_monitor autoware_pose_covariance_modifier autoware_pose_estimator_arbiter autoware_pose_initialization_requester autoware_pose_instability_detector yabloc_common yabloc_image_processing yabloc_monitor yabloc_particle_filter yabloc_pose_initializer autoware_map_tf_generator autoware_bevfusion autoware_bytetrack autoware_camera_streampetr autoware_cluster_merger autoware_compare_map_segmentation autoware_crosswalk_traffic_light_estimator autoware_detected_object_feature_remover autoware_detected_object_validation autoware_detection_by_tracker autoware_elevation_map_loader autoware_euclidean_cluster autoware_ground_segmentation autoware_ground_segmentation_cuda autoware_image_object_locator autoware_image_projection_based_fusion autoware_lidar_apollo_instance_segmentation autoware_lidar_centerpoint autoware_lidar_frnet autoware_lidar_transfusion autoware_map_based_prediction autoware_multi_object_tracker autoware_object_merger autoware_object_sorter autoware_occupancy_grid_map_outlier_filter autoware_predicted_path_postprocessor autoware_probabilistic_occupancy_grid_map autoware_ptv3 autoware_radar_fusion_to_detected_object autoware_radar_object_tracker autoware_radar_tracks_msgs_converter autoware_raindrop_cluster_filter autoware_shape_estimation autoware_simpl_prediction autoware_simple_object_merger autoware_tensorrt_bevdet autoware_tensorrt_bevformer autoware_tensorrt_classifier autoware_tensorrt_common autoware_tensorrt_plugins autoware_tensorrt_yolox autoware_tracking_object_merger autoware_traffic_light_arbiter autoware_traffic_light_category_merger autoware_traffic_light_classifier autoware_traffic_light_fine_detector autoware_traffic_light_map_based_detector autoware_traffic_light_multi_camera_fusion autoware_traffic_light_occlusion_predictor autoware_traffic_light_pipeline autoware_traffic_light_selector autoware_traffic_light_visualization perception_utils autoware_costmap_generator autoware_diffusion_planner autoware_external_velocity_limit_selector autoware_freespace_planner autoware_freespace_planning_algorithms autoware_hazard_lights_selector autoware_in_lane_mrm_planner autoware_manual_lane_change_handler autoware_minimum_rule_based_planner autoware_mission_planner_universe autoware_path_optimizer autoware_path_smoother autoware_remaining_distance_time_calculator autoware_rtc_interface autoware_scenario_selector autoware_surround_obstacle_checker autoware_trajectory_adapter autoware_trajectory_concatenator autoware_trajectory_gate autoware_trajectory_modifier autoware_trajectory_ranker autoware_trajectory_selector autoware_trajectory_validator autoware_behavior_path_avoidance_by_lane_change_module autoware_behavior_path_bidirectional_traffic_module autoware_behavior_path_direction_change_module autoware_behavior_path_dynamic_obstacle_avoidance_module autoware_behavior_path_external_request_lane_change_module autoware_behavior_path_goal_planner_module autoware_behavior_path_lane_change_module autoware_behavior_path_planner autoware_behavior_path_planner_common autoware_behavior_path_sampling_planner_module autoware_behavior_path_side_shift_module autoware_behavior_path_start_planner_module autoware_behavior_path_static_obstacle_avoidance_module autoware_behavior_velocity_blind_spot_module autoware_behavior_velocity_crosswalk_module autoware_behavior_velocity_detection_area_module autoware_behavior_velocity_intersection_module autoware_behavior_velocity_no_drivable_lane_module autoware_behavior_velocity_no_stopping_area_module autoware_behavior_velocity_occlusion_spot_module autoware_behavior_velocity_roundabout_module autoware_behavior_velocity_rtc_interface autoware_behavior_velocity_speed_bump_module autoware_behavior_velocity_template_module autoware_behavior_velocity_traffic_light_module autoware_behavior_velocity_virtual_traffic_light_module autoware_behavior_velocity_walkway_module autoware_motion_velocity_boundary_departure_prevention_module autoware_motion_velocity_dynamic_obstacle_stop_module autoware_motion_velocity_obstacle_cruise_module autoware_motion_velocity_obstacle_slow_down_module autoware_motion_velocity_obstacle_velocity_limiter_module autoware_motion_velocity_out_of_lane_module autoware_motion_velocity_road_user_stop_module autoware_motion_velocity_run_out_module autoware_planning_validator autoware_planning_validator_intersection_collision_checker autoware_planning_validator_latency_checker autoware_planning_validator_rear_collision_checker autoware_planning_validator_test_utils autoware_planning_validator_trajectory_checker autoware_bezier_sampler autoware_frenet_planner autoware_path_sampler autoware_sampler_common autoware_calibration_status_classifier autoware_cuda_pointcloud_preprocessor autoware_cuda_utils autoware_image_transport_decompressor autoware_imu_corrector autoware_pcl_extensions autoware_pointcloud_preprocessor autoware_radar_objects_adapter autoware_radar_scan_to_pointcloud2 autoware_radar_static_pointcloud_filter autoware_radar_threshold_filter autoware_radar_tracks_noise_filter autoware_carla_interface autoware_dummy_diag_publisher autoware_dummy_infrastructure autoware_dummy_traffic_light_publisher autoware_fault_injection autoware_redundancy_command_selector autoware_vehicle_door_simulator tier4_dummy_object_rviz_plugin autoware_command_mode_decider autoware_command_mode_decider_plugins autoware_command_mode_switcher autoware_command_mode_switcher_plugins autoware_command_mode_types autoware_component_state_monitor autoware_adapi_visualizers autoware_default_adapi_universe autoware_diagnostic_graph_aggregator autoware_diagnostic_graph_merger autoware_diagnostic_graph_utils autoware_driving_mode_manager autoware_duplicated_node_checker autoware_generic_service_divider autoware_hazard_status_converter autoware_mrm_comfortable_stop_operator autoware_mrm_emergency_stop_operator autoware_mrm_handler autoware_mrm_in_lane_stop_operator autoware_mrm_reset_manager autoware_mrm_steering_hold_stop_operator autoware_pipeline_latency_monitor autoware_processing_time_checker autoware_redundancy_adapi_switcher autoware_redundancy_switcher_interface autoware_redundancy_switcher_interface_plugins autoware_system_monitor autoware_topic_relay_controller autoware_topic_state_monitor autoware_velodyne_monitor autoware_accel_brake_map_calibrator autoware_external_cmd_converter autoware_raw_vehicle_cmd_converter autoware_steer_offset_estimator autoware_bag_time_manager_rviz_plugin autoware_traffic_light_rviz_plugin tier4_active_generator_rviz_plugin tier4_adapi_rviz_plugin tier4_camera_view_rviz_plugin tier4_control_mode_rviz_plugin tier4_manual_lane_change_rviz_plugin tier4_perception_rviz_plugin tier4_planning_factor_rviz_plugin tier4_state_rviz_plugin tier4_traffic_light_rviz_plugin tier4_vehicle_rviz_plugin

ROS Distro
github

Package Summary

Version 0.53.0
License Apache 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/autowarefoundation/autoware_universe.git
VCS Type git
VCS Version main
Last Updated 2026-10-23
Dev Status UNKNOWN
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

PID-based longitudinal controller

Maintainers

  • Yuki Takagi
  • Kyoichi Sugahara
  • Arjun Ram
  • Takumi Odashima

Authors

  • Takamasa Horibe
  • Maxime CLEMENT
  • Takayuki Murooka

PID Longitudinal Controller

Purpose / Use cases

The longitudinal_controller computes the target acceleration to achieve the target velocity set at each point of the target trajectory using a feed-forward/back control.

It also contains a slope force correction that takes into account road slope information, and a delay compensation function. It is assumed that the target acceleration calculated here will be properly realized by the vehicle interface.

Note that the use of this module is not mandatory for Autoware if the vehicle supports the “target speed” interface.

Design / Inner-workings / Algorithms

States

This module has four state transitions as shown below in order to handle special processing in a specific situation.

  • DRIVE
    • Executes target velocity tracking by PID control.
    • It also applies the delay compensation and slope compensation.
  • STOPPING
    • Controls the motion just before stopping.
    • Special sequence is performed to achieve accurate and smooth stopping.
  • STOPPED
    • Performs operations in the stopped state (e.g. brake hold)
  • EMERGENCY.
    • Enters an emergency state when certain conditions are met (e.g., when the vehicle has crossed a certain distance of a stop line).
    • The recovery condition (whether or not to keep emergency state until the vehicle completely stops) or the deceleration in the emergency state are defined by parameters.

The state transition diagram is shown below.

LongitudinalControllerStateTransition

Logics

Control Block Diagram

LongitudinalControllerDiagram

FeedForward (FF)

The reference acceleration set in the trajectory and slope compensation terms are output as a feedforward. Under ideal conditions with no modeling error, this FF term alone should be sufficient for velocity tracking.

Tracking errors causing modeling or discretization errors are removed by the feedback control (now using PID).

Brake keeping

From the viewpoint of ride comfort, stopping with 0 acceleration is important because it reduces the impact of braking. However, if the target acceleration when stopping is 0, the vehicle may cross over the stop line or accelerate a little in front of the stop line due to vehicle model error or gradient estimation error.

For reliable stopping, the target acceleration calculated by the FeedForward system is limited to a negative acceleration when stopping.

BrakeKeepingDiagram

Slope compensation

Based on the slope information, a compensation term is added to the target acceleration.

There are two sources of the slope information, which can be switched by a parameter.

  • Pitch of the estimated ego-pose (default)
    • Calculates the current slope from the pitch angle of the estimated ego-pose
    • Pros: Easily available
    • Cons: Cannot extract accurate slope information due to the influence of vehicle vibration.
  • Z coordinate on the trajectory
    • Calculates the road slope from the difference of z-coordinates between the front and rear wheel positions in the target trajectory
    • Pros: More accurate than pitch information, if the z-coordinates of the route are properly maintained
    • Pros: Can be used in combination with delay compensation (not yet implemented)
    • Cons: z-coordinates of high-precision map is needed.
    • Cons: Does not support free space planning (for now)

We also offer the options to switch between these, depending on driving conditions.

Notation: This function works correctly only in a vehicle system that does not have acceleration feedback in the low-level control system.

This compensation adds gravity correction to the target acceleration, resulting in an output value that is no longer equal to the target acceleration that the autonomous driving system desires. Therefore, it conflicts with the role of the acceleration feedback in the low-level controller. For instance, if the vehicle is attempting to start with an acceleration of 1.0 m/s^2 and a gravity correction of -1.0 m/s^2 is applied, the output value will be 0. If this output value is mistakenly treated as the target acceleration, the vehicle will not start.

A suitable example of a vehicle system for the slope compensation function is one in which the output acceleration from the longitudinal_controller is converted into target accel/brake pedal input without any feedbacks. In this case, the output acceleration is just used as a feedforward term to calculate the target pedal, and hence the issue mentioned above does not arise.

Note: The angle of the slope is defined as positive for an uphill slope, while the pitch angle of the ego pose is defined as negative when facing upward. They have an opposite definition.

slope_definition

PID control

For deviations that cannot be handled by FeedForward control, such as model errors, PID control is used to construct a feedback system.

This PID control calculates the target acceleration from the deviation between the current ego-velocity and the target velocity.

This PID logic has a maximum value for the output of each term. This is to prevent the following:

  • Large integral terms may cause unintended behavior by users.
  • Unintended noise may cause the output of the derivative term to be very large.

Note: by default, the integral term in the control system is not accumulated when the vehicle is stationary. This precautionary measure aims to prevent unintended accumulation of the integral term in scenarios where Autoware assumes the vehicle is engaged, but an external system has immobilized the vehicle to initiate startup procedures.

However, certain situations may arise, such as when the vehicle encounters a depression in the road surface during startup or if the slope compensation is inaccurately estimated (lower than necessary), leading to a failure to initiate motion. To address these scenarios, it is possible to activate error integration even when the vehicle is at rest by setting the enable_integration_at_low_speed parameter to true.

When enable_integration_at_low_speed is set to true, the PID controller will initiate integration of the acceleration error after a specified duration defined by the time_threshold_before_pid_integration parameter has elapsed without the vehicle surpassing a minimum velocity set by the current_vel_threshold_pid_integration parameter.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package autoware_pid_longitudinal_controller

0.53.0 (2026-09-29)

  • Merge remote-tracking branch 'origin/main' into prepare-0.53.0-changelog

  • fix(pid_long): fix slope sign (#13247)

  • refactor(pid_logitudinal_controller): cleanup core logic (#13071)

    * refactor(autoware_pid_longitudinal_controller): remove unused m_current_time member m_current_time was assigned once per run() but never read anywhere in the class.

    * refactor(autoware_pid_longitudinal_controller): remove unused m_prev_nearest_time member m_prev_nearest_time was only ever written to (set or reset) and never read, so it had no effect on behavior.

    * refactor(autoware_pid_longitudinal_controller): pass is_steer_converged as parameter is_steer_converged was cached as a member for one control cycle only to be read inside updateControlState(), the sole function that used it. Pass it as a parameter to updateControlState() instead of holding it as class state.

    * refactor(autoware_pid_longitudinal_controller): remove unimplemented member function declarations getCurrentMotion() and calcFilteredAcc() were declared in the header but never defined or called anywhere in the class.

    * refactor(autoware_pid_longitudinal_controller): remove redundant m_received_invalid_trajectory member The value was only set and read within a single run() call, so it can be a local variable derived directly from is_valid_trajectory() instead of a persistent member.

    * refactor(autoware_pid_longitudinal_controller): extract debug/slope message creation into free helper functions Move the inline debug_message and slope_message construction in run() into createDebugMessage() and createSlopeMessage() free functions.

    * refactor(autoware_pid_longitudinal_controller): return emergency stop reason from updateControlState Have changeControlState() and updateControlState() return the emergency stop reason instead of writing it to the m_emergency_stop_reason member, removing the member variable and the reset-before-use pattern in run().

    * refactor(autoware_pid_longitudinal_controller): add const to side-effect-free member functions Moves the m_prev_ctrl_cmd update out of createCtrlCmdMsg (which should only format the output message) and into calcCtrlCmd where the state transition belongs, allowing createCtrlCmdMsg and getTimeUnderControl to be marked const.

    * refactor(autoware_pid_longitudinal_controller): make createCtrlCmdMsg a free helper function Converts createCtrlCmdMsg into a free function in the anonymous namespace, matching createDebugMessage/createSlopeMessage, since it does not need access to any member state. Argument order places current_time first to align with the other message-creation helpers.

    * fix(autoware_pid_longitudinal_controller): avoid clock-type mismatch in delay-compensation time arithmetic PidLongitudinalController compared current_time (whose clock type is caller-supplied) against timestamps implicitly converted from builtin_interfaces::msg::Time, which defaults to RCL_ROS_TIME. When current_time used a different clock type, rclcpp::Time subtraction threw "can't subtract times with different time sources". Replace the ROS-message-backed m_ctrl_cmd_vec with a dedicated TimestampedAcceleration struct that stores rclcpp::Time directly, so stored stamps always share current_time's clock type without needing an explicit conversion. The remaining message-derived timestamp (trajectory header stamp) is now converted using current_time.get_clock_type() instead of the implicit RCL_ROS_TIME default.

    * test(autoware_pid_longitudinal_controller): drop clock-type overrides now that current_time flows through unchanged make_time() no longer needs an rcl_clock_type_t parameter, and no test needs to force RCL_ROS_TIME, since PidLongitudinalController no longer implicitly assumes RCL_ROS_TIME for message-derived timestamps. ---------Co-authored-by: Takahisa.Ishikawa <<takahisa.ishikawa@tier4.jp>>

  • test(pid_longitudinal_controller): add unit tests (#13064)

    • test(autoware_pid_longitudinal_controller): add unit tests for PidLongitudinalController

    * test(autoware_pid_longitudinal_controller): trim redundant PidLongitudinalController test cases Removes several overlapping/redundant test cases while keeping the temporal-trajectory coverage (TemporalTrajectoryProducesValidCommand and its make_temporal_trajectory helper), which exercises the use_temporal_trajectory branch in getControlData.

    * test(autoware_pid_longitudinal_controller): assert control_cmd

File truncated at 100 lines see the full file

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged autoware_pid_longitudinal_controller at Robotics Stack Exchange

Package symbol

autoware_pid_longitudinal_controller package from autoware_universe repo

autoware_boundary_departure_checker autoware_component_interface_specs_universe autoware_cuda_dependency_meta autoware_deprecated_boundary_departure_checker autoware_fake_test_node autoware_glog_component autoware_goal_distance_calculator autoware_grid_map_utils autoware_obstacle_proximity_checker autoware_path_distance_calculator autoware_time_utils autoware_traffic_light_compliance_checker autoware_traffic_light_recognition_marker_publisher autoware_traffic_light_utils autoware_universe_utils tier4_api_utils autoware_autonomous_emergency_braking autoware_collision_detector autoware_control_command_gate autoware_control_performance_analysis autoware_control_validator autoware_external_cmd_selector autoware_joy_controller autoware_lane_departure_checker autoware_mpc_lateral_controller autoware_obstacle_collision_checker autoware_operation_mode_transition_manager autoware_pid_longitudinal_controller autoware_predicted_path_checker autoware_pure_pursuit autoware_shift_decider autoware_smart_mpc_trajectory_follower autoware_spheric_collision_detector autoware_stop_mode_operator autoware_trajectory_follower_base autoware_trajectory_follower_node autoware_vehicle_cmd_gate autoware_tensorrt_vad autoware_control_evaluator autoware_evaluation_adapter autoware_kinematic_evaluator autoware_localization_evaluator autoware_perception_online_evaluator autoware_planning_evaluator autoware_scenario_simulator_v2_adapter autoware_diagnostic_graph_test_examples autoware_geo_pose_projector autoware_ar_tag_based_localizer autoware_landmark_manager autoware_lidar_marker_localizer autoware_localization_error_monitor autoware_pose_covariance_modifier autoware_pose_estimator_arbiter autoware_pose_initialization_requester autoware_pose_instability_detector yabloc_common yabloc_image_processing yabloc_monitor yabloc_particle_filter yabloc_pose_initializer autoware_map_tf_generator autoware_bevfusion autoware_bytetrack autoware_camera_streampetr autoware_cluster_merger autoware_compare_map_segmentation autoware_crosswalk_traffic_light_estimator autoware_detected_object_feature_remover autoware_detected_object_validation autoware_detection_by_tracker autoware_elevation_map_loader autoware_euclidean_cluster autoware_ground_segmentation autoware_ground_segmentation_cuda autoware_image_object_locator autoware_image_projection_based_fusion autoware_lidar_apollo_instance_segmentation autoware_lidar_centerpoint autoware_lidar_frnet autoware_lidar_transfusion autoware_map_based_prediction autoware_multi_object_tracker autoware_object_merger autoware_object_sorter autoware_occupancy_grid_map_outlier_filter autoware_predicted_path_postprocessor autoware_probabilistic_occupancy_grid_map autoware_ptv3 autoware_radar_fusion_to_detected_object autoware_radar_object_tracker autoware_radar_tracks_msgs_converter autoware_raindrop_cluster_filter autoware_shape_estimation autoware_simpl_prediction autoware_simple_object_merger autoware_tensorrt_bevdet autoware_tensorrt_bevformer autoware_tensorrt_classifier autoware_tensorrt_common autoware_tensorrt_plugins autoware_tensorrt_yolox autoware_tracking_object_merger autoware_traffic_light_arbiter autoware_traffic_light_category_merger autoware_traffic_light_classifier autoware_traffic_light_fine_detector autoware_traffic_light_map_based_detector autoware_traffic_light_multi_camera_fusion autoware_traffic_light_occlusion_predictor autoware_traffic_light_pipeline autoware_traffic_light_selector autoware_traffic_light_visualization perception_utils autoware_costmap_generator autoware_diffusion_planner autoware_external_velocity_limit_selector autoware_freespace_planner autoware_freespace_planning_algorithms autoware_hazard_lights_selector autoware_in_lane_mrm_planner autoware_manual_lane_change_handler autoware_minimum_rule_based_planner autoware_mission_planner_universe autoware_path_optimizer autoware_path_smoother autoware_remaining_distance_time_calculator autoware_rtc_interface autoware_scenario_selector autoware_surround_obstacle_checker autoware_trajectory_adapter autoware_trajectory_concatenator autoware_trajectory_gate autoware_trajectory_modifier autoware_trajectory_ranker autoware_trajectory_selector autoware_trajectory_validator autoware_behavior_path_avoidance_by_lane_change_module autoware_behavior_path_bidirectional_traffic_module autoware_behavior_path_direction_change_module autoware_behavior_path_dynamic_obstacle_avoidance_module autoware_behavior_path_external_request_lane_change_module autoware_behavior_path_goal_planner_module autoware_behavior_path_lane_change_module autoware_behavior_path_planner autoware_behavior_path_planner_common autoware_behavior_path_sampling_planner_module autoware_behavior_path_side_shift_module autoware_behavior_path_start_planner_module autoware_behavior_path_static_obstacle_avoidance_module autoware_behavior_velocity_blind_spot_module autoware_behavior_velocity_crosswalk_module autoware_behavior_velocity_detection_area_module autoware_behavior_velocity_intersection_module autoware_behavior_velocity_no_drivable_lane_module autoware_behavior_velocity_no_stopping_area_module autoware_behavior_velocity_occlusion_spot_module autoware_behavior_velocity_roundabout_module autoware_behavior_velocity_rtc_interface autoware_behavior_velocity_speed_bump_module autoware_behavior_velocity_template_module autoware_behavior_velocity_traffic_light_module autoware_behavior_velocity_virtual_traffic_light_module autoware_behavior_velocity_walkway_module autoware_motion_velocity_boundary_departure_prevention_module autoware_motion_velocity_dynamic_obstacle_stop_module autoware_motion_velocity_obstacle_cruise_module autoware_motion_velocity_obstacle_slow_down_module autoware_motion_velocity_obstacle_velocity_limiter_module autoware_motion_velocity_out_of_lane_module autoware_motion_velocity_road_user_stop_module autoware_motion_velocity_run_out_module autoware_planning_validator autoware_planning_validator_intersection_collision_checker autoware_planning_validator_latency_checker autoware_planning_validator_rear_collision_checker autoware_planning_validator_test_utils autoware_planning_validator_trajectory_checker autoware_bezier_sampler autoware_frenet_planner autoware_path_sampler autoware_sampler_common autoware_calibration_status_classifier autoware_cuda_pointcloud_preprocessor autoware_cuda_utils autoware_image_transport_decompressor autoware_imu_corrector autoware_pcl_extensions autoware_pointcloud_preprocessor autoware_radar_objects_adapter autoware_radar_scan_to_pointcloud2 autoware_radar_static_pointcloud_filter autoware_radar_threshold_filter autoware_radar_tracks_noise_filter autoware_carla_interface autoware_dummy_diag_publisher autoware_dummy_infrastructure autoware_dummy_traffic_light_publisher autoware_fault_injection autoware_redundancy_command_selector autoware_vehicle_door_simulator tier4_dummy_object_rviz_plugin autoware_command_mode_decider autoware_command_mode_decider_plugins autoware_command_mode_switcher autoware_command_mode_switcher_plugins autoware_command_mode_types autoware_component_state_monitor autoware_adapi_visualizers autoware_default_adapi_universe autoware_diagnostic_graph_aggregator autoware_diagnostic_graph_merger autoware_diagnostic_graph_utils autoware_driving_mode_manager autoware_duplicated_node_checker autoware_generic_service_divider autoware_hazard_status_converter autoware_mrm_comfortable_stop_operator autoware_mrm_emergency_stop_operator autoware_mrm_handler autoware_mrm_in_lane_stop_operator autoware_mrm_reset_manager autoware_mrm_steering_hold_stop_operator autoware_pipeline_latency_monitor autoware_processing_time_checker autoware_redundancy_adapi_switcher autoware_redundancy_switcher_interface autoware_redundancy_switcher_interface_plugins autoware_system_monitor autoware_topic_relay_controller autoware_topic_state_monitor autoware_velodyne_monitor autoware_accel_brake_map_calibrator autoware_external_cmd_converter autoware_raw_vehicle_cmd_converter autoware_steer_offset_estimator autoware_bag_time_manager_rviz_plugin autoware_traffic_light_rviz_plugin tier4_active_generator_rviz_plugin tier4_adapi_rviz_plugin tier4_camera_view_rviz_plugin tier4_control_mode_rviz_plugin tier4_manual_lane_change_rviz_plugin tier4_perception_rviz_plugin tier4_planning_factor_rviz_plugin tier4_state_rviz_plugin tier4_traffic_light_rviz_plugin tier4_vehicle_rviz_plugin

ROS Distro
github

Package Summary

Version 0.53.0
License Apache 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/autowarefoundation/autoware_universe.git
VCS Type git
VCS Version main
Last Updated 2026-10-23
Dev Status UNKNOWN
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

PID-based longitudinal controller

Maintainers

  • Yuki Takagi
  • Kyoichi Sugahara
  • Arjun Ram
  • Takumi Odashima

Authors

  • Takamasa Horibe
  • Maxime CLEMENT
  • Takayuki Murooka

PID Longitudinal Controller

Purpose / Use cases

The longitudinal_controller computes the target acceleration to achieve the target velocity set at each point of the target trajectory using a feed-forward/back control.

It also contains a slope force correction that takes into account road slope information, and a delay compensation function. It is assumed that the target acceleration calculated here will be properly realized by the vehicle interface.

Note that the use of this module is not mandatory for Autoware if the vehicle supports the “target speed” interface.

Design / Inner-workings / Algorithms

States

This module has four state transitions as shown below in order to handle special processing in a specific situation.

  • DRIVE
    • Executes target velocity tracking by PID control.
    • It also applies the delay compensation and slope compensation.
  • STOPPING
    • Controls the motion just before stopping.
    • Special sequence is performed to achieve accurate and smooth stopping.
  • STOPPED
    • Performs operations in the stopped state (e.g. brake hold)
  • EMERGENCY.
    • Enters an emergency state when certain conditions are met (e.g., when the vehicle has crossed a certain distance of a stop line).
    • The recovery condition (whether or not to keep emergency state until the vehicle completely stops) or the deceleration in the emergency state are defined by parameters.

The state transition diagram is shown below.

LongitudinalControllerStateTransition

Logics

Control Block Diagram

LongitudinalControllerDiagram

FeedForward (FF)

The reference acceleration set in the trajectory and slope compensation terms are output as a feedforward. Under ideal conditions with no modeling error, this FF term alone should be sufficient for velocity tracking.

Tracking errors causing modeling or discretization errors are removed by the feedback control (now using PID).

Brake keeping

From the viewpoint of ride comfort, stopping with 0 acceleration is important because it reduces the impact of braking. However, if the target acceleration when stopping is 0, the vehicle may cross over the stop line or accelerate a little in front of the stop line due to vehicle model error or gradient estimation error.

For reliable stopping, the target acceleration calculated by the FeedForward system is limited to a negative acceleration when stopping.

BrakeKeepingDiagram

Slope compensation

Based on the slope information, a compensation term is added to the target acceleration.

There are two sources of the slope information, which can be switched by a parameter.

  • Pitch of the estimated ego-pose (default)
    • Calculates the current slope from the pitch angle of the estimated ego-pose
    • Pros: Easily available
    • Cons: Cannot extract accurate slope information due to the influence of vehicle vibration.
  • Z coordinate on the trajectory
    • Calculates the road slope from the difference of z-coordinates between the front and rear wheel positions in the target trajectory
    • Pros: More accurate than pitch information, if the z-coordinates of the route are properly maintained
    • Pros: Can be used in combination with delay compensation (not yet implemented)
    • Cons: z-coordinates of high-precision map is needed.
    • Cons: Does not support free space planning (for now)

We also offer the options to switch between these, depending on driving conditions.

Notation: This function works correctly only in a vehicle system that does not have acceleration feedback in the low-level control system.

This compensation adds gravity correction to the target acceleration, resulting in an output value that is no longer equal to the target acceleration that the autonomous driving system desires. Therefore, it conflicts with the role of the acceleration feedback in the low-level controller. For instance, if the vehicle is attempting to start with an acceleration of 1.0 m/s^2 and a gravity correction of -1.0 m/s^2 is applied, the output value will be 0. If this output value is mistakenly treated as the target acceleration, the vehicle will not start.

A suitable example of a vehicle system for the slope compensation function is one in which the output acceleration from the longitudinal_controller is converted into target accel/brake pedal input without any feedbacks. In this case, the output acceleration is just used as a feedforward term to calculate the target pedal, and hence the issue mentioned above does not arise.

Note: The angle of the slope is defined as positive for an uphill slope, while the pitch angle of the ego pose is defined as negative when facing upward. They have an opposite definition.

slope_definition

PID control

For deviations that cannot be handled by FeedForward control, such as model errors, PID control is used to construct a feedback system.

This PID control calculates the target acceleration from the deviation between the current ego-velocity and the target velocity.

This PID logic has a maximum value for the output of each term. This is to prevent the following:

  • Large integral terms may cause unintended behavior by users.
  • Unintended noise may cause the output of the derivative term to be very large.

Note: by default, the integral term in the control system is not accumulated when the vehicle is stationary. This precautionary measure aims to prevent unintended accumulation of the integral term in scenarios where Autoware assumes the vehicle is engaged, but an external system has immobilized the vehicle to initiate startup procedures.

However, certain situations may arise, such as when the vehicle encounters a depression in the road surface during startup or if the slope compensation is inaccurately estimated (lower than necessary), leading to a failure to initiate motion. To address these scenarios, it is possible to activate error integration even when the vehicle is at rest by setting the enable_integration_at_low_speed parameter to true.

When enable_integration_at_low_speed is set to true, the PID controller will initiate integration of the acceleration error after a specified duration defined by the time_threshold_before_pid_integration parameter has elapsed without the vehicle surpassing a minimum velocity set by the current_vel_threshold_pid_integration parameter.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package autoware_pid_longitudinal_controller

0.53.0 (2026-09-29)

  • Merge remote-tracking branch 'origin/main' into prepare-0.53.0-changelog

  • fix(pid_long): fix slope sign (#13247)

  • refactor(pid_logitudinal_controller): cleanup core logic (#13071)

    * refactor(autoware_pid_longitudinal_controller): remove unused m_current_time member m_current_time was assigned once per run() but never read anywhere in the class.

    * refactor(autoware_pid_longitudinal_controller): remove unused m_prev_nearest_time member m_prev_nearest_time was only ever written to (set or reset) and never read, so it had no effect on behavior.

    * refactor(autoware_pid_longitudinal_controller): pass is_steer_converged as parameter is_steer_converged was cached as a member for one control cycle only to be read inside updateControlState(), the sole function that used it. Pass it as a parameter to updateControlState() instead of holding it as class state.

    * refactor(autoware_pid_longitudinal_controller): remove unimplemented member function declarations getCurrentMotion() and calcFilteredAcc() were declared in the header but never defined or called anywhere in the class.

    * refactor(autoware_pid_longitudinal_controller): remove redundant m_received_invalid_trajectory member The value was only set and read within a single run() call, so it can be a local variable derived directly from is_valid_trajectory() instead of a persistent member.

    * refactor(autoware_pid_longitudinal_controller): extract debug/slope message creation into free helper functions Move the inline debug_message and slope_message construction in run() into createDebugMessage() and createSlopeMessage() free functions.

    * refactor(autoware_pid_longitudinal_controller): return emergency stop reason from updateControlState Have changeControlState() and updateControlState() return the emergency stop reason instead of writing it to the m_emergency_stop_reason member, removing the member variable and the reset-before-use pattern in run().

    * refactor(autoware_pid_longitudinal_controller): add const to side-effect-free member functions Moves the m_prev_ctrl_cmd update out of createCtrlCmdMsg (which should only format the output message) and into calcCtrlCmd where the state transition belongs, allowing createCtrlCmdMsg and getTimeUnderControl to be marked const.

    * refactor(autoware_pid_longitudinal_controller): make createCtrlCmdMsg a free helper function Converts createCtrlCmdMsg into a free function in the anonymous namespace, matching createDebugMessage/createSlopeMessage, since it does not need access to any member state. Argument order places current_time first to align with the other message-creation helpers.

    * fix(autoware_pid_longitudinal_controller): avoid clock-type mismatch in delay-compensation time arithmetic PidLongitudinalController compared current_time (whose clock type is caller-supplied) against timestamps implicitly converted from builtin_interfaces::msg::Time, which defaults to RCL_ROS_TIME. When current_time used a different clock type, rclcpp::Time subtraction threw "can't subtract times with different time sources". Replace the ROS-message-backed m_ctrl_cmd_vec with a dedicated TimestampedAcceleration struct that stores rclcpp::Time directly, so stored stamps always share current_time's clock type without needing an explicit conversion. The remaining message-derived timestamp (trajectory header stamp) is now converted using current_time.get_clock_type() instead of the implicit RCL_ROS_TIME default.

    * test(autoware_pid_longitudinal_controller): drop clock-type overrides now that current_time flows through unchanged make_time() no longer needs an rcl_clock_type_t parameter, and no test needs to force RCL_ROS_TIME, since PidLongitudinalController no longer implicitly assumes RCL_ROS_TIME for message-derived timestamps. ---------Co-authored-by: Takahisa.Ishikawa <<takahisa.ishikawa@tier4.jp>>

  • test(pid_longitudinal_controller): add unit tests (#13064)

    • test(autoware_pid_longitudinal_controller): add unit tests for PidLongitudinalController

    * test(autoware_pid_longitudinal_controller): trim redundant PidLongitudinalController test cases Removes several overlapping/redundant test cases while keeping the temporal-trajectory coverage (TemporalTrajectoryProducesValidCommand and its make_temporal_trajectory helper), which exercises the use_temporal_trajectory branch in getControlData.

    * test(autoware_pid_longitudinal_controller): assert control_cmd

File truncated at 100 lines see the full file

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged autoware_pid_longitudinal_controller at Robotics Stack Exchange

No version for distro galactic showing github. Known supported distros are highlighted in the buttons above.
Package symbol

autoware_pid_longitudinal_controller package from autoware_universe repo

autoware_boundary_departure_checker autoware_component_interface_specs_universe autoware_cuda_dependency_meta autoware_deprecated_boundary_departure_checker autoware_fake_test_node autoware_glog_component autoware_goal_distance_calculator autoware_grid_map_utils autoware_obstacle_proximity_checker autoware_path_distance_calculator autoware_time_utils autoware_traffic_light_compliance_checker autoware_traffic_light_recognition_marker_publisher autoware_traffic_light_utils autoware_universe_utils tier4_api_utils autoware_autonomous_emergency_braking autoware_collision_detector autoware_control_command_gate autoware_control_performance_analysis autoware_control_validator autoware_external_cmd_selector autoware_joy_controller autoware_lane_departure_checker autoware_mpc_lateral_controller autoware_obstacle_collision_checker autoware_operation_mode_transition_manager autoware_pid_longitudinal_controller autoware_predicted_path_checker autoware_pure_pursuit autoware_shift_decider autoware_smart_mpc_trajectory_follower autoware_spheric_collision_detector autoware_stop_mode_operator autoware_trajectory_follower_base autoware_trajectory_follower_node autoware_vehicle_cmd_gate autoware_tensorrt_vad autoware_control_evaluator autoware_evaluation_adapter autoware_kinematic_evaluator autoware_localization_evaluator autoware_perception_online_evaluator autoware_planning_evaluator autoware_scenario_simulator_v2_adapter autoware_diagnostic_graph_test_examples autoware_geo_pose_projector autoware_ar_tag_based_localizer autoware_landmark_manager autoware_lidar_marker_localizer autoware_localization_error_monitor autoware_pose_covariance_modifier autoware_pose_estimator_arbiter autoware_pose_initialization_requester autoware_pose_instability_detector yabloc_common yabloc_image_processing yabloc_monitor yabloc_particle_filter yabloc_pose_initializer autoware_map_tf_generator autoware_bevfusion autoware_bytetrack autoware_camera_streampetr autoware_cluster_merger autoware_compare_map_segmentation autoware_crosswalk_traffic_light_estimator autoware_detected_object_feature_remover autoware_detected_object_validation autoware_detection_by_tracker autoware_elevation_map_loader autoware_euclidean_cluster autoware_ground_segmentation autoware_ground_segmentation_cuda autoware_image_object_locator autoware_image_projection_based_fusion autoware_lidar_apollo_instance_segmentation autoware_lidar_centerpoint autoware_lidar_frnet autoware_lidar_transfusion autoware_map_based_prediction autoware_multi_object_tracker autoware_object_merger autoware_object_sorter autoware_occupancy_grid_map_outlier_filter autoware_predicted_path_postprocessor autoware_probabilistic_occupancy_grid_map autoware_ptv3 autoware_radar_fusion_to_detected_object autoware_radar_object_tracker autoware_radar_tracks_msgs_converter autoware_raindrop_cluster_filter autoware_shape_estimation autoware_simpl_prediction autoware_simple_object_merger autoware_tensorrt_bevdet autoware_tensorrt_bevformer autoware_tensorrt_classifier autoware_tensorrt_common autoware_tensorrt_plugins autoware_tensorrt_yolox autoware_tracking_object_merger autoware_traffic_light_arbiter autoware_traffic_light_category_merger autoware_traffic_light_classifier autoware_traffic_light_fine_detector autoware_traffic_light_map_based_detector autoware_traffic_light_multi_camera_fusion autoware_traffic_light_occlusion_predictor autoware_traffic_light_pipeline autoware_traffic_light_selector autoware_traffic_light_visualization perception_utils autoware_costmap_generator autoware_diffusion_planner autoware_external_velocity_limit_selector autoware_freespace_planner autoware_freespace_planning_algorithms autoware_hazard_lights_selector autoware_in_lane_mrm_planner autoware_manual_lane_change_handler autoware_minimum_rule_based_planner autoware_mission_planner_universe autoware_path_optimizer autoware_path_smoother autoware_remaining_distance_time_calculator autoware_rtc_interface autoware_scenario_selector autoware_surround_obstacle_checker autoware_trajectory_adapter autoware_trajectory_concatenator autoware_trajectory_gate autoware_trajectory_modifier autoware_trajectory_ranker autoware_trajectory_selector autoware_trajectory_validator autoware_behavior_path_avoidance_by_lane_change_module autoware_behavior_path_bidirectional_traffic_module autoware_behavior_path_direction_change_module autoware_behavior_path_dynamic_obstacle_avoidance_module autoware_behavior_path_external_request_lane_change_module autoware_behavior_path_goal_planner_module autoware_behavior_path_lane_change_module autoware_behavior_path_planner autoware_behavior_path_planner_common autoware_behavior_path_sampling_planner_module autoware_behavior_path_side_shift_module autoware_behavior_path_start_planner_module autoware_behavior_path_static_obstacle_avoidance_module autoware_behavior_velocity_blind_spot_module autoware_behavior_velocity_crosswalk_module autoware_behavior_velocity_detection_area_module autoware_behavior_velocity_intersection_module autoware_behavior_velocity_no_drivable_lane_module autoware_behavior_velocity_no_stopping_area_module autoware_behavior_velocity_occlusion_spot_module autoware_behavior_velocity_roundabout_module autoware_behavior_velocity_rtc_interface autoware_behavior_velocity_speed_bump_module autoware_behavior_velocity_template_module autoware_behavior_velocity_traffic_light_module autoware_behavior_velocity_virtual_traffic_light_module autoware_behavior_velocity_walkway_module autoware_motion_velocity_boundary_departure_prevention_module autoware_motion_velocity_dynamic_obstacle_stop_module autoware_motion_velocity_obstacle_cruise_module autoware_motion_velocity_obstacle_slow_down_module autoware_motion_velocity_obstacle_velocity_limiter_module autoware_motion_velocity_out_of_lane_module autoware_motion_velocity_road_user_stop_module autoware_motion_velocity_run_out_module autoware_planning_validator autoware_planning_validator_intersection_collision_checker autoware_planning_validator_latency_checker autoware_planning_validator_rear_collision_checker autoware_planning_validator_test_utils autoware_planning_validator_trajectory_checker autoware_bezier_sampler autoware_frenet_planner autoware_path_sampler autoware_sampler_common autoware_calibration_status_classifier autoware_cuda_pointcloud_preprocessor autoware_cuda_utils autoware_image_transport_decompressor autoware_imu_corrector autoware_pcl_extensions autoware_pointcloud_preprocessor autoware_radar_objects_adapter autoware_radar_scan_to_pointcloud2 autoware_radar_static_pointcloud_filter autoware_radar_threshold_filter autoware_radar_tracks_noise_filter autoware_carla_interface autoware_dummy_diag_publisher autoware_dummy_infrastructure autoware_dummy_traffic_light_publisher autoware_fault_injection autoware_redundancy_command_selector autoware_vehicle_door_simulator tier4_dummy_object_rviz_plugin autoware_command_mode_decider autoware_command_mode_decider_plugins autoware_command_mode_switcher autoware_command_mode_switcher_plugins autoware_command_mode_types autoware_component_state_monitor autoware_adapi_visualizers autoware_default_adapi_universe autoware_diagnostic_graph_aggregator autoware_diagnostic_graph_merger autoware_diagnostic_graph_utils autoware_driving_mode_manager autoware_duplicated_node_checker autoware_generic_service_divider autoware_hazard_status_converter autoware_mrm_comfortable_stop_operator autoware_mrm_emergency_stop_operator autoware_mrm_handler autoware_mrm_in_lane_stop_operator autoware_mrm_reset_manager autoware_mrm_steering_hold_stop_operator autoware_pipeline_latency_monitor autoware_processing_time_checker autoware_redundancy_adapi_switcher autoware_redundancy_switcher_interface autoware_redundancy_switcher_interface_plugins autoware_system_monitor autoware_topic_relay_controller autoware_topic_state_monitor autoware_velodyne_monitor autoware_accel_brake_map_calibrator autoware_external_cmd_converter autoware_raw_vehicle_cmd_converter autoware_steer_offset_estimator autoware_bag_time_manager_rviz_plugin autoware_traffic_light_rviz_plugin tier4_active_generator_rviz_plugin tier4_adapi_rviz_plugin tier4_camera_view_rviz_plugin tier4_control_mode_rviz_plugin tier4_manual_lane_change_rviz_plugin tier4_perception_rviz_plugin tier4_planning_factor_rviz_plugin tier4_state_rviz_plugin tier4_traffic_light_rviz_plugin tier4_vehicle_rviz_plugin

ROS Distro
github

Package Summary

Version 0.53.0
License Apache 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/autowarefoundation/autoware_universe.git
VCS Type git
VCS Version main
Last Updated 2026-10-23
Dev Status UNKNOWN
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

PID-based longitudinal controller

Maintainers

  • Yuki Takagi
  • Kyoichi Sugahara
  • Arjun Ram
  • Takumi Odashima

Authors

  • Takamasa Horibe
  • Maxime CLEMENT
  • Takayuki Murooka

PID Longitudinal Controller

Purpose / Use cases

The longitudinal_controller computes the target acceleration to achieve the target velocity set at each point of the target trajectory using a feed-forward/back control.

It also contains a slope force correction that takes into account road slope information, and a delay compensation function. It is assumed that the target acceleration calculated here will be properly realized by the vehicle interface.

Note that the use of this module is not mandatory for Autoware if the vehicle supports the “target speed” interface.

Design / Inner-workings / Algorithms

States

This module has four state transitions as shown below in order to handle special processing in a specific situation.

  • DRIVE
    • Executes target velocity tracking by PID control.
    • It also applies the delay compensation and slope compensation.
  • STOPPING
    • Controls the motion just before stopping.
    • Special sequence is performed to achieve accurate and smooth stopping.
  • STOPPED
    • Performs operations in the stopped state (e.g. brake hold)
  • EMERGENCY.
    • Enters an emergency state when certain conditions are met (e.g., when the vehicle has crossed a certain distance of a stop line).
    • The recovery condition (whether or not to keep emergency state until the vehicle completely stops) or the deceleration in the emergency state are defined by parameters.

The state transition diagram is shown below.

LongitudinalControllerStateTransition

Logics

Control Block Diagram

LongitudinalControllerDiagram

FeedForward (FF)

The reference acceleration set in the trajectory and slope compensation terms are output as a feedforward. Under ideal conditions with no modeling error, this FF term alone should be sufficient for velocity tracking.

Tracking errors causing modeling or discretization errors are removed by the feedback control (now using PID).

Brake keeping

From the viewpoint of ride comfort, stopping with 0 acceleration is important because it reduces the impact of braking. However, if the target acceleration when stopping is 0, the vehicle may cross over the stop line or accelerate a little in front of the stop line due to vehicle model error or gradient estimation error.

For reliable stopping, the target acceleration calculated by the FeedForward system is limited to a negative acceleration when stopping.

BrakeKeepingDiagram

Slope compensation

Based on the slope information, a compensation term is added to the target acceleration.

There are two sources of the slope information, which can be switched by a parameter.

  • Pitch of the estimated ego-pose (default)
    • Calculates the current slope from the pitch angle of the estimated ego-pose
    • Pros: Easily available
    • Cons: Cannot extract accurate slope information due to the influence of vehicle vibration.
  • Z coordinate on the trajectory
    • Calculates the road slope from the difference of z-coordinates between the front and rear wheel positions in the target trajectory
    • Pros: More accurate than pitch information, if the z-coordinates of the route are properly maintained
    • Pros: Can be used in combination with delay compensation (not yet implemented)
    • Cons: z-coordinates of high-precision map is needed.
    • Cons: Does not support free space planning (for now)

We also offer the options to switch between these, depending on driving conditions.

Notation: This function works correctly only in a vehicle system that does not have acceleration feedback in the low-level control system.

This compensation adds gravity correction to the target acceleration, resulting in an output value that is no longer equal to the target acceleration that the autonomous driving system desires. Therefore, it conflicts with the role of the acceleration feedback in the low-level controller. For instance, if the vehicle is attempting to start with an acceleration of 1.0 m/s^2 and a gravity correction of -1.0 m/s^2 is applied, the output value will be 0. If this output value is mistakenly treated as the target acceleration, the vehicle will not start.

A suitable example of a vehicle system for the slope compensation function is one in which the output acceleration from the longitudinal_controller is converted into target accel/brake pedal input without any feedbacks. In this case, the output acceleration is just used as a feedforward term to calculate the target pedal, and hence the issue mentioned above does not arise.

Note: The angle of the slope is defined as positive for an uphill slope, while the pitch angle of the ego pose is defined as negative when facing upward. They have an opposite definition.

slope_definition

PID control

For deviations that cannot be handled by FeedForward control, such as model errors, PID control is used to construct a feedback system.

This PID control calculates the target acceleration from the deviation between the current ego-velocity and the target velocity.

This PID logic has a maximum value for the output of each term. This is to prevent the following:

  • Large integral terms may cause unintended behavior by users.
  • Unintended noise may cause the output of the derivative term to be very large.

Note: by default, the integral term in the control system is not accumulated when the vehicle is stationary. This precautionary measure aims to prevent unintended accumulation of the integral term in scenarios where Autoware assumes the vehicle is engaged, but an external system has immobilized the vehicle to initiate startup procedures.

However, certain situations may arise, such as when the vehicle encounters a depression in the road surface during startup or if the slope compensation is inaccurately estimated (lower than necessary), leading to a failure to initiate motion. To address these scenarios, it is possible to activate error integration even when the vehicle is at rest by setting the enable_integration_at_low_speed parameter to true.

When enable_integration_at_low_speed is set to true, the PID controller will initiate integration of the acceleration error after a specified duration defined by the time_threshold_before_pid_integration parameter has elapsed without the vehicle surpassing a minimum velocity set by the current_vel_threshold_pid_integration parameter.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package autoware_pid_longitudinal_controller

0.53.0 (2026-09-29)

  • Merge remote-tracking branch 'origin/main' into prepare-0.53.0-changelog

  • fix(pid_long): fix slope sign (#13247)

  • refactor(pid_logitudinal_controller): cleanup core logic (#13071)

    * refactor(autoware_pid_longitudinal_controller): remove unused m_current_time member m_current_time was assigned once per run() but never read anywhere in the class.

    * refactor(autoware_pid_longitudinal_controller): remove unused m_prev_nearest_time member m_prev_nearest_time was only ever written to (set or reset) and never read, so it had no effect on behavior.

    * refactor(autoware_pid_longitudinal_controller): pass is_steer_converged as parameter is_steer_converged was cached as a member for one control cycle only to be read inside updateControlState(), the sole function that used it. Pass it as a parameter to updateControlState() instead of holding it as class state.

    * refactor(autoware_pid_longitudinal_controller): remove unimplemented member function declarations getCurrentMotion() and calcFilteredAcc() were declared in the header but never defined or called anywhere in the class.

    * refactor(autoware_pid_longitudinal_controller): remove redundant m_received_invalid_trajectory member The value was only set and read within a single run() call, so it can be a local variable derived directly from is_valid_trajectory() instead of a persistent member.

    * refactor(autoware_pid_longitudinal_controller): extract debug/slope message creation into free helper functions Move the inline debug_message and slope_message construction in run() into createDebugMessage() and createSlopeMessage() free functions.

    * refactor(autoware_pid_longitudinal_controller): return emergency stop reason from updateControlState Have changeControlState() and updateControlState() return the emergency stop reason instead of writing it to the m_emergency_stop_reason member, removing the member variable and the reset-before-use pattern in run().

    * refactor(autoware_pid_longitudinal_controller): add const to side-effect-free member functions Moves the m_prev_ctrl_cmd update out of createCtrlCmdMsg (which should only format the output message) and into calcCtrlCmd where the state transition belongs, allowing createCtrlCmdMsg and getTimeUnderControl to be marked const.

    * refactor(autoware_pid_longitudinal_controller): make createCtrlCmdMsg a free helper function Converts createCtrlCmdMsg into a free function in the anonymous namespace, matching createDebugMessage/createSlopeMessage, since it does not need access to any member state. Argument order places current_time first to align with the other message-creation helpers.

    * fix(autoware_pid_longitudinal_controller): avoid clock-type mismatch in delay-compensation time arithmetic PidLongitudinalController compared current_time (whose clock type is caller-supplied) against timestamps implicitly converted from builtin_interfaces::msg::Time, which defaults to RCL_ROS_TIME. When current_time used a different clock type, rclcpp::Time subtraction threw "can't subtract times with different time sources". Replace the ROS-message-backed m_ctrl_cmd_vec with a dedicated TimestampedAcceleration struct that stores rclcpp::Time directly, so stored stamps always share current_time's clock type without needing an explicit conversion. The remaining message-derived timestamp (trajectory header stamp) is now converted using current_time.get_clock_type() instead of the implicit RCL_ROS_TIME default.

    * test(autoware_pid_longitudinal_controller): drop clock-type overrides now that current_time flows through unchanged make_time() no longer needs an rcl_clock_type_t parameter, and no test needs to force RCL_ROS_TIME, since PidLongitudinalController no longer implicitly assumes RCL_ROS_TIME for message-derived timestamps. ---------Co-authored-by: Takahisa.Ishikawa <<takahisa.ishikawa@tier4.jp>>

  • test(pid_longitudinal_controller): add unit tests (#13064)

    • test(autoware_pid_longitudinal_controller): add unit tests for PidLongitudinalController

    * test(autoware_pid_longitudinal_controller): trim redundant PidLongitudinalController test cases Removes several overlapping/redundant test cases while keeping the temporal-trajectory coverage (TemporalTrajectoryProducesValidCommand and its make_temporal_trajectory helper), which exercises the use_temporal_trajectory branch in getControlData.

    * test(autoware_pid_longitudinal_controller): assert control_cmd

File truncated at 100 lines see the full file

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged autoware_pid_longitudinal_controller at Robotics Stack Exchange

No version for distro iron showing github. Known supported distros are highlighted in the buttons above.
Package symbol

autoware_pid_longitudinal_controller package from autoware_universe repo

autoware_boundary_departure_checker autoware_component_interface_specs_universe autoware_cuda_dependency_meta autoware_deprecated_boundary_departure_checker autoware_fake_test_node autoware_glog_component autoware_goal_distance_calculator autoware_grid_map_utils autoware_obstacle_proximity_checker autoware_path_distance_calculator autoware_time_utils autoware_traffic_light_compliance_checker autoware_traffic_light_recognition_marker_publisher autoware_traffic_light_utils autoware_universe_utils tier4_api_utils autoware_autonomous_emergency_braking autoware_collision_detector autoware_control_command_gate autoware_control_performance_analysis autoware_control_validator autoware_external_cmd_selector autoware_joy_controller autoware_lane_departure_checker autoware_mpc_lateral_controller autoware_obstacle_collision_checker autoware_operation_mode_transition_manager autoware_pid_longitudinal_controller autoware_predicted_path_checker autoware_pure_pursuit autoware_shift_decider autoware_smart_mpc_trajectory_follower autoware_spheric_collision_detector autoware_stop_mode_operator autoware_trajectory_follower_base autoware_trajectory_follower_node autoware_vehicle_cmd_gate autoware_tensorrt_vad autoware_control_evaluator autoware_evaluation_adapter autoware_kinematic_evaluator autoware_localization_evaluator autoware_perception_online_evaluator autoware_planning_evaluator autoware_scenario_simulator_v2_adapter autoware_diagnostic_graph_test_examples autoware_geo_pose_projector autoware_ar_tag_based_localizer autoware_landmark_manager autoware_lidar_marker_localizer autoware_localization_error_monitor autoware_pose_covariance_modifier autoware_pose_estimator_arbiter autoware_pose_initialization_requester autoware_pose_instability_detector yabloc_common yabloc_image_processing yabloc_monitor yabloc_particle_filter yabloc_pose_initializer autoware_map_tf_generator autoware_bevfusion autoware_bytetrack autoware_camera_streampetr autoware_cluster_merger autoware_compare_map_segmentation autoware_crosswalk_traffic_light_estimator autoware_detected_object_feature_remover autoware_detected_object_validation autoware_detection_by_tracker autoware_elevation_map_loader autoware_euclidean_cluster autoware_ground_segmentation autoware_ground_segmentation_cuda autoware_image_object_locator autoware_image_projection_based_fusion autoware_lidar_apollo_instance_segmentation autoware_lidar_centerpoint autoware_lidar_frnet autoware_lidar_transfusion autoware_map_based_prediction autoware_multi_object_tracker autoware_object_merger autoware_object_sorter autoware_occupancy_grid_map_outlier_filter autoware_predicted_path_postprocessor autoware_probabilistic_occupancy_grid_map autoware_ptv3 autoware_radar_fusion_to_detected_object autoware_radar_object_tracker autoware_radar_tracks_msgs_converter autoware_raindrop_cluster_filter autoware_shape_estimation autoware_simpl_prediction autoware_simple_object_merger autoware_tensorrt_bevdet autoware_tensorrt_bevformer autoware_tensorrt_classifier autoware_tensorrt_common autoware_tensorrt_plugins autoware_tensorrt_yolox autoware_tracking_object_merger autoware_traffic_light_arbiter autoware_traffic_light_category_merger autoware_traffic_light_classifier autoware_traffic_light_fine_detector autoware_traffic_light_map_based_detector autoware_traffic_light_multi_camera_fusion autoware_traffic_light_occlusion_predictor autoware_traffic_light_pipeline autoware_traffic_light_selector autoware_traffic_light_visualization perception_utils autoware_costmap_generator autoware_diffusion_planner autoware_external_velocity_limit_selector autoware_freespace_planner autoware_freespace_planning_algorithms autoware_hazard_lights_selector autoware_in_lane_mrm_planner autoware_manual_lane_change_handler autoware_minimum_rule_based_planner autoware_mission_planner_universe autoware_path_optimizer autoware_path_smoother autoware_remaining_distance_time_calculator autoware_rtc_interface autoware_scenario_selector autoware_surround_obstacle_checker autoware_trajectory_adapter autoware_trajectory_concatenator autoware_trajectory_gate autoware_trajectory_modifier autoware_trajectory_ranker autoware_trajectory_selector autoware_trajectory_validator autoware_behavior_path_avoidance_by_lane_change_module autoware_behavior_path_bidirectional_traffic_module autoware_behavior_path_direction_change_module autoware_behavior_path_dynamic_obstacle_avoidance_module autoware_behavior_path_external_request_lane_change_module autoware_behavior_path_goal_planner_module autoware_behavior_path_lane_change_module autoware_behavior_path_planner autoware_behavior_path_planner_common autoware_behavior_path_sampling_planner_module autoware_behavior_path_side_shift_module autoware_behavior_path_start_planner_module autoware_behavior_path_static_obstacle_avoidance_module autoware_behavior_velocity_blind_spot_module autoware_behavior_velocity_crosswalk_module autoware_behavior_velocity_detection_area_module autoware_behavior_velocity_intersection_module autoware_behavior_velocity_no_drivable_lane_module autoware_behavior_velocity_no_stopping_area_module autoware_behavior_velocity_occlusion_spot_module autoware_behavior_velocity_roundabout_module autoware_behavior_velocity_rtc_interface autoware_behavior_velocity_speed_bump_module autoware_behavior_velocity_template_module autoware_behavior_velocity_traffic_light_module autoware_behavior_velocity_virtual_traffic_light_module autoware_behavior_velocity_walkway_module autoware_motion_velocity_boundary_departure_prevention_module autoware_motion_velocity_dynamic_obstacle_stop_module autoware_motion_velocity_obstacle_cruise_module autoware_motion_velocity_obstacle_slow_down_module autoware_motion_velocity_obstacle_velocity_limiter_module autoware_motion_velocity_out_of_lane_module autoware_motion_velocity_road_user_stop_module autoware_motion_velocity_run_out_module autoware_planning_validator autoware_planning_validator_intersection_collision_checker autoware_planning_validator_latency_checker autoware_planning_validator_rear_collision_checker autoware_planning_validator_test_utils autoware_planning_validator_trajectory_checker autoware_bezier_sampler autoware_frenet_planner autoware_path_sampler autoware_sampler_common autoware_calibration_status_classifier autoware_cuda_pointcloud_preprocessor autoware_cuda_utils autoware_image_transport_decompressor autoware_imu_corrector autoware_pcl_extensions autoware_pointcloud_preprocessor autoware_radar_objects_adapter autoware_radar_scan_to_pointcloud2 autoware_radar_static_pointcloud_filter autoware_radar_threshold_filter autoware_radar_tracks_noise_filter autoware_carla_interface autoware_dummy_diag_publisher autoware_dummy_infrastructure autoware_dummy_traffic_light_publisher autoware_fault_injection autoware_redundancy_command_selector autoware_vehicle_door_simulator tier4_dummy_object_rviz_plugin autoware_command_mode_decider autoware_command_mode_decider_plugins autoware_command_mode_switcher autoware_command_mode_switcher_plugins autoware_command_mode_types autoware_component_state_monitor autoware_adapi_visualizers autoware_default_adapi_universe autoware_diagnostic_graph_aggregator autoware_diagnostic_graph_merger autoware_diagnostic_graph_utils autoware_driving_mode_manager autoware_duplicated_node_checker autoware_generic_service_divider autoware_hazard_status_converter autoware_mrm_comfortable_stop_operator autoware_mrm_emergency_stop_operator autoware_mrm_handler autoware_mrm_in_lane_stop_operator autoware_mrm_reset_manager autoware_mrm_steering_hold_stop_operator autoware_pipeline_latency_monitor autoware_processing_time_checker autoware_redundancy_adapi_switcher autoware_redundancy_switcher_interface autoware_redundancy_switcher_interface_plugins autoware_system_monitor autoware_topic_relay_controller autoware_topic_state_monitor autoware_velodyne_monitor autoware_accel_brake_map_calibrator autoware_external_cmd_converter autoware_raw_vehicle_cmd_converter autoware_steer_offset_estimator autoware_bag_time_manager_rviz_plugin autoware_traffic_light_rviz_plugin tier4_active_generator_rviz_plugin tier4_adapi_rviz_plugin tier4_camera_view_rviz_plugin tier4_control_mode_rviz_plugin tier4_manual_lane_change_rviz_plugin tier4_perception_rviz_plugin tier4_planning_factor_rviz_plugin tier4_state_rviz_plugin tier4_traffic_light_rviz_plugin tier4_vehicle_rviz_plugin

ROS Distro
github

Package Summary

Version 0.53.0
License Apache 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/autowarefoundation/autoware_universe.git
VCS Type git
VCS Version main
Last Updated 2026-10-23
Dev Status UNKNOWN
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

PID-based longitudinal controller

Maintainers

  • Yuki Takagi
  • Kyoichi Sugahara
  • Arjun Ram
  • Takumi Odashima

Authors

  • Takamasa Horibe
  • Maxime CLEMENT
  • Takayuki Murooka

PID Longitudinal Controller

Purpose / Use cases

The longitudinal_controller computes the target acceleration to achieve the target velocity set at each point of the target trajectory using a feed-forward/back control.

It also contains a slope force correction that takes into account road slope information, and a delay compensation function. It is assumed that the target acceleration calculated here will be properly realized by the vehicle interface.

Note that the use of this module is not mandatory for Autoware if the vehicle supports the “target speed” interface.

Design / Inner-workings / Algorithms

States

This module has four state transitions as shown below in order to handle special processing in a specific situation.

  • DRIVE
    • Executes target velocity tracking by PID control.
    • It also applies the delay compensation and slope compensation.
  • STOPPING
    • Controls the motion just before stopping.
    • Special sequence is performed to achieve accurate and smooth stopping.
  • STOPPED
    • Performs operations in the stopped state (e.g. brake hold)
  • EMERGENCY.
    • Enters an emergency state when certain conditions are met (e.g., when the vehicle has crossed a certain distance of a stop line).
    • The recovery condition (whether or not to keep emergency state until the vehicle completely stops) or the deceleration in the emergency state are defined by parameters.

The state transition diagram is shown below.

LongitudinalControllerStateTransition

Logics

Control Block Diagram

LongitudinalControllerDiagram

FeedForward (FF)

The reference acceleration set in the trajectory and slope compensation terms are output as a feedforward. Under ideal conditions with no modeling error, this FF term alone should be sufficient for velocity tracking.

Tracking errors causing modeling or discretization errors are removed by the feedback control (now using PID).

Brake keeping

From the viewpoint of ride comfort, stopping with 0 acceleration is important because it reduces the impact of braking. However, if the target acceleration when stopping is 0, the vehicle may cross over the stop line or accelerate a little in front of the stop line due to vehicle model error or gradient estimation error.

For reliable stopping, the target acceleration calculated by the FeedForward system is limited to a negative acceleration when stopping.

BrakeKeepingDiagram

Slope compensation

Based on the slope information, a compensation term is added to the target acceleration.

There are two sources of the slope information, which can be switched by a parameter.

  • Pitch of the estimated ego-pose (default)
    • Calculates the current slope from the pitch angle of the estimated ego-pose
    • Pros: Easily available
    • Cons: Cannot extract accurate slope information due to the influence of vehicle vibration.
  • Z coordinate on the trajectory
    • Calculates the road slope from the difference of z-coordinates between the front and rear wheel positions in the target trajectory
    • Pros: More accurate than pitch information, if the z-coordinates of the route are properly maintained
    • Pros: Can be used in combination with delay compensation (not yet implemented)
    • Cons: z-coordinates of high-precision map is needed.
    • Cons: Does not support free space planning (for now)

We also offer the options to switch between these, depending on driving conditions.

Notation: This function works correctly only in a vehicle system that does not have acceleration feedback in the low-level control system.

This compensation adds gravity correction to the target acceleration, resulting in an output value that is no longer equal to the target acceleration that the autonomous driving system desires. Therefore, it conflicts with the role of the acceleration feedback in the low-level controller. For instance, if the vehicle is attempting to start with an acceleration of 1.0 m/s^2 and a gravity correction of -1.0 m/s^2 is applied, the output value will be 0. If this output value is mistakenly treated as the target acceleration, the vehicle will not start.

A suitable example of a vehicle system for the slope compensation function is one in which the output acceleration from the longitudinal_controller is converted into target accel/brake pedal input without any feedbacks. In this case, the output acceleration is just used as a feedforward term to calculate the target pedal, and hence the issue mentioned above does not arise.

Note: The angle of the slope is defined as positive for an uphill slope, while the pitch angle of the ego pose is defined as negative when facing upward. They have an opposite definition.

slope_definition

PID control

For deviations that cannot be handled by FeedForward control, such as model errors, PID control is used to construct a feedback system.

This PID control calculates the target acceleration from the deviation between the current ego-velocity and the target velocity.

This PID logic has a maximum value for the output of each term. This is to prevent the following:

  • Large integral terms may cause unintended behavior by users.
  • Unintended noise may cause the output of the derivative term to be very large.

Note: by default, the integral term in the control system is not accumulated when the vehicle is stationary. This precautionary measure aims to prevent unintended accumulation of the integral term in scenarios where Autoware assumes the vehicle is engaged, but an external system has immobilized the vehicle to initiate startup procedures.

However, certain situations may arise, such as when the vehicle encounters a depression in the road surface during startup or if the slope compensation is inaccurately estimated (lower than necessary), leading to a failure to initiate motion. To address these scenarios, it is possible to activate error integration even when the vehicle is at rest by setting the enable_integration_at_low_speed parameter to true.

When enable_integration_at_low_speed is set to true, the PID controller will initiate integration of the acceleration error after a specified duration defined by the time_threshold_before_pid_integration parameter has elapsed without the vehicle surpassing a minimum velocity set by the current_vel_threshold_pid_integration parameter.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package autoware_pid_longitudinal_controller

0.53.0 (2026-09-29)

  • Merge remote-tracking branch 'origin/main' into prepare-0.53.0-changelog

  • fix(pid_long): fix slope sign (#13247)

  • refactor(pid_logitudinal_controller): cleanup core logic (#13071)

    * refactor(autoware_pid_longitudinal_controller): remove unused m_current_time member m_current_time was assigned once per run() but never read anywhere in the class.

    * refactor(autoware_pid_longitudinal_controller): remove unused m_prev_nearest_time member m_prev_nearest_time was only ever written to (set or reset) and never read, so it had no effect on behavior.

    * refactor(autoware_pid_longitudinal_controller): pass is_steer_converged as parameter is_steer_converged was cached as a member for one control cycle only to be read inside updateControlState(), the sole function that used it. Pass it as a parameter to updateControlState() instead of holding it as class state.

    * refactor(autoware_pid_longitudinal_controller): remove unimplemented member function declarations getCurrentMotion() and calcFilteredAcc() were declared in the header but never defined or called anywhere in the class.

    * refactor(autoware_pid_longitudinal_controller): remove redundant m_received_invalid_trajectory member The value was only set and read within a single run() call, so it can be a local variable derived directly from is_valid_trajectory() instead of a persistent member.

    * refactor(autoware_pid_longitudinal_controller): extract debug/slope message creation into free helper functions Move the inline debug_message and slope_message construction in run() into createDebugMessage() and createSlopeMessage() free functions.

    * refactor(autoware_pid_longitudinal_controller): return emergency stop reason from updateControlState Have changeControlState() and updateControlState() return the emergency stop reason instead of writing it to the m_emergency_stop_reason member, removing the member variable and the reset-before-use pattern in run().

    * refactor(autoware_pid_longitudinal_controller): add const to side-effect-free member functions Moves the m_prev_ctrl_cmd update out of createCtrlCmdMsg (which should only format the output message) and into calcCtrlCmd where the state transition belongs, allowing createCtrlCmdMsg and getTimeUnderControl to be marked const.

    * refactor(autoware_pid_longitudinal_controller): make createCtrlCmdMsg a free helper function Converts createCtrlCmdMsg into a free function in the anonymous namespace, matching createDebugMessage/createSlopeMessage, since it does not need access to any member state. Argument order places current_time first to align with the other message-creation helpers.

    * fix(autoware_pid_longitudinal_controller): avoid clock-type mismatch in delay-compensation time arithmetic PidLongitudinalController compared current_time (whose clock type is caller-supplied) against timestamps implicitly converted from builtin_interfaces::msg::Time, which defaults to RCL_ROS_TIME. When current_time used a different clock type, rclcpp::Time subtraction threw "can't subtract times with different time sources". Replace the ROS-message-backed m_ctrl_cmd_vec with a dedicated TimestampedAcceleration struct that stores rclcpp::Time directly, so stored stamps always share current_time's clock type without needing an explicit conversion. The remaining message-derived timestamp (trajectory header stamp) is now converted using current_time.get_clock_type() instead of the implicit RCL_ROS_TIME default.

    * test(autoware_pid_longitudinal_controller): drop clock-type overrides now that current_time flows through unchanged make_time() no longer needs an rcl_clock_type_t parameter, and no test needs to force RCL_ROS_TIME, since PidLongitudinalController no longer implicitly assumes RCL_ROS_TIME for message-derived timestamps. ---------Co-authored-by: Takahisa.Ishikawa <<takahisa.ishikawa@tier4.jp>>

  • test(pid_longitudinal_controller): add unit tests (#13064)

    • test(autoware_pid_longitudinal_controller): add unit tests for PidLongitudinalController

    * test(autoware_pid_longitudinal_controller): trim redundant PidLongitudinalController test cases Removes several overlapping/redundant test cases while keeping the temporal-trajectory coverage (TemporalTrajectoryProducesValidCommand and its make_temporal_trajectory helper), which exercises the use_temporal_trajectory branch in getControlData.

    * test(autoware_pid_longitudinal_controller): assert control_cmd

File truncated at 100 lines see the full file

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged autoware_pid_longitudinal_controller at Robotics Stack Exchange

No version for distro melodic showing github. Known supported distros are highlighted in the buttons above.
Package symbol

autoware_pid_longitudinal_controller package from autoware_universe repo

autoware_boundary_departure_checker autoware_component_interface_specs_universe autoware_cuda_dependency_meta autoware_deprecated_boundary_departure_checker autoware_fake_test_node autoware_glog_component autoware_goal_distance_calculator autoware_grid_map_utils autoware_obstacle_proximity_checker autoware_path_distance_calculator autoware_time_utils autoware_traffic_light_compliance_checker autoware_traffic_light_recognition_marker_publisher autoware_traffic_light_utils autoware_universe_utils tier4_api_utils autoware_autonomous_emergency_braking autoware_collision_detector autoware_control_command_gate autoware_control_performance_analysis autoware_control_validator autoware_external_cmd_selector autoware_joy_controller autoware_lane_departure_checker autoware_mpc_lateral_controller autoware_obstacle_collision_checker autoware_operation_mode_transition_manager autoware_pid_longitudinal_controller autoware_predicted_path_checker autoware_pure_pursuit autoware_shift_decider autoware_smart_mpc_trajectory_follower autoware_spheric_collision_detector autoware_stop_mode_operator autoware_trajectory_follower_base autoware_trajectory_follower_node autoware_vehicle_cmd_gate autoware_tensorrt_vad autoware_control_evaluator autoware_evaluation_adapter autoware_kinematic_evaluator autoware_localization_evaluator autoware_perception_online_evaluator autoware_planning_evaluator autoware_scenario_simulator_v2_adapter autoware_diagnostic_graph_test_examples autoware_geo_pose_projector autoware_ar_tag_based_localizer autoware_landmark_manager autoware_lidar_marker_localizer autoware_localization_error_monitor autoware_pose_covariance_modifier autoware_pose_estimator_arbiter autoware_pose_initialization_requester autoware_pose_instability_detector yabloc_common yabloc_image_processing yabloc_monitor yabloc_particle_filter yabloc_pose_initializer autoware_map_tf_generator autoware_bevfusion autoware_bytetrack autoware_camera_streampetr autoware_cluster_merger autoware_compare_map_segmentation autoware_crosswalk_traffic_light_estimator autoware_detected_object_feature_remover autoware_detected_object_validation autoware_detection_by_tracker autoware_elevation_map_loader autoware_euclidean_cluster autoware_ground_segmentation autoware_ground_segmentation_cuda autoware_image_object_locator autoware_image_projection_based_fusion autoware_lidar_apollo_instance_segmentation autoware_lidar_centerpoint autoware_lidar_frnet autoware_lidar_transfusion autoware_map_based_prediction autoware_multi_object_tracker autoware_object_merger autoware_object_sorter autoware_occupancy_grid_map_outlier_filter autoware_predicted_path_postprocessor autoware_probabilistic_occupancy_grid_map autoware_ptv3 autoware_radar_fusion_to_detected_object autoware_radar_object_tracker autoware_radar_tracks_msgs_converter autoware_raindrop_cluster_filter autoware_shape_estimation autoware_simpl_prediction autoware_simple_object_merger autoware_tensorrt_bevdet autoware_tensorrt_bevformer autoware_tensorrt_classifier autoware_tensorrt_common autoware_tensorrt_plugins autoware_tensorrt_yolox autoware_tracking_object_merger autoware_traffic_light_arbiter autoware_traffic_light_category_merger autoware_traffic_light_classifier autoware_traffic_light_fine_detector autoware_traffic_light_map_based_detector autoware_traffic_light_multi_camera_fusion autoware_traffic_light_occlusion_predictor autoware_traffic_light_pipeline autoware_traffic_light_selector autoware_traffic_light_visualization perception_utils autoware_costmap_generator autoware_diffusion_planner autoware_external_velocity_limit_selector autoware_freespace_planner autoware_freespace_planning_algorithms autoware_hazard_lights_selector autoware_in_lane_mrm_planner autoware_manual_lane_change_handler autoware_minimum_rule_based_planner autoware_mission_planner_universe autoware_path_optimizer autoware_path_smoother autoware_remaining_distance_time_calculator autoware_rtc_interface autoware_scenario_selector autoware_surround_obstacle_checker autoware_trajectory_adapter autoware_trajectory_concatenator autoware_trajectory_gate autoware_trajectory_modifier autoware_trajectory_ranker autoware_trajectory_selector autoware_trajectory_validator autoware_behavior_path_avoidance_by_lane_change_module autoware_behavior_path_bidirectional_traffic_module autoware_behavior_path_direction_change_module autoware_behavior_path_dynamic_obstacle_avoidance_module autoware_behavior_path_external_request_lane_change_module autoware_behavior_path_goal_planner_module autoware_behavior_path_lane_change_module autoware_behavior_path_planner autoware_behavior_path_planner_common autoware_behavior_path_sampling_planner_module autoware_behavior_path_side_shift_module autoware_behavior_path_start_planner_module autoware_behavior_path_static_obstacle_avoidance_module autoware_behavior_velocity_blind_spot_module autoware_behavior_velocity_crosswalk_module autoware_behavior_velocity_detection_area_module autoware_behavior_velocity_intersection_module autoware_behavior_velocity_no_drivable_lane_module autoware_behavior_velocity_no_stopping_area_module autoware_behavior_velocity_occlusion_spot_module autoware_behavior_velocity_roundabout_module autoware_behavior_velocity_rtc_interface autoware_behavior_velocity_speed_bump_module autoware_behavior_velocity_template_module autoware_behavior_velocity_traffic_light_module autoware_behavior_velocity_virtual_traffic_light_module autoware_behavior_velocity_walkway_module autoware_motion_velocity_boundary_departure_prevention_module autoware_motion_velocity_dynamic_obstacle_stop_module autoware_motion_velocity_obstacle_cruise_module autoware_motion_velocity_obstacle_slow_down_module autoware_motion_velocity_obstacle_velocity_limiter_module autoware_motion_velocity_out_of_lane_module autoware_motion_velocity_road_user_stop_module autoware_motion_velocity_run_out_module autoware_planning_validator autoware_planning_validator_intersection_collision_checker autoware_planning_validator_latency_checker autoware_planning_validator_rear_collision_checker autoware_planning_validator_test_utils autoware_planning_validator_trajectory_checker autoware_bezier_sampler autoware_frenet_planner autoware_path_sampler autoware_sampler_common autoware_calibration_status_classifier autoware_cuda_pointcloud_preprocessor autoware_cuda_utils autoware_image_transport_decompressor autoware_imu_corrector autoware_pcl_extensions autoware_pointcloud_preprocessor autoware_radar_objects_adapter autoware_radar_scan_to_pointcloud2 autoware_radar_static_pointcloud_filter autoware_radar_threshold_filter autoware_radar_tracks_noise_filter autoware_carla_interface autoware_dummy_diag_publisher autoware_dummy_infrastructure autoware_dummy_traffic_light_publisher autoware_fault_injection autoware_redundancy_command_selector autoware_vehicle_door_simulator tier4_dummy_object_rviz_plugin autoware_command_mode_decider autoware_command_mode_decider_plugins autoware_command_mode_switcher autoware_command_mode_switcher_plugins autoware_command_mode_types autoware_component_state_monitor autoware_adapi_visualizers autoware_default_adapi_universe autoware_diagnostic_graph_aggregator autoware_diagnostic_graph_merger autoware_diagnostic_graph_utils autoware_driving_mode_manager autoware_duplicated_node_checker autoware_generic_service_divider autoware_hazard_status_converter autoware_mrm_comfortable_stop_operator autoware_mrm_emergency_stop_operator autoware_mrm_handler autoware_mrm_in_lane_stop_operator autoware_mrm_reset_manager autoware_mrm_steering_hold_stop_operator autoware_pipeline_latency_monitor autoware_processing_time_checker autoware_redundancy_adapi_switcher autoware_redundancy_switcher_interface autoware_redundancy_switcher_interface_plugins autoware_system_monitor autoware_topic_relay_controller autoware_topic_state_monitor autoware_velodyne_monitor autoware_accel_brake_map_calibrator autoware_external_cmd_converter autoware_raw_vehicle_cmd_converter autoware_steer_offset_estimator autoware_bag_time_manager_rviz_plugin autoware_traffic_light_rviz_plugin tier4_active_generator_rviz_plugin tier4_adapi_rviz_plugin tier4_camera_view_rviz_plugin tier4_control_mode_rviz_plugin tier4_manual_lane_change_rviz_plugin tier4_perception_rviz_plugin tier4_planning_factor_rviz_plugin tier4_state_rviz_plugin tier4_traffic_light_rviz_plugin tier4_vehicle_rviz_plugin

ROS Distro
github

Package Summary

Version 0.53.0
License Apache 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/autowarefoundation/autoware_universe.git
VCS Type git
VCS Version main
Last Updated 2026-10-23
Dev Status UNKNOWN
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

PID-based longitudinal controller

Maintainers

  • Yuki Takagi
  • Kyoichi Sugahara
  • Arjun Ram
  • Takumi Odashima

Authors

  • Takamasa Horibe
  • Maxime CLEMENT
  • Takayuki Murooka

PID Longitudinal Controller

Purpose / Use cases

The longitudinal_controller computes the target acceleration to achieve the target velocity set at each point of the target trajectory using a feed-forward/back control.

It also contains a slope force correction that takes into account road slope information, and a delay compensation function. It is assumed that the target acceleration calculated here will be properly realized by the vehicle interface.

Note that the use of this module is not mandatory for Autoware if the vehicle supports the “target speed” interface.

Design / Inner-workings / Algorithms

States

This module has four state transitions as shown below in order to handle special processing in a specific situation.

  • DRIVE
    • Executes target velocity tracking by PID control.
    • It also applies the delay compensation and slope compensation.
  • STOPPING
    • Controls the motion just before stopping.
    • Special sequence is performed to achieve accurate and smooth stopping.
  • STOPPED
    • Performs operations in the stopped state (e.g. brake hold)
  • EMERGENCY.
    • Enters an emergency state when certain conditions are met (e.g., when the vehicle has crossed a certain distance of a stop line).
    • The recovery condition (whether or not to keep emergency state until the vehicle completely stops) or the deceleration in the emergency state are defined by parameters.

The state transition diagram is shown below.

LongitudinalControllerStateTransition

Logics

Control Block Diagram

LongitudinalControllerDiagram

FeedForward (FF)

The reference acceleration set in the trajectory and slope compensation terms are output as a feedforward. Under ideal conditions with no modeling error, this FF term alone should be sufficient for velocity tracking.

Tracking errors causing modeling or discretization errors are removed by the feedback control (now using PID).

Brake keeping

From the viewpoint of ride comfort, stopping with 0 acceleration is important because it reduces the impact of braking. However, if the target acceleration when stopping is 0, the vehicle may cross over the stop line or accelerate a little in front of the stop line due to vehicle model error or gradient estimation error.

For reliable stopping, the target acceleration calculated by the FeedForward system is limited to a negative acceleration when stopping.

BrakeKeepingDiagram

Slope compensation

Based on the slope information, a compensation term is added to the target acceleration.

There are two sources of the slope information, which can be switched by a parameter.

  • Pitch of the estimated ego-pose (default)
    • Calculates the current slope from the pitch angle of the estimated ego-pose
    • Pros: Easily available
    • Cons: Cannot extract accurate slope information due to the influence of vehicle vibration.
  • Z coordinate on the trajectory
    • Calculates the road slope from the difference of z-coordinates between the front and rear wheel positions in the target trajectory
    • Pros: More accurate than pitch information, if the z-coordinates of the route are properly maintained
    • Pros: Can be used in combination with delay compensation (not yet implemented)
    • Cons: z-coordinates of high-precision map is needed.
    • Cons: Does not support free space planning (for now)

We also offer the options to switch between these, depending on driving conditions.

Notation: This function works correctly only in a vehicle system that does not have acceleration feedback in the low-level control system.

This compensation adds gravity correction to the target acceleration, resulting in an output value that is no longer equal to the target acceleration that the autonomous driving system desires. Therefore, it conflicts with the role of the acceleration feedback in the low-level controller. For instance, if the vehicle is attempting to start with an acceleration of 1.0 m/s^2 and a gravity correction of -1.0 m/s^2 is applied, the output value will be 0. If this output value is mistakenly treated as the target acceleration, the vehicle will not start.

A suitable example of a vehicle system for the slope compensation function is one in which the output acceleration from the longitudinal_controller is converted into target accel/brake pedal input without any feedbacks. In this case, the output acceleration is just used as a feedforward term to calculate the target pedal, and hence the issue mentioned above does not arise.

Note: The angle of the slope is defined as positive for an uphill slope, while the pitch angle of the ego pose is defined as negative when facing upward. They have an opposite definition.

slope_definition

PID control

For deviations that cannot be handled by FeedForward control, such as model errors, PID control is used to construct a feedback system.

This PID control calculates the target acceleration from the deviation between the current ego-velocity and the target velocity.

This PID logic has a maximum value for the output of each term. This is to prevent the following:

  • Large integral terms may cause unintended behavior by users.
  • Unintended noise may cause the output of the derivative term to be very large.

Note: by default, the integral term in the control system is not accumulated when the vehicle is stationary. This precautionary measure aims to prevent unintended accumulation of the integral term in scenarios where Autoware assumes the vehicle is engaged, but an external system has immobilized the vehicle to initiate startup procedures.

However, certain situations may arise, such as when the vehicle encounters a depression in the road surface during startup or if the slope compensation is inaccurately estimated (lower than necessary), leading to a failure to initiate motion. To address these scenarios, it is possible to activate error integration even when the vehicle is at rest by setting the enable_integration_at_low_speed parameter to true.

When enable_integration_at_low_speed is set to true, the PID controller will initiate integration of the acceleration error after a specified duration defined by the time_threshold_before_pid_integration parameter has elapsed without the vehicle surpassing a minimum velocity set by the current_vel_threshold_pid_integration parameter.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package autoware_pid_longitudinal_controller

0.53.0 (2026-09-29)

  • Merge remote-tracking branch 'origin/main' into prepare-0.53.0-changelog

  • fix(pid_long): fix slope sign (#13247)

  • refactor(pid_logitudinal_controller): cleanup core logic (#13071)

    * refactor(autoware_pid_longitudinal_controller): remove unused m_current_time member m_current_time was assigned once per run() but never read anywhere in the class.

    * refactor(autoware_pid_longitudinal_controller): remove unused m_prev_nearest_time member m_prev_nearest_time was only ever written to (set or reset) and never read, so it had no effect on behavior.

    * refactor(autoware_pid_longitudinal_controller): pass is_steer_converged as parameter is_steer_converged was cached as a member for one control cycle only to be read inside updateControlState(), the sole function that used it. Pass it as a parameter to updateControlState() instead of holding it as class state.

    * refactor(autoware_pid_longitudinal_controller): remove unimplemented member function declarations getCurrentMotion() and calcFilteredAcc() were declared in the header but never defined or called anywhere in the class.

    * refactor(autoware_pid_longitudinal_controller): remove redundant m_received_invalid_trajectory member The value was only set and read within a single run() call, so it can be a local variable derived directly from is_valid_trajectory() instead of a persistent member.

    * refactor(autoware_pid_longitudinal_controller): extract debug/slope message creation into free helper functions Move the inline debug_message and slope_message construction in run() into createDebugMessage() and createSlopeMessage() free functions.

    * refactor(autoware_pid_longitudinal_controller): return emergency stop reason from updateControlState Have changeControlState() and updateControlState() return the emergency stop reason instead of writing it to the m_emergency_stop_reason member, removing the member variable and the reset-before-use pattern in run().

    * refactor(autoware_pid_longitudinal_controller): add const to side-effect-free member functions Moves the m_prev_ctrl_cmd update out of createCtrlCmdMsg (which should only format the output message) and into calcCtrlCmd where the state transition belongs, allowing createCtrlCmdMsg and getTimeUnderControl to be marked const.

    * refactor(autoware_pid_longitudinal_controller): make createCtrlCmdMsg a free helper function Converts createCtrlCmdMsg into a free function in the anonymous namespace, matching createDebugMessage/createSlopeMessage, since it does not need access to any member state. Argument order places current_time first to align with the other message-creation helpers.

    * fix(autoware_pid_longitudinal_controller): avoid clock-type mismatch in delay-compensation time arithmetic PidLongitudinalController compared current_time (whose clock type is caller-supplied) against timestamps implicitly converted from builtin_interfaces::msg::Time, which defaults to RCL_ROS_TIME. When current_time used a different clock type, rclcpp::Time subtraction threw "can't subtract times with different time sources". Replace the ROS-message-backed m_ctrl_cmd_vec with a dedicated TimestampedAcceleration struct that stores rclcpp::Time directly, so stored stamps always share current_time's clock type without needing an explicit conversion. The remaining message-derived timestamp (trajectory header stamp) is now converted using current_time.get_clock_type() instead of the implicit RCL_ROS_TIME default.

    * test(autoware_pid_longitudinal_controller): drop clock-type overrides now that current_time flows through unchanged make_time() no longer needs an rcl_clock_type_t parameter, and no test needs to force RCL_ROS_TIME, since PidLongitudinalController no longer implicitly assumes RCL_ROS_TIME for message-derived timestamps. ---------Co-authored-by: Takahisa.Ishikawa <<takahisa.ishikawa@tier4.jp>>

  • test(pid_longitudinal_controller): add unit tests (#13064)

    • test(autoware_pid_longitudinal_controller): add unit tests for PidLongitudinalController

    * test(autoware_pid_longitudinal_controller): trim redundant PidLongitudinalController test cases Removes several overlapping/redundant test cases while keeping the temporal-trajectory coverage (TemporalTrajectoryProducesValidCommand and its make_temporal_trajectory helper), which exercises the use_temporal_trajectory branch in getControlData.

    * test(autoware_pid_longitudinal_controller): assert control_cmd

File truncated at 100 lines see the full file

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged autoware_pid_longitudinal_controller at Robotics Stack Exchange

No version for distro noetic showing github. Known supported distros are highlighted in the buttons above.
Package symbol

autoware_pid_longitudinal_controller package from autoware_universe repo

autoware_boundary_departure_checker autoware_component_interface_specs_universe autoware_cuda_dependency_meta autoware_deprecated_boundary_departure_checker autoware_fake_test_node autoware_glog_component autoware_goal_distance_calculator autoware_grid_map_utils autoware_obstacle_proximity_checker autoware_path_distance_calculator autoware_time_utils autoware_traffic_light_compliance_checker autoware_traffic_light_recognition_marker_publisher autoware_traffic_light_utils autoware_universe_utils tier4_api_utils autoware_autonomous_emergency_braking autoware_collision_detector autoware_control_command_gate autoware_control_performance_analysis autoware_control_validator autoware_external_cmd_selector autoware_joy_controller autoware_lane_departure_checker autoware_mpc_lateral_controller autoware_obstacle_collision_checker autoware_operation_mode_transition_manager autoware_pid_longitudinal_controller autoware_predicted_path_checker autoware_pure_pursuit autoware_shift_decider autoware_smart_mpc_trajectory_follower autoware_spheric_collision_detector autoware_stop_mode_operator autoware_trajectory_follower_base autoware_trajectory_follower_node autoware_vehicle_cmd_gate autoware_tensorrt_vad autoware_control_evaluator autoware_evaluation_adapter autoware_kinematic_evaluator autoware_localization_evaluator autoware_perception_online_evaluator autoware_planning_evaluator autoware_scenario_simulator_v2_adapter autoware_diagnostic_graph_test_examples autoware_geo_pose_projector autoware_ar_tag_based_localizer autoware_landmark_manager autoware_lidar_marker_localizer autoware_localization_error_monitor autoware_pose_covariance_modifier autoware_pose_estimator_arbiter autoware_pose_initialization_requester autoware_pose_instability_detector yabloc_common yabloc_image_processing yabloc_monitor yabloc_particle_filter yabloc_pose_initializer autoware_map_tf_generator autoware_bevfusion autoware_bytetrack autoware_camera_streampetr autoware_cluster_merger autoware_compare_map_segmentation autoware_crosswalk_traffic_light_estimator autoware_detected_object_feature_remover autoware_detected_object_validation autoware_detection_by_tracker autoware_elevation_map_loader autoware_euclidean_cluster autoware_ground_segmentation autoware_ground_segmentation_cuda autoware_image_object_locator autoware_image_projection_based_fusion autoware_lidar_apollo_instance_segmentation autoware_lidar_centerpoint autoware_lidar_frnet autoware_lidar_transfusion autoware_map_based_prediction autoware_multi_object_tracker autoware_object_merger autoware_object_sorter autoware_occupancy_grid_map_outlier_filter autoware_predicted_path_postprocessor autoware_probabilistic_occupancy_grid_map autoware_ptv3 autoware_radar_fusion_to_detected_object autoware_radar_object_tracker autoware_radar_tracks_msgs_converter autoware_raindrop_cluster_filter autoware_shape_estimation autoware_simpl_prediction autoware_simple_object_merger autoware_tensorrt_bevdet autoware_tensorrt_bevformer autoware_tensorrt_classifier autoware_tensorrt_common autoware_tensorrt_plugins autoware_tensorrt_yolox autoware_tracking_object_merger autoware_traffic_light_arbiter autoware_traffic_light_category_merger autoware_traffic_light_classifier autoware_traffic_light_fine_detector autoware_traffic_light_map_based_detector autoware_traffic_light_multi_camera_fusion autoware_traffic_light_occlusion_predictor autoware_traffic_light_pipeline autoware_traffic_light_selector autoware_traffic_light_visualization perception_utils autoware_costmap_generator autoware_diffusion_planner autoware_external_velocity_limit_selector autoware_freespace_planner autoware_freespace_planning_algorithms autoware_hazard_lights_selector autoware_in_lane_mrm_planner autoware_manual_lane_change_handler autoware_minimum_rule_based_planner autoware_mission_planner_universe autoware_path_optimizer autoware_path_smoother autoware_remaining_distance_time_calculator autoware_rtc_interface autoware_scenario_selector autoware_surround_obstacle_checker autoware_trajectory_adapter autoware_trajectory_concatenator autoware_trajectory_gate autoware_trajectory_modifier autoware_trajectory_ranker autoware_trajectory_selector autoware_trajectory_validator autoware_behavior_path_avoidance_by_lane_change_module autoware_behavior_path_bidirectional_traffic_module autoware_behavior_path_direction_change_module autoware_behavior_path_dynamic_obstacle_avoidance_module autoware_behavior_path_external_request_lane_change_module autoware_behavior_path_goal_planner_module autoware_behavior_path_lane_change_module autoware_behavior_path_planner autoware_behavior_path_planner_common autoware_behavior_path_sampling_planner_module autoware_behavior_path_side_shift_module autoware_behavior_path_start_planner_module autoware_behavior_path_static_obstacle_avoidance_module autoware_behavior_velocity_blind_spot_module autoware_behavior_velocity_crosswalk_module autoware_behavior_velocity_detection_area_module autoware_behavior_velocity_intersection_module autoware_behavior_velocity_no_drivable_lane_module autoware_behavior_velocity_no_stopping_area_module autoware_behavior_velocity_occlusion_spot_module autoware_behavior_velocity_roundabout_module autoware_behavior_velocity_rtc_interface autoware_behavior_velocity_speed_bump_module autoware_behavior_velocity_template_module autoware_behavior_velocity_traffic_light_module autoware_behavior_velocity_virtual_traffic_light_module autoware_behavior_velocity_walkway_module autoware_motion_velocity_boundary_departure_prevention_module autoware_motion_velocity_dynamic_obstacle_stop_module autoware_motion_velocity_obstacle_cruise_module autoware_motion_velocity_obstacle_slow_down_module autoware_motion_velocity_obstacle_velocity_limiter_module autoware_motion_velocity_out_of_lane_module autoware_motion_velocity_road_user_stop_module autoware_motion_velocity_run_out_module autoware_planning_validator autoware_planning_validator_intersection_collision_checker autoware_planning_validator_latency_checker autoware_planning_validator_rear_collision_checker autoware_planning_validator_test_utils autoware_planning_validator_trajectory_checker autoware_bezier_sampler autoware_frenet_planner autoware_path_sampler autoware_sampler_common autoware_calibration_status_classifier autoware_cuda_pointcloud_preprocessor autoware_cuda_utils autoware_image_transport_decompressor autoware_imu_corrector autoware_pcl_extensions autoware_pointcloud_preprocessor autoware_radar_objects_adapter autoware_radar_scan_to_pointcloud2 autoware_radar_static_pointcloud_filter autoware_radar_threshold_filter autoware_radar_tracks_noise_filter autoware_carla_interface autoware_dummy_diag_publisher autoware_dummy_infrastructure autoware_dummy_traffic_light_publisher autoware_fault_injection autoware_redundancy_command_selector autoware_vehicle_door_simulator tier4_dummy_object_rviz_plugin autoware_command_mode_decider autoware_command_mode_decider_plugins autoware_command_mode_switcher autoware_command_mode_switcher_plugins autoware_command_mode_types autoware_component_state_monitor autoware_adapi_visualizers autoware_default_adapi_universe autoware_diagnostic_graph_aggregator autoware_diagnostic_graph_merger autoware_diagnostic_graph_utils autoware_driving_mode_manager autoware_duplicated_node_checker autoware_generic_service_divider autoware_hazard_status_converter autoware_mrm_comfortable_stop_operator autoware_mrm_emergency_stop_operator autoware_mrm_handler autoware_mrm_in_lane_stop_operator autoware_mrm_reset_manager autoware_mrm_steering_hold_stop_operator autoware_pipeline_latency_monitor autoware_processing_time_checker autoware_redundancy_adapi_switcher autoware_redundancy_switcher_interface autoware_redundancy_switcher_interface_plugins autoware_system_monitor autoware_topic_relay_controller autoware_topic_state_monitor autoware_velodyne_monitor autoware_accel_brake_map_calibrator autoware_external_cmd_converter autoware_raw_vehicle_cmd_converter autoware_steer_offset_estimator autoware_bag_time_manager_rviz_plugin autoware_traffic_light_rviz_plugin tier4_active_generator_rviz_plugin tier4_adapi_rviz_plugin tier4_camera_view_rviz_plugin tier4_control_mode_rviz_plugin tier4_manual_lane_change_rviz_plugin tier4_perception_rviz_plugin tier4_planning_factor_rviz_plugin tier4_state_rviz_plugin tier4_traffic_light_rviz_plugin tier4_vehicle_rviz_plugin

ROS Distro
github

Package Summary

Version 0.53.0
License Apache 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/autowarefoundation/autoware_universe.git
VCS Type git
VCS Version main
Last Updated 2026-10-23
Dev Status UNKNOWN
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

PID-based longitudinal controller

Maintainers

  • Yuki Takagi
  • Kyoichi Sugahara
  • Arjun Ram
  • Takumi Odashima

Authors

  • Takamasa Horibe
  • Maxime CLEMENT
  • Takayuki Murooka

PID Longitudinal Controller

Purpose / Use cases

The longitudinal_controller computes the target acceleration to achieve the target velocity set at each point of the target trajectory using a feed-forward/back control.

It also contains a slope force correction that takes into account road slope information, and a delay compensation function. It is assumed that the target acceleration calculated here will be properly realized by the vehicle interface.

Note that the use of this module is not mandatory for Autoware if the vehicle supports the “target speed” interface.

Design / Inner-workings / Algorithms

States

This module has four state transitions as shown below in order to handle special processing in a specific situation.

  • DRIVE
    • Executes target velocity tracking by PID control.
    • It also applies the delay compensation and slope compensation.
  • STOPPING
    • Controls the motion just before stopping.
    • Special sequence is performed to achieve accurate and smooth stopping.
  • STOPPED
    • Performs operations in the stopped state (e.g. brake hold)
  • EMERGENCY.
    • Enters an emergency state when certain conditions are met (e.g., when the vehicle has crossed a certain distance of a stop line).
    • The recovery condition (whether or not to keep emergency state until the vehicle completely stops) or the deceleration in the emergency state are defined by parameters.

The state transition diagram is shown below.

LongitudinalControllerStateTransition

Logics

Control Block Diagram

LongitudinalControllerDiagram

FeedForward (FF)

The reference acceleration set in the trajectory and slope compensation terms are output as a feedforward. Under ideal conditions with no modeling error, this FF term alone should be sufficient for velocity tracking.

Tracking errors causing modeling or discretization errors are removed by the feedback control (now using PID).

Brake keeping

From the viewpoint of ride comfort, stopping with 0 acceleration is important because it reduces the impact of braking. However, if the target acceleration when stopping is 0, the vehicle may cross over the stop line or accelerate a little in front of the stop line due to vehicle model error or gradient estimation error.

For reliable stopping, the target acceleration calculated by the FeedForward system is limited to a negative acceleration when stopping.

BrakeKeepingDiagram

Slope compensation

Based on the slope information, a compensation term is added to the target acceleration.

There are two sources of the slope information, which can be switched by a parameter.

  • Pitch of the estimated ego-pose (default)
    • Calculates the current slope from the pitch angle of the estimated ego-pose
    • Pros: Easily available
    • Cons: Cannot extract accurate slope information due to the influence of vehicle vibration.
  • Z coordinate on the trajectory
    • Calculates the road slope from the difference of z-coordinates between the front and rear wheel positions in the target trajectory
    • Pros: More accurate than pitch information, if the z-coordinates of the route are properly maintained
    • Pros: Can be used in combination with delay compensation (not yet implemented)
    • Cons: z-coordinates of high-precision map is needed.
    • Cons: Does not support free space planning (for now)

We also offer the options to switch between these, depending on driving conditions.

Notation: This function works correctly only in a vehicle system that does not have acceleration feedback in the low-level control system.

This compensation adds gravity correction to the target acceleration, resulting in an output value that is no longer equal to the target acceleration that the autonomous driving system desires. Therefore, it conflicts with the role of the acceleration feedback in the low-level controller. For instance, if the vehicle is attempting to start with an acceleration of 1.0 m/s^2 and a gravity correction of -1.0 m/s^2 is applied, the output value will be 0. If this output value is mistakenly treated as the target acceleration, the vehicle will not start.

A suitable example of a vehicle system for the slope compensation function is one in which the output acceleration from the longitudinal_controller is converted into target accel/brake pedal input without any feedbacks. In this case, the output acceleration is just used as a feedforward term to calculate the target pedal, and hence the issue mentioned above does not arise.

Note: The angle of the slope is defined as positive for an uphill slope, while the pitch angle of the ego pose is defined as negative when facing upward. They have an opposite definition.

slope_definition

PID control

For deviations that cannot be handled by FeedForward control, such as model errors, PID control is used to construct a feedback system.

This PID control calculates the target acceleration from the deviation between the current ego-velocity and the target velocity.

This PID logic has a maximum value for the output of each term. This is to prevent the following:

  • Large integral terms may cause unintended behavior by users.
  • Unintended noise may cause the output of the derivative term to be very large.

Note: by default, the integral term in the control system is not accumulated when the vehicle is stationary. This precautionary measure aims to prevent unintended accumulation of the integral term in scenarios where Autoware assumes the vehicle is engaged, but an external system has immobilized the vehicle to initiate startup procedures.

However, certain situations may arise, such as when the vehicle encounters a depression in the road surface during startup or if the slope compensation is inaccurately estimated (lower than necessary), leading to a failure to initiate motion. To address these scenarios, it is possible to activate error integration even when the vehicle is at rest by setting the enable_integration_at_low_speed parameter to true.

When enable_integration_at_low_speed is set to true, the PID controller will initiate integration of the acceleration error after a specified duration defined by the time_threshold_before_pid_integration parameter has elapsed without the vehicle surpassing a minimum velocity set by the current_vel_threshold_pid_integration parameter.

File truncated at 100 lines see the full file

CHANGELOG

Changelog for package autoware_pid_longitudinal_controller

0.53.0 (2026-09-29)

  • Merge remote-tracking branch 'origin/main' into prepare-0.53.0-changelog

  • fix(pid_long): fix slope sign (#13247)

  • refactor(pid_logitudinal_controller): cleanup core logic (#13071)

    * refactor(autoware_pid_longitudinal_controller): remove unused m_current_time member m_current_time was assigned once per run() but never read anywhere in the class.

    * refactor(autoware_pid_longitudinal_controller): remove unused m_prev_nearest_time member m_prev_nearest_time was only ever written to (set or reset) and never read, so it had no effect on behavior.

    * refactor(autoware_pid_longitudinal_controller): pass is_steer_converged as parameter is_steer_converged was cached as a member for one control cycle only to be read inside updateControlState(), the sole function that used it. Pass it as a parameter to updateControlState() instead of holding it as class state.

    * refactor(autoware_pid_longitudinal_controller): remove unimplemented member function declarations getCurrentMotion() and calcFilteredAcc() were declared in the header but never defined or called anywhere in the class.

    * refactor(autoware_pid_longitudinal_controller): remove redundant m_received_invalid_trajectory member The value was only set and read within a single run() call, so it can be a local variable derived directly from is_valid_trajectory() instead of a persistent member.

    * refactor(autoware_pid_longitudinal_controller): extract debug/slope message creation into free helper functions Move the inline debug_message and slope_message construction in run() into createDebugMessage() and createSlopeMessage() free functions.

    * refactor(autoware_pid_longitudinal_controller): return emergency stop reason from updateControlState Have changeControlState() and updateControlState() return the emergency stop reason instead of writing it to the m_emergency_stop_reason member, removing the member variable and the reset-before-use pattern in run().

    * refactor(autoware_pid_longitudinal_controller): add const to side-effect-free member functions Moves the m_prev_ctrl_cmd update out of createCtrlCmdMsg (which should only format the output message) and into calcCtrlCmd where the state transition belongs, allowing createCtrlCmdMsg and getTimeUnderControl to be marked const.

    * refactor(autoware_pid_longitudinal_controller): make createCtrlCmdMsg a free helper function Converts createCtrlCmdMsg into a free function in the anonymous namespace, matching createDebugMessage/createSlopeMessage, since it does not need access to any member state. Argument order places current_time first to align with the other message-creation helpers.

    * fix(autoware_pid_longitudinal_controller): avoid clock-type mismatch in delay-compensation time arithmetic PidLongitudinalController compared current_time (whose clock type is caller-supplied) against timestamps implicitly converted from builtin_interfaces::msg::Time, which defaults to RCL_ROS_TIME. When current_time used a different clock type, rclcpp::Time subtraction threw "can't subtract times with different time sources". Replace the ROS-message-backed m_ctrl_cmd_vec with a dedicated TimestampedAcceleration struct that stores rclcpp::Time directly, so stored stamps always share current_time's clock type without needing an explicit conversion. The remaining message-derived timestamp (trajectory header stamp) is now converted using current_time.get_clock_type() instead of the implicit RCL_ROS_TIME default.

    * test(autoware_pid_longitudinal_controller): drop clock-type overrides now that current_time flows through unchanged make_time() no longer needs an rcl_clock_type_t parameter, and no test needs to force RCL_ROS_TIME, since PidLongitudinalController no longer implicitly assumes RCL_ROS_TIME for message-derived timestamps. ---------Co-authored-by: Takahisa.Ishikawa <<takahisa.ishikawa@tier4.jp>>

  • test(pid_longitudinal_controller): add unit tests (#13064)

    • test(autoware_pid_longitudinal_controller): add unit tests for PidLongitudinalController

    * test(autoware_pid_longitudinal_controller): trim redundant PidLongitudinalController test cases Removes several overlapping/redundant test cases while keeping the temporal-trajectory coverage (TemporalTrajectoryProducesValidCommand and its make_temporal_trajectory helper), which exercises the use_temporal_trajectory branch in getControlData.

    * test(autoware_pid_longitudinal_controller): assert control_cmd

File truncated at 100 lines see the full file

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged autoware_pid_longitudinal_controller at Robotics Stack Exchange