LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
drive.hpp File Reference

(top-level) More...

#include "LightLib/lib.hpp"

Go to the source code of this file.

Classes

class  Coordinate
 One waypoint in the legacy injected-path representation. More...
 

Enumerations

enum  DistanceSide { BACK = 0 , RIGHT = 1 , LEFT = 2 }
 Which side a distance sensor faces for the legacy distance helpers. More...
 
enum  AutonMode { STANLEY = 0 , ODOM = 1 , PLAIN = 2 , BRAIN = 3 }
 Auton mode selector for the legacy path runner. More...
 
enum  Wait { WAIT = 0 , QUICK = 1 , CHAIN = 2 }
 Wait-mode selector for pidWait(). More...
 

Functions

Internal math (legacy path helpers)
double getDistance (Coordinate point1, Coordinate point2)
 
double getTheta (Coordinate point1, Coordinate point2, light::drive_directions direction)
 
double getVelocity (double voltage)
 
double getTimeToPoint (double distance, double velocity)
 
Coordinate getPoint (Coordinate startPoint, double distance)
 
Coordinate getPoint (Coordinate startPoint, double v_left, double v_right, double time)
 
std::vector< CoordinateinjectPoint (Coordinate startPoint, Coordinate endPoint, e_angle_behavior behavior, double left, double right, double theta, double lookAhead)
 
std::vector< CoordinateinjectPath (std::vector< Coordinate > coordList, double lookAhead)
 
Position wrappers
void setPosition (double x, double y)
 
void setPosition (double x, double y, double t)
 
double getDistanceActual (DistanceSide sensor, bool use_theta, double failsafe)
 
Wait wrappers
void pidWait (Wait type)
 
void pidWaitUntil (okapi::QLength distance)
 
void pidWaitUntil (okapi::QAngle distance)
 
void pidWaitUntil (Coordinate coordinate)
 
void delayMillis (int millis)
 
void delayMillis (int millis, bool ignore)
 
Drive-set wrappers
void driveSet (double distance, int speed, bool slew)
 
void driveSet (double distance, int speed)
 
void driveSmartSet (double distance, int speed)
 
Turn-set wrappers
void turnSet (double theta, int speed, e_angle_behavior behavior)
 
void turnSet (double theta, int speed)
 
void turnSet (Coordinate point, drive_directions direction, int speed, e_angle_behavior behavior)
 
void turnSet (Coordinate point, drive_directions direction, int speed)
 
void turnSetRelative (double theta, int speed, e_angle_behavior behavior)
 
void turnSetRelative (double theta, int speed)
 
Swing-set wrappers
void swingSet (light::e_swing side, double theta, double main, double opp, light::e_angle_behavior behavior)
 
void swingSet (light::e_swing side, double theta, double main, light::e_angle_behavior behavior)
 
void swingSet (light::e_swing side, double theta, double main, double opp)
 
void swingSet (light::e_swing side, double theta, double main)
 
Path debugging
void getPath ()
 Print the current autonPath to the PROS terminal.
 
void getPathInjected ()
 Print the post-injection autonPath to the PROS terminal.
 

Variables

const double WHEEL_DIAMETER = 3.3369184232
 Default wheel diameter, inches.
 
const double ROBOT_WIDTH = 11.4375
 Default robot track width, inches.
 
const int KEY = 267267
 Misc. magic constant retained for legacy code.
 
double angle_offset
 Heading offset applied by the legacy helpers.
 
AutonMode autonMode
 Active auton mode for the legacy runner.
 
std::vector< CoordinateautonPath
 Path being executed by the legacy runner.
 

Detailed Description

(top-level)

Legacy global-namespace drive helpers — short-name wrappers around the light::Drive API plus a Stanley/path-injection helper that predates the RAMSETE follower.

Most new code should use the light::Drive methods directly. These wrappers remain for older auton routines and for the path-injection / Stanley path-follower entry points.

Definition in file drive.hpp.

Enumeration Type Documentation

◆ AutonMode

enum AutonMode

Auton mode selector for the legacy path runner.

Enumerator
STANLEY 

Stanley path-follower.

ODOM 

Odom-based motion primitives.

PLAIN 

Direct PID drive sequencing.

BRAIN 

Driven by the brain-screen selector.

Definition at line 29 of file drive.hpp.

◆ DistanceSide

Which side a distance sensor faces for the legacy distance helpers.

Enumerator
BACK 
RIGHT 
LEFT 

Definition at line 22 of file drive.hpp.

◆ Wait

enum Wait

Wait-mode selector for pidWait().

