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

Extended Kalman Filter implementation for maintaining the robot's pose. More...

#include <pose_ekf.h>

Public Member Functions

EIGEN_MAKE_ALIGNED_OPERATOR_NEW void setProcessNoise (float xNoise, float yNoise, float thetaNoise, float measNoise)
 Set the process noise values for the Kalman filter matrices.
 
 PoseEKF (float initial_x, float initial_y, float initial_theta)
 Construct a new Pose EKF object.
 
void predict (float dx_local, float dy_local, float dtheta)
 The prediction step of the EKF based on local relative movements.
 
void updateIMU (float measured_theta, float dynamic_R)
 Update the state using absolute heading measured by an IMU.
 
void updateTrackingWheels (const std::vector< TrackingWheelConfig > &configs, const Eigen::VectorXf &measured_deltas, float dx_local, float dy_local, float dtheta, float wheel_noise)
 Update the state using unpowered tracking wheels data.
 
void setTrackingWheelNoise (float xNoise, float yNoise, float thetaNoise)
 Set specific process noises when using tracking wheels.
 
float getX () const
 Get current X position.
 
float getY () const
 Get current Y position.
 
float getTheta () const
 Get current heading angle.
 
void setPose (float new_x, float new_y, float new_theta)
 Reset the state to a specific pose.
 

Detailed Description

Extended Kalman Filter implementation for maintaining the robot's pose.

Fuses IMU heading and tracking wheel (or motor encoder) deltas to estimate X, Y, and Theta coordinates on the field.

Definition at line 16 of file pose_ekf.h.

Constructor & Destructor Documentation

◆ PoseEKF()

PoseEKF::PoseEKF ( float  initial_x,
float  initial_y,
float  initial_theta 
)
inline

Construct a new Pose EKF object.

Parameters
initial_xStarting X position.
initial_yStarting Y position.
initial_thetaStarting heading.

Definition at line 51 of file pose_ekf.h.

Member Function Documentation

◆ setProcessNoise()

EIGEN_MAKE_ALIGNED_OPERATOR_NEW void PoseEKF::setProcessNoise ( float  xNoise,
float  yNoise,
float  thetaNoise,
float  measNoise 
)
inline

Set the process noise values for the Kalman filter matrices.

Parameters
xNoiseProcess noise in the X direction.
yNoiseProcess noise in the Y direction.
thetaNoiseProcess noise for the heading.
measNoiseMeasurement noise parameter.

Definition at line 36 of file pose_ekf.h.

◆ predict()

void PoseEKF::predict ( float  dx_local,
float  dy_local,
float  dtheta 
)
inline

The prediction step of the EKF based on local relative movements.

Parameters
dx_localChange in local X position.
dy_localChange in local Y position.
dthetaChange in heading.

Definition at line 65 of file pose_ekf.h.

◆ updateIMU()

void PoseEKF::updateIMU ( float  measured_theta,
float  dynamic_R 
)
inline

Update the state using absolute heading measured by an IMU.

Parameters
measured_thetaHeading read from the IMU.
dynamic_RDynamic measurement noise.

Definition at line 114 of file pose_ekf.h.

◆ updateTrackingWheels()

void PoseEKF::updateTrackingWheels ( const std::vector< TrackingWheelConfig > &  configs,
const Eigen::VectorXf &  measured_deltas,
float  dx_local,
float  dy_local,
float  dtheta,
float  wheel_noise 
)
inline

Update the state using unpowered tracking wheels data.

Parameters
configsVector of tracking wheel configurations.
measured_deltasMeasurement differences for each wheel since the last step.
dx_localEstimated local X change.
dy_localEstimated local Y change.
dthetaEstimated heading change.
wheel_noiseSensor noise for the tracking wheels.

Definition at line 135 of file pose_ekf.h.

◆ setTrackingWheelNoise()

void PoseEKF::setTrackingWheelNoise ( float  xNoise,
float  yNoise,
float  thetaNoise 
)
inline

Set specific process noises when using tracking wheels.

Parameters
xNoiseProcess noise in X direction.
yNoiseProcess noise in Y direction.
thetaNoiseProcess noise for the heading.

Definition at line 186 of file pose_ekf.h.

◆ getX()

float PoseEKF::getX ( ) const
inline

Get current X position.

Returns
float The X position.

Definition at line 196 of file pose_ekf.h.

◆ getY()

float PoseEKF::getY ( ) const
inline

Get current Y position.

Returns
float The Y position.

Definition at line 202 of file pose_ekf.h.

◆ getTheta()

float PoseEKF::getTheta ( ) const
inline

Get current heading angle.

Returns
float The heading in radians.

Definition at line 208 of file pose_ekf.h.

◆ setPose()

void PoseEKF::setPose ( float  new_x,
float  new_y,
float  new_theta 
)
inline

Reset the state to a specific pose.

Parameters
new_xNew X position.
new_yNew Y position.
new_thetaNew heading angle.

Definition at line 217 of file pose_ekf.h.