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/gazeboros/gzserver: line 34: 18759 Aborted (core dumped) GAZEBOMASTERURI="$desiredmasteruri" gzserver $final [gazebo-2] process has died [pid 18723, exit code 134, cmd /opt/ros/jade/lib/gazeboros/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.
Asked by JoshMarino on 2016-11-01 14:12:04 UTC
Answers
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...
Asked by chapulina on 2016-11-02 10:44:01 UTC
Comments
Changed
'type
from"fixed"
to"revolute"
and it did not crash. Isfixed
joint not implemented?Asked by JoshMarino on 2016-11-01 15:07:40 UTC
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.
Asked by Abdullah on 2016-11-02 04:49:51 UTC