Florescent lights green on both sides?!?

While mentally trying to figure out how I’ll be programming the CMUcam2 in the next couple of days… I thought “Camera scans, finds the lights, turns the shooter towards the target and I click the “fire” button”

But than it hit me, how is the robot suppose to know which target it’s pointing at? Are the targets different colors? :ahh:

The targets are not different colors. But you will know which direction yours will be in from the beginning of the match (right side if facing center of field). Using this you can tell the robot to scan a smaller area until it finds the light, and not your opponent’s.

There are no distinguishing differences between the 2 goals, and I’m guessing GDC did this on purpose to force you into doing a little bit more for autonomous. You can simply limit your camera pan so you only point at one side of the field, or if you want to be extra careful in case an opposing (or alliance) robot turns you around, use a gyro and don’t shoot unless you’re within a certain range representing the side of the field you want to point towards.

If you are using the mount that came in the kit of parts, then the camera does not have more than 180 degrees of rotation.

A solution to your problem might to write a short dead reckoning algorithm, lets say (in pseudocode):

 forward(1 sec) 
turn left(2 sec) /*or right, depending on which side of the field you are starting at*/
forward(2 sec)
hand control over to the camera

Something like this would more than likely make sure that you won’t shoot into you’re own goal during autonomous.

Next, you can have a switch on your control board (or a joystick button), such that:

 if(p1_sw_trig (hypothetical)==1){ disable_cam=1;} 
if(p1_sw_top==1){ disable_cam=0;}

Which would allow you to disable the camera when you are on defence (if you so choose).

Hope this helps,