Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   PID Loop Controller with a Servo (http://www.chiefdelphi.com/forums/showthread.php?t=147285)

tomy 17-04-2016 18:59

Re: PID Loop Controller with a Servo
 
Quote:

Originally Posted by Ether (Post 1574425)
Is the camera indeed mounted to the servo? Or is the camera mounted to a turret which is to be actuated by the servo?




For testing purposes the camera would be mounted on a turret which is actuated by a servo for both rotating the camera and angling the camera.

The purpose is to test vision tracking without having a robot that tracks the target but a camera that tracks the target. I don't have a robot on hand just a test board with the camera turret mount.

Ether 17-04-2016 19:40

Re: PID Loop Controller with a Servo
 
Quote:

Originally Posted by tomy (Post 1574445)
For testing purposes the camera would be mounted on a turret which is actuated by a servo

Is the servo you've selected powerful enough to rotate the turret at the desired speed?



euhlmann 17-04-2016 20:46

Re: PID Loop Controller with a Servo
 
A typical (non-continuous) servo already implements closed-loop control onboard, so a PID loop is unnecessary. Just set it to the angle you want and it will handle going there. Servos are quite effective at moving to positions quickly and without overshoot.

Quote:

Originally Posted by tomy (Post 1574419)
Sounds good but how do you control that in Java based programming

You can set a servo in wpilib using Servo.setAngle(degrees)

tomy 17-04-2016 23:05

Re: PID Loop Controller with a Servo
 
Quote:

Originally Posted by euhlmann (Post 1574493)
A typical (non-continuous) servo already implements closed-loop control onboard, so a PID loop is unnecessary. Just set it to the angle you want and it will handle going there. Servos are quite effective at moving to positions quickly and without overshoot.



You can set a servo in wpilib using Servo.setAngle(degrees)

I know I can do that. I am talking about live tracking a target. If the camera is mounted on a turret and the servo can turn it fast enough there needs to be a ratio between the distance to the center of the target and angle to turn. My question is if this is a good method?

billbo911 18-04-2016 00:31

Re: PID Loop Controller with a Servo
 
Quote:

Originally Posted by tomy (Post 1574564)
I know I can do that. I am talking about live tracking a target. If the camera is mounted on a turret and the servo can turn it fast enough there needs to be a ratio between the distance to the center of the target and angle to turn. My question is if this is a good method?

If I'm following your question, there is a really nice thread discussing it here.

In very simple terms, divide your camera's field of view in degrees by your horizontal resolution. That will give you degrees per pixel.
Now just multiply the numbers of pixels you are out of alignment by the degrees per pixel and you have your degrees to turn.


All times are GMT -5. The time now is 03:22.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi