HoloLib
High-performance holonomic (X-Drive) control library for VEX V5
Loading...
Searching...
No Matches
DistanceReset Class Reference

Handles resetting the robot's odometry using distance sensors. More...

#include <distanceReset.h>

Public Member Functions

 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 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.
 
distancePose updateSpecific (const std::vector< DistanceSensor > &active_sensors, bool setPose, bool filter)
 Updates position using an explicitly provided list of active sensors.
 

Detailed Description

Handles resetting the robot's odometry using distance sensors.

It calculates the absolute position on the field using distance to walls.

Definition at line 32 of file distanceReset.h.

Constructor & Destructor Documentation

◆ DistanceReset()

DistanceReset::DistanceReset ( Chassis robot_chassis,
const std::vector< DistanceSensor > &  robot_sensors,
float  heading_tolerance = 40.0,
float  filter_range = 3.5 
)

Construct a DistanceReset handler.

Parameters
robot_chassisPointer to the chassis object.
robot_sensorsVector of DistanceSensor configurations.
heading_toleranceTolerance in degrees for the sensor to be considered perpendicular to the wall.
filter_rangeMaximum acceptable deviation from the current odometry reading.

Member Function Documentation

◆ update() [1/2]

distancePose DistanceReset::update ( bool  setPose = false,
bool  filter = true 
)

Updates position using all configured sensors.

Parameters
setPoseIf true, automatically updates the chassis odometry with the calculated position.
filterIf true, applies filtering based on filter_range.
Returns
distancePose The newly calculated position.

◆ update() [2/2]

distancePose DistanceReset::update ( const std::vector< bool > &  use_flags,
bool  setPose = false,
bool  filter = true 
)

Updates position using a specific set of sensors by flags.

Parameters
use_flagsBoolean flags corresponding to each configured sensor (true to use).
setPoseIf true, automatically updates the chassis odometry.
filterIf true, applies filtering.
Returns
distancePose The newly calculated position.

◆ updateSpecific()

distancePose DistanceReset::updateSpecific ( const std::vector< DistanceSensor > &  active_sensors,
bool  setPose,
bool  filter 
)

Updates position using an explicitly provided list of active sensors.

Parameters
active_sensorsVector of sensors to use for this update.
setPoseIf true, automatically updates the chassis odometry.
filterIf true, applies filtering.
Returns
distancePose The newly calculated position.