model-generator.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2015-2020 CNRS INRIA
3 //
4 
5 #include "pinocchio/multibody/model.hpp"
6 
7 namespace pinocchio
8 {
9 
10  template<typename D>
12  const JointModelBase<D> & jmodel,
14  const SE3 & joint_placement,
15  const std::string & name,
16  const Inertia & Y)
17  {
19  typedef typename D::TangentVector_t TV;
20  typedef typename D::ConfigVector_t CV;
21 
22  idx = model.addJoint(parent_id,jmodel,joint_placement,
23  name + "_joint",
24  TV::Zero(),
25  1e3 * (TV::Random() + TV::Constant(1)),
26  1e3 * (CV::Random() - CV::Constant(1)),
27  1e3 * (CV::Random() + CV::Constant(1))
28  );
29 
30  model.appendBodyToJoint(idx,Y,SE3::Identity());
31  }
32 
34  {
35  addJointAndBody(model,JointModelFreeFlyer(),model.getJointId("universe"),SE3::Identity(),"freeflyer",Inertia::Random());
36  addJointAndBody(model,JointModelSpherical(),model.getJointId("freeflyer_joint"),SE3::Identity(),"spherical",Inertia::Random());
37  addJointAndBody(model,JointModelPlanar(),model.getJointId("spherical_joint"),SE3::Identity(),"planar",Inertia::Random());
38  addJointAndBody(model,JointModelRX(),model.getJointId("planar_joint"),SE3::Identity(),"rx",Inertia::Random());
39  addJointAndBody(model,JointModelPX(),model.getJointId("rx_joint"),SE3::Identity(),"px",Inertia::Random());
42  addJointAndBody(model,JointModelSphericalZYX(),model.getJointId("ru_joint"),SE3::Identity(),"sphericalZYX",Inertia::Random());
43  addJointAndBody(model,JointModelTranslation(),model.getJointId("sphericalZYX_joint"),SE3::Identity(),"translation",Inertia::Random());
44  }
45 
46 }
JointModelPrismaticTpl< double, 0, 0 > JointModelPX
void addJointAndBody(Model &model, const JointModelBase< D > &jmodel, const Model::JointIndex parent_id, const SE3 &joint_placement, const std::string &name, const Inertia &Y)
static InertiaTpl Random()
JointModelRevoluteUnalignedTpl< double > JointModelRevoluteUnaligned
std::string name(const LieGroupGenericTpl< LieGroupCollection > &lg)
Visit a LieGroupVariant to get the name of it.
JointModelSphericalZYXTpl< double > JointModelSphericalZYX
void buildAllJointsModel(Model &model)
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.
pinocchio::JointIndex JointIndex
traits< SE3Tpl >::Vector3 Vector3
JointModelTranslationTpl< double > JointModelTranslation
Main pinocchio namespace.
Definition: timings.cpp:30
JointModelSphericalTpl< double > JointModelSpherical
JointIndex getJointId(const std::string &name) const
Return the index of a joint given by its name.
JointModelFreeFlyerTpl< double > JointModelFreeFlyer
JointModelPrismaticUnalignedTpl< double > JointModelPrismaticUnaligned
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.
JointModelRevoluteTpl< double, 0, 0 > JointModelRX
JointCollectionTpl & model
JointModelPlanarTpl< double > JointModelPlanar


pinocchio
Author(s):
autogenerated on Tue Jun 1 2021 02:45:04