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
15namespace light {
16
18enum class Follower {
19 RAMSETE,
21};
22
29struct PathEvent {
30 int atWaypoint = 0;
31 std::function<void()> action;
32};
33
36 float b = 2.0f;
37 float zeta = 0.7f;
38 float trackWidthIn = 12.0f;
39 float wheelDiamIn = 3.25f;
40 float gearRatio = 0.75f;
41};
42
44struct DriveFF {
45 float kS = 0.0f;
46 float kV = 0.0f;
47 float kA = 0.0f;
48 float kP = 0.0f;
49};
50
63
76 int timeoutMs = -1,
77 float poseErrBailIn = 8.0f,
79
96bool followTrajectory(const std::vector<Waypoint>& wps,
97 const TrajConstraints& cons,
98 bool reversed = false,
99 int timeoutMs = -1,
100 float poseErrBailIn = 8.0f,
102
108bool followTrajectory(const std::vector<Waypoint>& wps,
109 const TrajConstraints& cons,
110 std::vector<PathEvent> events,
111 bool reversed = false,
112 int timeoutMs = -1,
113 float poseErrBailIn = 8.0f,
115
120bool followTrajectory(const std::vector<Waypoint>& wps,
121 bool reversed = false,
122 int timeoutMs = -1,
123 float poseErrBailIn = 8.0f,
125
130bool followTrajectory(const std::vector<Waypoint>& wps,
131 std::vector<PathEvent> events,
132 bool reversed = false,
133 int timeoutMs = -1,
134 float poseErrBailIn = 8.0f,
136
143bool runJerryioPath(const char* csv,
144 bool reversed = false,
145 int timeoutMs = -1,
146 float poseErrBailIn = 8.0f,
148
150bool runJerryioPath(const char* csv,
151 std::vector<PathEvent> events,
152 bool reversed = false,
153 int timeoutMs = -1,
154 float poseErrBailIn = 8.0f,
156
158bool runJerryioPathFromSD(const char* filePath,
159 bool reversed = false,
160 int timeoutMs = -1,
161 float poseErrBailIn = 8.0f,
163
165bool runJerryioPathFromSD(const char* filePath,
166 std::vector<PathEvent> events,
167 bool reversed = false,
168 int timeoutMs = -1,
169 float poseErrBailIn = 8.0f,
171
178void characterize_kV_kA_kS(float maxVoltage = 10.0f, float rampVps = 0.25f);
179
181float characterize_track_width(int rotations = 10);
182
185
191void characterize_friction(float maxVoltage = 10.0f, float stepV = 0.5f);
194} // namespace light
Time-parameterized trajectory: dense state table + total duration.
Initialize once via init(); poll getPose/setPose from any task.
Definition pid.hpp:22
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.
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.
void characterize_friction(float maxVoltage=10.0f, float stepV=0.5f)
Friction-FF auto-ID for non-trajectory PIDs.
bool followTrajectory(const Trajectory &traj, int timeoutMs=-1, float poseErrBailIn=8.0f, Follower follower=Follower::PURE_PURSUIT)
Follow a pre-generated Trajectory.
void ramsete_configure(RamseteConfig rc, DriveFF ff, TrajConstraints defaultCons)
Configure the RAMSETE follower.
Follower
Path-following controller selector.
Definition ramsete.hpp:18
float characterize_a_lat_max()
Identify the maximum sustainable lateral acceleration.
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).
@ PURE_PURSUIT
Definition util.hpp:85
Per-wheel feedforward + simple velocity-loop gains.
Definition ramsete.hpp:44
float kP
Volts per (in/s) of velocity error.
Definition ramsete.hpp:48
float kS
Volts to break static friction.
Definition ramsete.hpp:45
float kA
Volts per (in/s²).
Definition ramsete.hpp:47
float kV
Volts per (in/s) at steady state.
Definition ramsete.hpp:46
Mid-path action fired once when the trajectory passes its resolved time.
Definition ramsete.hpp:29
int atWaypoint
Index of the waypoint to fire on.
Definition ramsete.hpp:30
std::function< void()> action
Callback invoked when the trigger is reached.
Definition ramsete.hpp:31
RAMSETE controller and chassis-geometry config.
Definition ramsete.hpp:35
float b
Aggressiveness — larger = more correction.
Definition ramsete.hpp:36
float wheelDiamIn
Wheel diameter, inches.
Definition ramsete.hpp:39
float zeta
Damping, [0, 1]; 0.7 is classic.
Definition ramsete.hpp:37
float trackWidthIn
Track width, inches.
Definition ramsete.hpp:38
float gearRatio
wheel_rpm / motor_rpm (0.75 = 36:48 blue).
Definition ramsete.hpp:40
Kinematic limits used by the trajectory generator.
Time-parameterized trajectory over a Spline.