LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
ramsete.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <functional>
4#include <vector>
5
7
31namespace light {
32
48struct PathEvent {
49 int atWaypoint = 0;
50 std::function<void()> action;
51};
52
55 float b = 2.0f;
56 float zeta = 0.7f;
57 float trackWidthIn = 12.0f;
58 float wheelDiamIn = 3.25f;
59 float gearRatio = 0.75f;
60};
61
63struct DriveFF {
64 float kS = 0.0f;
65 float kV = 0.0f;
66 float kA = 0.0f;
67 float kP = 0.0f;
68};
69
82
95 int timeoutMs = -1,
96 float poseErrBailIn = 8.0f);
97
112bool followTrajectory(const std::vector<Waypoint>& wps,
113 const TrajConstraints& cons,
114 bool reversed = false,
115 int timeoutMs = -1,
116 float poseErrBailIn = 8.0f);
117
123bool followTrajectory(const std::vector<Waypoint>& wps,
124 const TrajConstraints& cons,
125 std::vector<PathEvent> events,
126 bool reversed = false,
127 int timeoutMs = -1,
128 float poseErrBailIn = 8.0f);
129
139bool runJerryioPath(const char* csv,
140 bool reversed = false,
141 int timeoutMs = -1,
142 float poseErrBailIn = 8.0f);
143
145bool runJerryioPath(const char* csv,
146 std::vector<PathEvent> events,
147 bool reversed = false,
148 int timeoutMs = -1,
149 float poseErrBailIn = 8.0f);
150
152bool runJerryioPathFromSD(const char* filePath,
153 bool reversed = false,
154 int timeoutMs = -1,
155 float poseErrBailIn = 8.0f);
156
158bool runJerryioPathFromSD(const char* filePath,
159 std::vector<PathEvent> events,
160 bool reversed = false,
161 int timeoutMs = -1,
162 float poseErrBailIn = 8.0f);
163
170void characterize_kV_kA_kS(float maxVoltage = 10.0f, float rampVps = 0.25f);
171
173float characterize_track_width(int rotations = 10);
174
177
186void characterize_friction(float maxVoltage = 10.0f, float stepV = 0.5f);
221void autotune_turn_pid(float reliefV = 4.0f, int cycles = 6, int timeoutMs = 15000,
222 int chunkCycles = 2, int coolMs = 5000);
223void autotune_drive_pid(float reliefV = 6.0f, int cycles = 5, int timeoutMs = 15000,
224 int chunkCycles = 2, int coolMs = 5000);
225void autotune_swing_pid(float reliefV = 4.0f, int cycles = 6, int timeoutMs = 15000,
226 int chunkCycles = 2, int coolMs = 5000);
227void autotune_heading_pid(float forwardV = 3.0f, float reliefV = 2.0f,
228 int cycles = 5, int timeoutMs = 15000,
229 int chunkCycles = 2, int coolMs = 5000);
245void autotune_ekf_noise(int sampleMs = 10, int durationMs = 5000, int warmupMs = 500);
246
254void autotune_mcl_noise(int sampleMs = 20, int durationMs = 4000, int warmupMs = 300);
255
256} // namespace light
Time-parameterized trajectory: dense state table + total duration.
Public LightLib odometry / pose-estimation API.
Definition pid.hpp:22
void characterize_kV_kA_kS(float maxVoltage=10.0f, float rampVps=0.25f)
Identify kV / kA / kS by ramping voltage and recording velocity.
bool runJerryioPathFromSD(const char *filePath, bool reversed=false, int timeoutMs=-1, float poseErrBailIn=8.0f)
Read the CSV from the V5 SD card (e.g.
float characterize_track_width(int rotations=10)
Identify the effective track width by spinning in place.
void characterize_friction(float maxVoltage=10.0f, float stepV=0.5f)
Friction-FF auto-ID for the non-trajectory PID controllers.
void autotune_heading_pid(float forwardV=3.0f, float reliefV=2.0f, int cycles=5, int timeoutMs=15000, int chunkCycles=2, int coolMs=5000)
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)
Follow a pre-generated Trajectory.
void autotune_drive_pid(float reliefV=6.0f, int cycles=5, int timeoutMs=15000, int chunkCycles=2, int coolMs=5000)
bool runJerryioPath(const char *csv, bool reversed=false, int timeoutMs=-1, float poseErrBailIn=8.0f)
Run a waypoint path exported from path.jerryio.com (or any CSV-like text).
float characterize_a_lat_max()
Identify the maximum sustainable lateral acceleration.
void autotune_ekf_noise(int sampleMs=10, int durationMs=5000, int warmupMs=500)
Stationary EKF process-noise calibration.
void autotune_turn_pid(float reliefV=4.0f, int cycles=6, int timeoutMs=15000, int chunkCycles=2, int coolMs=5000)
void autotune_mcl_noise(int sampleMs=20, int durationMs=4000, int warmupMs=300)
Stationary MCL distance-sensor noise calibration.
void autotune_swing_pid(float reliefV=4.0f, int cycles=6, int timeoutMs=15000, int chunkCycles=2, int coolMs=5000)
Per-wheel feedforward + simple velocity-loop gains.
Definition ramsete.hpp:63
float kP
Volts per (in/s) of velocity error.
Definition ramsete.hpp:67
float kS
Volts to break static friction.
Definition ramsete.hpp:64
float kA
Volts per (in/s²).
Definition ramsete.hpp:66
float kV
Volts per (in/s) at steady state.
Definition ramsete.hpp:65
Mid-path action triggered at a specific input waypoint.
Definition ramsete.hpp:48
int atWaypoint
Index of the waypoint to fire on.
Definition ramsete.hpp:49
std::function< void()> action
Callback invoked when the trigger is reached.
Definition ramsete.hpp:50
RAMSETE controller and chassis-geometry config.
Definition ramsete.hpp:54
float b
Aggressiveness — larger = more correction.
Definition ramsete.hpp:55
float wheelDiamIn
Wheel diameter, inches.
Definition ramsete.hpp:58
float zeta
Damping, [0, 1]; 0.7 is classic.
Definition ramsete.hpp:56
float trackWidthIn
Track width, inches.
Definition ramsete.hpp:57
float gearRatio
wheel_rpm / motor_rpm (0.75 = 36:48 blue).
Definition ramsete.hpp:59
Kinematic limits used by the trajectory generator.
Time-parameterized trajectory over a Spline.