Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Beacon selector switch? How to find/make? (http://www.chiefdelphi.com/forums/showthread.php?t=24919)

Fen 07-02-2004 23:47

Beacon selector switch? How to find/make?
 
In working on the program to test the IR sensors, the code we get is, "This code assumes beacon type selector switch is on digital I/O 7." Other threads state that a switch must be installed to use this function in competition. What sort of switch do we need? Was it in the KOP? Do we buy it locally? What specs if so? :confused:

steven114 08-02-2004 01:02

Re: Beacon selector switch? How to find/make?
 
Unpowered switches are pretty much the same all around - they simply connect the two ends of a circuit together, closing it. I don't believe switches are in the KOP, but they should be dirt cheap at your local store. Oh, and BTW, could you please not use light blue text on the grey background? Near impossible to read...

The Lucas 08-02-2004 02:06

Re: Beacon selector switch? How to find/make?
 
Any toggle switch should work, but avoid rocker or momentary switches (pretty much any one that springs back to the a position after you push it). If you are ordering from a catlog like DigiKey you need a toogle switch with a Switch Function: SPST (Single Pull Single Throw) and Switch Circuit: On-Off or Off-On. Avoid any switch with the a Switch Circuit that says "Mom" (Momentary).
You could do as Steve said and make a simple closed circuit by cutting 3 pin cable (AKA PWM cable) and soldering the black wire to the white one. Just plug this cable into digital in 7 when you want to seek beacon type 0 (longer period) and unplug it when you want to seek beacon type 1 (shorter period). I am not sure which beacon FIRST will place on which side.

KevinB 08-02-2004 09:40

Re: Beacon selector switch? How to find/make?
 
You could just put a jumper across the pins, no?

Mark McLeod 08-02-2004 10:32

Re: Beacon selector switch? How to find/make?
 
Quote:

Originally Posted by KevinB
You could just put a jumper across the pins, no?

As long as you avoid the +5v center pin.

KevinB 08-02-2004 11:04

Re: Beacon selector switch? How to find/make?
 
Quote:

Originally Posted by Mark McLeod
As long as you avoid the +5v center pin.

Good call. For some reason I was thinking that the +5v pin was to the outside.

Fen 09-02-2004 19:48

Re: Beacon selector switch? How to find/make?
 
Thanks so much for the info. FWIW, the light blue color is our team color; I'll not use it again. We were using the center pin, so that is our trouble. Off to the races!
:]

shsdragon 11-02-2004 16:19

Re: Beacon selector switch? How to find/make?
 
i don;t thisswitch how does it rrecognize wut type beacon it is someone plz explain

Mark McLeod 11-02-2004 16:34

Re: Beacon selector switch? How to find/make?
 
Quote:

Originally Posted by shsdragon
i don;t thisswitch how does it rrecognize wut type beacon it is someone plz explain

The switch returns a value of 0(on) or 1(off)

In the tracker code this switch value is represented by rc_dig_in07

rc_dig_in07 is given another name (DESIRED_BEACON_TYPE) by tracker.h and that's what you'll see used in the tracker.c code.

The tracker code then checks rc_dig_in07 to see which of the two beacon types it is supposed to be looking for.

FIRST hasn't yet told us which sides of the field the two beacons are going to be on, but if you have your beacon switch you can just label them at the regional competition.
I like to think of the switch as red/blue alliance rather than beacon type-0/type-1.

Matthew_H 11-02-2004 16:39

Re: Beacon selector switch? How to find/make?
 
Quote:

Originally Posted by Mark McLeod
The switch returns a value of 0(on) or 1(off)
In the tracker code this switch value is represented by rc_dig_in07

rc_dig_in07 is given another name (DESIRED_BEACON_TYPE) by tracker.h and that's what you'll see used in the tracker.c code.

The tracker code then checks rc_dig_in07 to see which of the two beacon types it is supposed to be looking for.

FIRST hasn't yet told us which sides of the field the two beacons are going to be on, but if you have your beacon switch you can just label them at the regional competition.
I like to think of the switch as red/blue alliance rather than beacon type-0/type-1.

I don't think they will be either red or blue alliance because there is a beacon on either side of the field. Which means one red alliance will go towards beacon 0 while the other red alliance will drive towards beacon 1. If I am wrong about this please let me know.

So for the switch we just need to jumper the first and third pins for beacon type 1 and leave them off for beacon type 0? I think we tried that and by default it was looking for beacon type 1 with no jumper. I had to hard code in beacon type 0 for it to look for that beacon.

Mark McLeod 11-02-2004 16:47

Re: Beacon selector switch? How to find/make?
 
Quote:

Originally Posted by Matthew_H
I don't think they will be either red or blue alliance because there is a beacon on either side of the field. Which means one red alliance will go towards beacon 0 while the other red alliance will drive towards beacon 1. If I am wrong about this please let me know.

So for the switch we just need to jumper the first and third pins for beacon type 1 and leave them off for beacon type 0? I think we tried that and by default it was looking for beacon type 1 with no jumper. I had to hard code in beacon type 0 for it to look for that beacon.

Sorry, we are using a left/right switch as well as a red/blue alliance switch to simplify things for the drivers. That also tells us which direction to strike out at the 10 pt ball, as well as which beacon to home-in on.

[edit]
Quote:

Originally Posted by Matthew_H
So for the switch we just need to jumper the first and third pins for beacon type 1 and leave them off for beacon type 0? I think we tried that and by default it was looking for beacon type 1 with no jumper. I had to hard code in beacon type 0 for it to look for that beacon.

If the jumper is off the tracker will look for beacon type-1.
With the jumper on it will look for type-0

deltacoder1020 11-02-2004 17:05

Re: Beacon selector switch? How to find/make?
 
Quote:

Originally Posted by Matthew_H
I don't think they will be either red or blue alliance because there is a beacon on either side of the field. Which means one red alliance will go towards beacon 0 while the other red alliance will drive towards beacon 1. If I am wrong about this please let me know.

So for the switch we just need to jumper the first and third pins for beacon type 1 and leave them off for beacon type 0? I think we tried that and by default it was looking for beacon type 1 with no jumper. I had to hard code in beacon type 0 for it to look for that beacon.

yes, you'll need to modify the default beacon code to check rc_dig_in01 for which beacon type it should broadcast.

Code\\Pilot 12-02-2004 15:39

Re: Beacon selector switch? How to find/make?
 
can you use the switches for other stuff? like if you want to change from IR autono to dead reck autono?, or if you have two dead reckonin codes, be able to switch it before the game?
If you can, can you tell me the variable asigned to the pins?
Thanks.

Mark McLeod 12-02-2004 16:31

Re: Beacon selector switch? How to find/make?
 
Quote:

Originally Posted by Code\\monkey
can you use the switches for other stuff? like if you want to change from IR autono to dead reck autono?, or if you have two dead reckonin codes, be able to switch it before the game?
If you can, can you tell me the variable asigned to the pins?
Thanks.

Yes, that's one of the main uses of switches.

We have:
- Left/Right switch
- Red/Blue alliance (the combinaton of these two specify the beacon type and which side of the robot the 10 pt ball will be on.)
- a 16-position BCD switch for selecting autonomous modes. It also doubles as a diagnostics switch when in user mode, e.g., center servos.

You can use a multi-position rotary switch from your local Radio Shack by wiring each position to a different available digital input.
Then test it in your code like so:
Code:

if (!rc_dig_in01)
{
        IR_Tracking();
}
else if (!rc_dig_in02)
{
        Dead_Reckon();
}
else
        Dead_Reckon();  // Always finish with a default setting



All times are GMT -5. The time now is 20:47.

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