Ask Your Question
2

Problems to move the wheels with a PID controller

asked 2012-10-04 05:33:58 -0500

arzhed gravatar image

updated 2012-10-11 02:15:55 -0500

Hi guys!

I got a robot simulated in Gazebo which i'd like to control easily. I made 3 controllers (thanks to the tutorials) : one to control the head and a controller for each wheel. I should mention that the robot stands on a 3rd wheel (it's just a ball actually), it might cause a problem but if so, I don't know which one.

By setting the effort applied on the wheel joints, it works "ok". It's not perfect (zigzags and slidings) but if the applied effort is not to high, it's ok. So, I tried to add a PID to these controllers. The head controller works just fine with it. But when I did the same with the left wheel, I got some very strange results : the robot starts jumping/flying before landing far away when the wheel comes to the position I asked.

I first thought to change the PID parameters, but the problem remains : the effort applied by the pid_controller_.updatePid(current_pos-desired_pos, dt) function is lower than the one I apply on the wheel "by myself" to make it move without "jumping", but the robot still "jumps" (see the update loop in the .cpp file in the "add a pid" tutorial).

I also tried changing the weight of the wheels and the body in the URDF file , and I set the contact coefficient using the following code :

 <gazebo reference="lefttire">
    <mu1 value="100.0" />
    <mu2 value="100.0" />
    <kp  value="1000000.0" />
    <kd  value="1.0" />
  </gazebo>

("lefttire" is the name of the link)

...vainly

Should I add a PID controller for the wheel speed? Or should I look at this 3rd wheel?

Any help appreciated! Thanks!

UPDATE : "Please, help!"

edit retag flag offensive close merge delete

Comments

can you share your model and code? thanks.

hsu gravatar imagehsu ( 2012-10-18 05:22:20 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2012-10-11 03:10:48 -0500

cagatay gravatar image

Hello , think of your system(dc motors) as a lineer system which is not xdot = A(t)x + B(t)u y = C(t)x + D(t)u

x is your state vectors and u is your inputs. When you apply inputs( such as a step function) to your system, you can't get same output because of system dynamics, etc..

So you have to implement a PID controller( because it is the easiest one to implement) to follow your inputs. If you have 2 wheels actuated by dc motor, you have to apply pid controller for both of them. If third wheel is a castor wheel, you can't apply pid control for it because it doesn't have any actuator.

Jumping stuff occurs maybe because of your pid gains or damping ratio of the joints in gazebo, have you added SimpleTransmission to your joints in your xacro file such as shown below?

<transmission type="pr2_mechanism_model/SimpleTransmission" name="righwheeljoint">
            <actuator name="rightwheelmotor" />
            <joint name="rightWheelJoint" />
            <mechanicalReduction>1.0</mechanicalReduction>
            <motorTorqueConstant>1.32</motorTorqueConstant>
</transmission>

Here is a great tutorial about dc motor modeling and controlling for continuous time

modeling controlling

don't forget you apply your control algorithm in discrete time.

Hope it helps, good luck

edit flag offensive delete link more

Comments

Well, as I said, I already tried changing my pid gains following the classic empirical method ("first set "p", then "i", then...") but i never got better results with any configuration. I didn't take much care of damping ratio since it's a pid controller. Should I?

arzhed gravatar imagearzhed ( 2012-10-11 03:35:20 -0500 )edit

And what do mechanicalReduction and motorTorqueConstant represent? I thought those were for the pr2 and it had nothing to do with any robot in gazebo...

arzhed gravatar imagearzhed ( 2012-10-11 03:36:21 -0500 )edit

mechanicalreduction for gearboxes, motortorqueconstant is the torque constant of the actuator that you are trying to control. generally motor controllers use PI for velocity control. Maybe your problem is not about pi controller, are you using differential drive plugin for gazebo ?

cagatay gravatar imagecagatay ( 2012-10-11 04:24:15 -0500 )edit

No I dont, I use a realtime joint controllers for each wheels, and I only added a pid controller and a service to communicate with. I have no actuator in my model, its a basic urdf model (though i added the <transmission> element in which I specified the joint name, but the other values dont matter)

arzhed gravatar imagearzhed ( 2012-10-11 04:59:20 -0500 )edit

Concerning the 3rd wheel, i thought it might cause some problem because of friction, for instance...

arzhed gravatar imagearzhed ( 2012-10-11 05:01:36 -0500 )edit
0

answered 2012-10-16 02:20:47 -0500

arzhed gravatar image
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2012-10-04 05:33:58 -0500

Seen: 2,737 times

Last updated: Oct 16 '12