Gazebo Answers logo

I have a contact sensor on my vacuum gripper. Once the gripper touches whatever I want to grip, I tried applying a force on the bottom of the object so that it gets pushed against the gripper. This method is not very stable and I would like to consider spawning a joint dynamically and deleting it when I am done moving the object. I am using ROS to command everything in Gazebo. What I was trying is to create plugins that create and delete a joint (Gripper-Object joint has always the same name in my case as I am always moving the same object).

This is what I tried (but doesn't compile)

I changed the content of the class to create a fixed joint as shown in an answer on this forum. How should this be done?

I have two models in my world, "my_package" containing the link "simple_box" and another model containing the link "gripper_rot" and I want to create a joint between those two joints.

#include <sdf/sdf.hh>
#include "gazebo/gazebo.hh"
#include "gazebo/common/Plugin.hh"
#include "gazebo/msgs/msgs.hh"
#include "gazebo/physics/physics.hh"
#include "gazebo/transport/transport.hh"

/// \example examples/plugins/world_edit.cc
/// This example creates a WorldPlugin, initializes the Transport system by
/// creating a new Node, and publishes messages to alter gravity.
namespace gazebo
  class WorldEdit : public WorldPlugin
    public: void Load(physics::WorldPtr _parent, sdf::ElementPtr _sdf)
      physics::JointPtr joint;

      joint = this->world->GetPhysicsEngine()->CreateJoint("fixed", "my_package");

      joint->Load("simple_box", "gripper_rot", math::Pose());

      joint->Attach("simple_box", "gripper_rot");

      joint->SetAxis(0, axis_ex);

      joint->SetHighStop(0, high_stop_ex);
      joint->SetParam("cfm", 0, cfm_ex);

  // Register this plugin with the simulator

Originally posted by mehdi on Gazebo Answers with karma: 94 on 2015-06-24

Post score: 2

Original comments

Comment by Abdullah on 2016-10-31:
Hi there, I am also looking into the solution of the question. Kindly let me know if you were able to solve it somehow?

Comment by mehdi on 2019-01-29:
I guess you don't need it anymore but I posted an answer to this question


1 Answer 1


Gazebo Answers logo

I stumbled upon a plugin that works. Had to to some changes to make it compatible with the nes API of Gazebo, it can be found here

Originally posted by mehdi with karma: 94 on 2019-01-29

This answer was ACCEPTED on the original site

Post score: 0


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.