PDA

View Full Version : Programming with Two CMU Cams


PuffGoLe
01-31-2007, 12:43 AM
With one camera connected to the serial port, and one to the programming port, how should our team go about programming so each can track a light? Thanks in advance.

kitscuzz
01-31-2007, 05:26 PM
You'll probably want to just take the camera.c and tracking.c (and their related .h files) and make a copy. Then change all of the static and extern variables to slightly different names. Then just call the camera handler and the servo track in User routines. http://kit.kitkorp.com/frc_camera_doublecamera.zip Shows the laziest of the lazy version of this code. There are some changes marked with "Brian" in the tracking2.h, tracking2.c, and tracking.h to limit the scope of each camera to half on either side, and reverses so they each start in the middle and spread out.

Metalgod4eva
02-01-2007, 02:56 PM
You'll probably want to just take the camera.c and tracking.c (and their related .h files) and make a copy. Then change all of the static and extern variables to slightly different names. Then just call the camera handler and the servo track in User routines. http://kit.kitkorp.com/frc_camera_doublecamera.zip Shows the laziest of the lazy version of this code. There are some changes marked with "Brian" in the tracking2.h, tracking2.c, and tracking.h to limit the scope of each camera to half on either side, and reverses so they each start in the middle and spread out.

Its never a great idea to name some slightly different for better read ability use _. Like if I had a function that writes I should name it write_function. Same with headers and source files. Unless its local variables dont just add a 1 or a random X. It will save you the headache in the long run.

iwdu15
02-01-2007, 06:02 PM
question for you....you said youv connected 2 cameras to your RC, both to the 232 ports.....how did you go about connecting the cameras that way and how did you transmit info during runtime? thanks

--iwdu15
--team811

kitscuzz
02-01-2007, 08:45 PM
You set up one camera normally through the TTL port with the TTL to 232 adapter. The second goes through a modified serial cable that connects the programming port to your camera.

The easiest way to simply test everything is to buy a ***null modem cable*** connector for your serial cable and simply plug the camera serial directly into the programming port.

To test whether or not it's working all you need to do is download the default camera code and change the line in camera.h from
// #define CAMERA_SERIAL_PORT_1

#define CAMERA_SERIAL_PORT_2

to

#define CAMERA_SERIAL_PORT_1

// #define CAMERA_SERIAL_PORT_2

IMPORTANT NOTES:
You won't have any terminal with two cameras. You must make sure that if you use both that you set
stdout_serial_port = NUL; in user_routines User_Initialization.

Some extra notes:
If you decide to modify the cable to go to a PWM output (which is what you'll do if you decide to go into competition with it) You'll need to ruin a serial (or make your own) and make the following connections:

1 0 2 3 0 << This is the serial port on your Robot controller
0 0 0 0

connect pin one to the black on a PWM, pin 2 to the red, and 3 to the white/yellow.

DanDon
02-01-2007, 08:47 PM
You set up one camera normally through the TTL port with the TTL to 232 adapter. The second goes through a modified serial cable that connects the programming port to your camera.

The easiest way to simply test everything is to buy a male-to-male connector for your serial cable and simply plug the camera serial directly into the programming port.


You would need a null modem cable, not just any male-to-male cable.

Here (http://en.wikipedia.org/wiki/Null_modem) is some more info about null modem cables, including wiring diagrams in case you wanted to make one yourself by splicing two cables.

kitscuzz
02-01-2007, 08:57 PM
Sorry, fixed.

Oh, and for those of you who are using, the code http://kit.kitkorp.com/frc_camera_doublecamera.zip I've now made it so that it works like originally planned. The Cameras both pan from left to right in a full arc. All of the edited code was removed save for the dual camera functionality.