Hello, my team has a question regarding autonomous mode. When we want to start it, it hangs and doesn’t run, but sometimes it does, but the message "!ERROR -44061 “Joystick.Joy"FRC: The loop that contains RobotDrive is not running fast enough. This error can occur if the loop contains too much code, or if one or more other loops are starting the RobotDrive loop.” appears. Teleop mode works smoothly. I saw in some posts that this can be caused when the “robot drive safety config” is activated.
Could I just disable it and be able to use the autonomous system I was taught? (in the example I just want it to go forward for 3 seconds and stop for 1 second):
You’re on the right track. There’s two general trains of thought here.
Disable the safety. Run the autonomous. Enable the safety
Use For Loops to handle the task.
I lean towards the second. The first can cause issues if something disconnects during autonomous or your code runs long. Generally, I prefer keep the safety on at all times.
For the second, I recommend for loops as you’re essentially trying to fit a while loop into the idea of a for loop. “While it’s run less than the number of iterations I’ve said, keep running”. I personally use a 50ms wait in a for loop to make math easier. Then, set it to the number of iterations I need. 5 is a quarter second. 10 is half a second. 20 is a full second. etc
You’ve also got loops inside of a sequence structure. Make your code cleaner. Remove that structure. It isn’t doing anything for you there. The operation is already ordered based on the wires going in and coming out of your loops