Society of Robots - Robot Forum

Software => Software => Topic started by: salama on February 16, 2012, 12:42:57 AM

Title: PID controller not enough
Post by: salama on February 16, 2012, 12:42:57 AM
Hello,
I'm building robot with piston legs and driving them with DC motor controlled with AVR. When the leg is on ground and need to push the robot up the force needed to move is really big compared when going down(pretty much no force needed). This makes using the standard PID algorithm really hard. I need pretty big P value to even move that leg. But when there is no load it pretty much impossible to make it stable. I will add force sensor to leg so I think I need to adjust the algorithm according to that. Any ideas how to do this most effectively? Thank you.
Title: Re: PID controller not enough
Post by: newInRobotics on February 16, 2012, 01:34:54 AM
What does PID have to do with how much force motor can output?

How do You use PID to control pistons? Do You have some sort of linear encoder for each piston?
Title: Re: PID controller not enough
Post by: salama on February 23, 2012, 02:02:22 AM
I use the the encoder value to determine current angle of motor. So with this information I can make pid controller with controls the motor output value from 0-255. With small control values the leg does not move at all. So when it is most hardest to move legs with small control values it moves pretty slowly.

But I think I found one critical bug in my code. So this might actually work. Thou I cannot get the data out of my circuits now for some reason so I am not sure yet.
Title: Re: PID controller not enough
Post by: mstacho on February 23, 2012, 08:45:35 AM
Your motor is operating in two regimes: MOVE_LEG_UP and MOVE_LEG_DOWN.  The simplest way of dealing with this is to just know which function you're in, and adjust the gains accordingly.  This is a (very crude) version of sliding mode control. 

Keep in mind one thing with this approach: the switch is NOT dependent on the sign of the error.  What I mean by this is if you overshoot while trying to move up, then the leg has to come down.  *but you are still in the GO_UP mode, so keep your gains high*.  If you don't, then your robot will "chatter": you'll overshoot just a bit, then the gains will jack right up, you'll undershoot, gains go low, overshoot...

It's not a big deal, but it can be funny to watch.

On the other hand, adding a very simple force sensor will just about solve the problem entirely, but will make position control a bit harder.

Good luck!

MIKE
Title: Re: PID controller not enough
Post by: salama on February 29, 2012, 12:21:44 AM
Yes I am going to use force sensor. I hope it will make it easier. Thank you for your advice!