Hi everyone,
I just wanted to add a note from 2046’s issues in Portland last weekend. We had some major problems with our autonomous mode while on the field in Portland. The diagnosis from the FTA was that our robot was getting “stuck in autonomous mode” and “not exiting autonomous mode” looking at the charts tab of our driver station we could see where FMS requested autonomous mode then requested teleop mode, however it also showed our driver station go into autonomous mode, but never switch to teleop mode - our driver station stayed in autonomous mode throughout the entire teleop mode. Our bot was motionless after it finished it’s autonomous routine - very sad.
Additionally several other teams had suffered similar issues with autonomous not “exiting” properly. Some of them simply disabled their autonomous routines others found problems when simply running their autonomous manually and were able to fix those in the pits. Ours was a bit different as everything worked manually - even in practice mode, but not when FMS controlled.
we spent all day friday trying to work out the possible causes. We luckily had an extra laptop and a copy of FMS Light handy - we configured that laptop as an FMS server with the correct IP 10.0.0.5 and tethered it to the robot along with our driver station in the pit - we were able to replicate the scenario that way where we saw FMS request teleop but the robot stayed in autonomous.
We found two possible causes of the issue during our testing. We’re programming in c++ this year and our while loop for autonomous originally looked like this :
while(IsAutonomous())
{
if(IsEnabled())
{
...
}
Wait(0.005);
}
Skunkworks 1983 came over to lend a pair of eyes to the problem (thanks Skunks!) and noted that they had both checks for autonomous and enabled as conditions for the while loop, so that if either was not true it would exit which made good sense and appeared to be a possible source of the problem - when autonomous is over it gets disabled, then switched to teleop - i believe we got disabled but never saw the driver station switch to teleop mode, so this change forces the autonomous routine to exit once disabled even though the driver station feels it is in autonomous mode still. So the updated loop looks like:
while(IsAutonomous() && IsEnabled())
{
...
Wait(0.005);
}
That seemed to alleviate some of our issues with the autonomous getting stuck, additionally we did find one part of our imaging stuff which was mostly for troubleshooting that appeared to be throwing errors occasionally. our theory was that might have been throwing an exception during autonomous and thus stopping the robot from reacting to further instructions… We got rid of that piece to be safe.
After these changes we were working fine and we were able to have a very productive Saturday.
Hopefully no one else will run into similar issues, but if you do I hope this helps.
Good luck everyone!