|
LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
|
Custom movement primitives using LightLib's Drive and dual distance sensors.
More...
Go to the source code of this file.
Functions | |
| void | custom_move_init (light::Drive &chassis) |
| Register the chassis used by the custom movement primitives. | |
| void | WallRide (pros::Distance *frontSensor, pros::Distance *leftSensor, double stopDistIn, double targetDistIn, int baseSpeed=80, int timeout=5000) |
| Drive forward while wall-tracking on the left. | |
Custom movement primitives using LightLib's Drive and dual distance sensors.
light::Drive)pros::Distance, pros::millis, etc.)LightLib/main.h (PROS umbrella header)initialize() in main.cpp, passing your existing light::Drive chassis object: pros::Distance sensors — one on the front of the robot and one on the left side — and call WallRide(): -127..127 scale (not raw millivolts).light::Drive reference is stored as a pointer at runtime inside custom_move_init(), avoiding the PROS cold/hot package linker constraint. Definition in file custom_move.hpp.
| void custom_move_init | ( | light::Drive & | chassis | ) |
Register the chassis used by the custom movement primitives.
Must be called once in initialize() before WallRide().
| chassis | the user's Drive instance |
| void WallRide | ( | pros::Distance * | frontSensor, |
| pros::Distance * | leftSensor, | ||
| double | stopDistIn, | ||
| double | targetDistIn, | ||
| int | baseSpeed = 80, |
||
| int | timeout = 5000 |
||
| ) |
Drive forward while wall-tracking on the left.
Combines two behaviors:
stopDistIn.targetDistIn from a left-side wall via a PD steering loop.Pass nullptr for a sensor whose port is 0 (not installed). Returns immediately if frontSensor is nullptr. If leftSensor is nullptr, the robot drives straight with no wall correction.
| frontSensor | front-facing distance sensor (stop condition) |
| leftSensor | left-facing distance sensor (wall-tracking) |
| stopDistIn | front threshold in inches — robot stops when front reads ≤ this |
| targetDistIn | desired lateral distance from the left wall, inches |
| baseSpeed | forward drive speed, 0–127 |
| timeout | max run duration in milliseconds before forced exit |