Skip to content
Snippets Groups Projects
Commit e7fa0775 authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

[C++] Inertia of the world is initialized with NaN.

parent 85c91b01
No related branches found
No related tags found
No related merge requests found
...@@ -115,7 +115,7 @@ namespace se3 ...@@ -115,7 +115,7 @@ namespace se3
, njoint(1) , njoint(1)
, nbody(1) , nbody(1)
, nFrames(0) , nFrames(0)
, inertias(1, Inertia::Zero()) , inertias(1)
, jointPlacements(1, SE3::Identity()) , jointPlacements(1, SE3::Identity())
, joints(1) , joints(1)
, parents(1, 0) , parents(1, 0)
...@@ -125,6 +125,10 @@ namespace se3 ...@@ -125,6 +125,10 @@ namespace se3
{ {
names[0] = "universe"; // Should be "universe joint (trivial)" names[0] = "universe"; // Should be "universe joint (trivial)"
addFrame(Frame("universe", 0, 0, SE3::Identity(), FIXED_JOINT)); addFrame(Frame("universe", 0, 0, SE3::Identity(), FIXED_JOINT));
// Inertia of universe has no sense.
inertias[0].mass() = std::numeric_limits<double>::quiet_NaN();
inertias[0].lever().fill (std::numeric_limits<double>::quiet_NaN());
inertias[0].inertia().fill (std::numeric_limits<double>::quiet_NaN());
} }
~Model() {} // std::cout << "Destroy model" << std::endl; } ~Model() {} // std::cout << "Destroy model" << std::endl; }
......
...@@ -64,14 +64,18 @@ namespace se3 ...@@ -64,14 +64,18 @@ namespace se3
{ {
const Frame& frame = model.frames[fid]; const Frame& frame = model.frames[fid];
const SE3& p = frame.placement * placement; const SE3& p = frame.placement * placement;
if (Y != NULL && Y->mass > Eigen::NumTraits<double>::epsilon()) { if (frame.parent > 0
&& Y != NULL
&& Y->mass > Eigen::NumTraits<double>::epsilon()) {
model.appendBodyToJoint(frame.parent, convertFromUrdf(*Y), p); model.appendBodyToJoint(frame.parent, convertFromUrdf(*Y), p);
} }
model.addBodyFrame(body_name, frame.parent, p, fid); model.addBodyFrame(body_name, frame.parent, p, fid);
// Reference to model.frames[fid] can has changed because the vector // Reference to model.frames[fid] can has changed because the vector
// may have been reallocated. // may have been reallocated.
assert (!model.inertias[model.frames[fid].parent].lever().hasNaN() if (model.frames[fid].parent > 0) {
&& !model.inertias[model.frames[fid].parent].inertia().data().hasNaN()); assert (!model.inertias[model.frames[fid].parent].lever().hasNaN()
&& !model.inertias[model.frames[fid].parent].inertia().data().hasNaN());
}
} }
/// ///
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment