|
WPILibC++
2020.3.2
|
Class for mecanum drive odometry. More...
#include <MecanumDriveOdometry.h>
Public Member Functions | |
| MecanumDriveOdometry (MecanumDriveKinematics kinematics, const Rotation2d &gyroAngle, const Pose2d &initialPose=Pose2d()) | |
| Constructs a MecanumDriveOdometry object. More... | |
| void | ResetPosition (const Pose2d &pose, const Rotation2d &gyroAngle) |
| Resets the robot's position on the field. More... | |
| const Pose2d & | GetPose () const |
| Returns the position of the robot on the field. More... | |
| const Pose2d & | UpdateWithTime (units::second_t currentTime, const Rotation2d &gyroAngle, MecanumDriveWheelSpeeds wheelSpeeds) |
| Updates the robot's position on the field using forward kinematics and integration of the pose over time. More... | |
| const Pose2d & | Update (const Rotation2d &gyroAngle, MecanumDriveWheelSpeeds wheelSpeeds) |
| Updates the robot's position on the field using forward kinematics and integration of the pose over time. More... | |
Class for mecanum drive odometry.
Odometry allows you to track the robot's position on the field over a course of a match using readings from your mecanum wheel 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.
|
explicit |
Constructs a MecanumDriveOdometry object.
| kinematics | The mecanum drive kinematics for your drivetrain. |
| gyroAngle | The angle reported by the gyroscope. |
| initialPose | The starting position of the robot on the field. |
|
inline |
Returns the position of the robot on the field.
|
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.
| pose | The position on the field that your robot is at. |
| gyroAngle | The angle reported by the gyroscope. |
|
inline |
Updates the robot's position on the field using forward kinematics and integration of the pose over time.
This method automatically calculates the current time to calculate period (difference between two timestamps). The period is used to calculate the change in distance from a velocity. This also takes in an angle parameter which is used instead of the angular rate that is calculated from forward kinematics.
| gyroAngle | The angle reported by the gyroscope. |
| wheelSpeeds | The current wheel speeds. |
| const Pose2d& frc::MecanumDriveOdometry::UpdateWithTime | ( | units::second_t | currentTime, |
| const Rotation2d & | gyroAngle, | ||
| MecanumDriveWheelSpeeds | wheelSpeeds | ||
| ) |
Updates the robot's position on the field using forward kinematics and integration of the pose over time.
This method takes in the current time as a parameter to calculate period (difference between two timestamps). The period is used to calculate the change in distance from a velocity. This also takes in an angle parameter which is used instead of the angular rate that is calculated from forward kinematics.
| currentTime | The current time. |
| gyroAngle | The angle reported by the gyroscope. |
| wheelSpeeds | The current wheel speeds. |