CARLA
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
carla::agents::navigation::PIDLongitudinalController Class Reference

Longitudinal PID controller. More...

#include <PIDController.h>

Public Member Functions

void ChangeParameters (float K_P, float K_I, float K_D, float dt)
 
 PIDLongitudinalController (SharedPtr< client::Vehicle > vehicle, float K_P=1.0f, float K_I=0.0f, float K_D=0.0f, float dt=0.03f)
 
float RunStep (float target_speed_kmh, bool debug=false)
 Returns the throttle/brake command (clamped to [-1, 1]).
 

Private Member Functions

float PidControl (float target_speed_kmh, float current_speed_kmh)
 

Private Attributes

float _dt
 
std::deque< float > _error_buffer
 
float _k_d
 
float _k_i
 
float _k_p
 
SharedPtr< client::Vehicle > _vehicle
 

Detailed Description

Longitudinal PID controller.

Mirrors agents.navigation.controller.PIDLongitudinalController.

Definition at line 25 of file agents/navigation/PIDController.h.

Constructor & Destructor Documentation

◆ PIDLongitudinalController()

carla::agents::navigation::PIDLongitudinalController::PIDLongitudinalController ( SharedPtr< client::Vehicle >  vehicle,
float  K_P = 1.0f,
float  K_I = 0.0f,
float  K_D = 0.0f,
float  dt = 0.03f 
)

Definition at line 42 of file PIDController.cpp.

Member Function Documentation

◆ ChangeParameters()

void carla::agents::navigation::PIDLongitudinalController::ChangeParameters ( float  K_P,
float  K_I,
float  K_D,
float  dt 
)

◆ PidControl()

float carla::agents::navigation::PIDLongitudinalController::PidControl ( float  target_speed_kmh,
float  current_speed_kmh 
)
private

Definition at line 59 of file PIDController.cpp.

References _dt, _error_buffer, _k_d, _k_i, and _k_p.

Referenced by RunStep().

◆ RunStep()

float carla::agents::navigation::PIDLongitudinalController::RunStep ( float  target_speed_kmh,
bool  debug = false 
)

Returns the throttle/brake command (clamped to [-1, 1]).

Definition at line 51 of file PIDController.cpp.

References _vehicle, carla::agents::navigation::GetSpeed(), and PidControl().

Referenced by carla::agents::navigation::VehiclePIDController::RunStep().

Member Data Documentation

◆ _dt

float carla::agents::navigation::PIDLongitudinalController::_dt
private

Definition at line 46 of file agents/navigation/PIDController.h.

Referenced by ChangeParameters(), and PidControl().

◆ _error_buffer

std::deque<float> carla::agents::navigation::PIDLongitudinalController::_error_buffer
private

Definition at line 47 of file agents/navigation/PIDController.h.

Referenced by PidControl().

◆ _k_d

float carla::agents::navigation::PIDLongitudinalController::_k_d
private

Definition at line 45 of file agents/navigation/PIDController.h.

Referenced by ChangeParameters(), and PidControl().

◆ _k_i

float carla::agents::navigation::PIDLongitudinalController::_k_i
private

Definition at line 44 of file agents/navigation/PIDController.h.

Referenced by ChangeParameters(), and PidControl().

◆ _k_p

float carla::agents::navigation::PIDLongitudinalController::_k_p
private

Definition at line 43 of file agents/navigation/PIDController.h.

Referenced by ChangeParameters(), and PidControl().

◆ _vehicle

SharedPtr<client::Vehicle> carla::agents::navigation::PIDLongitudinalController::_vehicle
private

Definition at line 42 of file agents/navigation/PIDController.h.

Referenced by RunStep().


The documentation for this class was generated from the following files: