Home | Tutorials | Wiki | Issues
Ask Your Question

CreateJoint() from plugin not working

asked 2016-11-01 14:12:04 -0500

JoshMarino gravatar image

updated 2016-11-01 14:26:29 -0500


I have a Gazebo simulation working for a robot through ROS. I am trying to add a custom plugin to create a fixed joint between two links when they come within a goal tolerance of each other. I have the plugin working through ROS up to the point where I would call the function CreateJoint(const std::string &_name, const std::string &_type, physics::LinkPtr _parent, physics::LinkPtr _child) from here. I have copied the CreateJoint() function over to my plugin since it is not included in the gazebo-5.3 files downloaded. The function have been reduced for now.

void GazeboRosVacuumGripper::CreateJoint(const std::string &_name, const std::string &_type, physics::LinkPtr _parent, physics::LinkPtr _child)
  gazebo::physics::JointPtr joint;      

  // Debugging to make sure have access to members
  std::cout << "Physics engine: " << world_->GetPhysicsEngine()->GetType() << std::endl;    
  std::cout << "Model joint count: " << parent_->GetJointCount() << std::endl;      

  joint = world_->GetPhysicsEngine()->CreateJoint(_type, parent_);    

However, when the plugin gets to the last line in CreateJoint(), the Gazebo simulation crashes. _type = "fixed" and parent_ is a pointer to physics::ModelPtr _model from the Load() function in the plugin.

Here is the error report:

terminate called after throwing an instance of 'gazebo::common::Exception' /opt/ros/jade/lib/gazebo_ros/gzserver: line 34: 18759 Aborted (core dumped) GAZEBO_MASTER_URI="$desired_master_uri" gzserver $final [gazebo-2] process has died [pid 18723, exit code 134, cmd /opt/ros/jade/lib/gazebo_ros/gzserver -e ode worlds/empty.world __name:=gazebo __log:=/home/josh/.ros/log/ff87df12-a067-11e6-9510-0800273acdef/gazebo-2.log]. log file: /home/josh/.ros/log/ff87df12-a067-11e6-9510-0800273acdef/gazebo-2*.log

I am not sure what I am doing wrong here, because I have access to world_->GetPhysicsEngine(). I tested this by displaying world_->GetPhysicsEngine()->GetType() and it returned ode.

Any help would be appreciated.

edit retag flag offensive close merge delete



Changed `'type` from `"fixed"` to `"revolute"` and it did not crash. Is `fixed` joint not implemented?

JoshMarino gravatar imageJoshMarino ( 2016-11-01 15:07:40 -0500 )edit

Hi there, I checked a similar code here https://github.com/pal-robotics/gazebo_ros_link_attacher I am also trying to do the exact same thing using this plugin, my simulation also crashes.

Abdullah gravatar imageAbdullah ( 2016-11-02 04:49:51 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-11-02 10:44:01 -0500

You're using Gazebo 5, and fixed joints were introduced in Gazebo 6.

In any case, crashing when attempting to create a joint type which doesn't exist is not very elegant...

edit flag offensive delete link more
Login/Signup to Answer

Question Tools



Asked: 2016-11-01 14:12:04 -0500

Seen: 195 times

Last updated: Nov 02 '16