Gazebo | Ignition | Community
Ask Your Question

Controller gains behind Joint::SetVelocity?

asked 2015-01-09 08:16:10 -0600

Eisenhorn gravatar image


In a plugin I am setting the rotational speed of a joint by using Joint::SetVelocity. The maximum force on that joint is limited by SetMaxForce.

I couldn't find the implementation of SetVelocity in How does SetVelocity set the speed exacty? Is there a PID control in the background? If so how can I change the PID gains? I am using ROS Hydro and Gazebo 1.9.


edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2015-01-09 12:37:52 -0600

jackie gravatar image

SetVelocity is implemented differently for different physics engines. Gazebo is compatible with several core physics engines: ODE, Simbody, Bullet, and DART. However, only ODE and Bullet are available in 1.9, and in all versions ODE is the default. Joint is actually an abstract class, and there's a different implementation for the different physics engines. There are also different implementations for the different kinds of joints (hinge, prismatic, etc.). To find the implementation of SetVelocity, look in folder gazebo/physics/ode/ for ODEJoint and ODEHingeJoint (since it sounds like you are using a rotating hinge joint).

As you can see if you read the source code, there is no PID control in the background for SetVelocity. There is a PID class that computes PID math for you, which you could try using for PID velocity control.

edit flag offensive delete link more


Sorry for my late answer. Yes it’s a HingeJoint. I am using ODE. The reason I ask is the very odd system response (aquired by getvelocity) which turns out to be a ramp function. The system is a 4 wheel robot. The velocity for 2 hingejoints connected to wheels is set. SetVelocity uses the tSetParam(dParamVel, _angle); (at least in gazebo 1.9) function. Shouldn't this set the velocity instantaneous?

Eisenhorn gravatar imageEisenhorn ( 2015-01-16 10:06:13 -0600 )edit

answered 2015-01-09 18:53:43 -0600

scpeters gravatar image

Jackie's answer is good, but I'll add a bit more here. The behavior of SetVelocity has been different for each physics engine up through gazebo4. For example, ODEJoint::SetVelocity uses a velocity controller with a max_force parameter (see ode user guide, specifically dParamVel and dParamFMax). On the other hand, BulletJoint::SetVelocity sets the velocity of the child link relative to the parent.

With gazebo5 (implemented in pull request 1218), ODEJoint::SetVelocity will match the behavior of bullet and other physics engines by setting the child velocity relative to the parent. This will also allow the dParamVel and dParamFMax parameters to be used for Coulomb joint friction.

Hope this helps.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-01-09 08:16:10 -0600

Seen: 1,444 times

Last updated: Jan 09 '15