Gazebo | Ignition | Community
Ask Your Question

Static friction parameter issue

asked 2016-10-26 11:50:56 -0600

SprGrf gravatar image

Hello everyone,

i have modeled a real joint that I am using in Gazebo and I am currently trying to set up the parameters (damping, static friction). I let the real link fall from an initial angle only under the effect of gravity and tried to match the response of the model. I achieved that, with parameters close to those I would have imagined (damping = 0.005, static friction coefficient = 0.64). The real and the simulated link stop at the same angle (non-zero, because of the friction and the damping) and fall for the same amount of time.

The problem appears when I use the ROS pid controller. When I give a setpoint to the simulated link, its response is very strange (I have attached a picture). X axis depicts time in seconds and Y is the joint angle. image description

If I change the static friction coefficient the only thing that changes is the settling time and not the steady state error, which strikes me as weird, as in the case of the free fall this parameter defined where the leg would stop. If i set it to zero the response is realistic but the steady state error is smaller than the real one (that is the reason I used the static friction in the first place).

If anyone could assist me I would greatly appreciate it. If I have not expressed myself clearly or any further clarification or information is required please do tell me.

Thank you all in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-10-31 13:35:23 -0600

pcdangio gravatar image

Your steady state error is probably caused by a Proportional gain that is not strong enough to overcome friction AND gravity. I imagine you are still seeing steady state error after zeroing your friction coefficient because of gravity. You need to use an Integral gain to overcome both of these forces and get rid of your steady state error.

Also, the response you posted looks really underdamped. Try increasing your P gain to get a faster rise time, and use a D gain to mitigate any oscillations that pop up.

The static friction coefficient doesn't make sense to me in this case... "static" friction should only apply when the joint is not moving at all. I would expect "dynamic" friction to effect your step response. I tried to look up how Gazebo/ODE implements the "static" friction for a joint, but unfortunately the ODE wiki is down. From what you have found though, it seems likely that either Gazebo or ODE is confusing static friction with dynamic friction. I imagine when you decrease the "static" friction coefficient, your rise time gets quicker? If so, they must be implementing it as dynamic friction.

Lastly, setting up a physically accurate model can be real tricky. I wouldn't rely on the accuracy of the simulation unless you've done some serious system identification... especially if you are trying to determine feedback control gains for a real world system. Setting up a single test case (e.g. letting the link fall from one angle to another) will only make your model accurate for that exact case. You can get entirely different behavior from one test case to the next.

Long story short, use sim to get an initial set of gains for your real world system... then do real world testing and adjust your gains as needed. All kinds of complications come up that are tough to model (e.g. motor dynamics, feedback loop rate effects on integral/derivative terms, etc).

Hope this helps!

edit flag offensive delete link more


First of all, thank you for the time you took to reply. I know about the steady state error, although in my case integral control is not really useful as the movement has to be very fast (about 200-300 ms). The integral term would not have enough time to "load", thus a large I gain would be required - not recommended. I could increase P but i was trying to see how the gains I am using in the real system would work on sim.

SprGrf gravatar imageSprGrf ( 2016-11-01 04:00:52 -0600 )edit

Static friction parameter could affect the final angle of the free fall, depending on the friction model that is used. Consider the following image (case a). After the motion starts there is a constant opposing force that could stop the link earlier. If we add the viscous damping we would end up with something like case b. However I can not understand if the static friction parameter inserts a model like b (so there is no need to add additional damping) or a.

SprGrf gravatar imageSprGrf ( 2016-11-01 04:04:00 -0600 )edit

Finally, I am not sure about the identification. What you are saying could be true (matching just the one case I am working on and not every case). However I can not comprehend how this could happen, and how can the physical parameters be correct for one senario and not for another.

SprGrf gravatar imageSprGrf ( 2016-11-01 04:04:44 -0600 )edit

Integral gain is the only possible way to get rid of steady state error completely. You can always increase your P gain to decrease your steady state error, but it will never reach zero. Also setting a P gain too high will create oscillations around the setpoint that you will have to deal with. If you use a P-I controller, you can use a decent P gain to get a fast response, and a small I gain to clean up the steady state error.

pcdangio gravatar imagepcdangio ( 2016-11-02 10:33:05 -0600 )edit

My comment about static friction... static friction is defined as the amount of force required to take an object at rest and put it into motion. Once the object goes into motion, dynamic (aka kinetic) friction takes over and the static friction has no effect. A good description can be found here: So static friction should have no effect on your link's joint while it is moving... if it does, then Gazebo/ODE is using the term incorrectly

pcdangio gravatar imagepcdangio ( 2016-11-02 10:37:21 -0600 )edit

I totally agree with you. It's just that if gazebo is using the friction model (a) on the image I included above, there will be no difference between static and kinetic friction. If this is true, the term is, as you mentioned, used incorrectly. I am going to run some simulations to find out how the parameter is implemented. Hopefully I will be able to post some results later.

SprGrf gravatar imageSprGrf ( 2016-11-02 10:46:17 -0600 )edit

As for the system identification... if you have a motor attached to that link in the real world, then there are all kinds of extra dynamics introduced. I'm assuming you turned off your motor and let your link free-fall to take your measurements. In that case, you can't just model it with joint friction and damping... the motor/gearbox has its own inertia term as well. On top of that, backdriving a motor induces currents which will dynamically effect the torque required to backdrive it

pcdangio gravatar imagepcdangio ( 2016-11-02 10:46:56 -0600 )edit

I'd say do your free-fall test from at least 5 different angles and see if you can approximate the model. You can also judge the accuracy of your model at that point. But in the end, I really doubt you will be able to tune your PID controller in simulation and copy the gains into a real world system and have them work the same. Even if you model all of your components exactly... physics simulation is still only an approximation of the real world. It's discrete, friction is "modeled", etc.

pcdangio gravatar imagepcdangio ( 2016-11-02 10:50:38 -0600 )edit

Question Tools

1 follower


Asked: 2016-10-26 11:48:38 -0600

Seen: 17,222 times

Last updated: Oct 31 '16