Ok so we’re trying to make our camera pan back and forth until it sees the vision tetra, then lock and track. However it appears that whenever we call camera_set_servos() it stops searching for a color, and when we tell it to look for a color ( camera_find_color() ) it then appears to recenter the servos; we’re stuck. Is there any solution to our problem?
This code block is inside Camera_Processing(), before it’s own tracking routine.
Now, when we had it in other places using ‘if(cam.conf < 60)’ or something similar to track it, we had the same problem. I believe the problem with the reseting servos, is using camera_reset() in camera_find_color(). But, the real problem, IMO, is the mysterious breaking of the camera while using camera_stop() (and therefore camera_getACK(), while using camera_set_servos). I really hope it’s something really silly.
I have the same problem. Today I am going to try an idea proposed somewhere around here to use a left, right, and center position and spend a few seconds at each. I dont know if it will work, and assuming that the conclusion you came to (that resetting the camera centers the servos) it wont work, but its worth a try.
That cause the servos to recenter though, meaning we can’t pan and look for a colr at the same time, cause it keeps recentering when we tell it to look for colors. Which makes pan useless…but without it we can’t see the tetras in most cases and we’re against the idea of moving our robot if we can avoid it.
Has anyone tried using camera_set_servos() without stopping the camera or auto servos or any of that? I know it says you can’t do anything other than camera_track_update() after camera_find_color(), but has anyone tried it anyway?
It works, but it calls camera_stop() in camera_set_servos(), which interestingly enough makes it stop…everything, color tracking included. Without camera_stop() it jsut seizes up the camera.
what if:
1)you took the pwm out on the camera, and connected that to the pwn in on the robot controller.
2)connected a pwm out from the robot controller to the servos on thecamera mount.
now all you need to do is decide on the software level when you want to track and when you want to keep panning.
if (!tracking) //if the caera isn't trying to track - pan
{
pwm_15=cnt;
cnt += dir;
if(cnt >= 210)
dir = -5;
else if(cnt <= 40)
dir = 5;
printf("Didn't find it: %d\r",cnt);
}
else if (tracking) //if the camera is trying to track, give the servos it's values.
{
pwm_15=pwm_in15;
}
one problem might be that the camera wouldnt know where it started, and if it needs its current location to move the servos correctly, you would need to compensate somehow:
else if (tracking) //if the camera is trying to track, give the servos it's values.
{
pwm_15=(cnt-127)+pwm_in15; //if the camera expects to start from 127, then you need to compenstae, because it thinks it's starting at a different place.....
}
ID: 1183 Section: 5.3 Status: Answered Date Answered: 1/17/2005
Q: May we connect servos to the PWM outputs on the CMUcam to take advantage of the automatic pan and tilt control that it provides
A: Yes. Servos connected to the camera module are considered part of the camera module and can only be connected to it.
So… no one has figured out how to make the camera pan back and forth to look for a color?
I’m working on the problem myself, without much success. >.< If I figure anything out, I’ll let ya know, but… right now it looks like we’ll just be turning the whole robot back and forth if the tetra isn’t in the camera’s field of vision. : :o
What I have been trying to do just now is something that was proposed elsewhere… foget who suggested it, but the point is this is not my own idea. But basically you plug the camera servos into the RC then set auto servos on the camera, then on the RC you check the supposed servo postions and then set the servos to those positions using the pwm outputs. It should work, but there is something wrong with my compiler. Or maybe my program. Something is wrong.
I dont think so. My guess is that the autoservo function just sets the servo ports to the values it wants the servos at, and doesnt actually check to see that the servos are functioning. Then when you retrieve data from the camera it will tell you the positions the servos should be in, then you use that info to put them into those positions. It seems workable to me.