CreateJoint() from plugin not working
Hello,
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.
Changed `'type` from `"fixed"` to `"revolute"` and it did not crash. Is `fixed` joint not implemented?
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.