6#ifndef __pinocchio_multibody_model_hpp__ 7#define __pinocchio_multibody_model_hpp__ 9#include "pinocchio/spatial/fwd.hpp" 10#include "pinocchio/spatial/se3.hpp" 11#include "pinocchio/spatial/force.hpp" 12#include "pinocchio/spatial/motion.hpp" 13#include "pinocchio/spatial/inertia.hpp" 15#include "pinocchio/multibody/fwd.hpp" 16#include "pinocchio/multibody/frame.hpp" 17#include "pinocchio/multibody/joint/joint-generic.hpp" 19#include "pinocchio/container/aligned-vector.hpp" 21#include "pinocchio/serialization/serializable.hpp" 32 template<
typename,
int>
class JointCollectionTpl>
38 template<
typename _Scalar,
int _Options,
template<
typename,
int>
class JointCollectionTpl>
41 typedef _Scalar Scalar;
44 template<
typename _Scalar,
int _Options,
template<
typename,
int>
class JointCollectionTpl>
47 ,
NumericalBase<ModelTpl<_Scalar, _Options, JointCollectionTpl>>
49 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
51 typedef _Scalar Scalar;
57 typedef JointCollectionTpl<Scalar, Options> JointCollection;
66 typedef pinocchio::Index Index;
67 typedef pinocchio::JointIndex JointIndex;
68 typedef pinocchio::GeomIndex GeomIndex;
69 typedef pinocchio::FrameIndex FrameIndex;
70 typedef std::vector<Index> IndexVector;
75 typedef PINOCCHIO_ALIGNED_STD_VECTOR(JointModel) JointModelVector;
76 typedef PINOCCHIO_ALIGNED_STD_VECTOR(JointData) JointDataVector;
78 typedef PINOCCHIO_ALIGNED_STD_VECTOR(Frame) FrameVector;
80 typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1, Options> VectorXs;
81 typedef Eigen::Matrix<Scalar, 3, 1, Options> Vector3;
83 typedef PINOCCHIO_ALIGNED_STD_VECTOR(Inertia) InertiaVector;
84 typedef PINOCCHIO_ALIGNED_STD_VECTOR(SE3) SE3Vector;
247 names[0] =
"universe";
259 template<
typename S2,
int O2>
266 template<
typename NewScalar>
281 return !(*
this == other);
304 const JointIndex parent,
305 const JointModel & joint_model,
306 const SE3 & joint_placement,
307 const std::string & joint_name);
319 const JointIndex parent,
320 const JointModel & joint_model,
321 const SE3 & joint_placement,
322 const std::string & joint_name,
323 const VectorXs & max_effort,
324 const VectorXs & max_velocity,
325 const VectorXs & min_config,
326 const VectorXs & max_config);
336 const JointIndex parent,
337 const JointModel & joint_model,
338 const SE3 & joint_placement,
339 const std::string & joint_name,
340 const VectorXs & max_effort,
341 const VectorXs & max_velocity,
342 const VectorXs & min_config,
343 const VectorXs & max_config,
356 FrameIndex
addJointFrame(
const JointIndex & joint_index,
int previous_frame_index = -1);
369 const JointIndex joint_index,
371 const SE3 & body_placement = SE3::Identity());
386 const std::string & body_name,
387 const JointIndex & parentJoint,
388 const SE3 & body_placement = SE3::Identity(),
389 int parentFrame = -1);
448 const std::string &
name,
460 const std::string &
name,
475 FrameIndex
addFrame(
const Frame & frame,
const bool append_inertia =
true);
490 return checker.checkModel(*
this);
517 bool check(
const Data & data)
const;
533#include "pinocchio/multibody/model.hxx" 535#if PINOCCHIO_ENABLE_TEMPLATE_INSTANTIATION 536 #include "pinocchio/multibody/model.txx" Main pinocchio namespace.
FrameType
Enum on the possible types of frames.
@ BODY
body frame: attached to the collision, inertial or visual properties of a link
@ SENSOR
sensor frame: defined in a sensor element
@ OP_FRAME
operational frame: user-defined frames that are defined at runtime
@ JOINT
joint frame: attached to the child body of a joint (a.k.a. child frame)
@ FIXED_JOINT
fixed joint frame: joint frame but for a fixed joint
CRTP class describing the API of the checkers.
Type of the cast of a class C templated by Scalar and Options, to a new NewScalar type....
A Plucker coordinate frame attached to a parent joint inside a kinematic tree.
JointIndex addJoint(const JointIndex parent, const JointModel &joint_model, const SE3 &joint_placement, const std::string &joint_name, const VectorXs &max_effort, const VectorXs &max_velocity, const VectorXs &min_config, const VectorXs &max_config, const VectorXs &friction, const VectorXs &damping)
TangentVectorType velocityLimit
TangentVectorType friction
CastType< NewScalar, ModelTpl >::type cast() const
std::vector< int > idx_vs
FrameIndex addJointFrame(const JointIndex &joint_index, int previous_frame_index=-1)
Add a joint to the frame tree.
std::vector< IndexVector > subtrees
std::vector< IndexVector > supports
std::vector< JointIndex > mimicking_joints
FrameIndex getBodyId(const std::string &name) const
Return the index of a body given by its name.
bool operator==(const ModelTpl &other) const
Equality comparison operator.
ConfigVectorType upperPositionLimit
TangentVectorType rotorGearRatio
ModelTpl()
Default constructor. Builds an empty model with no joints.
bool operator!=(const ModelTpl &other) const
FrameIndex addBodyFrame(const std::string &body_name, const JointIndex &parentJoint, const SE3 &body_placement=SE3::Identity(), int parentFrame=-1)
Add a body to the frame tree.
std::vector< int > idx_qs
SE3Vector jointPlacements
VectorXs TangentVectorType
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.
bool check() const
Run check(fusion::list) with DEFAULT_CHECKERS as argument.
std::vector< IndexVector > children
ModelTpl(const ModelTpl< S2, O2 > &other)
Copy constructor by casting.
TangentVectorType rotorInertia
TangentVectorType effortLimit
std::vector< JointIndex > parents
std::vector< int > idx_vExtendeds
std::vector< std::string > names
JointIndex getJointId(const std::string &name) const
Return the index of a joint given by its name.
std::vector< int > nvExtendeds
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.
bool check(const Data &data) const
Run checkData on data and current model.
ConfigVectorMap referenceConfigurations
void addJointIndexToParentSubtrees(const JointIndex joint_id)
Add the joint_id to its parent subtrees.
bool existBodyName(const std::string &name) const
Check if a body given by its name exists.
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< JointIndex > mimicked_joints
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.
static const Vector3 gravity981
std::vector< IndexVector > mimic_joint_supports
JointIndex addJoint(const JointIndex parent, const JointModel &joint_model, const SE3 &joint_placement, const std::string &joint_name, const VectorXs &max_effort, const VectorXs &max_velocity, const VectorXs &min_config, const VectorXs &max_config)
VectorXs ConfigVectorType
std::map< std::string, ConfigVectorType > ConfigVectorMap
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::vector< bool > hasConfigurationLimit()
Check if joints have configuration limits.
bool existJointName(const std::string &name) const
Check if a joint given by its name exists.
TangentVectorType damping
ConfigVectorType lowerPositionLimit
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...
std::vector< bool > hasConfigurationLimitInTangent()
Check if joints have configuration limits.