Running tasks between autonomous and driver control - from official VRC forum

This question was asked in the Official VRC Sack Attack Q&A

I though it would be worth explaining why the answer is yes and why ultimately it will not help you with your lift system.

First some background on the ROBOTC competition template, there is a more comprehensive explanation in this thread but in reality there is nothing special about this piece of code, all it is doing is monitoring the state in the competition control flags and starting one of two tasks depending on what it detects. There is nothing from stopping you from using your own custom main task instead of this code and starting as many additional tasks as you wish (within the limits of the ROBOTC resources). In the thread above I posted some code to demonstrate an alternative (note it was written using a previous version of ROBOTC). The bStopTasksBetweenModes boolean was introduced after that code was written, it’s just a global variable that the standard template checks to see if tasks should be stopped between the two competition phases. In other words, it is completely within the rules to have tasks running, in fact, there are no restrictions as to the code running on the cortex as long as the robot passes the competition control part of inspection.

Having said this, even if tasks continue to be run when the robot is disabled, the motors cannot be controlled. You can continue to send them control values but they will not respond. Again, there is more detail in this post but the short version is that the cortex contains two micro-controllers, a user processor on which your code is running and a master processor that manages the USB port (including VEXnet control), directly controls motor ports 2 through 9 and has the ability to disable the motors on ports 1 & 10.

If you want to be able to control your lift motors when the robot is disabled then you are out of luck, if you only wish to keep the PID running and monitor the lift sensor then that will work but, as there will be no motor control, the lift will probably drop due to gravity.

Anyway, hope this explanation helps.

1 Like