52 TrackingWheel(pros::Rotation* sensor,
float wheelDiam,
float offset,
float tpr = 36000.0f)
53 : rotSensor(sensor), motorGroup(nullptr), wheelCircumference(wheelDiam * M_PI), offset(offset), tpr(tpr), powered(false) {}
67 TrackingWheel(pros::MotorGroup* motors,
float wheelDiam,
float offset,
float tpr = 360.0f)
68 : rotSensor(nullptr), motorGroup(motors), wheelCircumference(wheelDiam * M_PI), offset(offset), tpr(tpr), powered(true) {}
72 if (rotSensor)
return (rotSensor->get_position() / tpr) * wheelCircumference;
73 if (motorGroup)
return (motorGroup->get_position() / tpr) * wheelCircumference;
85 if (rotSensor) rotSensor->reset_position();
86 if (motorGroup) motorGroup->tare_position();
90 pros::Rotation* rotSensor;
91 pros::MotorGroup* motorGroup;
92 float wheelCircumference;
143 pros::Imu*
imu, pros::Imu*
imu2 =
nullptr)
149 pros::Imu*
imu, pros::Imu*
imu2,
193void moveToPoint(
float targetX,
float targetY,
int timeout,
float maxSpeed,
bool reversed);
Single tracking wheel — works with either a Rotation sensor (preferred) or a powered MotorGroup.
float getDistanceTraveled() const
void reset()
Zero the encoder.
TrackingWheel(pros::Rotation *sensor, float wheelDiam, float offset, float tpr=36000.0f)
Construct from an unpowered Rotation sensor.
TrackingWheel(pros::MotorGroup *motors, float wheelDiam, float offset, float tpr=360.0f)
Construct from a powered MotorGroup (blue-cart default).
Runtime tuning for LightCast (particle filter) and the EKF.
Public LightLib odometry / pose-estimation API.
void update()
Force one update step (normally called by the background task).
Pose getSpeed(bool radians=false)
void init(OdomSensors sensors, MCLConfig cfg={})
Initialize the estimator.
Pose getPoseRad()
Radian-only pose accessor.
void stop()
Stop the background odometry task.
Pose estimatePose(float time, bool radians=false)
Linearly extrapolate the pose time seconds into the future, assuming current velocity holds.
Pose getLocalSpeed(bool radians=false)
void reset()
Reset all internal pose state to (0, 0, 0).
Pose getPose(bool radians=false)
void moveToPoint(float targetX, float targetY, int timeout, float maxSpeed, bool reversed)
Drive the chassis to a field-relative point (legacy entry point).
void setPose(Pose pose, bool radians=false)
Overwrite the current pose.
Per-sensor mount configuration for LightCast's ray-cast sensor model.
float offsetX
Mount X in robot frame, inches.
pros::Distance * sensor
Backing PROS distance sensor (not owned).
float offsetY
Mount Y in robot frame, inches.
float angleRad
Ray direction in robot frame, radians.
Tuning knobs for the LightCast particle filter and the EKF.
Bundle of all sensors used by the LightLib pose estimator.
TrackingWheel * horizontal1
Primary horizontal (lateral) tracking wheel.
TrackingWheel * vertical1
Primary vertical (forward-axis) tracking wheel.
OdomSensors(TrackingWheel *v1, TrackingWheel *v2, TrackingWheel *h1, TrackingWheel *h2, pros::Imu *imu, pros::Imu *imu2=nullptr)
Wheel + IMU only constructor.
pros::Gps * gps
Optional absolute-position GPS.
pros::Imu * imu2
Optional second IMU; nullptr if not used.
TrackingWheel * horizontal2
Secondary horizontal tracking wheel (or nullptr).
float gpsOffsetX
GPS mount X in robot frame, meters.
std::vector< DistanceSensorSpec > distanceSensors
Optional distance sensors for LightCast.
pros::Imu * imu
Primary IMU.
TrackingWheel * vertical2
Secondary vertical tracking wheel (or nullptr).
OdomSensors(TrackingWheel *v1, TrackingWheel *v2, TrackingWheel *h1, TrackingWheel *h2, pros::Imu *imu, pros::Imu *imu2, pros::Gps *gps, float gpsOffsetX, float gpsOffsetY, std::vector< DistanceSensorSpec > distanceSensors)
Full constructor with GPS and distance sensors.
float gpsOffsetY
GPS mount Y in robot frame, meters.
float x
X position, inches.
Pose(float x=0, float y=0, float theta=0)
float y
Y position, inches.
Pose operator*(float scalar) const
Pose operator-(const Pose &o) const
Pose operator+(const Pose &o) const
2D pose: position (in) and heading (deg).