<< return to Pixycam.com

Pixy PWM output to control dys gimbal

HI,

Im trying to use pixy to colour track and object, Im then using the PWM output to controll a dys 3 asix gimbal to keep the camera trained on the object to be tracked. I’ve had success doing this with the pitch axis but with they yaw axis the gimbal moves in the opposite direction. Is there a way i can invert the outputted signal from pixy to correct this?

Matt

Hello Matthew,
If you’re running the pan/tilt demo onboard Pixy by selecting it in PixyMon:

http://cmucam.org/projects/cmucam5/wiki/Action_Menu

you could try to make the Pan P gain for the negative:

http://cmucam.org/projects/cmucam5/wiki/Pantilt_Demo_Pane

If you’re running the pan/tilt code from an Arduino, you can easily invert the direction by modifying the C code.

Hope this helps!

Edward

could you please upload the logic part of your coding so that i can suggest? some time if you change the sign what you have done before can change the direction as well. i also had the same problem. my robot was going away from me rather to follow my object. so i did some modification on logic part then it starts working. that’s not the big problem, once your coding start working.

Hello Biswas,
In the pantilt demo:

Look for these lines:

  panError = X_CENTER-pixy.blocks[0].x;
  tiltError = pixy.blocks[0].y-Y_CENTER;

These lines determine the “sign” of the pan and tilt direction. To change the sign of pan, you can change to:

  panError = pixy.blocks[0].x-X_CENTER;
  tiltError = pixy.blocks[0].y-Y_CENTER;

and the pan will go in the opposite direction. This is a little different with a chase/follow program, but the concept is exactly the same.

Hope this helps!

Edward

it doesn’t seems like PWM, is it PID Controller ?

Yes, it is a PID controller.

Hello Edward, How can i use this pantilt demo along with PID controller for DC Gear Motor, any ideas ?

Hello Biswas,
The pan/tilt demo is designed around RC-servos. I’m not sure if I can think of a way to do what you’re describing.

Edward