scenic.domains.driving.controllers

Low-level controllers useful for vehicles.

The Lateral/Longitudinal PID controllers are adapted from CARLA’s PID controllers, which are licensed under the following terms:

Copyright (c) 2018-2020 CVC.

This work is licensed under the terms of the MIT license. For a copy, see <https://opensource.org/licenses/MIT>.

Summary of Module Members

Classes

PIDLateralController

Lateral control using a PID to track a trajectory.

PIDLongitudinalController

Longitudinal control using a PID to reach a target speed.

Member Details

class PIDLongitudinalController(K_P=0.5, K_D=0.1, K_I=0.2, dt=0.1)[source]

Longitudinal control using a PID to reach a target speed.

Parameters:
  • K_P – Proportional gain

  • K_D – Derivative gain

  • K_I – Integral gain

  • dt – time step

run_step(speed_error)[source]

Estimate the throttle/brake of the vehicle based on the PID equations.

Parameters:

speed_error – target speed minus current speed

Returns:

a signal between -1 and 1, with negative values indicating braking.

class PIDLateralController(K_P=0.3, K_D=0.2, K_I=0, dt=0.1)[source]

Lateral control using a PID to track a trajectory.

Parameters:
  • K_P – Proportional gain

  • K_D – Derivative gain

  • K_I – Integral gain

  • dt – time step

run_step(cte)[source]

Estimate the steering angle of the vehicle based on the PID equations.

Parameters:

cte – cross-track error (distance to right of desired trajectory)

Returns:

a signal between -1 and 1, with -1 meaning maximum steering to the left.