Trajectory Path Following - Reset Odometry questions

Hello,

This is the first season our team has experimented with Trajectory Path Following and we have had some issues with performance, which leads to some basic questions we need to get clarified.

First some details. We are driving multiple path segments broken up by command actions of other systems, so each of the trajectory building/following commands are executed in a separate Sequential Command Group. Our robot is Swerve Drive so we are using the SwerveControllerCommand path following command class.

What is the purpose of the ResetOdometry (Odometry. resetPostition()) command that is called at the beginning of the Path Following command? (We are instructed to do this in the Trajectory Path Following instructions.) Is this to set the home/ origin position (0,0,0°)? Or is this to set the current starting absolute field position? It is not clear to me on whether the SwerveControllerCommand class is Field Relative or Robot Relative.

Also, in this case of stacking multiple Trajectory Path Following commands together, should each command have a ResetOdometry invoked at the beginning of their SequentialCommandGroup, or only do a single ResetOdometry call at first Trajectory Path command and then not invoke ResetOdometry on the subsequent Trajectory Path commands since you just want to continue where you left off, not start over? Perhaps knowing the answer to the Absolute vs. Relative positioning question helps answer this.

Thank You

Reset Odometry is to tell the code where your robot is positioned on the field. This is usually done by getting the initial pose of the first trajectory you running.

The SwerveControllerCommand isn’t either Field or Robot Relative. It takes in a trajectory and a current pose and uses the PID controllers to get them to align. It is likely your trajectory is field relative, thus your robot pose should be too. This will also help with tracking your robot pose on the field during the match if you care about that.

No it is very important that you not reset odometry after each path. Only do this at the beginning.

Think about what resetting would do from the robot’s perspective. It would run the trajectory, possibly ending with some error. Then if you reset the odometry the robot would “teleport” to the proper ending position (or starting position of the next trajectory, they should be the same) and run the next sequence from there from the RIO’s perspective. In real life you robot obviously doesn’t teleport so it would just compound any error you had on the first trajectory and apply that to all subsequent trajectories instead or trying to correct it.

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