Robot Turning at end of Trajectory

At the end of a trajectory, the robot is turning (without command to do so) after it follows along how it’s supposed to. It is driving to the proper distance, just turning at the end. The gyroscope reads 0 (as it’s supposed to) at the beginning and just before it turns at the end. How would I go about fixing this?

Is it finishing the trajectory move then turning. If so maybe command the motors to zero after the trajectory.

I thought we had a .andthen(new InstantCommand(()->drive.arcadeDrive(0,0))); sort of finish.

Edit: look here for actual code we use:

I do have that in (I can put my code on github here in a minute), I negated the value for one of my encoders, and now it is not turning at the end, but it is driving forward on the trajectory (as it should) but then reversing along the trajectory (similar in a way to the turning, but going straight (probably because of the negated values)).

You can see above that I don’t negate any encoder values because they are automatically correct when I invert the leader motor on the right side.

I do have to check that the right side motor CAN addresses are for right side. I have to make sure the gyro is ccw positive. I have make sure neither the encoder or voltage setting methods are negated. And I have to make sure that I have the correct config, one for forward paths and another with the reverse flag for backward paths.

I’m not sure what more could be causing issues but I’ll reply if I think of something.

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