![]() |
Multiple Auton's
I was wondering of a way to do multiple auton modes. Please if you have any proven information let me know either in a PM or Email DragonMan@si.rr.com .
I tired having a switch to make a digital input on the Robot Controler trigger a different auton mode by grounding the Signal (To make it a 1) with such code as: (I forgot the actual name for the digital inputs so lets say dig 1 & dig 2) if (dig1 = 1) { /*Auton mode here/* } else if (dig2 =1) { /* other Auton Mode/* } else { /*do nothing /* } Can someone tell me why this theory wouldnt work ?? Does anyone have an auton mode that has a switch to change between modes that I can look at and pick apart. Thankyou |
Re: Multiple Auton's
Make sure you realize that = is the assignment operator in C and == is the equality test. Therefore, you'd have to say:
Code:
if (auto_selector_switch == 0) |
Re: Multiple Auton's
Quote:
The code is pretty much what you have above, albeit much uglier. This is an earlier copy that wasn't cleaned up. Cheers! Code:
void User_Autonomous_Code(void) |
Re: Multiple Auton's
We had the following code to use 2 pots on the OI to set the aunonomous mode.
Basically, we had 6 varieties of Auton (0-5). We had up to 15 steps per auton program (0-15). We could set the max number of steps as well as set the particular program. The way it works is that your robot has to be not in AUTONOMOUS MODE, DISABLED and the OI has to be in USER MODE. After that, you either are looking at the codes or you are setting the codes. For our OI, we had two software disable switches in addition to the disable from the competition port (OIW_Enable_Sw and OIA_Enable_Sw). We used these switches to decide if we were in the "view autonomous" mode or the "set autonomous" mode. If both of these switches are in the "enabled" state, the program is in the "viewing" mode. If one or both switch is disabled, then the program is in the "setting" mode. One pot sets the program number (OIW_RHW_Pot), the other sets the number of steps (OIA_Extra_Pot). The display is as follows XXY where XX is the number of steps the particular program will run and Y is the auton program number -- I use this format because the number of steps is greater then 10 and the number of auton programs is not AND I need to have the entire number (XXY) be less than 255 or it would not display properly on the 3 digit display on the OI. It is harder to explain than to use. Below is the code fragment of where we set the codes we use in autonomous mode to select which program runs and how far it runs. Finally, we also set these numbers to a safe condition upon reset so that we could simply cancel autonomous mode by simply hitting robot reset. Joe J. Quote:
|
Re: Multiple Auton's
Here are two ways teams I helped accomplished it this year.
1) Use a BCD style rotary switch available from Digi-Key (hooked to digital input pins 15-18 in this case). 16 choices using 4 digital input pins or 8 choices using 3 pins. The extra selections were used for diagnostic software rather than have so many autonomous programs. Code:
static unsigned int swtc; //set equal to the switch input2) Use a regular Radioshack style mechanical rotary switch. In this case a 6-position switch hooked to digital input pins 11-16. Code:
if (!rc_dig_in11) |
Re: Multiple Auton's
Quote:
Ours has a selector switch (10 position I think) where we select the autonomous program that we want to run. That coupled with the R/L switch on the robot selects the waypoint list that will get executed. While the robot is DISABLED and not in USER MODE, the RC is constantly taking the value of the OI auton selector and assigning pointers to the correct list (actually an array in memory, but that doesn't matter). Once the driver goes into USER MODE, we lock in the autonomous program and any changes to the selector switch are ignored. The OI display follows XYZ, where X is 0 for right, 1 for left; Y is the program number; Z is the current waypoint number in the program. I said it's been almost flawless because at Nationals in 2003 we failed to run autonomous in one of our qualification matches. One of the field crew members hit our OI select button and took us out of USER MODE after the drivers locked us in. No one noticed so no one re-locked us in. Apparently we needed to be in USER MODE in 2003 for us to run auto so we just sat there for 15 seconds. |
Re: Multiple Auton's
We used 5 switches on the OI: 1 for side select, 4 for auton select. Each of the 4 switches represents a bit. We set a variable with these values in Process_Data_From_Master_uP() (which got me to notice the bug in main.c).
For Auton, we do this: Code:
//... |
Looking at this thread, I think I will start a new one...
I thinkthat this is a great thread. I think that it brings up another good point. Innovation First does a great job, but in some ways they have no idea what we, the users of their stuff, really need.
I am going to start a new thread that will be a title something like "what should the "Default Code REALLY include?" Of course, one thing it should include is an easy way to select auton programs. Look for the thread, coming soon to a forum near you... Joe J. |
Re: Multiple Auton's
wow those are great solutions what we have is alo0ng the lines of:
Code:
|rc_dig_in_01| + |rc_dig_in_02 << |+ |rc_dig_in_03 <<| |
Re: Multiple Auton's
wait...
we were talking about this during our meeting today, and we didn't think that switches on the OI (vs on the robot) would work. this is because i didnt think that your robot would recieve data from the OI during autonomous mode. (its autonomous, why would you get the data?) altho, we did think it possible that it gets data once in the beginning, and could read the switches then. can someone clear us up on this? thanks, ~Stephanie Team 1351 |
Re: Multiple Auton's
Yeah, I was under the impression that you may not (can not?) access information from the OI during autonomous mode. :confused:
|
Re: Multiple Auton's
The OI switches and joysticks can be read by the robot any time autonomous mode is not active. It's no trouble to constantly read the value of a selector switch into a variable while auton_mode is false, and use that variable when auton_mode is true.
We liked having lots of autonomous options last year. Instead of eating up a bunch of switch inputs on the OI, we used a rotary switch to select between taps in a string of resistors and connected that to one of the joystick _aux inputs. The code saw an analog value, compared it against a collection of programmed low/high limits, determined which switch position had been selected, and stored a number representing that position in a global variable. We'll be doing something similar this year. |
Re: Multiple Auton's
Someone should sticky this. I know I will be refering back to it as soon as we actually have a working bot.
|
Re: Multiple Auton's
Quote:
-dave |
Re: Multiple Auton's
Quote:
~Stephanie Team 1351 |
| All times are GMT -5. The time now is 02:51. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi