|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
CMUCam2 Camera Code - Are important parts commented out?
Here's were Team188 is at in terms of the camera:
1) Enclosure is built 2) Mounted on Servo 3) Assembly mounted on last year's robot (Blizzard 5) - 36" off the ground 4) Calibrated for Yellow, Green and Red successfully 5) Successful "Colour Tracking" for the three calibrated colours through the CMUCam2 Java GUI using DB-9 serial cable (i.e. the camera discriminates the coloured target from the background with a nice tight bounding box, and can successfully return its midpoint coordinates) 6) Loaded the supplied CMUCam2 rev 3 FRC code onto last year's robot 7) Connected the FRC controller to the camera via TTL port and supplied TTL to RS232 adapter 8) Successful camera initialization 9) Successful camera tracking and servoing (camera pans to point directly at the coloured target and will follow it if either target or robot is moved - BTW green seems to work better than yellow or red by A LOT) NOW here's the problem: The supplied CMUCam2 code is SUPPOSED to also get the robot to navigate towards the coloured target out of the box. It doesn't seem to want to for us. Open user_routines_DDT.c -> Default_Routine() Code:
if (p1_sw_trig > 0 && tracking > 0) { //If vision active and tracking use camera data
p1_y = speed_control; //set forward speed
p1_x = pan_position; //set turning rate
p1_x = 255 - p1_x; //invert turn direction
// Steering Compensation
if (p1_x > 135 && p1_x < 225 && steering_comp > 0)
p1_x = p1_x + steering_comp;
if (p1_x < 120 && p1_x > steering_comp && steering_comp > 0)
p1_x = p1_x - steering_comp;
pwm11 = Limit_Mix(2000 + p1_y + p1_x - 127);
pwm12 = Limit_Mix(2000 + p1_y - p1_x + 127);
}
First problem: I don't think speed_control is ever assigned a value. It's declared in user_routines_DDT.c at the top. Code:
unsigned int speed_control; Code:
p1_y = speed_control; //set forward speed Second problem: tracking and pan_position are presumably defined by our camera handling routines. They technically ARE, but the entire code portion that does this is COMMENTED OUT? Open user_routines_fast_DDT.c -> process_vision() Code:
pan_position = 0;
for (i = 0; i <j; i++) { // Begin 'pan_position' conversion loop
if (i==0) {
transit_char = char_buffer[begin_x+i]; // convert character in one's place
pan_position = (transit_char - 48) * 100; // copy to 'pan_position'
}
if (i==1) {
transit_char = char_buffer[begin_x+i]; // convert character in ten's place
pan_position = pan_position + (transit_char - 48) * 10; // add to 'pan_position'
}
if (i==2 ) {
transit_char = char_buffer[begin_x+i]; // convert character in hundred's place
pan_position=pan_position + (transit_char-48); // add to 'pan_position'
}
}// End 'pan_position' conversion loop
if (j < 3) {
pan_position = pan_position / 10;
j = 0;
}
Code:
transit_char = char_buffer[1]; // get trracking flag from camera if (transit_char > 48) //Check to see if camera is tracking tracking = 1; // if yes then set 'tracking' flag else tracking = 0; // if not then clear 'tracking' flag In fact, even the call to process_vision() is commented out in Process_Data_From_Local_IO() Code:
*/
/*********************
** VISION CONTROL **
**********************/
/* int i;
if (p1_sw_trig > 0){
if(data_rdy==1)
process_vision();
}
*/
It could be that I'm simply missing all the REAL camera handlers in another file somewhere, and that all these commented out ones are superfluous. But needless to say, right now I'm CONFUSED, and could use a bit of guidance! Help! -SlimBoJones... |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [moderated] Spare Parts Rule for 2005 | Ken Patton | General Forum | 20 | 11-06-2005 14:19 |
| Sourceforge for Code Repository and other stuff | SilverStar | Programming | 9 | 15-01-2005 21:16 |
| Coding / Style Standards for sharing C code | Joe Johnson | Programming | 33 | 01-05-2004 15:15 |
| PLEASE RESPOND: NRLB & Spare Parts at Nats | ngreen | Championship Event | 12 | 23-04-2004 16:06 |
| Rules on making spare parts fyi | DougHogg | General Forum | 0 | 02-04-2003 16:18 |