|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Converting Joystick controls over to switches
I am not sure if it is too late to do this now that the robot has shipped but we were under the gun to get things
on our robot working and the operators didn't get adequate driving time. What we noticed is that the operators are having a heck of a time getting "used to" the manipulator controls that we set up with joysticks. Is it possible (per the rules & between now and the competition) to construct a new controller box with switches and then re-write the code to use this set up and use the fix-it window to tweak the code? If this is within the scope of the rules, I would appreciate any info on how to accomplish this with switches. What I especially need help in understanding is the following: I plan to use some SPDT toggle switches (with off positions). If I connect these switches to the X & Y pins on the joystick ports (port 3 & port 4 on our OI) and the switched values are either +5v, ground, how do I simulate (set up the hardware) so that the off condition is read by the OI as it currently is by the joystick as a neutral condition (127)? Does this require some sort of a weak pullup (or a trimmer pot) on the switch common to obtain this neutral condition (value 127)? Please advise... Thanks for the help! |
|
#2
|
|||||
|
|||||
|
Re: Converting Joystick controls over to switches
I encourage you to take a look at The Blue Alliance's coverage on this topic, and read the show notes. If you can obtain a joystick port extension cable (these contain the full amount of wires, compared to how many a kit joystick would have), and cut it open, you can crimp on quick-connects and use some other small wire to create interconnects to your switches. I will note, this can be a painstakingly long process (I've done something like 50 crimps on our OI this year).
If you look at the joystick pinout in the shownotes however, you'll notice that Port 4 steals some functions from Port 1 so that you can make a more extensive switch box. Port 2 also does this, but if you use 2 sticks for drive, using port 4 makes the most sense. So to wire it up from there you just connect ground + any one of the digital bits to wire a switch into the corresponding variable. If you want to use potentiometers off of the x, y, and etc. lines, I will let a smarter person than me answer because I'm not positive the way I did it was correct. You'll also need to consider a custom enclosure for it. Radioshack doesn't carry the most suitable project boxes, but specialty electronics stores around you probably would, and you can use a mill, drill, or anything else to cut the holes in the surface of it. Switches that mount circular work best compared to square hinges just due to how hard it is. |
|
#3
|
||||
|
||||
|
Re: Converting Joystick controls over to switches
if you want to use the analog inputs i would suggest using resisters so that it would change the value of that input. This is how we did out autonomous switch using six resisters on an analog input so we would roughly get 6 different ranges which can be fiqured out pretty easily using the ifi dashboard.
|
|
#4
|
|||||
|
|||||
|
Re: Converting Joystick controls over to switches
Quote:
-Danny Quote:
Quote:
Quote:
|
|
#5
|
||||
|
||||
|
Re: Converting Joystick controls over to switches
Quote:
When an analog input is open circuited, no current will flow into the pin, thus when the OI samples the input, it will read zero volts. Anything below about 500-600mV will be interpreted by the OI as a disconnected potentiometer and result in an analog value of 127. This is done so that a disconnected joystick is interpreted as a 'stopped' condition as opposed to 'full speed in reverse'. A full scale reading is obtained when the potentiometer's wiper is at the +5V end of the range, and a zero reading is obtained when the wiper is at the other end of its travel, (i.e. 100K ohms of resistance between +5V and the analog input). So to do what you want, connect the switch common to the analog input pin. Connect one of the switch positions to the +5V Aux pin, and then use something like a 82K or 91K resistor between the other switch pin and +5V Aux to repesent the other. You could try a 100K ohm resistor, but tolerance stack up may result in a voltage close to the trip point where the OI decides nothing is connected... and since you only need to represent something distictively less than 127, any value from about 68K on up should be adequate. Alternately, you could just wire your switches to the switch inputs and be done with it. Ports 2 and 4 have 8 switch inputs, the extra four on each are the switch inputs from ports 1 and 3. If you are already using those inputs for something else, then using the analog inputs should work fine. |
|
#6
|
||||
|
||||
|
Re: Converting Joystick controls over to switches
I used the four analog inputs on port 4 as each of my four switches is replacing a joystick X or Y value. I hacked up a Radio Shack joytick "Y" cable to get all the port pins that I needed...
On the switches, I connected one pole to +5v and the other to Ground and then tied the switch common to the appropriate joystick port pin and the wiper of a 100K ohm trimmer pot (which is tied to +5v and ground through 1K ohm bleeder resitors.) In the switch off position for each switch, I adjusted the trimmer pots to 2.5V and verified that switching to either of the two positions gives me +5 or 0V on the common. This should work (in theory) but I do not have an OI to test it with right now... Also, I tied the port 4 trigger switch pin to ground (this is not used on my port 3 or port 4 joysticks). Then I modified the code to read this port 4 trigger switch and if it is low to process code specifically for the control box or if it is high to process code specifically for the joysticks, that way I can use either without changing the code... Hope it works... Thanks for everyone's feedback on this issue !!! |
|
#7
|
||||
|
||||
|
Re: Converting Joystick controls over to switches
As for the legality, there's nothing stopping you from doing the whole shebang a few times for practice, then doing it again at the competition with your finely-honed mad skills of OI-upgrading. You can get around all the roadblocks first and find out the raw materials you need now rather than at the competition saying "oh crap, now I have to go a-running to radio shack. Does anyone know where a radio shack is?"
You may not be able to use the parts you make, but you can use your skills obtained from making the parts. I find that 90% of the time it takes to do anything for the first time is just stumbling about, looking for tools and parts. Last edited by Bongle : 27-02-2007 at 10:21. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Converting .wmv | Jay W. | IT / Communications | 6 | 04-05-2005 15:43 |
| Using non joystick controls with Operator Interface (Hacking Various Controllers) | Astronouth7303 | Control System | 58 | 02-02-2005 15:56 |
| Converting CAD!? | Tton | 3D Animation and Competition | 3 | 25-03-2003 17:29 |
| Converting Files | Hailfire | Programming | 9 | 28-12-2002 18:59 |
| when is over, over. | archiver | 2001 | 2 | 23-06-2002 23:05 |