View Single Post
  #10   Spotlight this post!  
Unread 14-05-2004, 19:05
Joshua May's Avatar
Joshua May Joshua May is offline
Go Bears!
FRC #1110 (Binary Bulldogs)
Team Role: College Student
 
Join Date: Nov 2003
Rookie Year: 2003
Location: Berkeley, CA
Posts: 1,306
Joshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond repute
Send a message via AIM to Joshua May
Re: 2001 2002 in Automous

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.
__________________
The FIRST Wiki - openFIRST - Ultimate Robot Challenge - URC Wiki
I currently have 50 GMail invites, PM or email me for one.
UC Berkeley Class of 2009

2005 Las Vegas Regional Autodesk Visualization Award
2005 Las Vegas Regional #8 Seeded Alliance with 988 and 1505
2006 Southern California Regional #15 seed