Quote:
Originally Posted by BigJ
While 1675 was messing around with more autonomous routines at Midwest this weekend, we found out that (at least the way we were doing it) when you try to read the digital IO pins in autonomous, it takes them from the state they were at driver station boot.
If you go this route, make sure you thoroughly test your system and that drivers know of any special procedures they need to follow to choose the mode they want.
(We ended up not putting it in yet because we only used one autonomous routine.)
|
We implemented a similar select auto program from OI method as we've used in past years, except we didn't use the Driver Station's digital IO - instead, we used the left and right stick push buttons on our Logitech gamepad to select start position and program number, respectively:
(This is obviously Wind River code. The code resides in the "Disabled Periodic" routine.)
Code:
/*
* Determine the autonomous start position and program number.
1 = NEAR, 2 = CENTER, 3 = FAR
Use left stick push for start pos cycle; right stick push for program cycle.
*/
#define MAXPOS 3
#define MAXPROG 8
//starting position
if (not autopos_sw) autostartlock = 0;
if ( (autopos_sw) && (autostartlock == 0) )
{
if (autostartpos < MAXPOS)
{
autostartpos++;
}
else
{
autostartpos = 1;
}
autostartlock = 1;
}
//autonomous program number
if (not autoprog_sw) autoproglock = 0;
if ( (autoprog_sw) && (autoproglock == 0) )
{
if (autoprognum < MAXPROG)
{
autoprognum++;
}
else
{
autoprognum = 1;
}
autoproglock = 1;
}
//Update the LCD Display
Write2LCD();
Write2LCD contains code which updates the nifty new user-writeable DS LCD display screen with robot info, including text descriptions of each auto program we run. Who needs a PC dashboard, anyway?