ApolloAuto / apollo

An open autonomous driving platform
Apache License 2.0
25.12k stars 9.7k forks source link

MPC control tuning values? #11244

Closed Addi2020 closed 4 years ago

Addi2020 commented 4 years ago
  1. How to tune MPC control (matrix_q:) to get a smooth response of steer, throttle, brake. The issue is heading error is high, so the car move in zigzag motion. (steer is not straight, zigzag motion). In (matrix_q: 1.0) 3rd state is heading error.

  2. How to get cf and cr value for a new car or use default values?

e.g. mpc_controller_conf { ts: 0.01 cf: 155494.663 cr: 155494.663 mass_fl: 526 mass_fr: 509 mass_rl: 354 mass_rr: 341 eps: 0.01 matrix_q: 0.05 matrix_q: 0.0 matrix_q: 1.0 matrix_q: 0.0 matrix_q: 0.0 matrix_q: 0.0 matrix_r: 1.0 matrix_r: 1.0

control_period: 0.01 trajectory_period: 0.1 chassis_period: 0.01 localization_period: 0.01 max_status_interval_sec: 0.1 max_planning_interval_sec: 0.2 max_planning_delay_threshold: 4.0 action: STOP soft_estop_brake: 50.0 active_controllers: MPC_CONTROLLER max_steering_percentage_allowed: 100 minimum_speed_resolution: 0.2 query_relative_time: 0.8 minimum_speed_protection: 0.1 lat_controller_conf { ts: 0.01 preview_window: 0 cf: 155494.663 cr: 155494.663

jilinzhou commented 4 years ago

To get cf and cr (cornering stiffness) is pretty involving. A lot of data under different driving scenarios needs to be collected and some kinds of least square fitting are then used to find them. The value of 155496.663 was originally published in one technical paper and has been referenced and directly used by many other papers and also in apollo for Lincoln MKZ.
Take a look of technical paper "Autonmatic Steering Methods for Autonomous Automobile Path Tracking" by Jarrod M. Snider. Section 4.1.3 explains how to identify model parameters including cf and cf.

Addi2020 commented 4 years ago

@jilinzhou .. Thank you for response. I use the default values for cf and cr is ok. cf: 155494.663 cr: 155494.663

The problem is that is am trying to control steer, I am trying MPC and LQR tuning , set differetn vlaues for matrix_q, but still the steer is not stable. it give heading error.

How to get a stable response, with zero heading error? what are the best tuning values for MPC or LQR?

lat_controller_conf { ts: 0.01 preview_window: 0 cf: 155494.663 cr: 155494.663 mass_fl: 547 mass_fr: 525 mass_rl: 552 mass_rr: 531 eps: 0.01 matrix_q: 0.3 matrix_q: 0.0 matrix_q: 1.8 matrix_q: 0.0

mpc_controller_conf { ts: 0.01 cf: 155494.663 cr: 155494.663 mass_fl: 520 mass_fr: 520 mass_rl: 520 mass_rr: 520 eps: 0.01 matrix_q: 0.05 matrix_q: 0.0 matrix_q: 1.0 matrix_q: 0.0 matrix_q: 0.0 matrix_q: 0.0 matrix_r: 1.0 matrix_r: 1.0 cutoff_freq: 10