How do I pause tasks on pros?

How would I pause a PID loop so that it does not interrupt my turning process?

You should be able to make a boolean value where it only runs the PID is the boolean is set to true.


Yep this is exactly what you will need to do. As an extension of this, you should be aware that you should never have two (or more) tasks that are accessing the same motor at the same time. Otherwise, you will see very strange and unpredictable behavior. Given this contract, you have a couple options.

For one, you can have a task that simply does calculations and another that is dedicated to powering the motor. The dedicated motor task can then decided when it wants to access the PID outputs. A drawback of this is that since they are probably not running at the same rate there might be some dataloss in the calculations (although for this application its negligible)

Or, do what was described above and use a boolean to flag when to send power to the motor and when not to.

I am emphasizing send power to the motors because even if you stop doing the PID calculation it is equally as important to stop sending any commands to the motor. I have seen many times (even in my own code) where I forget there is an autonomous task interfering with the operator’s controls. For example the driver control might try to send 0 power to the motor since the joystick is not being pushed, but an autonomous macro might try to drive the robot forward at the same time. You can easily spot this if the motor has very stuttery movement.

If you manage to properly handle access to the motor you can have the ability to do something like this video. Where, once we lined up for the flags, the driver pressed a macro button that: shot 1 ball, drove forward a pre-determined distance, and then shot the next ball. (For the duration of the macro, the joystick input was ignored so it did not conflict with the autonomous movement). Overall, we found it very useful for driver skills consistency.