freneticlib.executors.bicycle.controller
This module contains PID controllers to perform lateral and longitudinal control.
Module Contents
Classes
VehiclePIDController is the combination of two PID controllers |
|
PIDLongitudinalController implements longitudinal control using a PID. |
|
PIDLateralController implements lateral control using a PID. |
- class freneticlib.executors.bicycle.controller.VehiclePIDController(vehicle, args_lateral, args_longitudinal, offset=0, max_throttle=0.75, max_brake=0.3, max_steering=0.8)[source]
VehiclePIDController is the combination of two PID controllers (lateral and longitudinal) to perform the low level control a vehicle from client side
Constructor method.
- Parameters:
vehicle – actor to apply to local planner logic onto
args_lateral – dictionary of arguments to set the lateral PID controller
- using the following semantics:
K_P – Proportional term K_D – Differential term K_I – Integral term
- Parameters:
args_longitudinal – dictionary of arguments to set the longitudinal
- PID controller using the following semantics:
K_P – Proportional term K_D – Differential term K_I – Integral term
- Parameters:
offset – If different than zero, the vehicle will drive displaced from the center line.
Positive values imply a right offset while negative ones mean a left one. Numbers high enough to cause the vehicle to drive through other lanes might break the controller.
- run_step(target_speed, waypoint)[source]
Execute one step of control invoking both lateral and longitudinal PID controllers to reach a target waypoint at a given target_speed.
- param target_speed:
desired vehicle speed
- param waypoint:
target location encoded as a waypoint
- return:
distance (in meters) to the waypoint
- class freneticlib.executors.bicycle.controller.PIDLongitudinalController(vehicle, K_P=1.0, K_I=0.0, K_D=0.0, dt=0.03)[source]
PIDLongitudinalController implements longitudinal control using a PID.
Constructor method.
- param vehicle:
actor to apply to local planner logic onto
- param K_P:
Proportional term
- param K_D:
Differential term
- param K_I:
Integral term
- param dt:
time differential in seconds
- run_step(target_speed, debug=False)[source]
Execute one step of longitudinal control to reach a given target speed.
- param target_speed:
target speed in Km/h
- param debug:
boolean for debugging
- return:
throttle control
- class freneticlib.executors.bicycle.controller.PIDLateralController(vehicle, offset=0, K_P=1.0, K_I=0.0, K_D=0.0, dt=0.03)[source]
PIDLateralController implements lateral control using a PID.
Constructor method.
- param vehicle:
actor to apply to local planner logic onto
- param offset:
distance to the center line. If might cause issues if the value is large enough to make the vehicle invade other lanes.
- param K_P:
Proportional term
- param K_D:
Differential term
- param K_I:
Integral term
- param dt:
time differential in seconds
- run_step(waypoint)[source]
Execute one step of lateral control to steer the vehicle towards a certain waypoin.
- param waypoint:
target waypoint
- return:
steering control in the range [-1, 1] where:
-1 maximum steering to left +1 maximum steering to right