No version for distro humble. Known supported distros are highlighted in the buttons above.
No version for distro jazzy. Known supported distros are highlighted in the buttons above.
No version for distro rolling. Known supported distros are highlighted in the buttons above.

autoware_smart_mpc_trajectory_follower package from autoware_universe repo

autoware_adapi_specs autoware_agnocast_wrapper autoware_auto_common autoware_component_interface_specs_universe autoware_component_interface_tools autoware_component_interface_utils autoware_cuda_dependency_meta autoware_fake_test_node autoware_glog_component autoware_goal_distance_calculator autoware_grid_map_utils autoware_path_distance_calculator autoware_polar_grid autoware_time_utils 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_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_trajectory_follower_base autoware_trajectory_follower_node autoware_vehicle_cmd_gate autoware_control_evaluator autoware_kinematic_evaluator autoware_localization_evaluator autoware_perception_online_evaluator autoware_planning_evaluator autoware_scenario_simulator_v2_adapter tier4_autoware_api_launch tier4_control_launch tier4_localization_launch tier4_map_launch tier4_perception_launch tier4_planning_launch tier4_sensing_launch tier4_simulator_launch tier4_system_launch tier4_vehicle_launch autoware_geo_pose_projector autoware_gyro_odometer autoware_ar_tag_based_localizer autoware_landmark_manager autoware_lidar_marker_localizer autoware_localization_error_monitor autoware_ndt_scan_matcher autoware_pose2twist autoware_pose_covariance_modifier autoware_pose_estimator_arbiter autoware_pose_initializer autoware_pose_instability_detector yabloc_common yabloc_image_processing yabloc_monitor yabloc_particle_filter yabloc_pose_initializer autoware_lanelet2_map_visualizer autoware_map_height_fitter autoware_map_tf_generator autoware_bytetrack 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_image_projection_based_fusion autoware_lidar_apollo_instance_segmentation autoware_lidar_centerpoint autoware_lidar_transfusion autoware_map_based_prediction autoware_multi_object_tracker autoware_object_merger autoware_object_range_splitter autoware_object_velocity_splitter autoware_occupancy_grid_map_outlier_filter autoware_probabilistic_occupancy_grid_map autoware_radar_crossing_objects_noise_filter autoware_radar_fusion_to_detected_object autoware_radar_object_clustering autoware_radar_object_tracker autoware_radar_tracks_msgs_converter autoware_raindrop_cluster_filter autoware_shape_estimation autoware_simple_object_merger autoware_tensorrt_classifier autoware_tensorrt_common 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_selector autoware_traffic_light_visualization perception_utils autoware_costmap_generator autoware_external_velocity_limit_selector autoware_freespace_planner autoware_freespace_planning_algorithms autoware_mission_planner_universe autoware_obstacle_cruise_planner autoware_obstacle_stop_planner autoware_path_optimizer autoware_path_smoother autoware_planning_validator autoware_remaining_distance_time_calculator autoware_rtc_interface autoware_scenario_selector autoware_surround_obstacle_checker autoware_behavior_path_avoidance_by_lane_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_rtc_interface autoware_behavior_velocity_run_out_module 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_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_bezier_sampler autoware_frenet_planner autoware_path_sampler autoware_sampler_common autoware_cuda_pointcloud_preprocessor autoware_cuda_utils autoware_image_diagnostics autoware_image_transport_decompressor autoware_imu_corrector autoware_pcl_extensions autoware_pointcloud_preprocessor autoware_radar_scan_to_pointcloud2 autoware_radar_static_pointcloud_filter autoware_radar_threshold_filter autoware_radar_tracks_noise_filter autoware_livox_tag_filter autoware_carla_interface autoware_dummy_perception_publisher autoware_fault_injection autoware_learning_based_vehicle_model autoware_simple_planning_simulator autoware_vehicle_door_simulator tier4_dummy_object_rviz_plugin autoware_bluetooth_monitor autoware_component_monitor autoware_component_state_monitor autoware_default_adapi autoware_adapi_adaptors autoware_adapi_visualizers autoware_automatic_pose_initializer autoware_diagnostic_graph_aggregator autoware_diagnostic_graph_utils autoware_dummy_diag_publisher autoware_dummy_infrastructure autoware_duplicated_node_checker autoware_hazard_status_converter autoware_mrm_comfortable_stop_operator autoware_mrm_emergency_stop_operator autoware_mrm_handler autoware_processing_time_checker autoware_system_diagnostic_monitor autoware_system_monitor autoware_topic_relay_controller autoware_topic_state_monitor autoware_velodyne_monitor reaction_analyzer 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_mission_details_overlay_rviz_plugin autoware_overlay_rviz_plugin autoware_string_stamped_rviz_plugin autoware_perception_rviz_plugin tier4_adapi_rviz_plugin tier4_camera_view_rviz_plugin tier4_datetime_rviz_plugin tier4_localization_rviz_plugin tier4_planning_factor_rviz_plugin tier4_planning_rviz_plugin tier4_state_rviz_plugin tier4_system_rviz_plugin tier4_traffic_light_rviz_plugin tier4_vehicle_rviz_plugin

