Skip to content

Commit 7449cea

Browse files
committed
Fixed the crash, at least on gazebo 2.2.3
We needed to set the model of the joint, which was the second model, as when creating the joint we already set the first one
1 parent 3fe7fe9 commit 7449cea

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

src/gazebo_ros_link_attacher.cpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,22 @@ namespace gazebo
6363
ROS_ERROR_STREAM(link1 << " link was not found");
6464
return false;
6565
}
66+
if (l1->GetInertial() == NULL){
67+
ROS_ERROR_STREAM("link1 inertia is NULL!");
68+
}
69+
else
70+
ROS_INFO_STREAM("link1 inertia is not NULL, for example, mass is: " << l1->GetInertial()->GetMass());
6671
ROS_INFO_STREAM("Getting link: '" << link2 << "' from model: '" << model2 << "'");
6772
physics::LinkPtr l2 = m2->GetLink(link2);
6873
if (l2 == NULL){
6974
ROS_ERROR_STREAM(link2 << " link was not found");
7075
return false;
7176
}
77+
if (l2->GetInertial() == NULL){
78+
ROS_ERROR_STREAM("link2 inertia is NULL!");
79+
}
80+
else
81+
ROS_INFO_STREAM("link2 inertia is not NULL, for example, mass is: " << l2->GetInertial()->GetMass());
7282

7383
ROS_INFO_STREAM("Links are: " << l1->GetName() << " and " << l2->GetName());
7484

@@ -84,7 +94,21 @@ namespace gazebo
8494
this->fixedJoint->Load(l1,
8595
l2, math::Pose());
8696
ROS_INFO_STREAM("SetModel");
87-
this->fixedJoint->SetModel(m1);
97+
this->fixedJoint->SetModel(m2);
98+
/*
99+
* If SetModel is not done we get:
100+
* ***** Internal Program Error - assertion (this->GetParentModel() != __null)
101+
failed in void gazebo::physics::Entity::PublishPose():
102+
/tmp/buildd/gazebo2-2.2.3/gazebo/physics/Entity.cc(225):
103+
An entity without a parent model should not happen
104+
105+
* If SetModel is given the same model than CreateJoint given
106+
* Gazebo crashes with
107+
* ***** Internal Program Error - assertion (self->inertial != __null)
108+
failed in static void gazebo::physics::ODELink::MoveCallback(dBodyID):
109+
/tmp/buildd/gazebo2-2.2.3/gazebo/physics/ode/ODELink.cc(183): Inertial pointer is NULL
110+
*/
111+
88112
ROS_INFO_STREAM("SetAxis");
89113
this->fixedJoint->SetAxis(0, math::Vector3(0, 0, 1));
90114
ROS_INFO_STREAM("SetHightstop");

0 commit comments

Comments
 (0)