LemLib  0.4.7
An easy to use and feature-rich PROS template
Loading...
Searching...
No Matches
lemlib::Chassis Class Reference

Chassis class. More...

#include <chassis.hpp>

Public Member Functions

 Chassis (Drivetrain_t drivetrain, ChassisController_t lateralSettings, ChassisController_t angularSettings, OdomSensors_t sensors)
 Construct a new Chassis. More...
 
void calibrate ()
 Calibrate the chassis sensors. More...
 
void setPose (double x, double y, double theta, bool radians=false)
 Set the pose of the chassis. More...
 
void setPose (Pose pose, bool radians=false)
 Set the pose of the chassis. More...
 
Pose getPose (bool radians=false)
 Get the pose of the chassis. More...
 
void turnTo (float x, float y, int timeout, bool reversed=false, float maxSpeed=127, bool log=false)
 Turn the chassis so it is facing the target point. More...
 
void moveTo (float x, float y, int timeout, float maxSpeed=200, bool log=false)
 Move the chassis towards the target point. More...
 
void follow (const char *filePath, int timeout, float lookahead, bool reverse=false, float maxSpeed=127, bool log=false)
 Move the chassis along a path. More...
 

Detailed Description

Chassis class.

Constructor & Destructor Documentation

◆ Chassis()

lemlib::Chassis::Chassis ( Drivetrain_t  drivetrain,
ChassisController_t  lateralSettings,
ChassisController_t  angularSettings,
OdomSensors_t  sensors 
)

Construct a new Chassis.

Parameters
drivetraindrivetrain to be used for the chassis
lateralSettingssettings for the lateral controller
angularSettingssettings for the angular controller
sensorssensors to be used for odometry

Member Function Documentation

◆ calibrate()

void lemlib::Chassis::calibrate ( )

Calibrate the chassis sensors.

◆ follow()

void lemlib::Chassis::follow ( const char *  filePath,
int  timeout,
float  lookahead,
bool  reverse = false,
float  maxSpeed = 127,
bool  log = false 
)

Move the chassis along a path.

Parameters
filePathfile path to the path. No need to preface it with /usd/
timeoutthe maximum time the robot can spend moving
lookaheadthe lookahead distance. Units in inches. Larger values will make the robot move faster but will follow the path less accurately
reversewhether the robot should follow the path in reverse. false by default
maxSpeedthe maximum speed the robot can move at
logwhether the chassis should log the path on a log file. false by default.

◆ getPose()

Pose lemlib::Chassis::getPose ( bool  radians = false)

Get the pose of the chassis.

Parameters
radianswhether theta should be in radians (true) or degrees (false). false by default
Returns
Pose

◆ moveTo()

void lemlib::Chassis::moveTo ( float  x,
float  y,
int  timeout,
float  maxSpeed = 200,
bool  log = false 
)

Move the chassis towards the target point.

The PID logging ids are "angularPID" and "lateralPID"

Parameters
xx location
yy location
timeoutlongest time the robot can spend moving
maxSpeedthe maximum speed the robot can move at
logwhether the chassis should log the turnTo function. false by default

◆ setPose() [1/2]

void lemlib::Chassis::setPose ( double  x,
double  y,
double  theta,
bool  radians = false 
)

Set the pose of the chassis.

Parameters
xnew x value
ynew y value
thetanew theta value
radianstrue if theta is in radians, false if not. False by default

◆ setPose() [2/2]

void lemlib::Chassis::setPose ( Pose  pose,
bool  radians = false 
)

Set the pose of the chassis.

Parameters
posethe new pose
radianswhether pose theta is in radians (true) or not (false). false by default

◆ turnTo()

void lemlib::Chassis::turnTo ( float  x,
float  y,
int  timeout,
bool  reversed = false,
float  maxSpeed = 127,
bool  log = false 
)

Turn the chassis so it is facing the target point.

The PID logging id is "angularPID"

Parameters
xx location
yy location
timeoutlongest time the robot can spend moving
reversedwhether the robot should turn in the opposite direction. false by default
maxSpeedthe maximum speed the robot can turn at. Default is 200
logwhether the chassis should log the turnTo function. false by default

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