Package Summary

Tags No category tags.
Version 0.43.0
License Apache License 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/autowarefoundation/autoware_universe.git
VCS Type git
VCS Version main
Last Updated 2025-04-03
Dev Status UNMAINTAINED
CI status No Continuous Integration
Released UNRELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

Nodes to follow a trajectory by generating control commands using smart mpc

Additional Links

No additional links.

Maintainers

  • Masayuki Aino
  • Kosuke Takeuchi
  • Takamasa Horibe
  • Takayuki Murooka

Authors

  • Masayuki Aino

Smart MPC Trajectory Follower

Smart MPC (Model Predictive Control) is a control algorithm that combines model predictive control and machine learning. While inheriting the advantages of model predictive control, it solves its disadvantage of modeling difficulty with a data-driven method using machine learning.

This technology makes it relatively easy to operate model predictive control, which is expensive to implement, as long as an environment for collecting data can be prepared.

</a> </p> ## Provided features This package provides smart MPC logic for path-following control as well as mechanisms for learning and evaluation. These features are described below. ### Trajectory following control based on iLQR/MPPI The control mode can be selected from "ilqr", "mppi", or "mppi_ilqr", and can be set as `mpc_parameter:system:mode` in [mpc_param.yaml](./autoware_smart_mpc_trajectory_follower/param/mpc_param.yaml). In "mppi_ilqr" mode, the initial value of iLQR is given by the MPPI solution. > [!NOTE] > With the default settings, the performance of "mppi" mode is limited due to an insufficient number of samples. This issue is being addressed with ongoing work to introduce GPU support. To perform a simulation, run the following command: ```bash ros2 launch autoware_launch planning_simulator.launch.xml map_path:=$HOME/autoware_map/sample-map-planning vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kit trajectory_follower_mode:=smart_mpc_trajectory_follower ``` > [!NOTE] > When running with the nominal model set in [nominal_param.yaml](./autoware_smart_mpc_trajectory_follower/param/nominal_param.yaml), set `trained_model_parameter:control_application:use_trained_model` to `false` in [trained_model_param.yaml](./autoware_smart_mpc_trajectory_follower/param/trained_model_param.yaml). To run using the trained model, set `trained_model_parameter:control_application:use_trained_model` to `true`, but the trained model must have been generated according to the following procedure. ### Training of model and reflection in control To obtain training data, start autoware, perform a drive, and record rosbag data with the following commands. ```bash ros2 bag record /localization/kinematic_state /localization/acceleration /vehicle/status/steering_status /control/command/control_cmd /control/trajectory_follower/control_cmd /control/trajectory_follower/lane_departure_checker_node/debug/deviation/lateral /control/trajectory_follower/lane_departure_checker_node/debug/deviation/yaw /system/operation_mode/state /vehicle/status/control_mode /sensing/imu/imu_data /debug_mpc_x_des /debug_mpc_y_des /debug_mpc_v_des /debug_mpc_yaw_des /debug_mpc_acc_des /debug_mpc_steer_des /debug_mpc_X_des_converted /debug_mpc_x_current /debug_mpc_error_prediction /debug_mpc_max_trajectory_err /debug_mpc_emergency_stop_mode /debug_mpc_goal_stop_mode /debug_mpc_total_ctrl_time /debug_mpc_calc_u_opt_time ``` Move [rosbag2.bash](./autoware_smart_mpc_trajectory_follower/training_and_data_check/rosbag2.bash) to the rosbag directory recorded above and execute the following command on the directory ```bash bash rosbag2.bash ``` This converts rosbag data into CSV format for training models. > [!NOTE] > Note that a large number of terminals are automatically opened at runtime, but they are automatically closed after rosbag data conversion is completed. > From the time you begin this process until all terminals are closed, autoware should not be running. Instead, the same result can be obtained by executing the following command in a python environment: ```python from autoware_smart_mpc_trajectory_follower.training_and_data_check import train_drive_NN_model model_trainer = train_drive_NN_model.train_drive_NN_model() model_trainer.transform_rosbag_to_csv(rosbag_dir) ``` Here, `rosbag_dir` represents the rosbag directory. At this time, all CSV files in `rosbag_dir` are automatically deleted first. We move on to an explanation of how the model is trained. If `trained_model_parameter:memory_for_training:use_memory_for_training` in [trained_model_param.yaml](./autoware_smart_mpc_trajectory_follower/param/trained_model_param.yaml) is set to `true`, training is performed on models that include LSTM, and if it is set to `false`, training is performed on models that do not include LSTM. When using LSTM, cell states and hidden states are updated based on historical time series data and reflected in the prediction. The paths of the rosbag directories used for training and validation, `dir_0`, `dir_1`, `dir_2`,..., `dir_val_0`, `dir_val_1`, `dir_val_2`,... and the directory `save_dir` where you save the models, the model can be saved in the python environment as follows: ```python from autoware_smart_mpc_trajectory_follower.training_and_data_check import train_drive_NN_model model_trainer = train_drive_NN_model.train_drive_NN_model() model_trainer.add_data_from_csv(dir_0, add_mode="as_train") model_trainer.add_data_from_csv(dir_1, add_mode="as_train") model_trainer.add_data_from_csv(dir_2, add_mode="as_train") ... model_trainer.add_data_from_csv(dir_val_0, add_mode="as_val") model_trainer.add_data_from_csv(dir_val_1, add_mode="as_val") model_trainer.add_data_from_csv(dir_val_2, add_mode="as_val") ... model_trainer.get_trained_model() model_trainer.save_models(save_dir) ``` If `add_mode` is not specified or validation data is not added, the training data is split to be used for training and validation. After performing the polynomial regression, the NN can be trained on the residuals as follows: ```python model_trainer.get_trained_model(use_polynomial_reg=True) ``` > [!NOTE] > In the default setting, regression is performed by several preselected polynomials. > When `use_selected_polynomial=False` is set as the argument of get_trained_model, the `deg` argument allows setting the maximum degree of the polynomial to be used. If only polynomial regression is performed and no NN model is used, run the following command: ```python model_trainer.get_trained_model(use_polynomial_reg=True,force_NN_model_to_zero=True) ``` Move `model_for_test_drive.pth` and `polynomial_reg_info.npz` saved in `save_dir` to the home directory and set `trained_model_parameter:control_application:use_trained_model` in [trained_model_param.yaml](./autoware_smart_mpc_trajectory_follower/param/trained_model_param.yaml) to `true` to reflect the trained model in the control. ### Performance evaluation Here, as an example, we describe the verification of the adaptive performance when the wheel base of the sample_vehicle is 2.79 m, but an incorrect value of 2.0 m is given to the controller side. To give the controller 2.0 m as the wheel base, set the value of `nominal_parameter:vehicle_info:wheel_base` in [nominal_param.yaml](./autoware_smart_mpc_trajectory_follower/param/nominal_param.yaml) to 2.0, and run the following command: ```bash python3 -m smart_mpc_trajectory_follower.clear_pycache ``` #### Test on autoware To perform a control test on autoware with the nominal model before training, make sure that `trained_model_parameter:control_application:use_trained_model` in [trained_model_param.yaml](./autoware_smart_mpc_trajectory_follower/param/trained_model_param.yaml) is `false` and launch autoware in the manner described in "Trajectory following control based on iLQR/MPPI". This time, the following route will be used for the test:

