I’ve been running into this error in the 2023 beta version of WPIlib. The error message I am getting is : No matching call to 'frc::SwerveDriveOdometry<4>::SwerveDriveOdometry(<brace-enclosed initalizer list>)
in reference to this line: static frc::SwerveDriveOdometry<4> odometry{kinematics, frc::Rotation2d{0_deg}};
Note: kinematics is defined as the following (keep in mind it uses extern):
Odometry::kinematics is shown above. Drivetrain::getCCWHeading() is a wrapper around units::degree_t{navx->GetAngle()}
Finally, module_states is defined as:
Could you post a link to your code and the full compilation error? There isn’t enough context here to figure out what’s gone wrong.
If I had to guess based on what you’ve provided, Drivetrain::getCCWHeading() doesn’t return a Rotation2d and using {} for constructing SwerveDriveOdometry means no implicit conversion to Rotation2d occurs.
I think you are supplying swerve module states not swerve module position. To me the parameter naming is not great as it’s a bit misleading.
I think this has changed in the 2023 release. Odometry now wants module distances in metres and angles in radians, not module velocities and angles like it used to be.
I was wrong, Drivetrain::getCCWHeading() is defined as frc::Rotation2d navx->GetAngle()
I think that the issue is a matter of passing SwerveModulePosition (desired) and not SwerveModuleState (Current). I am attempting to create a get_position() method like the example provides, however I am running into some issues. The method is defined as: