File-By-File
SwerveChassisOdometry

SwerveChassisOdometry

This class is an AbstractOdometry implementation designed for swerve drive chassis. It combines the odometry data from individual swerve modules and a gyroscope to provide the overall position of the robot. It utilizes a SwerveDriveOdometry instance for the core kinematic calculations.

Methods

SwerveChassisOdometry(Kinematics<SwerveState> kinematics, SwerveModuleOdometry frontRightOdometry, SwerveModuleOdometry frontLeftOdometry, SwerveModuleOdometry backRightOdometry, SwerveModuleOdometry backLeftOdometry, Supplier<Angle> getGyroAngle)

Constructs a new SwerveChassisOdometry instance.

  • kinematics: A Kinematics object that defines how SwerveState (the state of all swerve modules) translates into robot movement.
  • frontRightOdometry: The SwerveModuleOdometry for the front-right swerve module.
  • frontLeftOdometry: The SwerveModuleOdometry for the front-left swerve module.
  • backRightOdometry: The SwerveModuleOdometry for the back-right swerve module.
  • backLeftOdometry: The SwerveModuleOdometry for the back-left swerve module.
  • getGyroAngle: A Supplier<Angle> that provides the current angle of the robot's gyroscope.

getRawPosition()

Overrides the abstract method from AbstractOdometry. This method gathers the current state from each individual swerve module's odometry, combines them into a SwerveState, and then uses the internal SwerveDriveOdometry to update and return the robot's current PointXYZ position. The position is updated based on the current time and gyroscope angle.