During last year’s competitions, I was able to see that teams were able to create switches for their robot which told the robot what to do based on
their location on the field. Does anyone now how this is done or any clue about it or as to where to get information about such a thing? Is it electrical wiring or programming?
For example press a switch (or flip a switch) “A” (out of three) and the robot does only the things programmed for that switch.
Please note I posted the same question under programming. I do apologize if that was wrong.
My team has used a similar setup to select autonomous modes… you wire the switch in to the robot as you would a limit-switch or any other digital sensor. The code can be as simple as in if statement around the code you want to turn on/off that checks the appropriate digital I/O ports.
In the past we have used three switches treated as 3 binary bits to get 8 possible autonomous modes.
In the past our team has used dipswitches (they look like the bank of small switches found on the front of the cRIO) to set our autonomous modes, in '09 we had a full 32 modes programmed :D, but just a regular collection of switches would work too (it would just be bulkier). Basically you wire these switches into the digital ins on the side car. Then in the code I would suggest converting the collection on/off switch values into a binary number (LabVIEW even has a function for this already). Then assign each of your different autonomous modes a number (in the range that you switches can supply) and have your autonomous code read the dipswitch values before it starts. If you end up with a lot of auto modes make sure to give your drivers a “playbook .”
Last year we used a potentiometer with 10 detented positions on the robot. It used only one analog input. It gave us up to 10 possible autonomous modes. All you need to do is read it and then have the code select which auton. mode you want to perform.
We read the pot using voltage range windows to select, not just discrete values. This allowed for some error in the values to exist, and still select the right mode.
We have used a Radio Shack modified six position switch for many years. It is a simple matter to remove a detent that allows you to select one of twelve auto mode program features. You simply wire 9.1k resistors in a series string across each tab of the switch, attach 5 volts and common, and wire the wiper of the switch to an analog input. You then have twelve steps in voltage from 0v to 5v. Search and ye shall find discussion on this here on CD.