I have been sriting a basic code for the camera which requires the camera to use its demo mode to track colors, i then triangulate the position of the object that the camera is tracking and tell how far away it is, my only problem is that my code is designed to use the PWM input that the camera sends to the servos to move it so that it stays pointing at them,
Basically how do I get a pwm input into the RC or do I need to attach a potentiometer to the camera’s mount and measure it that way?
Thanks for the help,
The PWM from the camera is not an absolute position, it is the drive to turn the camera towards the color source. Eventually it will go to “zero” when the camera is pointed at the object is it looking for. A pot attached to the gimbal mount will give some data for triangulation but you do need two cameras to triangulate and the distance between the cameras and the distance to the object are variables that pots alone can’t give accurate results. You will need something that has very high resolution when the object is far away. Remember that the A/D in the RC may not give a different data output with a pot moving a degree or two. You need somthing that can get you sub-degree accracy for data points and calculations. The optical distance sensors actually shine light on a photo resistor to determine angle. They efectively split the beam from one source and reflect one of the beams using a moving mirror that is “finding” the target.
I am actually triangulating with the floor so that i know the height of the cam and just use height times tangent of the angle,
Thanks I will work on writing the code to use a pot then as well as try to use something better when i can find what that would be, but the intension is to use this as a start so the camera for distance is neccissary.