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

model: minor clean of the code and doc

parent 089f46b7
......@@ -272,32 +272,32 @@ namespace pinocchio
return false;
res &= other.referenceConfigurations == referenceConfigurations;
if(!res) return res;
if(other.rotorInertia.size() != rotorInertia.size())
return false;
res &= other.rotorInertia == rotorInertia;
if(!res) return res;
if(other.rotorGearRatio.size() != rotorGearRatio.size())
return false;
res &= other.rotorGearRatio == rotorGearRatio;
if(!res) return res;
if(other.effortLimit.size() != effortLimit.size())
return false;
res &= other.effortLimit == effortLimit;
if(!res) return res;
if(other.velocityLimit.size() != velocityLimit.size())
return false;
res &= other.velocityLimit == velocityLimit;
if(!res) return res;
if(other.lowerPositionLimit.size() != lowerPositionLimit.size())
return false;
res &= other.lowerPositionLimit == lowerPositionLimit;
if(!res) return res;
if(other.upperPositionLimit.size() != upperPositionLimit.size())
return false;
res &= other.upperPositionLimit == upperPositionLimit;
......@@ -322,7 +322,7 @@ namespace pinocchio
return res;
}
//
///
/// \returns true if *this is NOT equal to other.
///
bool operator!=(const ModelTpl & other) const
......@@ -391,8 +391,8 @@ namespace pinocchio
///
/// \return The index of the new frame or -1 in case of error.
///
int addJointFrame(const JointIndex& jointIndex,
int frameIndex = -1);
int addJointFrame(const JointIndex & joint_index,
int previous_frame_index = -1);
///
/// \brief Append a body to a given joint of the kinematic tree.
......@@ -424,11 +424,11 @@ namespace pinocchio
///
/// \brief Return the index of a body given by its name.
///
///
/// \warning If no body is found, return the number of elements at time T.
/// This can lead to errors if the model is expanded after this method is called
/// (for example to get the id of a parent body)
///
///
/// \param[in] name Name of the body.
///
/// \return Index of the body.
......@@ -483,7 +483,7 @@ namespace pinocchio
/// \warning If no frame is found, returns the size of the vector of Model::frames.
/// This can lead to errors if the model is expanded after this method is called
/// (for example to get the id of a parent frame).
///
///
/// \param[in] name Name of the frame.
/// \param[in] type Type of the frame.
///
......@@ -503,7 +503,6 @@ namespace pinocchio
bool existFrame(const std::string & name,
const FrameType& type = (FrameType) (JOINT | FIXED_JOINT | BODY | OP_FRAME | SENSOR )) const;
///
/// \brief Adds a frame to the kinematic tree.
///
......@@ -514,13 +513,16 @@ namespace pinocchio
///
int addFrame(const Frame & frame);
///
/// \brief Check the validity of the attributes of Model with respect to the specification of some
/// algorithms.
///
/// The method is a template so that the checkers can be defined in each algorithms.
/// \param[in] checker a class, typically defined in the algorithm module, that
/// validates the attributes of model.
///
/// \return true if the Model is valid, false otherwise.
///
template<typename D>
inline bool check(const AlgorithmCheckerBase<D> & checker = AlgorithmCheckerBase<D>()) const
{ return checker.checkModel(*this); }
......@@ -528,15 +530,18 @@ namespace pinocchio
/// Run check(fusion::list) with DEFAULT_CHECKERS as argument.
inline bool check() const;
///
/// \brief Run checkData on data and current model.
///
/// \param[in] data to be checked wrt *this.
///
/// \return true if the data is valid, false otherwise.
///
inline bool check(const Data & data) const;
protected:
///
/// \brief Add the joint_id to its parent subtrees.
///
/// \param[in] joint_id The id of the joint to add to the subtrees
......
......@@ -147,17 +147,21 @@ namespace pinocchio
template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
inline int ModelTpl<Scalar,Options,JointCollectionTpl>::
addJointFrame(const JointIndex & jidx,
int fidx)
addJointFrame(const JointIndex & joint_index,
int previous_frame_index)
{
if(fidx < 0) {
PINOCCHIO_CHECK_INPUT_ARGUMENT(joint_index >= 0 && joint_index < joints.size(),
"The joint index is larger than the number of joints in the model.");
if(previous_frame_index < 0)
{
// FIXED_JOINT is required because the parent can be the universe and its
// type is FIXED_JOINT
fidx = (int)getFrameId(names[parents[jidx]], (FrameType)(JOINT | FIXED_JOINT));
previous_frame_index = (int)getFrameId(names[parents[joint_index]], (FrameType)(JOINT | FIXED_JOINT));
}
assert((size_t)fidx < frames.size() && "Frame index out of bound");
assert((size_t)previous_frame_index < frames.size() && "Frame index out of bound");
// Add a the joint frame attached to itself to the frame vector - redundant information but useful.
return addFrame(Frame(names[jidx],jidx,(FrameIndex)fidx,SE3::Identity(),JOINT));
return addFrame(Frame(names[joint_index],joint_index,(FrameIndex)previous_frame_index,SE3::Identity(),JOINT));
}
template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
......
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