Record rosbag and train the model in the manner described in "Training of model and reflection in control", and move the generated files `model_for_test_drive.pth` and `polynomial_reg_info.npz` to the home directory. Sample models, which work under the condition that`trained_model_parameter:memory_for_training:use_memory_for_training` in [trained_model_param.yaml](./autoware_smart_mpc_trajectory_follower/param/trained_model_param.yaml) is set to `true`, can be obtained at [sample_models/wheel_base_changed](./sample_models/wheel_base_changed/). > [!NOTE] > Although the data used for training is small, for the sake of simplicity, we will see how much performance can be improved with this amount of data. To control using the trained model obtained here, set `trained_model_parameter:control_application:use_trained_model` to `true`, start autoware in the same way, and drive the same route recording rosbag. After the driving is complete, convert the rosbag file to CSV format using the method described in "Training of model and reflection in control". A plot of the lateral deviation is obtained by running the `lateral_error_visualize` function in `control/autoware_smart_mpc_trajectory_follower/autoware_smart_mpc_trajectory_follower/training_and_data_check/data_checker.ipynb` for the nominal and training model rosbag files `rosbag_nominal` and `rosbag_trained`, respectively, as follows: ```python lateral_error_visualize(dir_name=rosbag_nominal,ylim=[-1.2,1.2]) lateral_error_visualize(dir_name=rosbag_trained,ylim=[-1.2,1.2]) ``` The following results were obtained.
#### Test on python simulator First, to give wheel base 2.79 m in the python simulator, create the following file and save it in `control/autoware_smart_mpc_trajectory_follower/autoware_smart_mpc_trajectory_follower/python_simulator` with the name `sim_setting.json`: ```json { "wheel_base": 2.79 } ``` Next, after moving to `control/autoware_smart_mpc_trajectory_follower/autoware_smart_mpc_trajectory_follower/python_simulator`, run the following commands to test the slalom driving on the python simulator with the nominal control: ```bash python3 run_python_simulator.py nominal_test ``` The result of the driving is stored in `test_python_nominal_sim`. The following results were obtained.

