BLlakers / 2024_Official

Other
2 stars 1 forks source link

Correction for SwerveDriveOdometry object #1

Closed dlezcan1 closed 5 months ago

dlezcan1 commented 5 months ago

There should be a getPosition() function for your swerve module to be fed into the odometry model. Example code for generating a SwerveModulePosition object is below: https://github.com/wpilibsuite/allwpilib/blob/ce550705d7cdab117c0153a202973fc026a81274/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/swervebot/SwerveModule.java#L100C1-L103C4

The from there, in the drivetrain, the SwerveDriveOdometry object can be generated as below: https://github.com/wpilibsuite/allwpilib/blob/ce550705d7cdab117c0153a202973fc026a81274/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/swervebot/Drivetrain.java#L35C1-L44C12

The following changes could help: