WPILibC++ 2025.1.1
|
Class for differential drive odometry. More...
#include <frc/kinematics/DifferentialDriveOdometry3d.h>
Public Member Functions | |
DifferentialDriveOdometry3d (const Rotation3d &gyroAngle, units::meter_t leftDistance, units::meter_t rightDistance, const Pose3d &initialPose=Pose3d{}) | |
Constructs a DifferentialDriveOdometry3d object. | |
void | ResetPosition (const Rotation3d &gyroAngle, units::meter_t leftDistance, units::meter_t rightDistance, const Pose3d &pose) |
Resets the robot's position on the field. | |
const Pose3d & | Update (const Rotation3d &gyroAngle, units::meter_t leftDistance, units::meter_t rightDistance) |
Updates the robot position on the field using distance measurements from encoders. | |
Public Member Functions inherited from frc::Odometry3d< DifferentialDriveWheelSpeeds, DifferentialDriveWheelPositions > | |
Odometry3d (const Kinematics< DifferentialDriveWheelSpeeds, DifferentialDriveWheelPositions > &kinematics, const Rotation3d &gyroAngle, const DifferentialDriveWheelPositions &wheelPositions, const Pose3d &initialPose=Pose3d{}) | |
Constructs an Odometry3d object. | |
void | ResetPosition (const Rotation3d &gyroAngle, const DifferentialDriveWheelPositions &wheelPositions, const Pose3d &pose) |
Resets the robot's position on the field. | |
void | ResetPose (const Pose3d &pose) |
Resets the pose. | |
void | ResetTranslation (const Translation3d &translation) |
Resets the translation of the pose. | |
void | ResetRotation (const Rotation3d &rotation) |
Resets the rotation of the pose. | |
const Pose3d & | GetPose () const |
Returns the position of the robot on the field. | |
const Pose3d & | Update (const Rotation3d &gyroAngle, const DifferentialDriveWheelPositions &wheelPositions) |
Updates the robot's position on the field using forward kinematics and integration of the pose over time. | |
Class for differential drive odometry.
Odometry allows you to track the robot's position on the field over the course of a match using readings from 2 encoders and a gyroscope.
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.
It is important that you reset your encoders to zero before using this class. Any subsequent pose resets also require the encoders to be reset to zero.
|
explicit |
Constructs a DifferentialDriveOdometry3d object.
IF leftDistance and rightDistance are unspecified, You NEED to reset your encoders (to zero).
gyroAngle | The angle reported by the gyroscope. |
leftDistance | The distance traveled by the left encoder. |
rightDistance | The distance traveled by the right encoder. |
initialPose | The starting position of the robot on the field. |
|
inline |
Resets the robot's position on the field.
IF leftDistance and rightDistance are unspecified, You NEED to reset your encoders (to zero).
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.
pose | The position on the field that your robot is at. |
gyroAngle | The angle reported by the gyroscope. |
leftDistance | The distance traveled by the left encoder. |
rightDistance | The distance traveled by the right encoder. |
|
inline |
Updates the robot position on the field using distance measurements from encoders.
This method is more numerically accurate than using velocities to integrate the pose and is also advantageous for teams that are using lower CPR encoders.
gyroAngle | The angle reported by the gyroscope. |
leftDistance | The distance traveled by the left encoder. |
rightDistance | The distance traveled by the right encoder. |