|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
OI Input Autonomous
What our team is trying to do this year is to select our Autonomous mode by using the joystick buttons or some other type of button mounted on our control box. While searching Chief Delphi forums for possible solutions we have stumbled upon this code:
Quote:
|
|
#2
|
||||
|
||||
|
Re: OI Input Autonomous
Hmm, why would anyone want to select autonomous modes from the OI...
A better question is, will the drivers need to step back from the OI BEFORE the refs move the rack? |
|
#3
|
|||||
|
|||||
|
Re: OI Input Autonomous
Quote:
Quote:
|
|
#4
|
|||||
|
|||||
|
Re: OI Input Autonomous
Put that snippet of code in user_routines.c and call it from the same place you're reading the joysticks for other purposes. Default_Routine(), perhaps.
Your compiler errors are probably because you didn't get the hint to replace AUTON_UP and AUTON_DN with the actual OI controls you will be using to step the number up and down. p1_sw_trig and p1_sw_top, for example. You will also have to declare auton_select as a global variable so you can use it in your actual autonomous routine. |
|
#5
|
|||
|
|||
|
Re: OI Input Autonomous
I have a few questions. Well first of all I edited the code and this is what it looks like now as I try to compile:
Quote:
Quote:
|
|
#6
|
|||||
|
|||||
|
Re: OI Input Autonomous
You made the name of the function the same as the name of the variable it's trying to set. That's what most of your compiler errors are about. You should probably change it back to auton_selector the way it was in the example. You also misspelled User_Mode_byte with a capital B.
To declare a global variable, do it at the top of user_routines.c where it says DEFINE USER VARIABLES AND INITIALIZE THEM HERE. Oh, and I believe there was a typo in the example code. It looks like the 94 ought to be 99 instead. |
|
#7
|
|||
|
|||
|
Re: OI Input Autonomous
Thanks so much for your help so far. We have managed to get the code up and running displaying the numbers on the OI, however anytime I try to get a value from auton_select in my Autonomous Mode I keep getting
Quote:
Quote:
|
|
#8
|
|||||
|
|||||
|
Re: OI Input Autonomous
Add this at the top of user_routines_fast.c to tell the compiler that auton_select is created in another file.
Code:
extern int auton_select; |
|
#9
|
|||
|
|||
|
Re: OI Input Autonomous
Quote:
P.S. - Got it working HOWEVER I still have one more question. When the robot is disabled through the competition port it refuses to change the autonomous mode. Will our team have to change autonomous modes before we come to the player stations. Last edited by Ultima : 08-02-2007 at 15:00. |
|
#10
|
||||
|
||||
|
Re: OI Input Autonomous
If the competition switch is set to manual (non-autonomous) and disabled, you should still be able to read the OI settings.
|
|
#11
|
|||
|
|||
|
Re: OI Input Autonomous
Quote:
|
|
#12
|
||||
|
||||
|
Re: OI Input Autonomous
Quote:
Code:
void void main()
{
func();
}
void func()
{
}
Here are two ways to get rid of the warning. I prefer the first method. 1. Create a function prototype either at the top of the C file or in a header included by that C file. This will tell the compiler that a function named func that takes no inputs and returns nothing is defined somewhere in the code. Code:
void func(void); /* Here is the prototype */
void main()
{
func();
}
void func()
{
}
Code:
void func()
{
}
void main()
{
func();
}
|
|
#13
|
|||
|
|||
|
Re: OI Input Autonomous
I thought the Master code didn't allow any data transfer between the OI and the RC during autno mode.
|
|
#14
|
||||
|
||||
|
Re: OI Input Autonomous
Quote:
In this state, you can do just about anything except set any outputs on the RC (you can read inputs on the RC and the OI, and save these for when you start autonomous mode). |
|
#15
|
|||||
|
|||||
|
Re: OI Input Autonomous
Quote:
This is an important distinction when debugging. The dashboard displays the PWM values, even when you're disabled. This is useful if you don't want your arm to swing wildly. [/nit pick] |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| User Input | railerobotics | Programming | 4 | 29-08-2006 00:54 |
| Powered OI input | EricS-Team180 | Programming | 7 | 28-09-2003 21:23 |
| Graphic Input | Raven_Writer | Computer Graphics | 7 | 08-08-2003 15:43 |
| Autonomous user-input loophole? | Jeff McCune | Programming | 20 | 14-02-2003 22:44 |
| 2.5 is alive !!!! (input ! .. more input ! ) | Lloyd Burns | Programming | 2 | 14-01-2003 19:15 |