Mecanum Drive Odometry
import com.arcrobotics.ftclib.kinematics.wpilibkinematics.MecanumDriveOdometry
A user can use the mecanum drive kinematics classes in order to perform odometry. WPILib/FTCLib contains a MecanumDriveOdometry
class that can be used to track the position of a mecanum drive robot on the field.
Note: Because this method only uses encoders and a gyro, the estimate of the robot’s position on the field will drift over time, especially as your robot comes into contact with other robots during gameplay. However, odometry is usually very accurate during the autonomous period.
Creating the Odometry Object
0 degrees / radians represents the robot angle when the robot is facing directly toward your opponent’s alliance station. As your robot turns to the left, your gyroscope angle should increase.
Updating the Robot Pose
The update
method of the odometry class updates the robot position on the field. The update method takes in the gyro angle of the robot, along with a MecanumDriveWheelSpeeds
object representing the speed of each of the 4 wheels on the robot. This update
method must be called periodically, preferably in the periodic()
method of a Subsystem. The update
method returns the new updated pose of the robot.
The MecanumDriveWheelSpeeds
class must be constructed with each wheel speed in meters per second.
Resetting the Robot Pose
The robot pose can be reset via the resetPose
method. This method accepts two arguments – the new field-relative pose and the current gyro angle.
If at any time, you decide to reset your gyroscope, the resetPose
method MUST be called with the new gyro angle.
In addition, the getPoseMeters()
method can be used to retrieve the current robot pose without an update.
Last updated