Skip to content
Snippets Groups Projects
Verified Commit 10205b21 authored by Gabriele Buondonno's avatar Gabriele Buondonno Committed by Justin Carpentier
Browse files

[multibody] [addFrame] Change return type to FrameIndex

parent b1596234
No related branches found
No related tags found
No related merge requests found
......@@ -508,9 +508,8 @@ namespace pinocchio
/// \param[in] frame The frame to add to the kinematic tree.
///
/// \return Returns the index of the frame if it has been successfully added or if it already exists in the kinematic tree.
/// The function returns -1 when the frame.type did not match with the existing frame in the kinematic having the same name.
///
int addFrame(const Frame & frame);
FrameIndex addFrame(const Frame & frame);
///
/// \brief Check the validity of the attributes of Model with respect to the specification of some
......
......@@ -248,19 +248,19 @@ namespace pinocchio
}
template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
inline int ModelTpl<Scalar,Options,JointCollectionTpl>::
inline typename ModelTpl<Scalar,Options,JointCollectionTpl>::FrameIndex
ModelTpl<Scalar,Options,JointCollectionTpl>::
addFrame(const Frame & frame)
{
// Check if the frame.name exists with the same type
if(existFrame(frame.name,frame.type))
{
FrameIndex frame_id = getFrameId(frame.name,frame.type);
return (int)frame_id;
return getFrameId(frame.name,frame.type);
}
// else: we must add a new frames to the current stack
frames.push_back(frame);
nframes++;
return nframes - 1;
return FrameIndex(nframes - 1);
}
template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment