How to Tune PID, LQR and MPC Control Parameters (matiex_q, reverse_matrix_q and Kp, Ki, Kd) for real car in COMPELTE_AUTO_DRIVE?
I read an understand the procedure of control Tuning, but i have few question. Tune control parameter for actual car。。
- The car should be in (AUTO_DRIVE_MODE)?
- If auto drive mode then it required proper planning trajectory.
- How to change values of (matiex_q, reverse_matrix_q and Kp, Ki, Kd) in real time when the car is moving on auto drive mode? or we need to stop the car and change the value every time.
- These vales can only be change by hit and trial rule?
I am not sure if I really understand your question.
Use PID control for an example, the PID control param is use to just vertical control. And horizontal control used LQR.
- You need to drive a vehicle to get several sets of parameters, this is not on automatic driving mode. The parameters is in "apollo\modules\control\conf\calibration_table.pb.txt".
calibration {
speed: 0.0
acceleration: -1.43
command: -35.0
}
calibration {
speed: 0.0
acceleration: -1.28
command: -27.0
}
...
...
-
When you get there parameters means you make the pid output more easy. For example, if your pid output wants the car to rise from 20km/h to 30km/h, how much throttle should you give? If there is a table, you search from it to get the value. Then the output of the pid is very simple, which means that you fit the car's dynamic curve through the table.
-
Then you adjust the pid param and test the automatic driving mode. Which you said set the car in automatic driving mode and test the param and stop then adjust the param.
station_pid_conf {
integrator_enable: false
integrator_saturation_level: 0.3
kp: 0.2
ki: 0.0
kd: 0.0
}
low_speed_pid_conf {
integrator_enable: true
integrator_saturation_level: 0.3
kp: 2.0
ki: 0.3
kd: 0.0
}
high_speed_pid_conf {
integrator_enable: true
integrator_saturation_level: 0.3
kp: 1.0
ki: 0.3
kd: 0.0
}
- I'm not so sure about the "matrix_q" param, Can anyone else help?
@daohu527, Thanks for response. You are right.
- First , I drive a vehicle to get several sets of parameters by using python data_collector.py. for exp: throttle speed break 15 5 -15 17 5 -17 20 5 -20 25 5 -25 up to 80 5 -80
- second, I create the calibration table by using python files (module/tools/vehicle_callibration) which contains the default values of Kp, Ki, Kd for longitudinal and lateral control. e.g. matrix_q: 0.05 matrix_q: 0.0 matrix_q: 1.0 matrix_q: 0.0 reverse_matrix_q: 0.5 reverse_matrix_q: 0.0 reverse_matrix_q: 0.4 reverse_matrix_q: 0.0
station_pid_conf { integrator_enable: false integrator_saturation_level: 0.3 kp: 0.2 ki: 0.0 kd: 0.0 } low_speed_pid_conf { integrator_enable: true integrator_saturation_level: 0.3 kp: 0.5 ki: 0.3 kd: 0.0 } high_speed_pid_conf { integrator_enable: true integrator_saturation_level: 0.3 kp: 1.0 ki: 0.3 kd: 0.0 } e.g. calibration_table { calibration { speed: 0.0 acceleration: -6.67 command: -50.0 }
QUESTION:
- How do we know which values for Kp. Ki, Kd have better performance for auto_drive?
- Now how to do we change the vales of control gains/ param (matiex_q, reverse_matrix_q and Kp, Ki, Kd)?
@daohu527 How to record a good calibration data? I try many different commands (which start the car and then stop after it reach to speed 5m/s) for e.g. (fix speed) (throttle speed break) 3 5 -3 4 5 -4 5 5 -5 7 5 -7 10 5 -10 12 5 -12 up-to 50 5 -50
But after getting the data and creating calibration table, the Auto Drive car cannot start. what is the problem in calibration file?
Here is a guide How to Tune Control Parameters
@daohu527 , Thank you , we can tune the control parameters in (mosules/control/conf/control_conf.pb.txt) file and restart the Auto Drive car.