|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
PID Loop Controller with a Servo
Is it possible to use a servo as the output for for a PIDLoop? I am looking into some test vision tracking. The camera will be mounted to a servo and I wanted the camera to track the center of the target and move with it.
|
|
#2
|
||||
|
||||
|
Re: PID Loop Controller with a Servo
Great question!
I have not done this myself but I assume you would either need to add\subtract microseconds, or degrees, to your servo position signal in proportion to the error, and get your error from target position in the image. I know 254 has a continuous rotation servo controlling the elevation of their shooter hood this year. I don't know if they use PID or not. |
|
#3
|
|||
|
|||
|
Re: PID Loop Controller with a Servo
Building off billbo911 post:
I was thinking about it and I have a theory. Grip reports back the distance to the center of the target; x and y. Let's say the distance x was 50. If you did some testing to figure out how much the x error changes for each degree of rotation the servo makes then you could make a ratio. So basically you convert the error into degrees of change and then add it or subtract it to the current angle. The only problem would be the ratio would change based on the distance from the target. That throws some difficulty in the theory. Last edited by tomy : 17-04-2016 at 12:05. |
|
#4
|
||||
|
||||
|
Re: PID Loop Controller with a Servo
Depending on the servo and controller (I might be completely wrong, I've only tested this on the arduino) you might run into an error where you receive no real feedback from the servo. Some arduino libraries will only report the last value you've sent to the servo, which makes testing for values useless. It might be worth your time to test this hypothesis out with the hardware you plan on using to make sure it truly reports its absolute location and not what the software thinks.
|
|
#5
|
|||
|
|||
|
Re: PID Loop Controller with a Servo
I am getting a test bed built to do some testing with it. The current servo angle you could store as a separate variable and use that to update the new location. Then replace the variable with the new location
|
|
#6
|
||||
|
||||
|
Re: PID Loop Controller with a Servo
Forgive me for not knowing, but how do you get feedback from a hobby servo? Don't they already have PID built in too?
|
|
#7
|
|||
|
|||
|
Re: PID Loop Controller with a Servo
Quote:
I think they do. The more I think about this the more I'm thinking of not using a PID loop and using the distance to the target as a ratio of the angle. The only problem is that the distance away from the target will change that ratio. For instance if you are two feet away changing the angle by one degree will be different if you are five feet away |
|
#8
|
||||
|
||||
|
Re: PID Loop Controller with a Servo
Angle to center of target is independent of distance.
You will need to make less adjustment the further away you are but the error reported will be less as well. What you may run into is a lack of resolution to adjust the servo accurately. That's why I mentioned using microseconds instead of degrees. ie. (~ 1000 vs. ~180) |
|
#9
|
|||
|
|||
|
Re: PID Loop Controller with a Servo
Quote:
|
|
#10
|
||||
|
||||
|
Re: PID Loop Controller with a Servo
That would likely dictate that you would need to not direct mount to the servo. You would probably have to build a specific interface with gearing to account for the extra degrees of motion.
|
|
#11
|
|||
|
|||
|
Re: PID Loop Controller with a Servo
What I meant is how would you control the servo in code using microseconds?
|
|
#12
|
||||
|
||||
|
Re: PID Loop Controller with a Servo
Quote:
|
|
#13
|
|||
|
|||
|
Re: PID Loop Controller with a Servo
Quote:
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. |
|
#14
|
||||
|
||||
|
Re: PID Loop Controller with a Servo
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|