Having issues with updating odometry

Hi, I was following the wpi screensteps for trajectory following code and when I got to the position update I got an error message even though I was following wpi’s steps

get speeds
(my code)

get speeds 2
(screensteps code)

can someone please help me with this?

I’m presuming that you’re following this: Mecanum Drive Odometry — FIRST Robotics Competition documentation

Does getHeading() return a Rotation2d? Does getSpeed() return MecanumDriveWheelSpeeds? That’s what the MecanumDriveOdopmetry update method takes.

If that’s not it, we’ll need more context. Which tutorial are you following? What is the error message? Need more context for the code.

1 Like


that’s my code
and I am following this tutorial

( it starts right when he talks about the position update)

and the error message is “The method update(Rotation2d, double, double) in the type DifferentialDriveOdometry is not applicable for the arguments (Rotation2d, DifferentialDriveWheelSpeeds)”

There was an update to the update method before it was released to the public. The update removed the overload that accepted a DifferentialDriveWheelSpeeds objects. Now in order to call the update method you need to provide the 2 wheel distances instead of wheel speeds. For an example of how to do this, take a look at this page of the FRC Documentation.

2 Likes

does the encoder position counts as distance?

No. The number passed into the update method must be in a distance in meters.

Oops, I should probably add a note to the description of that video saying that the method I used was removed (by me, ironically).

But yeah, as Austin mentioned, the API changes a lot during the beta period, but it should be solid now and the latest documentation should reflect that.

Edit: Description has now been updated.

2 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.