Gazebo | Ignition | Community
Ask Your Question

how to stop the joint motion( clear the force)

asked 2012-09-19 23:07:26 -0500

nkoenig gravatar image

I have set a force on the shoulder of simple_arm and it seems that It is going to move forever until I stop it somehow.

How can I clear/stop the force that I have set by Joint::SetForce() on a joint? In general how can we stop the motion of a model in programming. Is there any function to stop the model?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2012-09-19 23:09:50 -0500

nkoenig gravatar image

Where in you'r code have you applied the force ? are you absolutely sure it is not in the onUpdate() or similar never ending call ?

What is the purpose?

have you got friction in the joint ? according to newtons laws of motion, the arm will continue to rotate forever, unless something provides a reaction force, like friction.

if you apply the force in a small duration of time, the turnrate of the arm will after that moment in time become constant. With frictions it will decellerate, with repeated force the arm will accellerate. with repeated force and friction the arm will reach a steady state where you'r applied force equals the force from friction, and from here the speed will eventually become constant.


  1. if you are repeatingly applying force, stop that after some time and let the friction stop the arm (use gazebos simulation time..)

  2. learn control theory, (and basic physics) and let a controller that calculate the desired force to have the arm move to a position or speed or both be implemented. (You should do this to control the HW anyway)

  3. stop using forces, cheat and use the animation interface for gazebo

edit flag offensive delete link more


i have the same kind of problem ,i tried to modify the c++ code in tutorial .it also not stopping.i have setForce to zero even it is not stooping .I am beginner in field of robotics as well as in gazebo .plz guide me ,i am attachin my modified code here

suvrat gravatar imagesuvrat ( 2013-07-30 15:49:01 -0500 )edit

double target_dist = 2.0;

   if (min_dist < this->laser->GetRangeMax())

    double torque = this->gain *( (min_dist - target_dist)*0.1 );

    this->leftWheelJoint->SetForce(0, torque);
    this->rightWheelJoint->SetForce(0, torque);



this->leftWheelJoint->SetForce(0,0.0); this->rightWheelJoint->SetForce(0,0.0); }

suvrat gravatar imagesuvrat ( 2013-07-30 15:51:34 -0500 )edit

as i can't paste my complete code here i just paste the part which i had modified .

suvrat gravatar imagesuvrat ( 2013-07-30 15:53:35 -0500 )edit

answered 2017-09-23 08:32:31 -0500

Do you guys install perf using following commands and it works for you?

Install perf sudo apt-get install linux-tools Record data perf record gzserver worlds/ Generate a report perf report

Beach Wall Murals Wallpaper Murals Flowers Wall Murals Wall Murals

edit flag offensive delete link more

answered 2013-08-01 14:13:20 -0500

suvrat gravatar image

i m begginer in gazebo but i solved the problem using SetDamping().if too obvious its k ,i just tell how i done in my case.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2012-09-19 23:07:26 -0500

Seen: 30,442 times

Last updated: Aug 01 '13