Enumerator
WAIT 
QUICK 
CHAIN 

Definition at line 37 of file drive.hpp.

Function Documentation

◆ delayMillis() [1/2]

void delayMillis ( int  millis)

◆ delayMillis() [2/2]

void delayMillis ( int  millis,
bool  ignore 
)

◆ driveSet() [1/2]

void driveSet ( double  distance,
int  speed 
)

◆ driveSet() [2/2]

void driveSet ( double  distance,
int  speed,
bool  slew 
)

◆ driveSmartSet()

void driveSmartSet ( double  distance,
int  speed 
)

◆ getDistance()

double getDistance ( Coordinate  point1,
Coordinate  point2 
)

◆ getDistanceActual()

double getDistanceActual ( DistanceSide  sensor,
bool  use_theta,
double  failsafe 
)

◆ getPath()

void getPath ( )

Print the current autonPath to the PROS terminal.

◆ getPathInjected()

void getPathInjected ( )

Print the post-injection autonPath to the PROS terminal.

◆ getPoint() [1/2]

Coordinate getPoint ( Coordinate  startPoint,
double  distance 
)

◆ getPoint() [2/2]

Coordinate getPoint ( Coordinate  startPoint,
double  v_left,
double  v_right,
double  time 
)

◆ getTheta()

double getTheta ( Coordinate  point1,
Coordinate  point2,
light::drive_directions  direction 
)

◆ getTimeToPoint()

double getTimeToPoint ( double  distance,
double  velocity 
)

◆ getVelocity()

double getVelocity ( double  voltage)

◆ injectPath()

std::vector< Coordinate > injectPath ( std::vector< Coordinate coordList,
double  lookAhead 
)

◆ injectPoint()

std::vector< Coordinate > injectPoint ( Coordinate  startPoint,
Coordinate  endPoint,
e_angle_behavior  behavior,
double  left,
double  right,
double  theta,
double  lookAhead 
)

◆ pidWait()

void pidWait ( Wait  type)

◆ pidWaitUntil() [1/3]

void pidWaitUntil ( Coordinate  coordinate)

◆ pidWaitUntil() [2/3]

void pidWaitUntil ( okapi::QAngle  distance)

◆ pidWaitUntil() [3/3]

void pidWaitUntil ( okapi::QLength  distance)

◆ setPosition() [1/2]

void setPosition ( double  x,
double  y 
)

◆ setPosition() [2/2]

void setPosition ( double  x,
double  y,
double  t 
)

◆ swingSet() [1/4]

void swingSet ( light::e_swing  side,
double  theta,
double  main 
)

◆ swingSet() [2/4]

void swingSet ( light::e_swing  side,
double  theta,
double  main,
double  opp 
)

◆ swingSet() [3/4]

void swingSet ( light::e_swing  side,
double  theta,
double  main,
double  opp,
light::e_angle_behavior  behavior 
)

◆ swingSet() [4/4]

void swingSet ( light::e_swing  side,
double  theta,
double  main,
light::e_angle_behavior  behavior 
)

◆ turnSet() [1/4]

void turnSet ( Coordinate  point,
drive_directions  direction,
int  speed 
)

◆ turnSet() [2/4]

void turnSet ( Coordinate  point,
drive_directions  direction,
int  speed,
e_angle_behavior  behavior 
)

◆ turnSet() [3/4]

void turnSet ( double  theta,
int  speed 
)

◆ turnSet() [4/4]

void turnSet ( double  theta,
int  speed,
e_angle_behavior  behavior 
)

◆ turnSetRelative() [1/2]

void turnSetRelative ( double  theta,
int  speed 
)

◆ turnSetRelative() [2/2]

void turnSetRelative ( double  theta,
int  speed,
e_angle_behavior  behavior 
)

Variable Documentation

◆ angle_offset

double angle_offset
extern

Heading offset applied by the legacy helpers.

◆ autonMode

AutonMode autonMode
extern

Active auton mode for the legacy runner.

◆ autonPath

std::vector<Coordinate> autonPath
extern

Path being executed by the legacy runner.

◆ KEY

const int KEY = 267267

Misc. magic constant retained for legacy code.

Definition at line 19 of file drive.hpp.

◆ ROBOT_WIDTH

const double ROBOT_WIDTH = 11.4375

Default robot track width, inches.

Definition at line 18 of file drive.hpp.

◆ WHEEL_DIAMETER

const double WHEEL_DIAMETER = 3.3369184232

Default wheel diameter, inches.

Definition at line 17 of file drive.hpp.