The center of the upper row represents the lateral deviation. Run the following commands to perform training using figure eight driving data under the control of pure pursuit. To perform training using a figure eight driving and driving based on the obtained model, run the following commands: ```bash python3 run_python_simulator.py ``` The result of the driving is stored in `test_python_trined_sim`. When `trained_model_parameter:memory_for_training:use_memory_for_training` in [trained_model_param.yaml](./autoware_smart_mpc_trajectory_follower/param/trained_model_param.yaml) is set to `true`, the following results were obtained.

When `trained_model_parameter:memory_for_training:use_memory_for_training` in [trained_model_param.yaml](./autoware_smart_mpc_trajectory_follower/param/trained_model_param.yaml) is set to `false`, the following results were obtained.

It can be seen that the lateral deviation has improved significantly. However, the difference in driving with and without LSTM is not very apparent. To see the difference, for example, we can experiment with parameters such as steer_time_delay. First, to restore nominal model settings to default values, set the value of `nominal_parameter:vehicle_info:wheel_base` in [nominal_param.yaml](./autoware_smart_mpc_trajectory_follower/param/nominal_param.yaml) to 2.79, and run the following command: ```bash python3 -m smart_mpc_trajectory_follower.clear_pycache ``` Next, modify `sim_setting.json` as follows: ```json { "steer_time_delay": 1.01 } ``` In this way, an experiment is performed when `steer_time_delay` is set to 1.01 sec. The result of the driving using the nominal model is as follows:

The result of the driving using the trained model with LSTM is as follows:

The result of the driving using the trained model without LSTM is as follows:

It can be seen that the performance with the model that includes LSTM is significantly better than with the model that does not. The parameters that can be passed to the python simulator are as follows. | Parameter | Type | Description | | ------------------------ | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | steer_bias | float | steer bias [rad] | | steer_rate_lim | float | steer rate limit [rad/s] | | vel_rate_lim | float | acceleration limit [m/s^2] | | wheel_base | float | wheel base [m] | | steer_dead_band | float | steer dead band [rad] | | adaptive_gear_ratio_coef | list[float] | List of floats of length 6 specifying information on speed-dependent gear ratios from tire angle to steering wheel angle. | | acc_time_delay | float | acceleration time delay [s] | | steer_time_delay | float | steer time delay [s] | | acc_time_constant | float | acceleration time constant [s] | | steer_time_constant | float | steer time constant [s] | | accel_map_scale | float | Parameter that magnifies the corresponding distortion from acceleration input values to actual acceleration realizations.
Correspondence information is kept in `control/autoware_smart_mpc_trajectory_follower/autoware_smart_mpc_trajectory_follower/python_simulator/accel_map.csv`. | | acc_scaling | float | acceleration scaling | | steer_scaling | float | steer scaling | | vehicle_type | int | Take values from 0 to 4 for pre-designed vehicle types.
A description of each vehicle type is given below. | For example, to give the simulation side 0.01 [rad] of steer bias and 0.001 [rad] of steer dead band, edit the `sim_setting.json` as follows. ```json { "steer_bias": 0.01, "steer_dead_band": 0.001 } ``` ##### vehicle_type_0 This vehicle type matches the default vehicle type used in the control. | Parameter | value | | ------------------- | ----- | | wheel_base | 2.79 | | acc_time_delay | 0.1 | | steer_time_delay | 0.27 | | acc_time_constant | 0.1 | | steer_time_constant | 0.24 | | acc_scaling | 1.0 | ##### vehicle_type_1 This vehicle type is intended for a heavy bus. | Parameter | value | | ------------------- | ----- | | wheel_base | 4.76 | | acc_time_delay | 1.0 | | steer_time_delay | 1.0 | | acc_time_constant | 1.0 | | steer_time_constant | 1.0 | | acc_scaling | 0.2 | ##### vehicle_type_2 This vehicle type is intended for a light bus. | Parameter | value | | ------------------- | ----- | | wheel_base | 4.76 | | acc_time_delay | 0.5 | | steer_time_delay | 0.5 | | acc_time_constant | 0.5 | | steer_time_constant | 0.5 | | acc_scaling | 0.5 | ##### vehicle_type_3 This vehicle type is intended for a small vehicle. | Parameter | value | | ------------------- | ----- | | wheel_base | 1.335 | | acc_time_delay | 0.3 | | steer_time_delay | 0.3 | | acc_time_constant | 0.3 | | steer_time_constant | 0.3 | | acc_scaling | 1.5 | ##### vehicle_type_4 This vehicle type is intended for a small robot. | Parameter | value | | ------------------- | ----- | | wheel_base | 0.395 | | acc_time_delay | 0.2 | | steer_time_delay | 0.2 | | acc_time_constant | 0.2 | | steer_time_constant | 0.2 | | acc_scaling | 1.0 | #### Auto test on python simulator Here, we describe a method for testing adaptive performance by giving the simulation side a predefined range of model parameters while the control side is given constant model parameters. To run a driving experiment within the parameter change range set in [run_sim.py](./autoware_smart_mpc_trajectory_follower/python_simulator/run_sim.py), for example, move to `control/autoware_smart_mpc_trajectory_follower/autoware_smart_mpc_trajectory_follower/python_simulator` and run the following command: ```bash python3 run_sim.py --param_name steer_bias ``` Here we described the experimental procedure for steer bias, and the same method can be used for other parameters. To run the test for all parameters except limits at once, run the following command: ```bash python3 run_auto_test.py ``` The results are stored in the `auto_test` directory. After the executions were completed, the following results were obtained by running [plot_auto_test_result.ipynb](./autoware_smart_mpc_trajectory_follower/python_simulator/plot_auto_test_result.ipynb):

