Closed dlezcan1 closed 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:
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: