Go to Post Though winning is not the end, that doesn't mean it's not important. - Michael Corsetto [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Spotlight this post!  
Unread 15-02-2005, 18:32
Travis Hoffman's Avatar Unsung FIRST Hero
Travis Hoffman Travis Hoffman is offline
O-H
FRC #0048 (Delphi E.L.I.T.E.)
Team Role: Engineer
 
Join Date: Sep 2001
Rookie Year: 2001
Location: Warren, Ohio USA
Posts: 4,047
Travis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond repute
Re: Receiving info from OI to select autonomous mode

Code:
void SelectAutonomousProgram(void)
{
 
if (autonomous_mode) 	//AUTONOMOUS MODE IS ACTIVE
{
	if (automode_LED == 0) 
	{
		automode_LED = 1; //Turn on the autonomous LED when autonomous mode first starts
 
		DriveNeutral(); //Stop the drive motors.
 
		//Do other initial autonomous initialization stuff.
 
	}
}
else		//MANUAL MODE IS ACTIVE
{			
	 if (automode_LED == 1)
	 {
		 automode_LED = 0; //Turn off the autonomous LED
 
		 DriveNeutral();	 //Stop the motors
	 }
 
	//Store the status of the LR side select switch
	sideselect = LRsideselect_sw;
 
	//Store the status of the Auto Drive Disable switch
 
	autodriveselect = smartdrivedisable_sw;
	//Calculate the autonomous program number set by the BCD switch on the button box --> positions 0-7 are valid. 8-9 are not
 
	autocode = (autoselect0 * 1) + (autoselect1 * 2) + (autoselect2 * 4);
 
} 
 
} //End SelectAutonomousProgram

See the above code for reference - it's what I used last year. I call the SelectAutonomousProgram routine from Process_Data_From_Master_uP. To store any OI switch-driven settings I want to make available to the program once the match starts, I create variables (i.e. sideselect, autodriveselect, autocode) and write the status of the OI switches to them while the robot is in human control mode (which it is when it's powered on and disabled before match start). When autonomous mode starts, these variables are still available to the autonomous code while the OI switches, joysticks, etc. are being ignored. This routine also sets initial robot behavior when the bot first comes out of autonomous mode.

This year, we're using a 3-position toggle switch (wired to an analog input with the help of 22k and 47k resistors) and a BCD thumbwheel switch (8 distinct program options that consume three digital inputs) to yield 24 different autonomous program possibilities. The likelihood of me having the time to program our robot to do 24 different things in autonomous is almost nil, but that's beside the point.
__________________

Travis Hoffman, Enginerd, FRC Team 48 Delphi E.L.I.T.E.
Encouraging Learning in Technology and Engineering - www.delphielite.com
NEOFRA - Northeast Ohio FIRST Robotics Alliance - www.neofra.com
NEOFRA / Delphi E.L.I.T.E. FLL Regional Partner
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
A little question about the autonomous mode Anton Programming 4 18-01-2005 14:08
Future of Autonomous Mode FadyS. Programming 41 24-05-2004 19:45
Blue Man Group FIRST get-together? Gui Cavalcanti Chit-Chat 11 16-09-2003 18:11
autonomous mode problem on field Chris_C Programming 17 26-03-2003 19:11


All times are GMT -5. The time now is 06:19.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi