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

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

#include <distanceReset.hpp>

Public Member Functions

 DistanceReset (const std::vector< DistanceSensor > &robot_sensors, EncoderEKFOdometry &odom=::odom, 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 33 of file distanceReset.hpp.

Constructor & Destructor Documentation

◆ DistanceReset()

hololib::DistanceReset::DistanceReset ( const std::vector< DistanceSensor > &  robot_sensors,
EncoderEKFOdometry odom = ::odom,
float  heading_tolerance = 40.0,
float  filter_range = 3.5 
)

Construct a DistanceReset handler.

Parameters
robot_sensorsVector of DistanceSensor configurations.
odomReference to the encoder EKF odometry object.
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 hololib::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 hololib::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 hololib::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.