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: AKinematicsobject that defines howSwerveState(the state of all swerve modules) translates into robot movement.frontRightOdometry: TheSwerveModuleOdometryfor the front-right swerve module.frontLeftOdometry: TheSwerveModuleOdometryfor the front-left swerve module.backRightOdometry: TheSwerveModuleOdometryfor the back-right swerve module.backLeftOdometry: TheSwerveModuleOdometryfor the back-left swerve module.getGyroAngle: ASupplier<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.