Go to the documentation of this file.
6 #ifndef __pinocchio_multibody_model_hpp__
7 #define __pinocchio_multibody_model_hpp__
30 template<
typename _Scalar,
int _Options,
template<
typename,
int>
class JointCollectionTpl>
32 : serialization::Serializable< ModelTpl<_Scalar,_Options,JointCollectionTpl> >
34 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
62 typedef Eigen::Matrix<Scalar,Eigen::Dynamic,1,Options>
VectorXs;
63 typedef Eigen::Matrix<Scalar,3,1,Options>
Vector3;
176 , jointPlacements(1,
SE3::Identity())
188 names[0] =
"universe";
197 template<
typename NewScalar>
210 res.gravity =
gravity.template cast<NewScalar>();
221 res.friction =
friction.template cast<NewScalar>();
222 res.damping =
damping.template cast<NewScalar>();
228 typename ConfigVectorMap::const_iterator it;
232 res.referenceConfigurations.insert(std::make_pair(it->first, it->second.template cast<NewScalar>()));
236 res.inertias.resize(inertias.size());
237 res.jointPlacements.resize(jointPlacements.size());
242 for(
size_t k = 0; k <
joints.size(); ++k)
244 res.inertias[k] = inertias[k].template cast<NewScalar>();
245 res.jointPlacements[k] = jointPlacements[k].template cast<NewScalar>();
246 res.joints[k] =
joints[k].template cast<NewScalar>();
249 for(
size_t k = 0; k <
frames.size(); ++k)
251 res.frames[k] =
frames[k].template cast<NewScalar>();
271 && other.names ==
names
274 && other.name ==
name;
286 typename ConfigVectorMap::const_iterator it_other = other.referenceConfigurations.begin();
289 std::advance(it,k); std::advance(it_other,k);
291 if(it->second.size() != it_other->second.size())
293 if(it->second != it_other->second)
302 if(other.friction.size() !=
friction.size())
307 if(other.damping.size() !=
damping.size())
337 for(
size_t k = 1; k < inertias.size(); ++k)
339 res &= other.inertias[k] == inertias[k];
343 for(
size_t k = 1; k < other.jointPlacements.size(); ++k)
345 res &= other.jointPlacements[k] == jointPlacements[k];
351 && other.frames ==
frames;
360 {
return !(*
this == other); }
429 int previous_frame_index = -1);
457 int previousFrame = -1);
540 const bool append_inertia =
true);
554 {
return checker.checkModel(*
this); }
571 inline bool check()
const;
597 #include "pinocchio/multibody/model.hxx"
599 #endif // ifndef __pinocchio_multibody_model_hpp__
std::vector< std::string > names
Name of joint i
MotionTpl< Scalar, Options > Motion
InertiaTpl< Scalar, Options > Inertia
FrameVector frames
Vector of operational frames registered on the model.
SE3Tpl< Scalar, Options > SE3
CRTP class describing the API of the checkers.
bool existJointName(const std::string &name) const
Check if a joint given by its name exists.
pinocchio::GeomIndex GeomIndex
ConfigVectorType lowerPositionLimit
Lower joint configuration limit.
bool existBodyName(const std::string &name) const
Check if a body given by its name exists.
bool operator==(const ModelTpl &other) const
Equality comparison operator.
bool operator!=(const ModelTpl &other) const
FrameIndex addJointFrame(const JointIndex &joint_index, int previous_frame_index=-1)
Add a joint to the frame tree.
FrameType
Enum on the possible types of frames.
@ SENSOR
sensor frame: defined in a sensor element
DataTpl< Scalar, Options, JointCollectionTpl > Data
ModelTpl< NewScalar, Options, JointCollectionTpl > cast() const
JointModelVector joints
Model of joint i, encapsulated in a JointModelAccessor.
bool existFrame(const std::string &name, const FrameType &type=(FrameType)(JOINT|FIXED_JOINT|BODY|OP_FRAME|SENSOR)) const
Checks if a frame given by its name exists.
std::string name
Model name;.
std::vector< bool > hasConfigurationLimit()
Check if joints have configuration limits.
TangentVectorType rotorInertia
Vector of rotor inertia parameters.
bool check(const AlgorithmCheckerBase< D > &checker=AlgorithmCheckerBase< D >()) const
Check the validity of the attributes of Model with respect to the specification of some algorithms.
A Plucker coordinate frame attached to a parent joint inside a kinematic tree.
pinocchio::JointIndex JointIndex
ConfigVectorMap referenceConfigurations
Map of reference configurations, indexed by user given names.
std::vector< IndexVector > subtrees
Vector of joint subtrees. subtree[j] corresponds to the subtree supported by the joint j....
JointCollectionTpl< Scalar, Options > JointCollection
std::vector< int > nqs
Dimension of the joint i configuration subspace.
typedef PINOCCHIO_ALIGNED_STD_VECTOR(JointModel) JointModelVector
std::vector< int > nvs
Dimension of the joint i tangent subspace.
std::vector< int > idx_qs
Starting index of the joint i in the configuration space.
VectorXs TangentVectorType
Dense vectorized version of a joint tangent vector (e.g. velocity, acceleration, etc)....
std::vector< Index > IndexVector
FrameIndex getFrameId(const std::string &name, const FrameType &type=(FrameType)(JOINT|FIXED_JOINT|BODY|OP_FRAME|SENSOR)) const
Returns the index of a frame given by its name.
std::vector< bool > hasConfigurationLimitInTangent()
Check if joints have configuration limits.
pinocchio::FrameIndex FrameIndex
TangentVectorType rotorGearRatio
Vector of rotor gear ratio parameters.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar
JointDataTpl< Scalar, Options, JointCollectionTpl > JointData
void addJointIndexToParentSubtrees(const JointIndex joint_id)
Add the joint_id to its parent subtrees.
int nframes
Number of operational frames.
JointIndex addJoint(const JointIndex parent, const JointModel &joint_model, const SE3 &joint_placement, const std::string &joint_name)
Add a joint to the kinematic tree with infinite bounds.
TangentVectorType velocityLimit
Vector of maximal joint velocities.
int nbodies
Number of bodies.
TangentVectorType friction
Vector of joint friction parameters.
JointModelTpl< Scalar, Options, JointCollectionTpl > JointModel
FrameIndex addFrame(const Frame &frame, const bool append_inertia=true)
Adds a frame to the kinematic tree. The inertia stored within the frame will be happened to the inert...
Motion gravity
Spatial gravity of the model.
@ JOINT
joint frame: attached to the child body of a joint (a.k.a. child frame)
static const Vector3 gravity981
Default 3D gravity vector (=(0,0,-9.81)).
JointIndex getJointId(const std::string &name) const
Return the index of a joint given by its name.
@ OP_FRAME
operational frame: user-defined frames that are defined at runtime
Eigen::Matrix< Scalar, Eigen::Dynamic, 1, Options > VectorXs
Eigen::Matrix< Scalar, 3, 1, Options > Vector3
TangentVectorType damping
Vector of joint damping parameters.
int nv
Dimension of the velocity vector space.
ForceTpl< Scalar, Options > Force
FrameIndex getBodyId(const std::string &name) const
Return the index of a body given by its name.
std::map< std::string, ConfigVectorType > ConfigVectorMap
Map between a string (key) and a configuration vector.
@ FIXED_JOINT
fixed joint frame: joint frame but for a fixed joint
std::vector< IndexVector > supports
Vector of joint supports. supports[j] corresponds to the vector of indices of the joints located on t...
bool check() const
Run check(fusion::list) with DEFAULT_CHECKERS as argument.
FrameIndex addBodyFrame(const std::string &body_name, const JointIndex &parentJoint, const SE3 &body_placement=SE3::Identity(), int previousFrame=-1)
Add a body to the frame tree.
TangentVectorType effortLimit
Vector of maximal joint torques.
std::vector< JointIndex > parents
Joint parent of joint i, denoted li (li==parents[i]).
ModelTpl()
Default constructor. Builds an empty model with no joints.
VectorXs ConfigVectorType
Dense vectorized version of a joint configuration vector.
FrameTpl< Scalar, Options > Frame
std::vector< int > idx_vs
Starting index of the joint i in the tangent configuration space.
ConfigVectorType upperPositionLimit
Upper joint configuration limit.
@ BODY
body frame: attached to the collision, inertial or visual properties of a link
int nq
Dimension of the configuration vector representation.
void appendBodyToJoint(const JointIndex joint_index, const Inertia &Y, const SE3 &body_placement=SE3::Identity())
Append a body to a given joint of the kinematic tree.
Main pinocchio namespace.
int njoints
Number of joints.
pinocchio
Author(s):
autogenerated on Sun Apr 28 2024 02:41:52