|
LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
|
Initialize once via init(); poll getPose/setPose from any task. More...
Namespaces | |
| namespace | ekf |
| namespace | field |
| namespace | lightcast |
| namespace | paths |
| namespace | sensor_aux |
| namespace | units |
| Single source of truth for unit conversions. | |
| namespace | util |
| Misc math, geometry, and unit-conversion helpers. | |
Classes | |
| struct | Auton |
| One registered autonomous routine. More... | |
| class | AutonSelector |
| On-brain auton picker UI. More... | |
| class | Drive |
| Tank-drive chassis class. More... | |
| struct | DriveFF |
| Per-wheel feedforward + simple velocity-loop gains. More... | |
| class | HDrive |
| Tank drive with a single center-mounted strafe wheel (H-drive layout). More... | |
| struct | HermiteSegment |
| One segment of a quintic Hermite spline. More... | |
| class | HoloDrive |
| 4-motor holonomic drive — supports X-Drive and Mecanum configurations. More... | |
| struct | HoloPID |
| Internal PID used by HoloDrive / HDrive. More... | |
| struct | odom |
| One waypoint of an odom-mode movement. More... | |
| struct | PathEvent |
| Mid-path action fired once when the trajectory passes its resolved time. More... | |
| class | PID |
| Discrete PID controller with rich exit-condition support. More... | |
| struct | PidConstants |
| Container for one PID's four editable gain values. More... | |
| class | PidTuner |
| Live PID tuner UI driven by LVGL. More... | |
| class | Piston |
| Stateful 3-wire pneumatic piston with toggle helpers. More... | |
| struct | pose |
| 2D pose: position (in) and heading (deg). More... | |
| struct | PurePursuitConfig |
| Pure Pursuit controller config — only knob is the carrot lookahead. More... | |
| struct | RamseteConfig |
| RAMSETE controller and chassis-geometry config. More... | |
| class | RotationalSnap |
| Manual-then-snap controller for a motor + rotation-sensor pair. More... | |
| class | slew |
| Slew-rate limiter that ramps speed up linearly over a configurable distance. More... | |
| class | Spline |
| Concatenated quintic Hermite spline with arc-length parameterization. More... | |
| struct | SplineSample |
| Pose / velocity / acceleration sample produced by spline evaluation. More... | |
| class | tracking_wheel |
| Single tracking wheel for odometry. More... | |
| struct | TrajConstraints |
| Kinematic limits used by the trajectory generator. More... | |
| class | Trajectory |
| Time-parameterized trajectory: dense state table + total duration. More... | |
| struct | TrajState |
| One sample of a time-parameterized trajectory. More... | |
| struct | united_odom |
| One waypoint of an odom-mode movement, with okapi units. More... | |
| struct | united_pose |
| 2D pose with okapi units. More... | |
| struct | Waypoint |
| Single 2-D waypoint with optional heading and per-point speed cap. More... | |
Typedefs | |
| using | PoseGetterFn = pose(*)() |
External pose getter used by register_pose_source(). | |
| using | PoseSetterFn = void(*)(pose) |
External pose setter used by register_pose_source(). | |
Enumerations | |
| enum | PidType { PID_DRIVE = 0 , PID_TURN , PID_SWING , PID_HEADING , PID_EKF , PID_COUNT } |
| PID controller categories selectable in the tuner. More... | |
| enum | ConstSlot { KP = 0 , KI , KD , START_I , CONST_COUNT } |
| Index into a PidConstants slot. More... | |
| enum class | Follower { RAMSETE , PURE_PURSUIT } |
| Path-following controller selector. More... | |
Functions | |
| void | register_pose_source (PoseGetterFn getter, PoseSetterFn setter) |
| Register an external pose source. | |
| double | wrap180 (double a) |
| Normalize an angle in degrees to the half-open interval (-180, 180] so PID always takes the shortest path. | |
| void | reset () |
| Reset all internal pose state to (0, 0, 0). | |
| void | init (OdomSensors sensors, MCLConfig cfg={}) |
| Initialize the estimator. | |
| void | stop () |
| Stop the background odometry task. | |
| void | moveToPoint (float targetX, float targetY, int timeout, float maxSpeed, bool reversed) |
| Drive to a field-relative point (legacy). | |
| Pose | getPose (bool radians=false) |
| void | setPose (Pose pose, bool radians=false) |
| Overwrite the current pose. | |
| Pose | getSpeed (bool radians=false) |
| Pose | getLocalSpeed (bool radians=false) |
| Pose | estimatePose (float time, bool radians=false) |
Linear extrapolation of pose time seconds ahead at current velocity. | |
| void | update () |
| Force one update (normally called by the background task). | |
| Pose | getPoseRad () |
| Radian-only accessor; trajectory code MUST use this to avoid deg/rad bugs. | |
| bool | runPath (const char *name, bool reversed=false, int timeoutMs=-1, float poseErrBailIn=8.0f, Follower follower=Follower::PURE_PURSUIT) |
| Run a registered path by name. | |
| bool | runPath (const char *name, std::vector< PathEvent > events, bool reversed=false, int timeoutMs=-1, float poseErrBailIn=8.0f, Follower follower=Follower::PURE_PURSUIT) |
| Variant accepting mid-path event triggers. | |
| void | pure_pursuit_configure (PurePursuitConfig cfg) |
| Configure the Pure Pursuit follower. | |
| void | ramsete_configure (RamseteConfig rc, DriveFF ff, TrajConstraints defaultCons) |
| Configure the RAMSETE follower. | |
| bool | followTrajectory (const Trajectory &traj, int timeoutMs=-1, float poseErrBailIn=8.0f, Follower follower=Follower::PURE_PURSUIT) |
| Follow a pre-generated Trajectory. | |
| bool | followTrajectory (const std::vector< Waypoint > &wps, const TrajConstraints &cons, bool reversed=false, int timeoutMs=-1, float poseErrBailIn=8.0f, Follower follower=Follower::PURE_PURSUIT) |
| Generate and follow a trajectory from waypoints. | |
| bool | followTrajectory (const std::vector< Waypoint > &wps, const TrajConstraints &cons, std::vector< PathEvent > events, bool reversed=false, int timeoutMs=-1, float poseErrBailIn=8.0f, Follower follower=Follower::PURE_PURSUIT) |
| Generate-and-follow variant with mid-path event triggers. | |
| bool | followTrajectory (const std::vector< Waypoint > &wps, bool reversed=false, int timeoutMs=-1, float poseErrBailIn=8.0f, Follower follower=Follower::PURE_PURSUIT) |
Generate and follow a trajectory from waypoints, using the default TrajConstraints registered via ramsete_configure(). | |
| bool | followTrajectory (const std::vector< Waypoint > &wps, std::vector< PathEvent > events, bool reversed=false, int timeoutMs=-1, float poseErrBailIn=8.0f, Follower follower=Follower::PURE_PURSUIT) |
| Same as above, with mid-path events. | |
| bool | runJerryioPath (const char *csv, bool reversed=false, int timeoutMs=-1, float poseErrBailIn=8.0f, Follower follower=Follower::PURE_PURSUIT) |
| Run a waypoint CSV (path.jerryio.com export or hand-written). | |
| bool | runJerryioPath (const char *csv, std::vector< PathEvent > events, bool reversed=false, int timeoutMs=-1, float poseErrBailIn=8.0f, Follower follower=Follower::PURE_PURSUIT) |
| Variant with mid-path event triggers. | |
| bool | runJerryioPathFromSD (const char *filePath, bool reversed=false, int timeoutMs=-1, float poseErrBailIn=8.0f, Follower follower=Follower::PURE_PURSUIT) |
| Read the CSV from the V5 SD card (e.g. | |
| bool | runJerryioPathFromSD (const char *filePath, std::vector< PathEvent > events, bool reversed=false, int timeoutMs=-1, float poseErrBailIn=8.0f, Follower follower=Follower::PURE_PURSUIT) |
| SD-card variant with mid-path event triggers. | |
| Trajectory | generateTrajectory (const std::vector< Waypoint > &wps, const TrajConstraints &cons, bool reversed=false) |
| Generate a time-parameterized trajectory from waypoints. | |
| uint32_t | auton_elapsed () |
| void | wait_until_auton (uint32_t ms) |
Block until ms milliseconds have elapsed since auton started. | |
| void | extras_init (light::Drive *chassis, pros::MotorGroup *leftMotors, pros::MotorGroup *rightMotors) |
| Register the user's drivetrain objects with LightLib. | |
| void | getDriveMotorGroups (pros::MotorGroup **leftOut, pros::MotorGroup **rightOut) |
| Look up the registered drivetrain motor groups. | |
| light::Drive * | getChassis () |
| void | ez_template_print () |
| Prints our branding all over your pros terminal. | |
| void | screen_print (std::string text, int line=0) |
| Prints to the brain screen in one string. | |
| std::string | exit_to_string (exit_output input) |
| Returns a human-readable name for an exit_output code. | |
Stationary noise calibration | |
| void | autotune_ekf_noise (int sampleMs=10, int durationMs=5000, int warmupMs=500) |
| Stationary EKF process-noise calibration. | |
| void | autotune_mcl_noise (int sampleMs=20, int durationMs=4000, int warmupMs=300) |
| Stationary MCL distance-sensor noise calibration. | |
Bracket-and-bisect PID auto-tune (drive / turn / swing / heading) | |
Three-phase tuner with kI=0. Phase 1 doubles kP until the robot oscillates (≥3 zero-crossings of pos − target), then bisects between the last stable and oscillating values. Phase 2 boosts that kP, doubles kD until the oscillation damps, then bisects to find the smallest sufficient kD. Phase 3 then pushes kP higher in +15% steps — bumping kD when oscillation returns — until settle time stops improving (best-of-2 confirmed), and writes the fastest-settling stable (kP, kD) pair. Final values are applied live via pid_*_constants_set; transcribe the printed FINAL line into default_constants() to persist across reboots. Heading scores on the |L−R| motor voltage differential (the heading PID's own controller effort) instead of IMU error, so its oscillation read isn't masked by drive PID dynamics. Space: turn/swing ~3 ft²; drive ≥6 ft straight; heading ≥10 ft straight. | |
| void | autotune_turn_pid (float turnAngleDeg=180.0f, float overshootThreshDeg=3.0f, int maxIters=20) |
| void | autotune_drive_pid (float driveDistIn=24.0f, float overshootThreshIn=0.5f, int maxIters=20) |
| void | autotune_swing_pid (float swingAngleDeg=90.0f, float overshootThreshDeg=3.0f, int maxIters=20) |
| void | autotune_heading_pid (float driveDistIn=48.0f, float peakDiffMv=3000.0f, int maxIters=20) |
Characterization routines | |
Each is meant to be run as its own selectable auton. | |
| void | characterize_kV_kA_kS (float maxVoltage=10.0f, float rampVps=0.25f) |
| Identify kV / kA / kS by ramping voltage and recording velocity. | |
| float | characterize_track_width (int rotations=10) |
| Identify the effective track width by spinning in place. | |
| float | characterize_a_lat_max () |
| Identify the maximum sustainable lateral acceleration. | |
| void | characterize_friction (float maxVoltage=10.0f, float stepV=0.5f) |
| Friction-FF auto-ID for non-trajectory PIDs. | |
Variables | |
| PidTuner | pid_tuner |
| Process-wide singleton tuner instance. | |
| int | DRIVE_SPEED |
Default speeds used when a pid_drive_set / pid_turn_set / pid_swing_set call omits the speed argument. | |
| int | TURN_SPEED |
| int | SWING_SPEED |
| AutonSelector | auton_selector |
| Process-wide singleton selector instance. | |
| uint32_t | auton_start_ms |
| Millisecond timestamp captured right before the selected auton routine runs. | |
Public types and enums | |
| enum | e_type { SINGLE = 0 , SPLIT = 1 } |
| Arcade joystick layout. More... | |
| enum | e_swing { LEFT_SWING = 0 , RIGHT_SWING = 1 } |
| Direction for swing-turn motions. More... | |
| enum | exit_output { RUNNING = 1 , SMALL_EXIT = 2 , BIG_EXIT = 3 , VELOCITY_EXIT = 4 , mA_EXIT = 5 , ERROR_NO_CONSTANTS = 6 } |
| Result codes returned by PID::exit_condition. More... | |
| enum | e_mode { DISABLE = 0 , SWING = 1 , TURN = 2 , TURN_TO_POINT = 3 , DRIVE = 4 , POINT_TO_POINT = 5 , PURE_PURSUIT = 6 } |
| Active chassis motion mode. More... | |
| enum | drive_directions { FWD = 0 , FORWARD = FWD , fwd = FWD , forward = FWD , REV = 1 , REVERSE = REV , rev = REV , reverse = REV } |
| Drive direction with multiple spelling aliases. More... | |
| enum | e_angle_behavior { raw = 0 , left_turn = 1 , LEFT_TURN = 1 , counterclockwise = 1 , ccw = 1 , right_turn = 2 , RIGHT_TURN = 2 , clockwise = 2 , cw = 2 , shortest = 3 , longest = 4 } |
| How to choose a turn direction when reaching an absolute heading. More... | |
| typedef struct light::pose | pose |
| 2D pose: position (in) and heading (deg). | |
| typedef struct light::united_pose | united_pose |
| 2D pose with okapi units. | |
| typedef struct light::odom | odom |
| One waypoint of an odom-mode movement. | |
| typedef struct light::united_odom | united_odom |
| One waypoint of an odom-mode movement, with okapi units. | |
| const double | ANGLE_NOT_SET = 0.0000000000000000000001 |
| Sentinel value indicating "no angle specified". | |
| const okapi::QAngle | p_ANGLE_NOT_SET = 0.0000000000000000000001_deg |
| Sentinel value indicating "no angle specified" (united). | |
Initialize once via init(); poll getPose/setPose from any task.
10 ms tick.
| typedef struct light::odom light::odom |
One waypoint of an odom-mode movement.
| typedef struct light::pose light::pose |
2D pose: position (in) and heading (deg).
| using light::PoseGetterFn = typedef pose (*)() |
External pose getter used by register_pose_source().
| using light::PoseSetterFn = typedef void (*)(pose) |
External pose setter used by register_pose_source().
| typedef struct light::united_odom light::united_odom |
One waypoint of an odom-mode movement, with okapi units.
| typedef struct light::united_pose light::united_pose |
2D pose with okapi units.
| enum light::ConstSlot |
Index into a PidConstants slot.
| Enumerator | |
|---|---|
| KP | Proportional gain. |
| KI | Integral gain. |
| KD | Derivative gain. |
| START_I | Integral activation threshold. |
| CONST_COUNT | |
Definition at line 26 of file pid_tuner.hpp.
| enum light::e_mode |
| enum light::e_swing |
| enum light::e_type |
| enum light::exit_output |
Result codes returned by PID::exit_condition.
|
strong |
Path-following controller selector.
Public entry points default to PURE_PURSUIT.
| Enumerator | |
|---|---|
| RAMSETE | |
| PURE_PURSUIT | |
Definition at line 18 of file ramsete.hpp.
| enum light::PidType |
| uint32_t light::auton_elapsed | ( | ) |
| void light::autotune_drive_pid | ( | float | driveDistIn = 24.0f, |
| float | overshootThreshIn = 0.5f, |
||
| int | maxIters = 20 |
||
| ) |
| void light::autotune_ekf_noise | ( | int | sampleMs = 10, |
| int | durationMs = 5000, |
||
| int | warmupMs = 500 |
||
| ) |
Stationary EKF process-noise calibration.
Robot parked. Per-tick var(x,y,θ) → Q values, pushed live via setConfig().
| void light::autotune_heading_pid | ( | float | driveDistIn = 48.0f, |
| float | peakDiffMv = 3000.0f, |
||
| int | maxIters = 20 |
||
| ) |
| void light::autotune_mcl_noise | ( | int | sampleMs = 20, |
| int | durationMs = 4000, |
||
| int | warmupMs = 300 |
||
| ) |
Stationary MCL distance-sensor noise calibration.
Robot parked with each sensor pointed at a wall in range. Mean per-sensor stddev → sensorSigmaIn; outlierGapIn = ~3·sigma. Pushed live via setConfig().
| void light::autotune_swing_pid | ( | float | swingAngleDeg = 90.0f, |
| float | overshootThreshDeg = 3.0f, |
||
| int | maxIters = 20 |
||
| ) |
| void light::autotune_turn_pid | ( | float | turnAngleDeg = 180.0f, |
| float | overshootThreshDeg = 3.0f, |
||
| int | maxIters = 20 |
||
| ) |
| float light::characterize_a_lat_max | ( | ) |
Identify the maximum sustainable lateral acceleration.
| void light::characterize_friction | ( | float | maxVoltage = 10.0f, |
| float | stepV = 0.5f |
||
| ) |
Friction-FF auto-ID for non-trajectory PIDs.
Fits V = kS·sgn(v) + kV·v + kQ·v·|v| (motor-cmd units) and applies via chassis.friction_constants_set(). Dumps to /usd/friction_id.csv if SD present.
| void light::characterize_kV_kA_kS | ( | float | maxVoltage = 10.0f, |
| float | rampVps = 0.25f |
||
| ) |
Identify kV / kA / kS by ramping voltage and recording velocity.
| float light::characterize_track_width | ( | int | rotations = 10 | ) |
Identify the effective track width by spinning in place.
| Pose light::estimatePose | ( | float | time, |
| bool | radians = false |
||
| ) |
Linear extrapolation of pose time seconds ahead at current velocity.
| std::string light::exit_to_string | ( | exit_output | input | ) |
Returns a human-readable name for an exit_output code.
| input | the exit_output value |
| void light::extras_init | ( | light::Drive * | chassis, |
| pros::MotorGroup * | leftMotors, | ||
| pros::MotorGroup * | rightMotors | ||
| ) |
Register the user's drivetrain objects with LightLib.
Must be called once in initialize() before screen_task / lib_extras / moveToPoint are used.
Takes pointers rather than externing globals so LightLib can live in the PROS cold package without linker errors.
| chassis | the user's Drive instance |
| leftMotors | left-side motor group |
| rightMotors | right-side motor group |
| void light::ez_template_print | ( | ) |
Prints our branding all over your pros terminal.
| bool light::followTrajectory | ( | const std::vector< Waypoint > & | wps, |
| bool | reversed = false, |
||
| int | timeoutMs = -1, |
||
| float | poseErrBailIn = 8.0f, |
||
| Follower | follower = Follower::PURE_PURSUIT |
||
| ) |
Generate and follow a trajectory from waypoints, using the default TrajConstraints registered via ramsete_configure().
| bool light::followTrajectory | ( | const std::vector< Waypoint > & | wps, |
| const TrajConstraints & | cons, | ||
| bool | reversed = false, |
||
| int | timeoutMs = -1, |
||
| float | poseErrBailIn = 8.0f, |
||
| Follower | follower = Follower::PURE_PURSUIT |
||
| ) |
Generate and follow a trajectory from waypoints.
| wps | waypoint list |
| cons | kinematic limits |
| reversed | drive the path in reverse |
| timeoutMs | wall-time bail in ms (-1 = no timeout) |
| poseErrBailIn | bail if the pose error grows above this many inches |
| follower | which controller to use (defaults to PURE_PURSUIT) |
| bool light::followTrajectory | ( | const std::vector< Waypoint > & | wps, |
| const TrajConstraints & | cons, | ||
| std::vector< PathEvent > | events, | ||
| bool | reversed = false, |
||
| int | timeoutMs = -1, |
||
| float | poseErrBailIn = 8.0f, |
||
| Follower | follower = Follower::PURE_PURSUIT |
||
| ) |
Generate-and-follow variant with mid-path event triggers.
Events whose index is out of range are skipped (with a printf warning); the path still runs.
| bool light::followTrajectory | ( | const std::vector< Waypoint > & | wps, |
| std::vector< PathEvent > | events, | ||
| bool | reversed = false, |
||
| int | timeoutMs = -1, |
||
| float | poseErrBailIn = 8.0f, |
||
| Follower | follower = Follower::PURE_PURSUIT |
||
| ) |
Same as above, with mid-path events.
Uses the default TrajConstraints from ramsete_configure().
| bool light::followTrajectory | ( | const Trajectory & | traj, |
| int | timeoutMs = -1, |
||
| float | poseErrBailIn = 8.0f, |
||
| Follower | follower = Follower::PURE_PURSUIT |
||
| ) |
Follow a pre-generated Trajectory.
| traj | the trajectory to follow |
| timeoutMs | wall-time bail in ms (-1 = no timeout) |
| poseErrBailIn | bail if the pose error grows above this many inches |
| Trajectory light::generateTrajectory | ( | const std::vector< Waypoint > & | wps, |
| const TrajConstraints & | cons, | ||
| bool | reversed = false |
||
| ) |
Generate a time-parameterized trajectory from waypoints.
| wps | ordered waypoint list |
| cons | kinematic limits |
| reversed | true if the robot should drive the path in reverse |
| light::Drive * light::getChassis | ( | ) |
| void light::getDriveMotorGroups | ( | pros::MotorGroup ** | leftOut, |
| pros::MotorGroup ** | rightOut | ||
| ) |
Look up the registered drivetrain motor groups.
Used by RAMSETE / characterization so they command the same motor groups the user registered via extras_init().
| leftOut | out: pointer to the registered left motor group, or nullptr |
| rightOut | out: pointer to the registered right motor group, or nullptr |
| Pose light::getLocalSpeed | ( | bool | radians = false | ) |
| Pose light::getPose | ( | bool | radians = false | ) |
| radians | true for radians, false for degrees. |
|
inline |
Radian-only accessor; trajectory code MUST use this to avoid deg/rad bugs.
Definition at line 182 of file odometry.hpp.
| Pose light::getSpeed | ( | bool | radians = false | ) |
| void light::init | ( | OdomSensors | sensors, |
| MCLConfig | cfg = {} |
||
| ) |
Initialize the estimator.
| sensors | sensor bundle (copied) |
| cfg | MCL configuration; defaults are usually fine |
| void light::moveToPoint | ( | float | targetX, |
| float | targetY, | ||
| int | timeout, | ||
| float | maxSpeed, | ||
| bool | reversed | ||
| ) |
Drive to a field-relative point (legacy).
Inches; speed cap 0..127.
| void light::pure_pursuit_configure | ( | PurePursuitConfig | cfg | ) |
Configure the Pure Pursuit follower.
Call once in initialize() (after ramsete_configure(), since PP reuses RamseteConfig + DriveFF).
| void light::ramsete_configure | ( | RamseteConfig | rc, |
| DriveFF | ff, | ||
| TrajConstraints | defaultCons | ||
| ) |
Configure the RAMSETE follower.
Call once in initialize() before any followTrajectory / runJerryioPath call.
| rc | controller and chassis geometry |
| ff | wheel feedforward gains |
| defaultCons | default kinematic limits used when none are passed explicitly |
| void light::register_pose_source | ( | PoseGetterFn | getter, |
| PoseSetterFn | setter | ||
| ) |
Register an external pose source.
When registered, all odom_*_get() reads return the externally-supplied pose instead of LightLib's wheel integrator, and odom_*_set() calls forward to the supplied setter. Used internally to route the legacy pid_odom_* motion through the fused EKF / MCL pose estimate.
| getter | function returning the current pose |
| setter | function applying a new pose |
| void light::reset | ( | ) |
Reset all internal pose state to (0, 0, 0).
| bool light::runJerryioPath | ( | const char * | csv, |
| bool | reversed = false, |
||
| int | timeoutMs = -1, |
||
| float | poseErrBailIn = 8.0f, |
||
| Follower | follower = Follower::PURE_PURSUIT |
||
| ) |
Run a waypoint CSV (path.jerryio.com export or hand-written).
Lines are "x,y" or "x,y,heading_rad"; extra columns ignored. Inches/radians, LightLib convention (+Y forward, CW+). Uses TrajConstraints from ramsete_configure().
| bool light::runJerryioPath | ( | const char * | csv, |
| std::vector< PathEvent > | events, | ||
| bool | reversed = false, |
||
| int | timeoutMs = -1, |
||
| float | poseErrBailIn = 8.0f, |
||
| Follower | follower = Follower::PURE_PURSUIT |
||
| ) |
Variant with mid-path event triggers.
See PathEvent for index semantics.
| bool light::runJerryioPathFromSD | ( | const char * | filePath, |
| bool | reversed = false, |
||
| int | timeoutMs = -1, |
||
| float | poseErrBailIn = 8.0f, |
||
| Follower | follower = Follower::PURE_PURSUIT |
||
| ) |
Read the CSV from the V5 SD card (e.g.
"/usd/paths/red_left.csv").
| bool light::runJerryioPathFromSD | ( | const char * | filePath, |
| std::vector< PathEvent > | events, | ||
| bool | reversed = false, |
||
| int | timeoutMs = -1, |
||
| float | poseErrBailIn = 8.0f, |
||
| Follower | follower = Follower::PURE_PURSUIT |
||
| ) |
SD-card variant with mid-path event triggers.
| bool light::runPath | ( | const char * | name, |
| bool | reversed = false, |
||
| int | timeoutMs = -1, |
||
| float | poseErrBailIn = 8.0f, |
||
| Follower | follower = Follower::PURE_PURSUIT |
||
| ) |
Run a registered path by name.
| name | path name (must match a row in kAll[]) |
| reversed | drive the path in reverse |
| timeoutMs | wall-time bail in ms (-1 = no timeout) |
| poseErrBailIn | bail if pose error exceeds this many inches |
| bool light::runPath | ( | const char * | name, |
| std::vector< PathEvent > | events, | ||
| bool | reversed = false, |
||
| int | timeoutMs = -1, |
||
| float | poseErrBailIn = 8.0f, |
||
| Follower | follower = Follower::PURE_PURSUIT |
||
| ) |
Variant accepting mid-path event triggers.
See PathEvent.
| void light::screen_print | ( | std::string | text, |
| int | line = 0 |
||
| ) |
Prints to the brain screen in one string.
Splits input between lines with '
' or when text longer then 32 characters.
| text | input string |
| line | starting line to print on, defaults to 0 |
| void light::setPose | ( | Pose | pose, |
| bool | radians = false |
||
| ) |
Overwrite the current pose.
| void light::stop | ( | ) |
Stop the background odometry task.
| void light::update | ( | ) |
Force one update (normally called by the background task).
| void light::wait_until_auton | ( | uint32_t | ms | ) |
Block until ms milliseconds have elapsed since auton started.
If that point is already in the past, returns immediately.
| ms | wall-clock target, in ms since auton start |
| double light::wrap180 | ( | double | a | ) |
Normalize an angle in degrees to the half-open interval (-180, 180] so PID always takes the shortest path.
| a | input angle in degrees |
| const double light::ANGLE_NOT_SET = 0.0000000000000000000001 |
|
extern |
Process-wide singleton selector instance.
|
extern |
Millisecond timestamp captured right before the selected auton routine runs.
Set by LightLib in autonomous(); read by the helpers below.
|
extern |
Default speeds used when a pid_drive_set / pid_turn_set / pid_swing_set call omits the speed argument.
Defined in src/autons.cpp — edit there.
| const okapi::QAngle light::p_ANGLE_NOT_SET = 0.0000000000000000000001_deg |
|
extern |
Process-wide singleton tuner instance.
|
extern |
|
extern |