ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Setting joint velocity in Gazebo

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

SpiderRico gravatar image

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

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 image Adolfo Rodriguez T  ( 2014-01-16 06:03:38 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted

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

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 image SpiderRico  ( 2014-01-20 00:41:26 -0600 )edit

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

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 image SpiderRico  ( 2014-01-16 02:16:22 -0600 )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 image Adolfo Rodriguez T  ( 2014-01-16 06:02:10 -0600 )edit

Question Tools

1 follower


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

Seen: 4,449 times

Last updated: Jan 19 '14