Auto Timer not working

I am working on an auto shoot command and when I call the auto period, it starts the needed motors, but does not sequence them and they do not turn off. I think my timer is messed up but I do not know how they work. Here is my current build

Also if you know how to make this thing move in auto, that would be AMAZING, cause I do not know how to call the drive function.

For the current timer I don’t think there is anything wrong in theory, but are you waiting the 1000 seconds because that is when the motors will turn off. Also did you mean to make it an else if, as the first two if statements are completely useless.

1 Like

michalyu caught what I saw.

You may find the logic simpler if you use a SequentialCommandGroup with multiple commands, and use the withTimeout decorator to handle the timing.

1 Like

I would recommend reading through the WPILib docs on swerve drive as well as looking through some other teams code. Here is a swerve drive example provided by WPILib: https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/swervebot

Yeah I completley forgot about else if statements. Removed the final else and swapped the rest to else if and now it runs just fine.

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