Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Autonomous selector (http://www.chiefdelphi.com/forums/showthread.php?t=53237)

simpsonboy77 01-02-2007 18:58

Autonomous selector
 
I was wondering if there is a way to read from the OI, before autonomous, a value. We are coding multiple autonomous functions and I need a way to select which one to run. We can't put it on the robot because we have no inputs left. We have 1 completely unused port on the OI if that helps.
Thanks,
Garrett
Team 41

AdamHeard 01-02-2007 19:00

Re: Autonomous selector
 
When the robot is disabled before autonomous you can read the OI switches. Set a (static) variable from one of those switches, and then you can choose your mode from that in autonomous.

It's pretty similar to reading one off the robot.

6600gt 01-02-2007 19:01

Re: Autonomous selector
 
It's written by Kevin Watson. We used a slightly modified version of it.

Quote:

void auton_selector(void)
{
static char last_sw1;
static char last_sw2;

if(AUTON_UP == 1 && AUTON_UP != last_sw1)
{
if(auton_select < MAXAUTONROUTINES)
auton_select++;
else
auton_select=99;
}
if(AUTON_DN == 1 && AUTON_DN != last_sw2 && auton_select > 0)
{
if (auton_select == 94)
auton_select=MAXAUTONROUTINES;
else
auton_select--;
}
last_sw1 = AUTON_UP; //oneshot the trigger and top buttons
last_sw2 = AUTON_DN;

User_Mode_Byte = auton_select;

}
User_Mode_Byte is the user display on the OI. Use that little button to change to it.

AUTON_UP/DOWN are the defines to which a joystick button or something similar.

tdlrali 01-02-2007 22:58

Re: Autonomous selector
 
We put little switches (the ones that go from 0-9) on the robot and hook them up to the dig in. Before each match, we set the autonomous mode by hand.

Lil' Lavery 01-02-2007 23:25

Re: Autonomous selector
 
Quote:

Originally Posted by tdlrali (Post 569948)
We put little switches (the ones that go from 0-9) on the robot and hook them up to the dig in. Before each match, we set the autonomous mode by hand.

We used click wheels like that (except our went much higher than 9) last year. We had two, one for starting position, and one for the autonomous "play". It worked really well for us, although we really ended up only using 3 plays of the many we had available.
You'll be seeing something more advanced this year though if all goes to plan ;)

Bongle 02-02-2007 08:32

Re: Autonomous selector
 
We used a little toggle switch on the robot last year.

if(rc_dig_in01 == 0)
{
run_blocking_auton()
}
else
{
run_shooting_auton()
}

Jared Russell 02-02-2007 11:16

Re: Autonomous selector
 
Quote:

Originally Posted by simpsonboy77 (Post 569740)
We can't put it on the robot because we have no inputs left.
Team 41

You used all 18 digital I/O pins?! Holy cow batman.

6600gt 02-02-2007 11:39

Re: Autonomous selector
 
The code that I posted previously, written by Kevin Watson, allows you have have 254 autons, that can be seen in the user display(the number) of the OI! Beats soldering any switches... We have been using this for the last 4 years at all competitions.

simpsonboy77 02-02-2007 15:14

Re: Autonomous selector
 
Quote:

Originally Posted by Abwehr (Post 570130)
You used all 18 digital I/O pins?! Holy cow batman.

We used 16 of them, that only leaves 2 open. That can only make 4 combinations, but we need 5.


6600GT thanks for the tip. I'll be doing that this year as the selector. Thank you everyone for your help.

Kingofl337 02-02-2007 16:19

Re: Autonomous selector
 
Use the trigger and thumb to set the autonomous mode. Pull the trigger and goto the next number. You can have the OI display what mode you have selected.

woody 02-02-2007 16:34

Re: Autonomous selector
 
Do you have any analog inputs left? If so, you should be able to use a 5 position toggle switch with 5 different value resistors as a sort of multiplexor. Just read the analog value and determine auto mode that way.. i think. im no programmer though ; )

AdamHeard 02-02-2007 16:37

Re: Autonomous selector
 
Quote:

Originally Posted by woody (Post 570317)
Do you have any analog inputs left? If so, you should be able to use a 5 position toggle switch with 5 different value resistors as a sort of multiplexor. Just read the analog value and determine auto mode that way.. i think. im no programmer though ; )

We usedd this same technique to make rotary switches for our OI that used one analog input for various purposes and it works fine. The programming part of it is really simple as well.

sarcasticmadnes 02-02-2007 17:56

Re: Autonomous selector
 
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.

AdamHeard 02-02-2007 18:05

Re: Autonomous selector
 
Quote:

Originally Posted by sarcasticmadnes (Post 570372)
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.

Is it legal to use batteries like that?

thefro526 02-02-2007 18:19

Re: Autonomous selector
 
Does anyone have any multiple autonomous code for easy-C?


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

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