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

multibody: add option to addFrame append_inertia when adding a Frame

parent 213904b7
......@@ -528,10 +528,12 @@ namespace pinocchio
/// The inertia stored within the frame will be happened to the inertia supported by the joint (frame.parent).
///
/// \param[in] frame The frame to add to the kinematic tree.
/// \param[in] append_inertia Append the inertia contained in the Frame to the inertia supported by the joint.
///
/// \return Returns the index of the frame if it has been successfully added or if it already exists in the kinematic tree.
///
FrameIndex addFrame(const Frame & frame);
FrameIndex addFrame(const Frame & frame,
const bool append_inertia = true);
///
/// \brief Check the validity of the attributes of Model with respect to the specification of some
......
......@@ -276,7 +276,7 @@ namespace pinocchio
template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
inline typename ModelTpl<Scalar,Options,JointCollectionTpl>::FrameIndex
ModelTpl<Scalar,Options,JointCollectionTpl>::
addFrame(const Frame & frame)
addFrame(const Frame & frame, const bool append_inertia)
{
PINOCCHIO_CHECK_INPUT_ARGUMENT(frame.parent < (JointIndex)njoints,
"The index of the parent frame is not valid.");
......@@ -290,7 +290,7 @@ namespace pinocchio
return getFrameId(frame.name,frame.type);
frames.push_back(frame);
// if(frame.inertia.mass() > Scalar(0))
if(append_inertia)
inertias[frame.parent] += frame.placement.act(frame.inertia);
nframes++;
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