Wouldn't it be possible to create a joystick trigger to start an "autonomous" mode. I think that something like this would be usable (its in C, its just for the basic idea):
Code:
/* Global Variables */
toggled = 0;
previous_toggle = 0;
clock_counter = 0;
/* Checks if the trigger is toggled */
void Default_Routine()
{
if (p1_sw_trig == 1 & previous_toggle == 0)
{
toggled = 1;
run_auto = 1;
}
previous_toggle = p1_sw_trig;
if (run_auto & clock_counter <= 225) /* ~15 seconds in slow loop */
{
clock_counter++;
/* Place "Autonomous" code here */
}
}
if (counter > 225)
counter = 0;
if (!run_auto)
{
/* Regular robot code here */
}
You could also do one that would last until the trigger is pressed again:
Code:
/* Global Variables */
toggled = 0;
previous_toggle = 0;
void Default_Routine()
{
/* Checks if the trigger is toggled */
if (p1_sw_trig == 1 & previous_toggle == 0)
{
toggled = 1;
run_auto = 1;
}
previous_toggle = p1_sw_trig;
if (p1_sw_trig == 1 & run_auto == 1)
{
toggled = 0;
run_auto = 0;
}
if (run_auto)
{
/* Place "Autonomous" code here */
}
}
if (!run_auto)
{
/* Regular robot code here */
}
Now these would be slower than a real processor with autonomous because of the If statements. Also, a heads up to the NRG Code Repository for the trigger
toggler code.
__________________
2005 Las Vegas Regional Autodesk Visualization Award
2005 Las Vegas Regional #8 Seeded Alliance with 988 and 1505
2006 Southern California Regional #15 seed