Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   PI Like Control with Pots (http://www.chiefdelphi.com/forums/showthread.php?t=35186)

Tom Bottiglieri 21-02-2005 22:39

PI Like Control with Pots
 
I have run into a problem. Our main arm is powered by 2 fisher price motors, and is subject to backdrive when the arm is extended too much. I have a pot connected to it to drive to pre set positions, and I was wondering if anyone has had experience with coding a control loop that is driven by a potentiometer. Normally, I would research this topic, but with one night left to get this working, I need help.

Right now i am using a basic "check and correct" function. I have the code so when the joystick is neutral, it grabs the pots value. Then in the following program loops if that value deviates from the original, it will drive the motor accordingly. This is not working very well. Our only other alternative is a mechanical brake, but we do not have enough time to do this.

Please help me with this...

Thanks,
Tom

Max Lobovsky 21-02-2005 22:43

Re: PI Like Control with Pots
 
A PID feedback loop is what you want. There are many, many threads on this including many with code posted. IM me if you want and I can give you my own code.

Bharat Nain 22-02-2005 02:07

Re: PI Like Control with Pots
 
All I can suggest from my past years experience of working with pots is give it some slack. If you over power it, it will go nuts trying to correct itself.

FotoPlasma 22-02-2005 02:18

Re: PI Like Control with Pots
 
If the point of this feedback loop is to prevent backdriving, have you considered switching the jumper on your speed controllers to active breaking?

The double jointed arm I had the pleasure of working on, last year, had some trouble with inertia until we turned this option on. It worked like a charm.

sanddrag 22-02-2005 02:26

Re: PI Like Control with Pots
 
Quote:

Originally Posted by FotoPlasma
have you considered switching the jumper on your speed controllers to active breaking?

LOL! A setting to break it! Anyhow, setting the braking jumper might not stop it, but it should noticably slow it's fall.

FotoPlasma 22-02-2005 02:31

Re: PI Like Control with Pots
 
*snap*
*crash*

*FotoPlasma walks away, whistling inconspicuously*

jzampier 26-02-2005 17:38

Re: PI Like Control with Pots
 
for an arm I'd avoid PID control. Usually you can get away with just P control and
you will avoid oscillatory problems that like to creep up with PI control.

The way P control works is very simple.
Take the actual postition of the arm (call it y) (from the pot) and subtract it from
the desired position of the arm. (call it r) (from your joystick/whatever).
This is your error signal value. e = r - y

Assuming your pots are calibrated so zero on the arm is in the appropriate location...
(if not add/subtract a fudge factor to y or r as needed)...

Multiple that error value by a constant... (called P
probably between 1 and 2) which is
determined experimentally...
and output that value + 127 to the motor.

output = 127 + ( P * e )

note that depending on directions of movement, e may be negative
and as such P may need to be negative if you are going the wrong direction.

Should work like a charm.
Matt Leese and I had a P controller working with 340's arm last sunday.
(Although I wanted a PD cause i thought it would be faster and more damped)

Man was it cool to push on the arm and watch it go back to where it was before. :D


All times are GMT -5. The time now is 01:25.

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