Home | Tutorials | Wiki | Issues
Ask Your Question
2

Create joint dynamically with ROS

asked 2015-06-24 10:47:22 -0600

mehdi gravatar image

updated 2015-06-24 10:50:09 -0600

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, "mypackage" containing the link "simplebox" 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
  GZ_REGISTER_WORLD_PLUGIN(WorldEdit);
}
edit retag flag offensive close merge delete

Comments

Hi there, I am also looking into the solution of the question. Kindly let me know if you were able to solve it somehow?

Abdullah gravatar imageAbdullah ( 2016-10-31 23:54:16 -0600 )edit

I guess you don't need it anymore but I posted an answer to this question

mehdi gravatar imagemehdi ( 2019-01-29 04:33:27 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-01-29 04:34:20 -0600

mehdi gravatar image

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

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-06-24 10:47:22 -0600

Seen: 2,105 times

Last updated: Jan 29