ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A
Ask Your Question

Setting joint velocity in Gazebo

asked 2014-01-16 01:05:04 -0500

SpiderRico gravatar image

updated 2014-01-28 17:06:36 -0500

ngrennan gravatar image

Hello all,

I'm trying to simulate an obstacle avoiding robot in gazebo. I've been following this tutorial.

The problem is that this tutorial uses the following function in order to move the robot.

SetForce(0, torque);

The problem with that is it eventually makes robot to spin.

So i looked in API ref and found

SetVelocity(0, vel);

Code compiles just fine however, this doesn't seem to have any effect on model. So how can I set velocity of wheels from a plugin ?

edit retag flag offensive close merge delete


This question is quite Gazebo-specific. You might get better feedback if you ask it on

Adolfo Rodriguez T gravatar imageAdolfo Rodriguez T ( 2014-01-16 06:03:38 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2014-01-19 13:35:33 -0500

The velocity controls will not respond unless the max force limit is large. Edit your sdf to increase the limit or programatically use setMaxForce() to increase the force to a large value. Gazebo will work within these limits to try and instantaneously accelerate your joint to those speeds, so you need no force limits on your joints if you are working on velocities.

edit flag offensive delete link more


Thank you. I actually asked the same question in gazebosim and got the same answer. Forgot about this one :)

SpiderRico gravatar imageSpiderRico ( 2014-01-20 00:41:26 -0500 )edit

answered 2014-01-16 01:56:06 -0500

davinci gravatar image

You probably need a controller for that, I think it is not possible to directly control the velocity.

Edit: it might be possible, in this example it is controlled:

But btw: see for gazebo questions.

edit flag offensive delete link more


The problem with this->model->SetLinearVel(math::Vector3(vel, 0, 0)); is that it sets the velocity for themodel. I want to set velocity for each wheel separately.

SpiderRico gravatar imageSpiderRico ( 2014-01-16 02:16:22 -0500 )edit

Joint commands can be set without a controller. Force and velocity commands require calling SetForce in advance (as the OP mentions), and it's possible to set the joint position with SetAngle, but here you bypass the physics and enforce perfect position control.

Adolfo Rodriguez T gravatar imageAdolfo Rodriguez T ( 2014-01-16 06:02:10 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2014-01-16 01:05:04 -0500

Seen: 2,464 times

Last updated: Jan 19 '14