Home | Tutorials | Wiki | Issues
Ask Your Question

Setting initial velocity in plugin

asked 2018-02-07 03:19:47 -0600

Edwin Walsh gravatar image

I am trying to have a model rotate along a Lissajous curve. I am using torques to set the angular acceleration to be able to simulate this movement.

For this to work, I have to set the initial angular velocity.

I tried this by adding a parameter which checks if the update method has run before, and then set the angular velocity the first time the Update method of the plugin is called.

if (!this->dataPtr->runOnce){
    this->dataPtr->runOnce = true;

However, if I print out the


I can see that it is set, but the next time the Update method is called, it is already set to a value close to zero.

Just to be sure I added a delay before setting the torques, but they don't have any influence on the initial value, so they must be reset somewhere else...

Any idea what I am doing wrong?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-02-07 09:02:37 -0600

Brosseau.F gravatar image

I suggest you to take a look at this tutorial :


Maybe you will have to play with some parameters of your link like the friction to make it enable to keep some velocity.


Take a look at the surface tag which contains friction parameters.

edit flag offensive delete link more


Your answer does not make sense to me. In a friction-less environment you would expect a velocity to stay constant, since no forces are applied (other then gravity, but that is turned off on the link in this case). Adding friction would add a force that would slow the object down. This would only explain the results I see (having a speed during only one timestep), if friction is so high that the speed is instantly reduced to zero. There is however no collision tag set (so no friction).

Edwin Walsh gravatar imageEdwin Walsh ( 2018-02-12 05:43:41 -0600 )edit

It's not because you didn't put a collision tag that there is no friction. According to this : http://sdformat.org/spec?ver=1.6&elem=collision Default values for mu1 and mu2 are set to 1.0 (max friction).

Brosseau.F gravatar imageBrosseau.F ( 2018-02-15 01:48:53 -0600 )edit

You may try to add a collision tag with low (or 0) value or you can try to set your link to be kinematic (http://sdformat.org/spec?ver=1.6&elem=link).

Brosseau.F gravatar imageBrosseau.F ( 2018-02-15 01:58:14 -0600 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-02-07 03:19:47 -0600

Seen: 40 times

Last updated: Feb 07