13 #include <type_traits>
19 #include <boost/fusion/container/vector.hpp>
20 #include <boost/variant/get.hpp>
22 #include "pinocchio/macros.hpp"
23 #include "pinocchio/fwd.hpp"
25 #include "pinocchio/spatial.hpp"
27 #include "pinocchio/multibody.hpp"
28 #include "pinocchio/geometry.hpp"
29 #include "pinocchio/multibody/joint.hpp"
31 #include "pinocchio/algorithm/joint-configuration.hpp"
50 template<
typename Scalar,
int Options,
template<
typename,
int>
class JointCollectionTpl>
52 const ModelTpl<Scalar, Options, JointCollectionTpl> & modelA,
53 const ModelTpl<Scalar, Options, JointCollectionTpl> & modelB,
54 const FrameIndex frameInModelA,
55 const SE3Tpl<Scalar, Options> & aMb,
56 ModelTpl<Scalar, Options, JointCollectionTpl> & model);
73 template<
typename Scalar,
int Options,
template<
typename,
int>
class JointCollectionTpl>
75 const ModelTpl<Scalar, Options, JointCollectionTpl> & modelA,
76 const ModelTpl<Scalar, Options, JointCollectionTpl> & modelB,
77 const FrameIndex frameInModelA,
78 const SE3Tpl<Scalar, Options> & aMb)
80 typedef ModelTpl<Scalar, Options, JointCollectionTpl> Model;
83 appendModel(modelA, modelB, frameInModelA, aMb, model);
100 template<
typename Scalar,
int Options,
template<
typename,
int>
class JointCollectionTpl>
102 const ModelTpl<Scalar, Options, JointCollectionTpl> & modelA,
103 const ModelTpl<Scalar, Options, JointCollectionTpl> & modelB,
104 const GeometryModel & geomModelA,
105 const GeometryModel & geomModelB,
106 const FrameIndex frameInModelA,
107 const SE3Tpl<Scalar, Options> & aMb,
108 ModelTpl<Scalar, Options, JointCollectionTpl> & model,
109 GeometryModel & geomModel);
130 template<
typename,
int>
class JointCollectionTpl,
131 typename ConfigVectorType>
133 const ModelTpl<Scalar, Options, JointCollectionTpl> & model,
134 std::vector<JointIndex> list_of_joints_to_lock,
135 const Eigen::MatrixBase<ConfigVectorType> & reference_configuration,
136 ModelTpl<Scalar, Options, JointCollectionTpl> & reduced_model);
155 template<
typename,
int>
class JointCollectionTpl,
156 typename ConfigVectorType>
158 const ModelTpl<Scalar, Options, JointCollectionTpl> & model,
159 const std::vector<JointIndex> & list_of_joints_to_lock,
160 const Eigen::MatrixBase<ConfigVectorType> & reference_configuration)
162 typedef ModelTpl<Scalar, Options, JointCollectionTpl> Model;
165 buildReducedModel(model, list_of_joints_to_lock, reference_configuration, reduced_model);
167 return reduced_model;
189 template<
typename,
int>
class JointCollectionTpl,
190 typename ConfigVectorType>
192 const ModelTpl<Scalar, Options, JointCollectionTpl> & model,
193 const GeometryModel & geom_model,
194 const std::vector<JointIndex> & list_of_joints_to_lock,
195 const Eigen::MatrixBase<ConfigVectorType> & reference_configuration,
196 ModelTpl<Scalar, Options, JointCollectionTpl> & reduced_model,
197 GeometryModel & reduced_geom_model);
218 template<
typename,
int>
class JointCollectionTpl,
219 typename ConfigVectorType>
221 const ModelTpl<Scalar, Options, JointCollectionTpl> & model,
222 const std::vector<GeometryModel> & list_of_geom_models,
223 const std::vector<JointIndex> & list_of_joints_to_lock,
224 const Eigen::MatrixBase<ConfigVectorType> & reference_configuration,
225 ModelTpl<Scalar, Options, JointCollectionTpl> & reduced_model,
226 std::vector<GeometryModel> & list_of_reduced_geom_models);
241 template<
typename Scalar,
int Options,
template<
typename,
int>
class JointCollectionTpl>
243 const ModelTpl<Scalar, Options, JointCollectionTpl> & input_model,
244 const JointIndex & index_mimicked,
245 const JointIndex & index_mimicking,
246 const Scalar & scaling,
247 const Scalar & offset,
248 ModelTpl<Scalar, Options, JointCollectionTpl> & output_model);
262 template<
typename Scalar,
int Options,
template<
typename,
int>
class JointCollectionTpl>
264 const ModelTpl<Scalar, Options, JointCollectionTpl> & input_model,
265 const std::vector<JointIndex> & index_mimicked,
266 const std::vector<JointIndex> & index_mimicking,
267 const std::vector<Scalar> & scaling,
268 const std::vector<Scalar> & offset,
269 ModelTpl<Scalar, Options, JointCollectionTpl> & output_model);
282 template<
typename Scalar,
int Options,
template<
typename,
int>
class JointCollectionTpl>
284 const ModelTpl<Scalar, Options, JointCollectionTpl> & model,
285 JointIndex joint1_id,
286 JointIndex joint2_id,
287 size_t & index_ancestor_in_support1,
288 size_t & index_ancestor_in_support2);
299 template<
typename Scalar,
int Options,
template<
typename,
int>
class JointCollectionTpl>
301 const ModelTpl<Scalar, Options, JointCollectionTpl> & model,
302 JointIndex joint1_id,
303 JointIndex joint2_id)
305 size_t index_ancestor_in_support1, index_ancestor_in_support2;
307 model, joint1_id, joint2_id, index_ancestor_in_support1, index_ancestor_in_support2);
313 #include "pinocchio/src/algorithm/model.hxx"
Main pinocchio namespace.
void buildMimicModel(const ModelTpl< Scalar, Options, JointCollectionTpl > &input_model, const std::vector< JointIndex > &index_mimicked, const std::vector< JointIndex > &index_mimicking, const std::vector< Scalar > &scaling, const std::vector< Scalar > &offset, ModelTpl< Scalar, Options, JointCollectionTpl > &output_model)
Transform joints of a model into mimic joints.
void appendModel(const ModelTpl< Scalar, Options, JointCollectionTpl > &modelA, const ModelTpl< Scalar, Options, JointCollectionTpl > &modelB, const FrameIndex frameInModelA, const SE3Tpl< Scalar, Options > &aMb, ModelTpl< Scalar, Options, JointCollectionTpl > &model)
Append a child model into a parent model, after a specific frame given by its index.
void transformJointIntoMimic(const ModelTpl< Scalar, Options, JointCollectionTpl > &input_model, const JointIndex &index_mimicked, const JointIndex &index_mimicking, const Scalar &scaling, const Scalar &offset, ModelTpl< Scalar, Options, JointCollectionTpl > &output_model)
Transform of a joint of the model into a mimic joint. Keep the type of the joint as it was previously...
void buildReducedModel(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, std::vector< JointIndex > list_of_joints_to_lock, const Eigen::MatrixBase< ConfigVectorType > &reference_configuration, ModelTpl< Scalar, Options, JointCollectionTpl > &reduced_model)
Build a reduced model from a given input model and a list of joint to lock.
JointIndex findCommonAncestor(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, JointIndex joint1_id, JointIndex joint2_id, size_t &index_ancestor_in_support1, size_t &index_ancestor_in_support2)
Computes the common ancestor between two joints belonging to the same kinematic tree.