Programming help for drivetrain (Urgent)

So, my team has been trying out a limelight 3 for vision, and whenever we try to do target tracking, it works, but then afterwards, one side of the drivetrain moves at about half the speed of the other. We use three sparkmaxes, and three neos for each side of the drivetrain. Here is the code for the AlignWithVision command, which seems to be causing the issue:

ChiefDelphi won’t let me post the code, so I’m gonna link to a reddit post I made: https://www.reddit.com/r/FRC_PROGRAMMING/comments/1247994/drivetrain_help/

Can anyone help me debug the code? In addition, the side of the drivetrain does not stop being slower after the command is no longer being run. It’s being triggered by a whileTrue. Thanks!

Is your drive command a default command? Maybe add a stop() call to your motors in the end of the command.

1 Like

Is your code on GitHub by chance? That would more easily let us look at all your code to help with the problem.

Agreed with @sam.mulvey747
The command is being ended with the while true, but you never send a command to your motors for them to stop moving. Add a drivetrain stop method to the end function in the command. Should fix that.

2 Likes

can you help me write an example?

In AlignWithVision.java, in the end() function, add a line saying drivetrain.setOutputVolts(0, 0).

It looks like that should do it for you. Let me know how that works!

What would this actually do in the code? just set the motors to off?

1 Like

Yeah it would set the motors to stop moving after the command is ended

1 Like

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