A few things.
global variables will always be available while the programming is running, in the code above “armDest” is a global and is available in all tasks.
using bStopTasksBetweenModes is not recommended unless you really understand what it means, your autonomous and usercontrol tasks will not be stopped when the field is disabled, if you do not manage these yourself then they may both end up running together.
Local variables to a task will not be retained when a task is stopped and re-started unless the variable is declared as static.
use “getTaskState” to get the status of a task, bear in mind that only the current task will be in the taskStateRunning state (ie. you have to be running to even be able to make that function call), other tasks will usually be in the taskStateWaitingForTimer state or taskStateStopped if they really are stopped.
in simple code I usually just let the system stop any PID tasks etc., for more complex code I don’t use the supplied competition template anyway so the bStopTasksBetweenModes flag becomes meaningless. Just restart any PID tasks at the start of both auton and driver control.