|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
Camera Range Finding
Ok I am new to programming, but I am supposed to be figuring out how we can use the camera this year. Now it looks easy enough to make the robot get to the vision tetra, but obviously it needs to know when it gets there. My first thought was to use one of the light sensors from last year and turn up the sensitivity so they would see any reflected light from a tetra, but that seemed kind of iffy. Now I am thinking of using the tilt of the camera to compute the range of the target. My plan was to run a cable from the tilt servo port on the camera then split it and run one end to the servo, and another to the RC, then monitor the signal on this cable in order to tell where the servo was supposed to be, then when it gets to the proper angle it starts up the code that makes the robot pick up the tetra. But just now I was going over the code and I noticed this in user_routines_DDT.c:
Quote:
|
|
#2
|
||||
|
||||
|
Re: Camera Range Finding
Yes. This is precisely why they have the camera on the TTL port: so you can have access to all of the data, including the servo positions.
|
|
#3
|
|||||
|
|||||
|
Re: Camera Range Finding
Ok. Thanks. Do you know what format that number is in? Is it the pwm value being sent to the tilt servo? And regardless of its format could I do something like this:
if (tilt_position =< x) { CODE FOR PICKING UP THE TETRA } where x is the value which represents the camera angle at which I want it to start executing the pick up the tetra code? |
|
#4
|
||||
|
||||
|
Re: Camera Range Finding
cam.tilt_servo is the variable for your "tilt_position" and will return your tilt servo position as a value from 0 to 255.
FYI, camera_track_update in camera.c has a pretty good breakdown on what useful values you can read from the camera in tracking mode. Code:
int camera_track_update(void)
{
int i;
if(wait_for_data()==0) return 0;
if(cam_uart_buffer[0]=='T' && cam_index_ptr>=9)
{
cam.x=cam_uart_buffer[1];
cam.y=cam_uart_buffer[2];
cam.x1=cam_uart_buffer[3];
cam.y1=cam_uart_buffer[4];
cam.x2=cam_uart_buffer[5];
cam.y2=cam_uart_buffer[6];
cam.size=cam_uart_buffer[7];
cam.conf=cam_uart_buffer[8];
if(cam_index_ptr>9)
{
cam.pan_servo=cam_uart_buffer[9];
cam.tilt_servo=cam_uart_buffer[10];
}
reset_rx_buffer();
return 1;
}
// Bad data in buffer
reset_rx_buffer();
return 0;
}
-SlimBoJones... Last edited by Mr. Lim : 15-01-2005 at 08:58. Reason: originally didn't provide much info |
|
#5
|
||||
|
||||
|
Re: Camera Range Finding
Where can we find the camera code, and is there a script we are supposed to use? We are new at programming and we have no idea how to program teh camera...
Thnx Fred |
|
#6
|
|||||
|
|||||
|
Re: Camera Range Finding
At least as of yesterday the camera code is not officially available. I think. Basically for the first few days innovation first had the code on their website, then they took it away and made it say that they are still working on the code.
|
|
#7
|
||||
|
||||
|
Re: Camera Range Finding
Quote:
|
|
#8
|
|||
|
|||
|
Re: Camera Range Finding
Hey, russel, I think basically that you would use the readings from the servos to tirnagulate the distance. Basically, you know the height of the camera, and you know one of the angle, and so you can triangulate the second side using a sin function, not too hard to do.. Thats why its nice havign the servo output readings... After looking I didn't find anything like that currently in the code but it would not be hard to write a little alogrithm to do that..
Peace up. |
|
#9
|
|||||
|
|||||
|
Re: Camera Range Finding
Quote:
|
|
#10
|
||||
|
||||
|
Re: Camera Range Finding
well maybe for the target it will work, but for finding the tetra the issue is that of camera is most likely not going to have to tilt the camera once it finds the tetra to follow it. Weve tried to mess around with this, but have had no sucess
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Scripting Setup and the Camera + Serial Port Drivers | CJO | Programming | 22 | 11-01-2006 17:42 |
| Kevin Watson's Kick-off Demo Code! | Mr. Lim | Programming | 27 | 22-01-2005 03:38 |
| Only 1 camera allowed? | Joe Ross | Control System | 4 | 17-01-2005 23:29 |
| Camera Problem | n_0163 | Electrical | 3 | 14-01-2005 21:10 |
| CMUCam2 Camera Code - Are important parts commented out? | Mr. Lim | Programming | 4 | 14-01-2005 12:11 |