Robotics StackExchange | Archived questions

How to fix joints from plugin (C++)

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;
joint[i]->AddType(type_fixed);
joint[i]->Update();
}

Asked by Vlad222 on 2017-04-13 08:35:02 UTC

Comments

Answers

Yeah! I find the answer! http://answers.gazebosim.org/question/5153/can-we-lock-or-freeze-a-moving-joint/

Asked by Vlad222 on 2017-04-13 09:58:10 UTC

Comments

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

Asked by eugene-katsevman on 2017-04-13 10:21:07 UTC

  • 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.

Asked by eugene-katsevman on 2017-04-13 10:05:29 UTC

Comments

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);
    joint->Init();

    // to destroy
    joint->Detach();
    joint->Fini();

Asked by sloretz on 2017-04-13 10:06:56 UTC

Comments

Wouldn't that introduce too much singularity?

Asked by eugene-katsevman on 2017-04-13 10:16:31 UTC