The orange line shows the intermediate model trained using pure pursuit figure eight drive, and the blue line shows the final model trained using data from both the intermediate model and the figure eight drive. In most cases, sufficient performance is obtained, but for `vehicle_type_1`, which is intended for a heavy bus, a lateral deviation of about 2 m was observed, which is not satisfactory. In `run_sim.py`, the following parameters can be set: | Parameter | Type | Description | | ------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | USE_TRAINED_MODEL_DIFF | bool | Whether the derivative of the trained model is reflected in the control | | DATA_COLLECTION_MODE | DataCollectionMode | Which method will be used to collect the training data 
"DataCollectionMode.ff": Straight line driving with feed-forward input
"DataCollectionMode.pp": Figure eight driving with pure pursuit control
"DataCollectionMode.mpc": Slalom driving with mpc | | USE_POLYNOMIAL_REGRESSION | bool | Whether to perform polynomial regression before NN | | USE_SELECTED_POLYNOMIAL | bool | When USE_POLYNOMIAL_REGRESSION is True, perform polynomial regression using only some preselected polynomials.
The choice of polynomials is intended to be able to absorb the contribution of some parameter shifts based on the nominal model of the vehicle. | | FORCE_NN_MODEL_TO_ZERO | bool | Whether to force the NN model to zero (i.e., erase the contribution of the NN model).
When USE_POLYNOMIAL_REGRESSION is True, setting FORCE_MODEL_TO_ZERO to True allows the control to reflect the results of polynomial regression only, without using NN models. | | FIT_INTERCEPT | bool | Whether to include bias in polynomial regression.
If it is False, perform the regression with a polynomial of the first degree or higher. | | USE_INTERCEPT | bool | When a polynomial regression including bias is performed, whether to use or discard the resulting bias information.
It is meaningful only if FIT_INTERCEPT is True.
If it is False, discard the bias in the polynomial regression in the hope that the NN model can remove the bias term, even if the polynomial regression is performed with the bias included. | > [!NOTE] > When `run_sim.py` is run, the `use_trained_model_diff` set in `run_sim.py` takes precedence over the `trained_model_parameter:control_application:use_trained_model_diff` set in [trained_model_param.yaml](./autoware_smart_mpc_trajectory_follower/param/trained_model_param.yaml). #### Kernel density estimation of pure pursuit driving data The distribution of data obtained from pure pursuit runs can be displayed using Kernel density estimation. To do this, run [density_estimation.ipynb](./autoware_smart_mpc_trajectory_follower/python_simulator/density_estimation.ipynb). The correlation between the minimum value of the density estimate and the lateral deviation of the run results is low. A scalar indicator that better predicts the value of lateral deviation is under development. ## Change of nominal parameters and their reloading The nominal parameters of vehicle model can be changed by editing the file [nominal_param.yaml](./autoware_smart_mpc_trajectory_follower/param/nominal_param.yaml). After changing the nominal parameters, the cache must be deleted by running the following command: ```bash python3 -m smart_mpc_trajectory_follower.clear_pycache ``` The nominal parameters include the following: | Parameter | Type | Description | | ------------------------------------------------ | ----- | ------------------------------ | | nominal_parameter:vehicle_info:wheel_base | float | wheel base [m] | | nominal_parameter:acceleration:acc_time_delay | float | acceleration time delay [s] | | nominal_parameter:acceleration:acc_time_constant | float | acceleration time constant [s] | | nominal_parameter:steering:steer_time_delay | float | steer time delay [s] | | nominal_parameter:steering:steer_time_constant | float | steer time constant [s] | ## Change of control parameters and their reloading The control parameters can be changed by editing files [mpc_param.yaml](./autoware_smart_mpc_trajectory_follower/param/mpc_param.yaml) and [trained_model_param.yaml](./autoware_smart_mpc_trajectory_follower/param/trained_model_param.yaml). Although it is possible to reflect parameter changes by restarting autoware, the following command allows us to do so without leaving autoware running: ```bash ros2 topic pub /pympc_reload_mpc_param_trigger std_msgs/msg/String "data: ''" --once ``` The main parameters among the control parameters are as follows. ### `mpc_param.yaml` | Parameter | Type | Description | | ------------------------------------------ | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | mpc_parameter:system:mode | str | control mode
"ilqr": iLQR mode
"mppi": MPPI mode
"mppi_ilqr": the initial value of iLQR is given by the MPPI solution. | | mpc_parameter:cost_parameters:Q | list[float] | Stage cost for states.
List of length 8, in order: straight deviation, lateral deviation, velocity deviation, yaw angle deviation, acceleration deviation, steer deviation, acceleration input deviation, steer input deviation cost weights. | | mpc_parameter:cost_parameters:Q_c | list[float] | Cost in the horizon corresponding to the following timing_Q_c for the states.
The correspondence of the components of the list is the same as for Q. | | mpc_parameter:cost_parameters:Q_f | list[float] | Termination cost for the states.
The correspondence of the components of the list is the same as for Q. | | mpc_parameter:cost_parameters:R | list[float] | A list of length 2 where R[0] is weight of cost for the change rate of acceleration input value and R[1] is weight of cost for the change rate of steer input value. | | mpc_parameter:mpc_setting:timing_Q_c | list[int] | Horizon numbers such that the stage cost for the states is set to Q_c. | | mpc_parameter:compensation:acc_fb_decay | float | Coefficient of damping in integrating the error between the observed and predicted acceleration values in the compensator outside the MPC. | | mpc_parameter:compensation:acc_fb_gain | float | Gain of acceleration compensation. | | mpc_parameter:compensation:max_error_acc | float | Maximum acceleration compensation (m/s^2) | | mpc_parameter:compensation:steer_fb_decay | float | Coefficient of damping in integrating the error between the observed and predicted steering values in the compensator outside the MPC. | | mpc_parameter:compensation:steer_fb_gain | float | Gain of steering compensation. | | mpc_parameter:compensation:max_error_steer | float | Maximum steering compensation (rad) | ### `trained_model_param.yaml` | Parameter | Type | Description | | ------------------------------------------------------------------- | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | trained_model_parameter:control_application:use_trained_model | bool | Whether the trained model is reflected in the control or not. | | trained_model_parameter:control_application:use_trained_model_diff | bool | Whether the derivative of the trained model is reflected on the control or not.
It is meaningful only when use_trained_model is True, and if False, the nominal model is used for the derivative of the dynamics, and trained model is used only for prediction. | | trained_model_parameter:memory_for_training:use_memory_for_training | bool | Whether to use the model that includes LSTM for learning or not. | | trained_model_parameter:memory_for_training:use_memory_diff | bool | Whether the derivative with respect to the cell state and hidden state at the previous time of LSTM is reflected in the control or not. | ## Request to release the slow stop mode If the predicted trajectory deviates too far from the target trajectory, the system enters a slow stop mode and the vehicle stops moving. To cancel the slow stop mode and make the vehicle ready to run again, run the following command: ```bash ros2 topic pub /pympc_stop_mode_reset_request std_msgs/msg/String "data: ''" --once ``` ## Limitation - May not be able to start when initial position/posture is far from the target. - It may take some time until the end of the planning to compile numba functions at the start of the first control. - In the stopping action near the goal our control switches to another simple control law. As a result, the stopping action may not work except near the goal. Stopping is also difficult if the acceleration map is significantly shifted. - If the dynamics deviates too much from the nominal model, as in `vehicle_type_1`, which is intended for heavy buses, it may not be well controlled.

