|
Re: Help with C robot example
In my experience using the C++ library (C without the wrappers), all outputs completely stop once you're outside the code blocks. The methods are called once in simple robot when it detects it's changed to autonomous or operator control, and control of the robot is enabled during your code blocks.
I'll have to double check this, but either the robot drives forward for 5 seconds, then stops at the end because the autonomous program has ended, or.... if it still detects autonomous, it'll just keep on driving past the end of the block, until it detects a disable command or switching to operator control, at which point you could send new commands to the jaguars. I'll have to recheck this today. The reason they've stopped before is probably a combination of below and the fact that I stop it only by disable commands.
Usually, in order to provide immediate control and switching, I simply enclose everything within the method in a while(IsAutonomous()) or while(IsOperatorControl()) loop with a Wait(.005) at the end, making sure the code runs fast and it'll check every 5 ms to end everything.
__________________
Attending: MN Duluth Regional
Last edited by theprgramerdude : 09-01-2012 at 12:00.
|