EEEN21000
GROUP 30 Line Following Buggy
Loading...
Searching...
No Matches
WheelControl Class Reference

Controller class to handle speed and steering of the buggy. More...

#include <wheelcontrol.h>

Collaboration diagram for WheelControl:
[legend]

Public Member Functions

 WheelControl ()
 Constructor. More...
 
void setSpeedController (float Kc, float tauI, float tauD)
 Set the speed controller tuning parameters. More...
 
void setLineController (float Kc, float tauI, float tauD)
 Set the line controller tuning parameters. More...
 
void setLineLimits (float low, float high)
 Set the line controller input limits. More...
 
void setPWMLimits (float low, float high)
 Set the PWM controller output limits. More...
 
void setTargetSpeed (float speed)
 Set the target speed in m/s. More...
 
void reset ()
 Reset the PID controllers to initial state. More...
 
vector< pifcomputeSpeed (float position, const Encoder &left_encoder, const Encoder &right_encoder)
 Compute the speed in pps for the left and right motors. More...
 

Private Member Functions

void m_setSetPoint (float left_val, float right_val)
 Set setpoint for left controller and right controller. More...
 
void m_setProcessValue (float left_val, float right_val)
 Set process value for left controller and right controller. More...
 

Private Attributes

PID m_leftcontroller
 PID controller for left speed. More...
 
PID m_rightcontroller
 PID controller for right speed. More...
 
PID m_linecontroller
 PID controller for line position. More...
 
float m_target
 PID output for line controller. More...
 

Detailed Description

Controller class to handle speed and steering of the buggy.

Constructor & Destructor Documentation

◆ WheelControl()

WheelControl::WheelControl ( )

Constructor.

Construct a new Wheel Control object.

Initializes three PID controllers with default values.

Member Function Documentation

◆ m_setSetPoint()

void WheelControl::m_setSetPoint ( float  left_val,
float  right_val 
)
private

Set setpoint for left controller and right controller.

◆ m_setProcessValue()

void WheelControl::m_setProcessValue ( float  left_val,
float  right_val 
)
private

Set process value for left controller and right controller.

◆ setSpeedController()

void WheelControl::setSpeedController ( float  Kc,
float  tauI,
float  tauD 
)

Set the speed controller tuning parameters.

Parameters
KcPropotional gain.
tauIIntegral gain.
tauDDerivative gain.

◆ setLineController()

void WheelControl::setLineController ( float  Kc,
float  tauI,
float  tauD 
)

Set the line controller tuning parameters.

Parameters
KcPropotional gain.
tauIIntegral gain.
tauDDerivative gain.

◆ setLineLimits()

void WheelControl::setLineLimits ( float  low,
float  high 
)

Set the line controller input limits.

Parameters
lowMinimum input value.
highMaximum input value.

◆ setPWMLimits()

void WheelControl::setPWMLimits ( float  low,
float  high 
)

Set the PWM controller output limits.

Parameters
lowMinimum output value.
highMaximum output value.

◆ setTargetSpeed()

void WheelControl::setTargetSpeed ( float  speed)

Set the target speed in m/s.

Parameters
speedTarget speed in m/s.

◆ reset()

void WheelControl::reset ( )

Reset the PID controllers to initial state.

◆ computeSpeed()

vector< pif > WheelControl::computeSpeed ( float  position,
const Encoder left_encoder,
const Encoder right_encoder 
)

Compute the speed in pps for the left and right motors.

Parameters
positionPosition of the white line in milimetres.
left_encoderLeft encoder.
right_encoderRight encoder.
Returns
vector<pif> Vector of pair of direction, PWM outputs for left and right motor.

Member Data Documentation

◆ m_leftcontroller

PID WheelControl::m_leftcontroller
private

PID controller for left speed.

◆ m_rightcontroller

PID WheelControl::m_rightcontroller
private

PID controller for right speed.

◆ m_linecontroller

PID WheelControl::m_linecontroller
private

PID controller for line position.

◆ m_target

float WheelControl::m_target
private

PID output for line controller.


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