Home | Tutorials | Wiki | Issues
Ask Your Question

How to fix joints from plugin (C++)

asked 2017-04-13 08:35:02 -0500

Vlad222 gravatar image

Hi all!

I have a big robot with a lot of joints. I want to write prog for autotuning PID parameters for each joint.

To do it I need to consequently fix all joints except one from C++ plugin.

How can I fix (stop) my joints using API? I use gazebo8.

I try to do it in such way but it has no affect:

for(int i=1;i<model->GetJointCount();++i)
joint[i] =_model->GetJoints()[i];
gazebo::physics::Entity::EntityType type_fixed = gazebo::physics::Entity::FIXED_JOINT;
edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2017-04-13 10:06:56 -0500

sloretz gravatar image

How about creating a fixed joint for every joint? Then when the PID tuning is done, remove all the joints that were created. The gripper shows how to create a fixed joint.

    using namespace gazebo;
    // to create
    physics::JointPtr joint;
    physics::WorldPtr world = physics::get_world("default");
    physics::PhysicsEnginePtr engine = world->GetPhysicsEngine();
    joint = engine->CreateJoint("fixed");
    joint->SetName(model->GetName() + "my_fixed_joint");
    // get parent, child, origin can be {0,0,0} in this case
    joint->Load(parent_link, child_link, joint_origin);

    // to destroy
edit flag offensive delete link more


Wouldn't that introduce too much singularity?

eugene-katsevman gravatar imageeugene-katsevman ( 2017-04-13 10:16:31 -0500 )edit

answered 2017-04-13 09:58:10 -0500

Vlad222 gravatar image
edit flag offensive delete link more


Please keep in mind, that you've pointed at old API, there are no such methods now. And the correct order for setting limits are: upper, lower, upper again, because of some ODE things

eugene-katsevman gravatar imageeugene-katsevman ( 2017-04-13 10:21:07 -0500 )edit

answered 2017-04-13 10:05:29 -0500

eugene-katsevman gravatar image
  • You might try to set upper and lower limits to almost same value (say 0.001 for lower and 0.002 and for upper) and add some static friction and damping for that joints.
  • You might also set a HUGE static friction for that joint.
  • Or set max_force to zero

Useful methods are : SetLowerLimit, SetUpperLimit, SetParam for setting a friction, SetEffortLimit.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-04-13 08:35:02 -0500

Seen: 78 times

Last updated: Apr 13