PID
commonroad_control.control.pid.pid_control
PIDControl
Bases: ControllerInterface
Source code in commonroad_control/control/pid/pid_control.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |
delta_t
property
Returns:
| Type | Description |
|---|---|
float
|
controller sampling time in seconds |
kd
property
Returns:
| Type | Description |
|---|---|
float
|
derivative gain |
ki
property
Returns:
| Type | Description |
|---|---|
float
|
integral gain |
kp
property
Returns:
| Type | Description |
|---|---|
float
|
proportional gain |
__init__(kp, ki, kd, delta_t)
PID controller
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kp
|
float
|
proportional gain |
required |
ki
|
float
|
integral gain |
required |
kd
|
float
|
derivative gain |
required |
delta_t
|
float
|
controller sampling time in seconds |
required |
Source code in commonroad_control/control/pid/pid_control.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
compute_control_input(measured_output, reference_output)
Computes control output given the measured and the reference output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
measured_output
|
float
|
measured single output |
required |
reference_output
|
float
|
reference single output |
required |
Returns:
| Type | Description |
|---|---|
float
|
control input |
Source code in commonroad_control/control/pid/pid_control.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
reset()
Reset running error values
Source code in commonroad_control/control/pid/pid_control.py
69 70 71 72 73 74 | |
commonroad_control.control.pid.pid_long_lat
PIDLongLat
Bases: ControllerInterface
PID-based controller that combines two PID controllers for decoupled longitudinal and lateral control. The longitudinal controller tracks a given velocity profile (by adapting the long. acceleration) and the lateral controller reduces the lateral offset from the reference trajectory (by adapting the steering angle velocity).
Source code in commonroad_control/control/pid/pid_long_lat.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
delta_t
property
Returns:
| Type | Description |
|---|---|
float
|
controller sampling time in seconds used for both PID controllers |
lateral_pid
property
Returns:
| Type | Description |
|---|---|
PIDControl
|
lateral PID controller |
longitudinal_pid
property
Returns:
| Type | Description |
|---|---|
PIDControl
|
longitudinal PID controller |
__init__(kp_long, ki_long, kd_long, kp_lat, ki_lat, kd_lat, delta_t)
Initialize controller.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kp_long
|
float
|
proportional gain longitudinal velocity |
required |
ki_long
|
float
|
integral gain longitudinal velocity |
required |
kd_long
|
float
|
derivative gain longitudinal velocity |
required |
kp_lat
|
float
|
proportional gain lateral offset |
required |
ki_lat
|
float
|
integral gain lateral offset |
required |
kd_lat
|
float
|
derivative gain lateral offset |
required |
delta_t
|
float
|
controller sampling time in seconds |
required |
Source code in commonroad_control/control/pid/pid_long_lat.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
compute_control_input(measured_v_long, reference_v_long, measured_lat_offset, reference_lat_offset=0)
Computes input from controller given the measured and the reference outputs
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
measured_v_long
|
float
|
measured longitudinal velocity |
required |
reference_v_long
|
float
|
reference longitudinal velocity |
required |
measured_lat_offset
|
float
|
measured lateral offset |
required |
reference_lat_offset
|
float
|
reference lateral offset, default 0 |
0
|
Returns:
| Type | Description |
|---|---|
Tuple[float, float]
|
control input for acceleration, control input for steering angle velocity |
Source code in commonroad_control/control/pid/pid_long_lat.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
reset()
Resets internal running states
Source code in commonroad_control/control/pid/pid_long_lat.py
85 86 87 88 89 90 | |