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!

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.

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.

Tread carefully when interpreting the Fix-It Window Rules. tells you that you are able to create SPARE and REPLACEMENT PARTS during the Fix-It windows between now and the FIRST regional, and tells you that you’re able to create SPARE, REPLACEMENT, and UPGRADE parts after the first regional. So, in your case, I interpret your new OI as being an UPGRADE part since you’re doing a redesign and also software modifications. This means you have to wait until the first regional has completed, but after that you’re able to begin working on your upgraded OI. If your team is only able to attend one regional, and it happens to be at the start of the season, you’re going to have to wait until you get to the competition site to work on your upgrade. Other teams at the competition would be more than happy to help you out if you need help, but that’s how the cookie crumbles.

-Danny

<R19> During the “FIX-IT WINDOWS” following the shipment of the ROBOT: During this period, all teams may utilize one or two 5-hour FIX-IT-WINDOWS to manufacture SPARE and REPLACEMENT PARTS and develop software for their ROBOT at their home facility. Fabrication of UPGRADE PARTS is not permitted during this period. The timing of these “FIX-IT WINDOWS” is at the discretion of the team, but all work must be completed by 5:00pm on the Friday following the ROBOT shipment deadline. Teams may manufacture all the SPARE and REPLACEMENT parts they want, but the amount of parts they can bring to a competition event is limited (as specified in Rule <R31>).

<R20> Prior to the competitions: After the close of the “FIX-IT WINDOWS” and prior to the competition, the team must put down their tools, cease fabrication of ROBOT parts, and cease all development of ROBOT software. Take this opportunity to rest, recover from the build season, and relax. Teams may scout other teams, gather and exchange information,
develop game-playing strategies, collect raw materials, prepare tool kits, plan how to make repairs, etc. in preparation for the upcoming competitions. But no construction or fabrication of any hardware, or development of any software, is allowed.

<R22> During the “FIX-IT WINDOW” following each Regional Competition weekend: During this period, all teams (not just those teams attending a Regional Competition) may utilize one or two 5-hour FIX-IT-WINDOWS to manufacture SPARE, REPLACEMENT and UPGRADE PARTS and develop software for their ROBOT at their home facility (not at the competition site). The timing of these “FIX-IT WINDOWS” is at the discretion of the team, but all work must be completed between the opening of the Competition (at 8:30 am on the Thursday of the Competition weekend) and 8:30 am on the Thursday following the Competition weekend. At the conclusion of a regional competition event, teams may take a limited
amount of broken or malfunctioning COMPONENTS or MECHANISMS back to their home facility to make SPARE or REPLACEMENT PARTS. The purpose of this rule is to allow teams to make critical repairs to existing parts to enable them to compete in following events. The intent of this rule is not to have teams take their entire ROBOT back home and make large-scale revisions or upgrades to the ROBOT. Teams may manufacture and/or repair all the parts they want, but the amount of parts they can bring to the competition
event is limited (as specified in Rule <R31>).

First, I will note that if you search a bit on the forums here, you will find several different threads that will provide additional insight beyond this response.

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.

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 !!!

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.