![]() |
1516X Push Back 1.0
1516X's robot code for the 2025-2026 VEX Robotics Competition
|
Classes | |
| struct | SensorConfig |
| struct | XorShift32 |
Functions | |
| float | degToRad (float d) |
| float | wrapAngle (float a) |
| void | StartMCL (double x, double y) |
| void | MotionUpdate (double dX_global, double dY_global, double dTheta, double robot_theta_deg) |
| void | SensorUpdate (const std::vector< float > &measurements, float robot_theta_deg, float current_confidence) |
| float | computeESS () |
| void | Resample () |
| void | MonteCarlo () |
Variables | |
| double | PARAMS_TRANS_BASE = 0.3 |
| double | PARAMS_TRANS_GAIN = 0.025 |
| double | global_X = 0 |
| double | global_Y = 0 |
| double | global_Theta = 0 |
| double | global_Confidence = 0 |
| float | w_slow = 0.0f |
| float | w_fast = 0.0f |
| constexpr float | ALPHA_SLOW = 0.001f |
| constexpr float | ALPHA_FAST = 0.1f |
| constexpr float | FIELD_SIZE = 140.42f |
| constexpr float | HALF_SIZE = FIELD_SIZE * 0.5f |
| constexpr float | FIELD_MIN = -HALF_SIZE |
| constexpr float | FIELD_MAX = HALF_SIZE |
| constexpr float | MAX_SENSOR_READING = 55.0f |
| float | particle_x [NUM_PARTICLES] |
| float | particle_y [NUM_PARTICLES] |
| float | particle_weights [NUM_PARTICLES] |
| pros::Mutex | particle_mutex |
| const std::vector< SensorConfig > | SENSOR_CONFIGS |
| struct MCL::XorShift32 | rng |
| float MCL::computeESS | ( | ) |
Definition at line 202 of file MCL.cpp.
References particle_mutex, and particle_weights.
Referenced by MonteCarlo().
|
inline |
Definition at line 73 of file MCL.cpp.
Referenced by MotionUpdate(), and SensorUpdate().
| void MCL::MonteCarlo | ( | ) |
Definition at line 254 of file MCL.cpp.
References backDistance(), chassis(), computeESS(), frontDistance(), global_Confidence, global_Theta, global_X, global_Y, leftDistance(), MAX_SENSOR_READING, MotionUpdate(), particle_mutex, particle_weights, particle_x, particle_y, Resample(), rightDistance(), SensorUpdate(), w_fast, w_slow, and wrapAngle().
| void MCL::MotionUpdate | ( | double | dX_global, |
| double | dY_global, | ||
| double | dTheta, | ||
| double | robot_theta_deg ) |
Definition at line 96 of file MCL.cpp.
References degToRad(), FIELD_MAX, FIELD_MIN, global_Confidence, PARAMS_TRANS_BASE, PARAMS_TRANS_GAIN, particle_mutex, particle_x, particle_y, and rng.
Referenced by MonteCarlo().
| void MCL::Resample | ( | ) |
Definition at line 211 of file MCL.cpp.
References FIELD_MAX, FIELD_MIN, global_X, global_Y, particle_mutex, particle_weights, particle_x, particle_y, rng, w_fast, and w_slow.
Referenced by MonteCarlo().
| void MCL::SensorUpdate | ( | const std::vector< float > & | measurements, |
| float | robot_theta_deg, | ||
| float | current_confidence ) |
Definition at line 129 of file MCL.cpp.
References ALPHA_FAST, ALPHA_SLOW, MCL::SensorConfig::angle, degToRad(), FIELD_MAX, FIELD_MIN, particle_mutex, particle_weights, particle_x, particle_y, SENSOR_CONFIGS, w_fast, w_slow, MCL::SensorConfig::x, and MCL::SensorConfig::y.
Referenced by MonteCarlo().
| void MCL::StartMCL | ( | double | x, |
| double | y ) |
Definition at line 81 of file MCL.cpp.
References FIELD_MAX, FIELD_MIN, particle_mutex, particle_weights, particle_x, particle_y, rng, w_fast, and w_slow.
|
inline |
Definition at line 74 of file MCL.cpp.
Referenced by MonteCarlo().
|
constexpr |
Definition at line 20 of file MCL.cpp.
Referenced by SensorUpdate().
|
constexpr |
Definition at line 19 of file MCL.cpp.
Referenced by SensorUpdate().
|
constexpr |
Definition at line 26 of file MCL.cpp.
Referenced by MotionUpdate(), Resample(), SensorUpdate(), and StartMCL().
|
constexpr |
Definition at line 25 of file MCL.cpp.
Referenced by MotionUpdate(), Resample(), SensorUpdate(), and StartMCL().
| double MCL::global_Confidence = 0 |
Definition at line 16 of file MCL.cpp.
Referenced by MonteCarlo(), and MotionUpdate().
| double MCL::global_Theta = 0 |
Definition at line 16 of file MCL.cpp.
Referenced by MonteCarlo().
| double MCL::global_X = 0 |
Definition at line 16 of file MCL.cpp.
Referenced by MonteCarlo(), and Resample().
| double MCL::global_Y = 0 |
Definition at line 16 of file MCL.cpp.
Referenced by MonteCarlo(), and Resample().
|
constexpr |
|
constexpr |
Definition at line 29 of file MCL.cpp.
Referenced by MonteCarlo().
| double MCL::PARAMS_TRANS_BASE = 0.3 |
Definition at line 13 of file MCL.cpp.
Referenced by MotionUpdate().
| double MCL::PARAMS_TRANS_GAIN = 0.025 |
Definition at line 14 of file MCL.cpp.
Referenced by MotionUpdate().
| pros::Mutex MCL::particle_mutex |
Definition at line 36 of file MCL.cpp.
Referenced by computeESS(), MonteCarlo(), MotionUpdate(), Resample(), SensorUpdate(), and StartMCL().
| float MCL::particle_weights[NUM_PARTICLES] |
Definition at line 34 of file MCL.cpp.
Referenced by computeESS(), MonteCarlo(), Resample(), SensorUpdate(), and StartMCL().
| float MCL::particle_x[NUM_PARTICLES] |
Definition at line 32 of file MCL.cpp.
Referenced by MonteCarlo(), MotionUpdate(), Resample(), SensorUpdate(), and StartMCL().
| float MCL::particle_y[NUM_PARTICLES] |
Definition at line 33 of file MCL.cpp.
Referenced by MonteCarlo(), MotionUpdate(), Resample(), SensorUpdate(), and StartMCL().
| struct MCL::XorShift32 MCL::rng |
Referenced by MotionUpdate(), Resample(), and StartMCL().
| const std::vector<SensorConfig> MCL::SENSOR_CONFIGS |
Definition at line 46 of file MCL.cpp.
Referenced by SensorUpdate().
| float MCL::w_fast = 0.0f |
Definition at line 18 of file MCL.cpp.
Referenced by MonteCarlo(), Resample(), SensorUpdate(), and StartMCL().
| float MCL::w_slow = 0.0f |
Definition at line 18 of file MCL.cpp.
Referenced by MonteCarlo(), Resample(), SensorUpdate(), and StartMCL().