Home | Tutorials | Wiki | Issues
Ask Your Question

Surprising tutorial behavior when using model->SetLinearVel. Also, where can I learn more?

asked 2016-01-14 09:05:03 -0500

raequin gravatar image

I've got questions about behavior seen in the model-plugin tutorial:


When I compile and run it the box slides along the ground for a bit then starts to turn over. Why does this happen? Is the ground bumpy or something? It appears smooth.

The behavior is also surprising because the plugin uses SetLinearVel() so I thought that would constrain the linear velocity of the box's center of mass but when it starts to flip over the z-component of velocity must be non-zero. Any comments about this discrepancy?

Finally, can you tell me where I can learn about what functions are available for links and models so that I can learn to write plugins controlling multi-link bodies?

edit retag flag offensive close merge delete


Maybe SetLinearVel has been changed "to refer to setting the velocity state (like an initial condition), but not turning on a persistent motor controller" like SetVelocity has, according to this answer: http://answers.gazebosim.org/question/8371/kobukiturtlebot-doesnt-move-when-given-velocity-commands-in-gazebo-5/?answer=8377#post-id-8377

raequin gravatar imageraequin ( 2016-01-14 14:27:47 -0500 )edit

2 Answers

Sort by » oldest newest most voted

answered 2016-01-16 03:35:22 -0500

hsu gravatar image

To answer the first question, the box turns over because of friction coefficient, which has a default value of 1. Update your collision to below to prevent rolling:

    <collision name="collision">
          <size>1 1 1</size>

And remember, even though the tutorial moves the block with Model::SetLinearVel, which forces CG's linear motion in a straight line, physics dictates that there is still a downward gravity force, and there is still an upward normal contact force and its corresponding tangential friction forces. Ultimately, the combination of forces imparts a rolling moment about CG of the box, causing it to tumble.

edit flag offensive delete link more

answered 2016-01-15 01:09:10 -0500

I can't help with you first question, but I can hopefully point you to some useful resources.

First off, the entire gazebo API is documented here

With particularly interesting sections on link and joints, which are all within physics

I find that learning by example works well... all of the gazebo plugins are here, and some simple ones I've written can be found here

Hopefully that should get you started! If you have specific ideas on tutorials/information that isn't well documented, help contribute to the documentation! We write our tutorials in markdown, so just make a pull request this repository if you have something to add.

edit flag offensive delete link more


I'd been wanting some examples and reading the gazebo plugins did not occur to me. Thanks also for linking to your plugins. They are at a good level of difficulty for me to learn from: some stuff I know already and some stuff I'll have to research. I still would like to understand why the velocity of the model origin in the tutorial is different from what's passed to SetLinearVelocity.

raequin gravatar imageraequin ( 2016-01-15 11:39:47 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-01-14 09:05:03 -0500

Seen: 690 times

Last updated: Jan 16 '16