6#include "pros/motors.hpp"
7#include "pros/rotation.hpp"
59 pros::Motor& fl, pros::Motor& fr, pros::Motor& bl, pros::Motor& br, pros::IMU& imu_sensor,
ChassisConfig cfg);
85 void setPose(
float x,
float y,
float theta);
105 pros::Motor& frontLeft;
106 pros::Motor& frontRight;
107 pros::Motor& backLeft;
108 pros::Motor& backRight;
120 bool useTrackingWheels =
false;
121 bool kfEnabled =
true;
122 float trackingWheelMeasNoise = 0.0005f;
123 float measurementNoise = 0.001f;
124 bool velocityCalculationsOn =
true;
125 float motionDistTraveled = 0.0f;
128 std::vector<TrackingWheelConfig> trackingWheelConfigs;
129 std::vector<pros::Rotation> trackingWheelSensors;
130 std::vector<float> prevTrackingPositions;
133 pros::Mutex poseMutex;
134 std::optional<pros::Task> m_task = std::nullopt;
void setPose(float x, float y, float theta)
Sets the pose of the robot.
void addTrackingWheel(TrackingWheelConfig config)
Adds a tracking wheel configuration to the pipeline.
Pose getPose(bool radians=false)
Gets the pose of the robot.
void clearTrackingWheels()
Clears tracking wheels and falls back to motor layout.
void startTask(uint32_t period_ms=10)
Spawns the processing task thread if not already running.
void setPose(Pose pose)
Sets the pose of the robot.
void setVelocityCalculations(bool state)
void setKalmanFilterEnabled(bool enabled)
Enable or disable the internal Extended Kalman Filter.
void update(uint32_t period_ms)
Main loop running the processing pipeline.
EncoderEKFOdometry(pros::Motor &fl, pros::Motor &fr, pros::Motor &bl, pros::Motor &br, pros::IMU &imu_sensor, ChassisConfig cfg)
Constructor initializing the EKF Odometry system.
Extended Kalman Filter implementation for maintaining the robot's pose.
TrackingWheelOrientation
Defines the orientation of an unpowered tracking wheel.
Core constants to configure the chassis dimensions and hardware.
float drivetrainLength
Physical length of the drivetrain.
float drivetrainWidth
Physical width of the drivetrain.
float trackWidth
Distance between left and right wheels.
float gearRatio
Gear ratio (motor rotations / wheel rotations)
float wheelDiameter
Diameter of the drive wheels.
VelocityComponents velocity
Configuration parameters for a tracking wheel.
float xOffset
Offset from tracking center on the X axis.
float gearRatio
Gear ratio between the wheel and the sensor.
TrackingWheelOrientation orientation
Orientation (horizontal or vertical)
float wheelDiameter
Diameter of the tracking wheel.
float yOffset
Offset from tracking center on the Y axis.
int8_t port
Sensor port number.