Go to Post Introverts can be good leaders too, we just lead differently. - Ari423 [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

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 02-02-2007, 19:07
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,082
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Autonomous selector

Quote:
Originally Posted by sarcasticmadnes View Post
Our team (MVRT) has a keypad that takes up one whole port. The keypad is coded in assembly and has its own circuit board and the lcd screen is powered by regular AA batteries. The keypad allows us to have 64 different autonomous positions and choose which alliance we are and which position we are in.
This is specifically disallowed by rule <R83>. Unless the LCD has no physical connection to the keypad and interfaces with only the dashboard port, it violates the rule of powering devices from a source other than the OI.
  #17   Spotlight this post!  
Unread 05-03-2007, 22:26
michniewski michniewski is offline
Registered User
FRC #1353
 
Join Date: Jan 2007
Location: Canada
Posts: 6
michniewski is an unknown quantity at this point
Post Re: Autonomous selector

I have an even more modified version of the autonomous selector code: this one is even simpler, and uses the exact same logic / has the same features. The only difference is that it is much cleaner. Here it is:


Note: this can be posted in user_routines.c or a separate file as we have.
Code:
// auton_selector()
//
// Select Autonomous Routine #
//
// - hundreds of autonomous plays can be chosen
// - use up/down switches defined by AUTON_UP etc in user_routines.h
// - shown on OI lcd
int auton_select = DEFAULT_AUTON_NUM;
void auton_selector(void)
{
	static char sw_up_prev;
	static char sw_dn_prev;

	// if up switch is pressed
	// increment autonomous routine number, 
	// if less than the max
	if(AUTON_UP == 1 && AUTON_UP != sw_up_prev && auton_select < MAX_AUTON_ROUTINES)
		auton_select++;

	// if pressed down switch,
	// decrement auton_select 
	// if higher than lowest routine number
	if(AUTON_DN == 1 && AUTON_DN != sw_dn_prev && auton_select > LOWEST_AUTON_NUM)
		auton_select--;

	sw_up_prev = AUTON_UP; // oneshot the trigger and top buttons
	sw_dn_prev = AUTON_DN;

	User_Mode_byte = auton_select;

	return;

}
Additionally, there is added commenting, which can be removed to make the code smaller, if thats what you want. It's only a few lines anyways.

Put the following into Default_Routine() in user_routines.c:
Code:
// handles the autonomous routine selection:
auton_selector();
& PLACE IT above the following line:
Code:
 /*---------- ROBOT FEEDBACK LEDs
... etc.

The following must be copied into user_routines.h:
Code:
// Autonomous Selection Defines:
#define		AUTON_UP				p4_sw_aux1		// autonomous select UP switch
#define		AUTON_DN				p4_sw_aux2		// autonomous select DOWN switch
#define		MAX_AUTON_ROUTINES		10				// max number of autonomous routines to scroll thru
#define		LOWEST_AUTON_NUM		1				// lowest auton number (keep it at one (1) )
#define		DEFAULT_AUTON_NUM		1				// the default autonomous routine

// Function Prototypes
void auton_selector(void);
Thats all! Have fun, and good luck.
__________________
- Michael Michniewski
Team 1353, The Spartans



Greater Toronto Regional
- look for the Spartan mascot
Closed Thread


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
Help with Selector Switch Slick Programming 2 16-02-2005 16:09
[OCCRA]: hose clamps on drill transmissions' gear selector? greencactus3 OCCRA Q&A 1 06-10-2004 05:28
Beacon selector switch? How to find/make? Fen Programming 13 12-02-2004 16:31
Team selector switches on ISAAC Lloyd Burns Robotics Education and Curriculum 0 17-12-2002 08:32
Channel Selector David Kelly Technical Discussion 6 03-06-2001 01:15


All times are GMT -5. The time now is 03:57.

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