Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Using Switches on the Operator Interface (http://www.chiefdelphi.com/forums/showthread.php?t=42430)

CronosPrime1 22-01-2006 14:06

Using Switches on the Operator Interface
 
I know it has been done many times. I know it's often very handy. But how do you install switches and buttons on the OI? I want my robot to dump balls into the corner goals when I push a button or flip a switch. The OI, unlike the RC, does not seem to have convenient digital input connections, only serial ports. How, then, would I connect something like a three-way switch (to control a spike, for instance) to the OI? Please don't tell me to use the buttons on the joysticks. I know how to do that. I'm interested in wiring an actual switch or button to the OI. I know lots of people have done it, but how do you do it?

Jared Russell 22-01-2006 14:15

Re: Using Switches on the Operator Interface
 
Use the pinout of the serial port to make your own connector (put a switch between ground and one of the buttons).

See pages 7-10 of http://www.ifirobotics.com/docs/oi-r...e-11-21-05.pdf.

MacFlightSierra 22-01-2006 14:17

Re: Using Switches on the Operator Interface
 
Using a custom control box in addition to the drive joysticks is a great idea, we are also building one at the moment.

The pinout diagrams for the OI ports are available from IFI in the OI reference guide (they have not changed since 2005/05 I beleive) - http://www.ifirobotics.com/oi.shtml

The pinout chart gives the pin number for the OI digital and analog inputs, as well as the LED feedback drivers, and the IFI aliases for those inputs/outputs.

You will need 15 pin solder cups [male and female] and some basic wiring skills, but its quite simple to do. For switches - wire them between the input pin and any ground pin of that port.

good luck, have fun.

Al Skierkiewicz 22-01-2006 14:23

Re: Using Switches on the Operator Interface
 
So as not to confuse the reader, the 15 pin connectors on the OI are gameports not serial ports. They are compatible with the oldstyle game port joysticks found on PC's from long ago. (In computer years, that is.)

CronosPrime1 22-01-2006 14:29

Re: Using Switches on the Operator Interface
 
Quote:

Originally Posted by Al Skierkiewicz
So as not to confuse the reader, the 15 pin connectors on the OI are gameports not serial ports. They are compatible with the oldstyle game port joysticks found on PC's from long ago. (In computer years, that is.)

Yea, I still have one of those joysticks. I think I might use it for the robot actually. Will joysticks that did not come in the kit work for controlling the robot? It's not joystick-dependent, is it?

CronosPrime1 22-01-2006 14:32

Re: Using Switches on the Operator Interface
 
Can someone please give me a less technical explanation of what everyone said about the pinouts and so on? I may be an experienced computer programmer, but I am fairly close to a newbie at robot programming. I'm not sure I know anything about the pins in the gameports.

Tristan Lall 22-01-2006 14:32

Re: Using Switches on the Operator Interface
 
Quote:

Originally Posted by CronosPrime1
Yea, I still have one of those joysticks. I think I might use it for the robot actually. Will joysticks that did not come in the kit work for controlling the robot? It's not joystick-dependent, is it?

A gameport joystick will usually work, however there exist some non-standard implementations that may not function quite as expected. In general, any simple 2-axis, 2-button gameport joystick will work.

Jared Russell 22-01-2006 14:45

Re: Using Switches on the Operator Interface
 
The 15 pin connector that goes to a joystick - each pin corresponds to a particular function in the program. The document linked to earlier has the pinout description of what each does. To use a digital switch, for example, connect one terminal of the switch to ground and the other to one of the pins that corresponds to, say, p1_sw_trig (assuming your switchbox is plugged into port 1).

Then, in the program, whenever you access p1_sw_trig, you are actually getting the value of your switch.

CronosPrime1 22-01-2006 14:51

Re: Using Switches on the Operator Interface
 
Okay, that works. Now what if I have a multi-way switch? Can I plug it into the pin corresponding to p4_x, let's say, under port 4, and get a value from 0 to 255, where 0 will be one position, 1 will be another, and 2 will be another? And how will the switch know which position should be 0 and which should be 2? Or is it going to return 1,0, and -1, thus throwing my unsigned char data type off balance?

Billfred 22-01-2006 14:55

Re: Using Switches on the Operator Interface
 
Well, p4_x is an analog variable, so you'd have to rig up some resistors in varying amounts to get different values for the switch positions. (I'm not entirely sure on the values of the resistors, so I won't guess.) Alternatively, you could wire it to two different digital inputs.

CronosPrime1 22-01-2006 15:36

Re: Using Switches on the Operator Interface
 
So, in a word, to get a binary switch working, I can simply wire it to the right pins, but to get a 0-255 thing working (analog), I'm actually going to have to build resistors or get potentiometers?

Ryan M. 22-01-2006 16:25

Re: Using Switches on the Operator Interface
 
Correct.

CronosPrime1 22-01-2006 17:13

Re: Using Switches on the Operator Interface
 
Well, I think I'll just wire several binary switches and ask the computer to compute values using binary. Like if I want to select between 4 things, I'll convert input from 2 binary switches to a number from 0-3, and attach a printed label sheet to the operator interface so my team members can know what's going on. No problem, I guess. Binary math is easy.

Billfred 22-01-2006 17:47

Re: Using Switches on the Operator Interface
 
Quote:

Originally Posted by CronosPrime1
Well, I think I'll just wire several binary switches and ask the computer to compute values using binary. Like if I want to select between 4 things, I'll convert input from 2 binary switches to a number from 0-3, and attach a printed label sheet to the operator interface so my team members can know what's going on. No problem, I guess. Binary math is easy.

Binary math may be easy, but I'd avoid it on the OI.

Last season, I was field coach for 1293 during their short (two-match, if I recall) reign as #1 seed at Palmetto. I wasn't even doing the driving, and my mind had a million things going (time remaining, which goals were ours, which goals needed to be ours, is anyone in the loading zones, et cetera). Trying to throw in much of any sort of math would've had dire consequences.

The general thing you'll see on most OI panels is that they're simple. A driver should be able to judge what's going on by touch or a brief glance. This, in turn, gives them more time to figure out how to do more important things, like moving around those two 120-pound hunks of machinery blocking your path to the goal. (Of course, if your two switches corresponded to something visual on the robot, such as a left and right ball sucker, then by all means go for it.)

That said, binary is perfectly fine on the robot side for things like setting an autonomous mode. Even the most tense field coach in the world can figure that sort of thing out.

Hope this helps!

artdutra04 22-01-2006 18:14

Re: Using Switches on the Operator Interface
 
Quote:

Originally Posted by Billfred
The general thing you'll see on most OI panels is that they're simple. A driver should be able to judge what's going on by touch or a brief glance. This, in turn, gives them more time to figure out how to do more important things, like moving around those two 120-pound hunks of machinery blocking your path to the goal. (Of course, if your two switches corresponded to something visual on the robot, such as a left and right ball sucker, then by all means go for it.)

Yes - simple is really good! :)

Last year, we decided that to make driver reaction faster, we would only use momentary large (coin op arcade-style) push buttons on our operator interface (besides the joysticks of course). We would then use code to make them emulate toggle switches. (Such as hit it once to start a function, and hit it again to stop it).

This may not be perfectly suited for every application, but I can tell from experience (I was the co-driver for my team last year), that not having to look down at the button when you push it really helps. As you can see, our 2005 operator interface was about as simple at you could get.



All times are GMT -5. The time now is 01:04.

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