CTRE Phoenix 6 C++ 25.0.0-beta-4
|
Class for swerve drive odometry. More...
#include <ctre/phoenix6/swerve/impl/SwerveDrivePoseEstimator.hpp>
Public Types | |
using | WheelSpeeds = std::vector<SwerveModuleState> |
using | WheelPositions = std::vector<SwerveModulePosition> |
Public Member Functions | |
SwerveDriveOdometry (SwerveDriveKinematics const &kinematics, Rotation2d const &gyroAngle, WheelPositions modulePositions, Pose2d initialPose=Pose2d{}) | |
Constructs a SwerveDriveOdometry object. | |
void | ResetPosition (Rotation2d const &gyroAngle, WheelPositions wheelPositions, Pose2d const &pose) |
Resets the robot's position on the field. | |
void | ResetPose (Pose2d const &pose) |
Resets the pose. | |
void | ResetTranslation (Translation2d const &translation) |
Resets the translation of the pose. | |
void | ResetRotation (Rotation2d const &rotation) |
Resets the rotation of the pose. | |
Pose2d const & | Pose () const |
Returns the position of the robot on the field. | |
Pose2d const & | Update (Rotation2d const &gyroAngle, WheelPositions wheelPositions) |
Updates the robot's position on the field using forward kinematics and integration of the pose over time. | |
Class for swerve drive odometry.
Odometry allows you to track the robot's position on the field over a course of a match using readings from your swerve drive encoders and swerve azimuth encoders.
Teams can use odometry during the autonomous period for complex tasks like path following. Furthermore, odometry can be used for latency compensation when using computer-vision systems.
using ctre::phoenix6::swerve::impl::SwerveDriveOdometry::WheelPositions = std::vector<SwerveModulePosition> |
using ctre::phoenix6::swerve::impl::SwerveDriveOdometry::WheelSpeeds = std::vector<SwerveModuleState> |
|
inline |
Constructs a SwerveDriveOdometry object.
kinematics | The swerve drive kinematics for your drivetrain. |
gyroAngle | The angle reported by the gyroscope. |
modulePositions | The wheel positions reported by each module. |
initialPose | The starting position of the robot on the field. |
|
inline |
Returns the position of the robot on the field.
|
inline |
Resets the pose.
pose | The pose to reset to. |
|
inline |
Resets the robot's position on the field.
The gyroscope angle does not need to be reset here on the user's robot code. The library automatically takes care of offsetting the gyro angle.
gyroAngle | The angle reported by the gyroscope. |
wheelPositions | The current distances measured by each wheel. |
pose | The position on the field that your robot is at. |
|
inline |
Resets the rotation of the pose.
rotation | The rotation to reset to. |
|
inline |
Resets the translation of the pose.
translation | The translation to reset to. |
Pose2d const & ctre::phoenix6::swerve::impl::SwerveDriveOdometry::Update | ( | Rotation2d const & | gyroAngle, |
WheelPositions | wheelPositions ) |
Updates the robot's position on the field using forward kinematics and integration of the pose over time.
This method takes in an angle parameter which is used instead of the angular rate that is calculated from forward kinematics, in addition to the current distance measurement at each wheel.
gyroAngle | The angle reported by the gyroscope. |
wheelPositions | The current distances measured by each wheel. |