CHANGELOG

Changelog for package autoware_smart_mpc_trajectory_follower

0.43.0 (2025-03-21)

  • Merge remote-tracking branch 'origin/main' into chore/bump-version-0.43
  • chore: rename from [autoware.universe]{.title-ref} to [autoware_universe]{.title-ref} (#10306)
  • Contributors: Hayato Mizushima, Yutaka Kondo

0.42.0 (2025-03-03)

  • Merge remote-tracking branch 'origin/main' into tmp/bot/bump_version_base
  • feat(autoware_utils): replace autoware_universe_utils with autoware_utils (#10191)
  • Contributors: Fumiya Watanabe, 心刚

0.41.2 (2025-02-19)

  • chore: bump version to 0.41.1 (#10088)
  • Contributors: Ryohsuke Mitsudome

0.41.1 (2025-02-10)

0.41.0 (2025-01-29)

  • Merge remote-tracking branch 'origin/main' into tmp/bot/bump_version_base
  • feat: tier4_debug_msgs changed to autoware_internal_debug_msgs in fil… (#9851)
  • Contributors: Fumiya Watanabe, Vishal Chauhan

0.40.0 (2024-12-12)

  • Merge branch 'main' into release-0.40.0
  • Revert "chore(package.xml): bump version to 0.39.0 (#9587)" This reverts commit c9f0f2688c57b0f657f5c1f28f036a970682e7f5.
  • fix: fix ticket links in CHANGELOG.rst (#9588)
  • chore(package.xml): bump version to 0.39.0 (#9587)
    • chore(package.xml): bump version to 0.39.0
    • fix: fix ticket links in CHANGELOG.rst

    * fix: remove unnecessary diff ---------Co-authored-by: Yutaka Kondo <<yutaka.kondo@youtalk.jp>>

  • fix: fix ticket links in CHANGELOG.rst (#9588)
  • fix(cpplint): include what you use - control (#9565)
  • fix(autoware_smart_mpc_trajectory_follower): fix clang-diagnostic-ignored-optimization-argument (#9437)
  • 0.39.0
  • update changelog
  • fix: fix ticket links to point to https://github.com/autowarefoundation/autoware_universe (#9304)
  • fix: fix ticket links to point to https://github.com/autowarefoundation/autoware_universe (#9304)
  • chore(package.xml): bump version to 0.38.0 (#9266) (#9284)
    • unify package.xml version to 0.37.0
    • remove system_monitor/CHANGELOG.rst
    • add changelog

    * 0.38.0

  • Contributors: Esteve Fernandez, Fumiya Watanabe, M. Fatih Cırıt, Ryohsuke Mitsudome, Ryuta Kambe, Yutaka Kondo

0.39.0 (2024-11-25)

0.38.0 (2024-11-08)

  • unify package.xml version to 0.37.0
  • fix(autoware_smart_mpc_trajectory_follower): fix unusedFunction (#8553) fix:unusedFunction
  • fix(autoware_smart_mpc_trajectory_follower): fix uninitMemberVar (#8346) fix: uninitMemberVar Co-authored-by: kobayu858 <<129580202+kobayu858@users.noreply.github.com>>
  • refactor(smart_mpc_trajectory_folower): modify pacakge structure and install without setup.py (#8268)
    • refactor(smart_mpc_trajectory_follower): modify pacakge structure and install without setup.py
    • import proxima calc
    • use ament_get_python_install_dir
    • add <depend>python3-torch</depend>
    • remove pip from readme
    • remove str conversion from open

    * sort in cmake ---------

  • feat(smart_mpc_trajectory_follower): enhance performance with LSTM and compensation, add compensator outside of MPC (#7696)
    • update smart mpc package

    * Update control/autoware_smart_mpc_trajectory_follower/autoware_smart_mpc_trajectory_follower/python_simulator/data_collection_utils.py Co-authored-by: Kosuke Takeuchi <<kosuke.tnp@gmail.com>> * Update control/autoware_smart_mpc_trajectory_follower/autoware_smart_mpc_trajectory_follower/python_simulator/data_collection_utils.py Co-authored-by: Kosuke Takeuchi <<kosuke.tnp@gmail.com>> * Update control/autoware_smart_mpc_trajectory_follower/autoware_smart_mpc_trajectory_follower/scripts/proxima_calc.cpp Co-authored-by: Kosuke Takeuchi <<kosuke.tnp@gmail.com>> * Update control/autoware_smart_mpc_trajectory_follower/autoware_smart_mpc_trajectory_follower/scripts/drive_iLQR.py Co-authored-by: Kosuke Takeuchi <<kosuke.tnp@gmail.com>> * Update control/autoware_smart_mpc_trajectory_follower/autoware_smart_mpc_trajectory_follower/python_simulator/pure_pursuit_gain_updater.py Co-authored-by: Kosuke Takeuchi <<kosuke.tnp@gmail.com>> * Update control/autoware_smart_mpc_trajectory_follower/autoware_smart_mpc_trajectory_follower/scripts/proxima_calc.cpp Co-authored-by: Kosuke Takeuchi <<kosuke.tnp@gmail.com>> * Update control/autoware_smart_mpc_trajectory_follower/autoware_smart_mpc_trajectory_follower/python_simulator/pure_pursuit_gain_updater.py Co-authored-by: Kosuke Takeuchi <<kosuke.tnp@gmail.com>>

    • style(pre-commit): autofix
    • modified commentout
    • fixed duplicate conditions in run_auto_test.py
    • doc: add description of kernel density estimation
    • rename some parameters and remove unnecessary parameters
    • style(pre-commit): autofix
    • Fixed links in README.md
    • add a sample of trained models
    • style(pre-commit): autofix
    • doc: remove japanese comment
    • update README.md
    • add whitespace

    * Update control/autoware_smart_mpc_trajectory_follower/autoware_smart_mpc_trajectory_follower/python_simulator/pure_pursuit_gain_updater.py Co-authored-by: Kosuke Takeuchi <<kosuke.tnp@gmail.com>> * Update control/autoware_smart_mpc_trajectory_follower/autoware_smart_mpc_trajectory_follower/scripts/drive_mppi.py Co-authored-by: Kosuke Takeuchi <<kosuke.tnp@gmail.com>>

    • style(pre-commit): autofix
    • Some files were refactored
    • const on member functions that do not change member variables

    * bug fixed ---------Co-authored-by: Kosuke Takeuchi <<kosuke.tnp@gmail.com>> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]\@users.noreply.github.com> Co-authored-by: asei-proxima <<asei.inoue@proxima-ai-tech.com>>

  • fix(smart_mpc_trajectory_folower): fix running by adding control_state and changing msg/package_name (#7666)
  • refactor(motion_utils)!: add autoware prefix and include dir (#7539) refactor(motion_utils): add autoware prefix and include dir
  • feat(autoware_universe_utils)!: rename from tier4_autoware_utils (#7538) Co-authored-by: kosuke55 <<kosuke.tnp@gmail.com>>
  • ci(pre-commit): autoupdate (#7499) Co-authored-by: M. Fatih Cırıt <<mfc@leodrive.ai>>
  • chore(smart_mpc_trajectory_follower): add prefix autoware_ to smart_mpc_trajectory_follower (#7367)
    • add prefix

    * fix pre-commit ---------

  • Contributors: Go Sakayori, Hayate TOBA, Kosuke Takeuchi, Takayuki Murooka, Yutaka Kondo, awf-autoware-bot[bot], kobayu858, masayukiaino

0.26.0 (2024-04-03)

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged autoware_smart_mpc_trajectory_follower at Robotics Stack Exchange

No version for distro noetic. Known supported distros are highlighted in the buttons above.
No version for distro ardent. Known supported distros are highlighted in the buttons above.
No version for distro bouncy. Known supported distros are highlighted in the buttons above.
No version for distro crystal. Known supported distros are highlighted in the buttons above.
No version for distro eloquent. Known supported distros are highlighted in the buttons above.
No version for distro dashing. Known supported distros are highlighted in the buttons above.
No version for distro galactic. Known supported distros are highlighted in the buttons above.
No version for distro foxy. Known supported distros are highlighted in the buttons above.
No version for distro iron. Known supported distros are highlighted in the buttons above.
No version for distro lunar. Known supported distros are highlighted in the buttons above.
No version for distro jade. Known supported distros are highlighted in the buttons above.
No version for distro indigo. Known supported distros are highlighted in the buttons above.
No version for distro hydro. Known supported distros are highlighted in the buttons above.
No version for distro kinetic. Known supported distros are highlighted in the buttons above.
No version for distro melodic. Known supported distros are highlighted in the buttons above.