OK, here’s the situation. Whenever the robot is booted and running, our camera code is running regardless of the state we are in, or the mode. We are using the Two Color Tracking vi. as the basis for our camera tracking code. So far it works really well. We have one “feature” we would like to add to the code.
What we want to be able to do is hold, or lock, the Gimbel tracking state machine in the “Begin-Search” mode whenever the robot is disabled, both Autonomous disabled and Teleop disabled.
Currently, if you watch the front panel indicators for the X and Y servo positions, they continue the “Searching” pattern even when disabled, though the servos them selves are not moving, eaxactly as you would expect.
What we want to do is: Whenever disabled, have the tracking code stay in the “Begin-Search” mode until the robot is enabled. As it currently works, the camera will jump to whatever position the code is at when the robot is transitioned from disabled to enabled. Being that we will have no control over when this will happen during competition, we have varying results in how our robot responds during autonomous.
Any clues on how to “hold” the state machine in one state during “Disabled” would be greatly appreciated.
I had something like this happen to me early on. The robot monitors all inputs, including the camera, so all your algorithms get messed up. What I do is disable vision completely when disabled, and set the servo positions to the middle. That way when the robot is enabled, everything is ready to go.
It seems like you want to still do camera stuff in disabled mode, though. Perhaps you can make the robot mode a global, and check for the “Disabled” mode in the Gimbel track vi. Just never let it go past that point until you are enabled.