Verified Commit ddd27947 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

model: check in addFrame whether the mass distribution is valid

parent 9f5db041
...@@ -281,13 +281,16 @@ namespace pinocchio ...@@ -281,13 +281,16 @@ namespace pinocchio
PINOCCHIO_CHECK_INPUT_ARGUMENT(frame.parent < (JointIndex)njoints, PINOCCHIO_CHECK_INPUT_ARGUMENT(frame.parent < (JointIndex)njoints,
"The index of the parent frame is not valid."); "The index of the parent frame is not valid.");
PINOCCHIO_CHECK_INPUT_ARGUMENT(frame.inertia.isValid(),
"The input inertia is not valid.")
// Check if the frame.name exists with the same type // Check if the frame.name exists with the same type
if(existFrame(frame.name,frame.type)) if(existFrame(frame.name,frame.type))
return getFrameId(frame.name,frame.type); return getFrameId(frame.name,frame.type);
// else: we must add a new frames to the current stack
frames.push_back(frame); frames.push_back(frame);
inertias[frame.parent] += frame.placement.act(frame.inertia); if(frame.inertia.mass() > Scalar(0))
inertias[frame.parent] += frame.placement.act(frame.inertia);
nframes++; nframes++;
return FrameIndex(nframes - 1); return FrameIndex(nframes - 1);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment