Quote:
|
Originally Posted by Tom Saxton
Does anyone understand the details of how values from the OI are sent to the RC prior to and during autonomous?
Our procedure is to put the robot in manual and disabled, then switch to autonomous, then enable. We know that we don't get into the autonomous branch of the code until we are in both autonomous and enabled. Even if we capture the values before the "autonomous_mode" becomes true, we still get values that are always wrong on some switches and sometimes wrong on the pot.
Has anyone else seen this issue? Obviously, it's pretty embarrassing when your robot runs the wrong autonomous mode in front of five other teams and a large perceptive audience!
|
You have the basic way the signals work correct. First the robot is disabled and the autonomous flag is not set. This goes on for an unspecified amount of time. At the start of the match the autonomous flag goes up, and then the robot is enabled. You can emulate this behavior on your competition port box, but not the exact timing of signals.
We used the OI to select autonomous mode back when PBASIC was being used. The first time through the loop after reset the switch values were not reliable. The last time through the loop, just prior to seeing the autonomous flag switch, the switch values were also not reliable. We wrote code that saved the values of the required switches after a couple of cycles. What you don't want to do is save the value on the first cycle, and you don't want to save the last value prior to the autonomous flag going up. In our scheme, we saved the value a couple of cycles after reset and the students knew to reset the robot after any adjustment to the switches. You could also save several versions of the value, and select one several cycles before the autonomous flag goes up to get a reliable value. Saving several samples of the value, comparing them, and selecting "do nothing" if they are not consistent is also a good idea.
We have not tried using the OI to select the autonomous mode since, as there are plenty of switches/pots available in the robot. It is the same basic OI as the PBASIC days, and it is likely to suffer from the same issues when reading switches to select the autonomous mode. A little tweaking of your code that reads and saves the mode selector value and you should be fine. If not, move the pot to the robot...