4#include "pros/distance.hpp"
34 static constexpr double MM_TO_IN = 0.0393701;
35 static constexpr double FIELD_WIDTH = 3566.668 * MM_TO_IN;
36 static constexpr double FIELD_HEIGHT = 3566.668 * MM_TO_IN;
37 static constexpr double HALF_WIDTH = FIELD_WIDTH / 2.0;
38 static constexpr double HALF_HEIGHT = FIELD_HEIGHT / 2.0;
39 static constexpr double MAX_SENSOR_RANGE = 2000 * MM_TO_IN;
40 static constexpr double MIN_SENSOR_RANGE = 0 * MM_TO_IN;
43 std::vector<DistanceSensor> sensors;
44 float default_heading_tolerance;
45 float default_filter_range;
48 calculateGlobalPosition(
const std::vector<DistanceSensor> &active_sensors,
49 double heading_deg,
double current_x,
62 const std::vector<DistanceSensor> &robot_sensors,
63 float heading_tolerance = 40.0,
float filter_range = 3.5);
94 bool setPose,
bool filter);
The main Chassis controller class.
Handles resetting the robot's odometry using distance sensors.
DistanceReset(Chassis *robot_chassis, const std::vector< DistanceSensor > &robot_sensors, float heading_tolerance=40.0, float filter_range=3.5)
Construct a DistanceReset handler.
distancePose updateSpecific(const std::vector< DistanceSensor > &active_sensors, bool setPose, bool filter)
Updates position using an explicitly provided list of active sensors.
distancePose update(bool setPose=false, bool filter=true)
Updates position using all configured sensors.
distancePose update(const std::vector< bool > &use_flags, bool setPose=false, bool filter=true)
Updates position using a specific set of sensors by flags.
Configuration for a single distance sensor used in odometry reset.
double strafe_offset
Offset of the sensor from the center of rotation (strafe direction)
double mounting_angle
Mounting angle of the sensor in degrees relative to the robot heading.
double forward_offset
Offset of the sensor from the center of rotation (forward direction)
pros::Distance * device
Pointer to the PROS Distance sensor object.
The resultant position calculated by distance sensors.
double x
X coordinate of the robot.
double y
Y coordinate of the robot.
bool using_odom_y
True if the Y coordinate is from odometry (sensor couldn't read Y)
bool using_odom_x
True if the X coordinate is from odometry (sensor couldn't read X)