View Single Post
  #7   Spotlight this post!  
Unread 14-02-2006, 18:06
devicenull devicenull is offline
Robot? We need a robot?
no team
 
Join Date: Sep 2004
Rookie Year: 1234
Location: n/a
Posts: 359
devicenull is just really nicedevicenull is just really nicedevicenull is just really nicedevicenull is just really nicedevicenull is just really nice
Re: Camera isn't working

Theres a difference between the servo's and the motor:

Lets say you have a servo on pwm01 and a motor on pwm02. You then set them both equal to 200. (pwm01=pwm02=200
With the servo's, your command of 200 represents POSITION. The servo will move to where it thinks position 200 is, and stay there.
With the motor's, your command of 200 represents SPEED. The motor will start spinning forward.

It sounds to me like you locked your camera and gun's pan together. Doing so, you lose the advantage of being able to use the included code. Your pans while scanning for the target may also be slower. You gain the advantage of not having to compensate for an off-center camera.

There is a simple way to control the motor from the camera, without any sort of feedback on the pan mechanism. To do this, change PAN_SERVO to an unused pwm port, and don't hook anything up to it, then take a look below:
Code:
if PAN_SERVO is facing left
PAN LEFT
else if PAN_SERVO is facing right
PAN RIGHT
else
DONT PAN
When the camera locks on to something, it will start trying to pan towards that object. The above "code" will read which way it is trying to pan, and pan for it with your rotation mechanism. It works pretty well, provided that your turret can keep up