mjcf-graph-geom.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2016-2024 CNRS INRIA
3 //
4 
6 #ifdef PINOCCHIO_WITH_HPP_FCL
7 
10 
11 #endif // PINOCCHIO_WITH_HPP_FCL
12 
13 namespace pinocchio
14 {
15  namespace mjcf
16  {
17  namespace details
18  {
19  static double computeVolume(const Eigen::VectorXd & size, const std::string & geomType)
20  {
21  double pi = boost::math::constants::pi<double>();
22  if (geomType == "box")
23  {
24  return size.prod();
25  }
26  else if (geomType == "cylinder")
27  {
28  return 2 * pi * std::pow(size(0), 2) * size(1);
29  }
30  else if (geomType == "sphere")
31  {
32  return 4.0 / 3 * pi * std::pow(size(0), 3);
33  }
34  else if (geomType == "capsule")
35  {
36  return 4.0 / 3 * pi * std::pow(size(0), 3) + 2 * pi * std::pow(size(0), 2) * size(1);
37  }
38  else if (geomType == "ellipsoid")
39  {
40  return 4.0 / 3 * pi * size.prod();
41  }
42  else
43  {
44  throw std::invalid_argument("geometry type does not exist");
45  }
46  }
47 
48  bool isType(const MjcfGeom & geom, const GeometryType & type)
49  {
50  switch (type)
51  {
53  return geom.geomKind != MjcfGeom::VISUAL;
54  default:
56  return geom.geomKind != MjcfGeom::COLLISION;
57  }
58  }
59 
67 #ifdef PINOCCHIO_WITH_HPP_FCL
68  static std::shared_ptr<fcl::CollisionGeometry> retrieveCollisionGeometry(
69  ::hpp::fcl::MeshLoaderPtr & meshLoader,
70  const MjcfGeom & geom,
71  const MjcfGraph & currentGraph,
72  std::string & meshPath,
73  Eigen::Vector3d & meshScale)
74  {
75  if (geom.geomType == "mesh")
76  {
77  MjcfMesh currentMesh = currentGraph.mapOfMeshes.at(geom.meshName);
78  if (currentMesh.vertices.size() > 0)
79  {
80  auto vertices = currentMesh.vertices;
81  // Scale vertices
82  for (std::size_t i = 0; i < vertices.rows(); ++i)
83  vertices.row(i) = vertices.row(i).cwiseProduct(currentMesh.scale.transpose());
84  auto model = std::make_shared<hpp::fcl::BVHModel<fcl::OBBRSS>>();
85  model->beginModel();
86  model->addVertices(vertices);
87  model->endModel();
88  model->buildConvexHull(true, "Qt");
89  return model->convex;
90  }
91  meshPath = currentMesh.filePath;
92  meshScale = currentMesh.scale;
93  hpp::fcl::BVHModelPtr_t bvh = meshLoader->load(meshPath, meshScale);
94  return bvh;
95  }
96  else if (geom.geomType == "cylinder")
97  {
98  meshPath = "CYLINDER";
99  meshScale << 1, 1, 1;
100  double radius = geom.size(0);
101  double height = geom.size(1) * 2;
102  return std::make_shared<fcl::Cylinder>(radius, height);
103  }
104  else if (geom.geomType == "box")
105  {
106  meshPath = "BOX";
107  meshScale << 1, 1, 1;
108  double x = geom.size(0);
109  double y = geom.size(1);
110  double z = geom.size(2);
111  return std::make_shared<fcl::Box>(x, y, z);
112  }
113  else if (geom.geomType == "sphere")
114  {
115  meshPath = "SPHERE";
116  meshScale << 1, 1, 1;
117  double radius = geom.size(0);
118  return std::make_shared<fcl::Sphere>(radius);
119  }
120  else if (geom.geomType == "ellipsoid")
121  {
122  meshPath = "ELLIPSOID";
123  meshScale << 1, 1, 1;
124  double rx = geom.size(0);
125  double ry = geom.size(1);
126  double rz = geom.size(2);
127  return std::make_shared<fcl::Ellipsoid>(rx, ry, rz);
128  }
129  else if (geom.geomType == "capsule")
130  {
131  meshPath = "CAPSULE";
132  meshScale << 1, 1, 1;
133  double radius = geom.size(0);
134  double height = geom.size(1) * 2;
135  return std::make_shared<fcl::Capsule>(radius, height);
136  }
137  else
138  throw std::invalid_argument("Unknown geometry type :"); // Missing plane, hfield and sdf
139  }
140 #else
141  static std::shared_ptr<fcl::CollisionGeometry> retrieveCollisionGeometry(
143  const MjcfGeom &,
144  const MjcfGraph &,
145  std::string &,
146  Eigen::Vector3d &)
147  {
148  return std::make_shared<fcl::CollisionGeometry>();
149  }
150 #endif
151 
157  static void addLinksToGeomModel(
158  const MjcfBody & currentBody,
159  const MjcfGraph & currentGraph,
160  GeometryModel & geomModel,
161  ::hpp::fcl::MeshLoaderPtr & meshLoader,
162  const GeometryType & type)
163  {
164  const std::string & bodyName = currentBody.bodyName;
165  FrameIndex frame_id = currentGraph.urdfVisitor.getBodyId(bodyName);
166  Frame frame = currentGraph.urdfVisitor.getBodyFrame(bodyName);
167 
168  const SE3 & bodyPlacement = frame.placement;
169 
170  std::size_t objectId = 0;
171  for (const auto & geom : currentBody.geomChildren)
172  {
173  std::string meshPath = "";
174  Eigen::Vector3d meshScale(Eigen::Vector3d::Ones());
175  if (isType(geom, type))
176  {
178  retrieveCollisionGeometry(meshLoader, geom, currentGraph, meshPath, meshScale);
179 
180  bool overrideMaterial = false;
181  Eigen::Vector4d meshColor = geom.rgba;
182  std::string texturePath;
183  if (!geom.materialName.empty())
184  {
185  MjcfMaterial mat = currentGraph.mapOfMaterials.at(geom.materialName);
186  meshColor = mat.rgba;
187  overrideMaterial = true;
188  if (!mat.texture.empty())
189  {
190  MjcfTexture text = currentGraph.mapOfTextures.at(mat.texture);
191  texturePath = text.filePath;
192  }
193  }
194  const SE3 geomPlacement = bodyPlacement * geom.geomPlacement;
195  std::ostringstream geometry_object_suffix;
196  geometry_object_suffix << "_" << objectId;
197  std::string geometry_object_name = std::string(bodyName + geometry_object_suffix.str());
198 
199  GeometryObject geometry_object(
200  geometry_object_name, frame.parentJoint, frame_id, geomPlacement, geometry, meshPath,
201  meshScale, overrideMaterial, meshColor, texturePath);
202  geomModel.addGeometryObject(geometry_object);
203  ++objectId;
204  }
205  }
206  }
207 
209  {
210  // texture name
211  auto text_s = el.get_optional<std::string>("<xmlattr>.texture");
212  if (text_s)
213  texture = *text_s;
214 
215  // Emission
216  auto single_v = el.get_optional<float>("<xmlattr>.emission");
217  if (single_v)
218  emission = *single_v;
219 
220  // Specular
221  if ((single_v = el.get_optional<float>("<xmlattr>.specular")))
222  specular = *single_v;
223 
224  // Shininess
225  if ((single_v = el.get_optional<float>("<xmlattr>.shininess")))
226  shininess = *single_v;
227 
228  if ((single_v = el.get_optional<float>("<xmlattr>.reflectance")))
229  reflectance = *single_v;
230 
231  auto rgba_ = el.get_optional<std::string>("<xmlattr>.rgba");
232  if (rgba_)
233  rgba = internal::getVectorFromStream<4>(*rgba_);
234  }
235 
236  void MjcfGeom::goThroughElement(const ptree & el, const MjcfGraph & currentGraph)
237  {
238  if (el.get_child_optional("<xmlattr>.pos") && el.get_child_optional("<xmlattr>.fromto"))
239  throw std::invalid_argument("Both pos and fromto are defined in geom object");
240 
241  // Placement
242  geomPlacement = currentGraph.convertPosition(el);
243 
244  // density
245  auto value_v = el.get_optional<double>("<xmlattr>.density");
246  if (value_v)
247  density = *value_v;
248 
249  // contype
250  auto val_v = el.get_optional<int>("<xmlattr>.contype");
251  if (val_v)
252  contype = *val_v;
253  // condim
254  if ((val_v = el.get_optional<int>("<xmlattr>.conaffinity")))
255  conaffinity = *val_v;
256  // group
257  if ((val_v = el.get_optional<int>("<xmlattr>.group")))
258  group = *val_v;
259 
260  // mass
261  massGeom = el.get_optional<double>("<xmlattr>.mass");
262 
263  // shellinertia
264  auto value_s = el.get_optional<std::string>("<xmlattr>.shellinertia");
265  if (value_s)
266  throw std::invalid_argument("Shell inertia computation is not supported yet.");
267 
268  // type
269  if ((value_s = el.get_optional<std::string>("<xmlattr>.type")))
270  geomType = *value_s;
271 
272  // material name
273  if ((value_s = el.get_optional<std::string>("<xmlattr>.material")))
274  materialName = *value_s;
275 
276  if (geomType == "mesh")
277  {
278  value_s = el.get_optional<std::string>("<xmlattr>.mesh");
279  if (value_s)
280  meshName = *value_s;
281  }
282 
283  // rgba
284  if ((value_s = el.get_optional<std::string>("<xmlattr>.rgba")))
285  rgba = internal::getVectorFromStream<4>(*value_s);
286 
287  // size
288  if ((value_s = el.get_optional<std::string>("<xmlattr>.size")))
289  sizeS = *value_s;
290  // fromto
291  if (!fromtoS)
292  fromtoS = el.get_optional<std::string>("<xmlattr>.fromto");
293  if (fromtoS)
294  {
295  Eigen::VectorXd poses = internal::getVectorFromStream<6>(*fromtoS);
296  geomPlacement.translation() = (poses.head(3) + poses.tail(3)) / 2;
297 
298  Eigen::Vector3d zaxis = poses.tail(3) - poses.head(3);
299  // Compute the rotation matrix that maps z_axis to unit z
301  Eigen::Quaterniond::FromTwoVectors(Eigen::Vector3d::UnitZ(), zaxis).toRotationMatrix();
302  }
303  }
304 
306  {
307  // Common mechanism to set visual only geometry
308  if (contype == 0 && conaffinity == 0)
309  geomKind = VISUAL;
310  else if (group > 2) // Mechanism for Collision only geometries
312  else
313  geomKind = BOTH;
314  }
315 
317  {
318  std::vector<std::string> forbiddenListFromTo = {"plane", "hfield", "mesh", "sphere"};
319  if (
320  fromtoS
321  && std::find(forbiddenListFromTo.begin(), forbiddenListFromTo.end(), geomType)
322  != forbiddenListFromTo.end())
323  throw std::invalid_argument(
324  "fromto tag can only be used with capsules, boxes, cylinders and ellipsoids");
325 
326  // First deal with cases that do not work with fromto
327  if (geomType == "sphere")
328  size = internal::getVectorFromStream<1>(sizeS);
329  else if (geomType == "plane")
330  size = internal::getVectorFromStream<3>(sizeS);
331  else if (geomType == "box")
332  {
333  if (!fromtoS)
334  size = internal::getVectorFromStream<3>(sizeS) * 2; // half x, half y, half z
335  else
336  {
337  size = Eigen::Vector3d::Zero();
338  size(0) = internal::getVectorFromStream<1>(sizeS)(0) * 2;
339  size(1) = size(0);
340  Eigen::VectorXd poses = internal::getVectorFromStream<6>(*fromtoS);
341  Eigen::Vector3d zaxis = poses.tail(3) - poses.head(3);
342  size(2) = zaxis.norm();
343  }
344  }
345  else if (geomType == "ellipsoid")
346  {
347  if (!fromtoS)
348  size = internal::getVectorFromStream<3>(sizeS); // radius and half length
349  else
350  {
351  size = Eigen::Vector3d::Zero();
352  size(0) = internal::getVectorFromStream<1>(sizeS)(0);
353  size(1) = size(0);
354  Eigen::VectorXd poses = internal::getVectorFromStream<6>(*fromtoS);
355  Eigen::Vector3d zaxis = poses.tail(3) - poses.head(3);
356  size(2) = zaxis.norm() / 2; // to get radius;
357  }
358  }
359  else if (geomType == "cylinder" || geomType == "capsule")
360  {
361  if (!fromtoS)
362  size = internal::getVectorFromStream<2>(sizeS);
363  else
364  {
365  size = Eigen::Vector2d::Zero();
366  size(0) = internal::getVectorFromStream<1>(sizeS)(0);
367  Eigen::VectorXd poses = internal::getVectorFromStream<6>(*fromtoS);
368  Eigen::Vector3d zaxis = poses.tail(3) - poses.head(3);
369  size(1) = zaxis.norm() / 2; // to get half height
370  }
371  }
372  else if (geomType == "mesh")
373  return;
374  else
375  throw std::invalid_argument("geomType does not exist");
376  }
377 
379  {
380  if (geomType == "mesh" || geomType == "plane" || geomType == "hfield")
381  return;
382 
383  double mass;
384  if (massGeom)
385  mass = *massGeom;
386  else
388 
389  if (geomType == "box")
390  {
392  }
393  else if (geomType == "cylinder")
394  {
396  }
397  else if (geomType == "ellipsoid")
398  {
400  }
401  else if (geomType == "sphere")
402  {
404  }
405  else if (geomType == "capsule")
406  {
408  }
409  else
410  {
411  throw std::invalid_argument("Unsupported geometry type");
412  }
413  }
414 
415  void
416  MjcfGeom::fill(const ptree & el, const MjcfBody & currentBody, const MjcfGraph & currentGraph)
417  {
418  // Name
419  auto name_s = el.get_optional<std::string>("<xmlattr>.name");
420  if (name_s)
421  geomName = *name_s;
422  else
423  geomName =
424  currentBody.bodyName + "Geom_" + std::to_string(currentBody.geomChildren.size());
425 
426  // default < ChildClass < Class < Real Joint
427  if (currentGraph.mapOfClasses.find("mujoco_default") != currentGraph.mapOfClasses.end())
428  {
429  const MjcfClass & classD = currentGraph.mapOfClasses.at("mujoco_default");
430  if (auto geom_p = classD.classElement.get_child_optional("geom"))
431  goThroughElement(*geom_p, currentGraph);
432  }
433  // childClass
434  if (currentBody.childClass != "")
435  {
436  const MjcfClass & classE = currentGraph.mapOfClasses.at(currentBody.childClass);
437  if (auto geom_p = classE.classElement.get_child_optional("geom"))
438  goThroughElement(*geom_p, currentGraph);
439  }
440 
441  // Class
442  auto cl_s = el.get_optional<std::string>("<xmlattr>.class");
443  if (cl_s)
444  {
445  std::string className = *cl_s;
446  const MjcfClass & classE = currentGraph.mapOfClasses.at(className);
447  if (auto geom_p = classE.classElement.get_child_optional("geom"))
448  goThroughElement(*geom_p, currentGraph);
449  }
450 
451  // Geom
452  goThroughElement(el, currentGraph);
453  if (geomType == "mesh" && meshName.empty())
454  throw std::invalid_argument("Type is mesh but no mesh file were provided");
455  // Compute Kind of geometry
456  findKind();
457 
458  computeSize();
459 
460  // Compute Mass and inertia of geom object
461  computeInertia();
462  }
463 
464  void MjcfSite::goThroughElement(const ptree & el, const MjcfGraph & currentGraph)
465  {
466  if (el.get_child_optional("<xmlattr>.pos") && el.get_child_optional("<xmlattr>.fromto"))
467  throw std::invalid_argument("Both pos and fromto are defined in site object");
468 
469  // Placement
470  sitePlacement = currentGraph.convertPosition(el);
471 
472  auto fromtoS = el.get_optional<std::string>("<xmlattr>.fromto");
473  if (fromtoS)
474  {
475  Eigen::VectorXd poses = internal::getVectorFromStream<6>(*fromtoS);
476  sitePlacement.translation() = (poses.head(3) + poses.tail(3)) / 2;
477 
478  Eigen::Vector3d zaxis = poses.tail(3) - poses.head(3);
479  // Compute the rotation matrix that maps z_axis to unit z
481  Eigen::Quaterniond::FromTwoVectors(Eigen::Vector3d::UnitZ(), zaxis).toRotationMatrix();
482  }
483  }
484 
485  void
486  MjcfSite::fill(const ptree & el, const MjcfBody & currentBody, const MjcfGraph & currentGraph)
487  {
488  // Name
489  auto name_s = el.get_optional<std::string>("<xmlattr>.name");
490  if (name_s)
491  siteName = *name_s;
492  else
493  siteName =
494  currentBody.bodyName + "Site_" + std::to_string(currentBody.siteChildren.size());
495 
496  // default < ChildClass < Class < Real Joint
497  if (currentGraph.mapOfClasses.find("mujoco_default") != currentGraph.mapOfClasses.end())
498  {
499  const MjcfClass & classD = currentGraph.mapOfClasses.at("mujoco_default");
500  if (auto site_p = classD.classElement.get_child_optional("site"))
501  goThroughElement(*site_p, currentGraph);
502  }
503  // childClass
504  if (currentBody.childClass != "")
505  {
506  const MjcfClass & classE = currentGraph.mapOfClasses.at(currentBody.childClass);
507  if (auto site_p = classE.classElement.get_child_optional("site"))
508  goThroughElement(*site_p, currentGraph);
509  }
510 
511  // Class
512  auto cl_s = el.get_optional<std::string>("<xmlattr>.class");
513  if (cl_s)
514  {
515  std::string className = *cl_s;
516  const MjcfClass & classE = currentGraph.mapOfClasses.at(className);
517  if (auto site_p = classE.classElement.get_child_optional("site"))
518  goThroughElement(*site_p, currentGraph);
519  }
520 
521  // Site
522  goThroughElement(el, currentGraph);
523  }
524 
526  const GeometryType & type,
527  GeometryModel & geomModel,
528  ::hpp::fcl::MeshLoaderPtr & meshLoader)
529  {
530 #ifdef PINOCCHIO_WITH_HPP_FCL
531  if (!meshLoader)
532  meshLoader = std::make_shared<fcl::MeshLoader>(fcl::MeshLoader());
533 #endif // ifdef PINOCCHIO_WITH_HPP_FCL
534 
535  for (const auto & entry : bodiesList)
536  {
537  const MjcfBody & currentBody = mapOfBodies.at(entry);
538 
539  addLinksToGeomModel(currentBody, *this, geomModel, meshLoader, type);
540  }
541  }
542  } // namespace details
543  } // namespace mjcf
544 } // namespace pinocchio
pinocchio::mjcf::details::retrieveCollisionGeometry
static std::shared_ptr< fcl::CollisionGeometry > retrieveCollisionGeometry(::hpp::fcl::MeshLoaderPtr &, const MjcfGeom &, const MjcfGraph &, std::string &, Eigen::Vector3d &)
Get a fcl::CollisionObject from an mjcf geometry, searching for it in specified package directories.
Definition: mjcf-graph-geom.cpp:141
pinocchio::FrameIndex
Index FrameIndex
Definition: multibody/fwd.hpp:28
common_symbols.type
type
Definition: common_symbols.py:35
pinocchio::mjcf::details::MjcfSite::siteName
std::string siteName
Definition: mjcf-graph.hpp:325
pinocchio::InertiaTpl< context::Scalar, context::Options >::FromEllipsoid
static InertiaTpl FromEllipsoid(const Scalar mass, const Scalar x, const Scalar y, const Scalar z)
Computes the Inertia of an ellipsoid defined by its mass and main semi-axis dimensions (x,...
Definition: spatial/inertia.hpp:389
pinocchio::mjcf::details::MjcfGeom::size
Eigen::VectorXd size
Definition: mjcf-graph.hpp:281
pinocchio::mjcf::details::MjcfClass
Structure to stock all default classes information.
Definition: mjcf-graph.hpp:77
pinocchio::mjcf::details::MjcfGraph::mapOfTextures
TextureMap_t mapOfTextures
Definition: mjcf-graph.hpp:405
append-urdf-model-with-another-model.meshColor
meshColor
Definition: append-urdf-model-with-another-model.py:46
pinocchio::mjcf::details::MjcfGeom::COLLISION
@ COLLISION
Definition: mjcf-graph.hpp:258
pinocchio::mjcf::details::MjcfSite::sitePlacement
SE3 sitePlacement
Definition: mjcf-graph.hpp:323
assimp.h
loader.h
pinocchio::mjcf::details::MjcfMaterial::goThroughElement
void goThroughElement(const ptree &el)
Go through a ptree node to look for material tag related.
Definition: mjcf-graph-geom.cpp:208
pinocchio::mjcf::details::MjcfGeom::findKind
void findKind()
Find the geometry kind.
Definition: mjcf-graph-geom.cpp:305
pinocchio::mjcf::details::MjcfGraph::mapOfClasses
ClassMap_t mapOfClasses
Definition: mjcf-graph.hpp:397
pinocchio::mjcf::details::computeVolume
static double computeVolume(const Eigen::VectorXd &size, const std::string &geomType)
Definition: mjcf-graph-geom.cpp:19
pinocchio::mjcf::details::MjcfGeom::geomKind
TYPE geomKind
Definition: mjcf-graph.hpp:268
pinocchio::mjcf::details::MjcfGeom::group
int group
Definition: mjcf-graph.hpp:274
pinocchio::mjcf::details::MjcfGeom::sizeS
std::string sizeS
Definition: mjcf-graph.hpp:277
y
y
pinocchio::SE3Tpl
Definition: context/casadi.hpp:29
inverse-kinematics.i
int i
Definition: inverse-kinematics.py:17
pinocchio::mjcf::details::MjcfGeom::computeSize
void computeSize()
Compute Geometry size based on sizeS and fromtoS.
Definition: mjcf-graph-geom.cpp:316
mjcf-graph.hpp
pinocchio::mjcf::details::MjcfGeom::geomType
std::string geomType
Definition: mjcf-graph.hpp:265
pinocchio::mjcf::details::MjcfGeom::geomPlacement
SE3 geomPlacement
Definition: mjcf-graph.hpp:297
pinocchio::mjcf::details::addLinksToGeomModel
static void addLinksToGeomModel(const MjcfBody &currentBody, const MjcfGraph &currentGraph, GeometryModel &geomModel, ::hpp::fcl::MeshLoaderPtr &meshLoader, const GeometryType &type)
Add all geometries associated with a body.
Definition: mjcf-graph-geom.cpp:157
pinocchio::mjcf::details::MjcfGeom::fromtoS
boost::optional< std::string > fromtoS
Definition: mjcf-graph.hpp:279
pinocchio::mjcf::details::MjcfGeom
Definition: mjcf-graph.hpp:249
pinocchio::mjcf::details::MjcfMaterial::shininess
float shininess
Definition: mjcf-graph.hpp:236
pinocchio::GeometryObject
Definition: multibody/geometry-object.hpp:87
pinocchio::mjcf::details::MjcfGraph::parseGeomTree
void parseGeomTree(const GeometryType &type, GeometryModel &geomModel, ::hpp::fcl::MeshLoaderPtr &meshLoader)
Fill geometry model with all the info taken from the mjcf model file.
Definition: mjcf-graph-geom.cpp:525
pinocchio::mjcf::details::MjcfMaterial
All informations related to material are stored here.
Definition: mjcf-graph.hpp:228
pinocchio::mjcf::details::MjcfGeom::ptree
boost::property_tree::ptree ptree
Definition: mjcf-graph.hpp:252
pinocchio::mjcf::details::isType
bool isType(const MjcfGeom &geom, const GeometryType &type)
Definition: mjcf-graph-geom.cpp:48
pinocchio::mjcf::details::MjcfMaterial::rgba
Eigen::Vector4d rgba
Definition: mjcf-graph.hpp:232
pinocchio::mjcf::details::MjcfGeom::rgba
Eigen::Vector4d rgba
Definition: mjcf-graph.hpp:284
pinocchio::mjcf::details::MjcfMaterial::emission
float emission
Definition: mjcf-graph.hpp:240
pinocchio::mjcf::details::MjcfMaterial::reflectance
float reflectance
Definition: mjcf-graph.hpp:234
pinocchio::mjcf::details::MjcfSite::ptree
boost::property_tree::ptree ptree
Definition: mjcf-graph.hpp:321
height
FCL_REAL height() const
pinocchio::FrameTpl
A Plucker coordinate frame attached to a parent joint inside a kinematic tree.
Definition: multibody/frame.hpp:55
pinocchio::VISUAL
@ VISUAL
Definition: multibody/geometry-object.hpp:26
pinocchio::SE3Tpl::translation
ConstLinearRef translation() const
Definition: se3-base.hpp:52
hpp::fcl::MeshLoaderPtr
std::shared_ptr< MeshLoader > MeshLoaderPtr
Definition: meshloader-fwd.hpp:25
pinocchio::mjcf::details::MjcfClass::classElement
ptree classElement
Definition: mjcf-graph.hpp:85
pinocchio::mjcf::details::MjcfBody::geomChildren
std::vector< MjcfGeom > geomChildren
Definition: mjcf-graph.hpp:110
pinocchio::mjcf::details::MjcfSite::goThroughElement
void goThroughElement(const ptree &el, const MjcfGraph &currentGraph)
Definition: mjcf-graph-geom.cpp:464
details
pinocchio::mjcf::details::MjcfMaterial::texture
std::string texture
Definition: mjcf-graph.hpp:242
collision-with-point-clouds.geometry
geometry
Definition: collision-with-point-clouds.py:83
pinocchio::mjcf::details::MjcfTexture::filePath
std::string filePath
Definition: mjcf-graph.hpp:222
mat
mat
pinocchio::SE3Tpl::rotation
ConstAngularRef rotation() const
Definition: se3-base.hpp:48
size
FCL_REAL size() const
pinocchio::InertiaTpl< context::Scalar, context::Options >::FromCapsule
static InertiaTpl FromCapsule(const Scalar mass, const Scalar radius, const Scalar height)
Computes the Inertia of a capsule defined by its mass, radius and length along the Z axis....
Definition: spatial/inertia.hpp:439
x
x
pinocchio::mjcf::details::MjcfMaterial::specular
float specular
Definition: mjcf-graph.hpp:238
pinocchio::mjcf::details::MjcfGraph::bodiesList
VectorOfStrings bodiesList
Definition: mjcf-graph.hpp:418
pinocchio::mjcf::details::MjcfGeom::computeInertia
void computeInertia()
Compute geometry inertia.
Definition: mjcf-graph-geom.cpp:378
pinocchio::mjcf::details::MjcfBody::siteChildren
std::vector< MjcfSite > siteChildren
Definition: mjcf-graph.hpp:112
pinocchio::mjcf::details::MjcfGraph::mapOfBodies
BodyMap_t mapOfBodies
Definition: mjcf-graph.hpp:399
contact-cholesky.frame
frame
Definition: contact-cholesky.py:24
pinocchio::mjcf::details::MjcfGeom::geomName
std::string geomName
Definition: mjcf-graph.hpp:262
anymal-simulation.mass
mass
Definition: anymal-simulation.py:62
pinocchio::mjcf::details::MjcfGeom::fill
void fill(const ptree &el, const MjcfBody &currentBody, const MjcfGraph &currentGraph)
Fill Geometry element with info from ptree nodes.
Definition: mjcf-graph-geom.cpp:416
contact-cholesky.frame_id
frame_id
Definition: contact-cholesky.py:19
pinocchio::mjcf::details::MjcfGraph::mapOfMaterials
MaterialMap_t mapOfMaterials
Definition: mjcf-graph.hpp:401
pinocchio::GeometryModel::addGeometryObject
GeomIndex addGeometryObject(const GeometryObject &object, const ModelTpl< S2, O2, _JointCollectionTpl > &model)
Add a geometry object to a GeometryModel and set its parent joint.
pinocchio::mjcf::details::MjcfGeom::materialName
std::string materialName
Definition: mjcf-graph.hpp:287
pinocchio::mjcf::details::MjcfGeom::meshName
std::string meshName
Definition: mjcf-graph.hpp:289
pinocchio::mjcf::details::MjcfGeom::BOTH
@ BOTH
Definition: mjcf-graph.hpp:259
pinocchio::mjcf::details::MjcfGraph::urdfVisitor
UrdfVisitor & urdfVisitor
Definition: mjcf-graph.hpp:428
pinocchio::mjcf::details::MjcfGraph::convertPosition
SE3 convertPosition(const ptree &el) const
Convert pose of an mjcf element into SE3.
Definition: mjcf-graph.cpp:285
pinocchio::mjcf::details::MjcfBody::bodyName
std::string bodyName
Definition: mjcf-graph.hpp:93
pinocchio::mjcf::details::MjcfGeom::conaffinity
int conaffinity
Definition: mjcf-graph.hpp:272
pinocchio::mjcf::details::MjcfGraph
The graph which contains all information taken from the mjcf file.
Definition: mjcf-graph.hpp:381
pinocchio::GeometryType
GeometryType
Definition: multibody/geometry-object.hpp:24
pinocchio::mjcf::details::MjcfBody
All Bodies informations extracted from mjcf model.
Definition: mjcf-graph.hpp:89
pinocchio::mjcf::details::MjcfGeom::geomInertia
Inertia geomInertia
Definition: mjcf-graph.hpp:299
pinocchio::InertiaTpl< context::Scalar, context::Options >::FromBox
static InertiaTpl FromBox(const Scalar mass, const Scalar x, const Scalar y, const Scalar z)
Computes the Inertia of a box defined by its mass and main dimensions (x,y,z).
Definition: spatial/inertia.hpp:423
pinocchio::GeometryModel
Definition: multibody/geometry.hpp:50
pinocchio::COLLISION
@ COLLISION
Definition: multibody/geometry-object.hpp:27
pinocchio::InertiaTpl< context::Scalar, context::Options >::FromSphere
static InertiaTpl FromSphere(const Scalar mass, const Scalar radius)
Computes the Inertia of a sphere defined by its mass and its radius.
Definition: spatial/inertia.hpp:374
pinocchio::GeometryObject::CollisionGeometryPtr
std::shared_ptr< fcl::CollisionGeometry > CollisionGeometryPtr
Definition: multibody/geometry-object.hpp:102
pinocchio::mjcf::details::MjcfMaterial::ptree
boost::property_tree::ptree ptree
Definition: mjcf-graph.hpp:230
pinocchio::mjcf::details::MjcfGeom::goThroughElement
void goThroughElement(const ptree &el, const MjcfGraph &currentGraph)
@bried Go through a geom ptree node, to gather informations
Definition: mjcf-graph-geom.cpp:236
pinocchio::mjcf::details::MjcfBody::childClass
std::string childClass
Definition: mjcf-graph.hpp:100
pinocchio::InertiaTpl< context::Scalar, context::Options >::FromCylinder
static InertiaTpl FromCylinder(const Scalar mass, const Scalar radius, const Scalar length)
Computes the Inertia of a cylinder defined by its mass, radius and length along the Z axis.
Definition: spatial/inertia.hpp:406
pinocchio::mjcf::details::MjcfGeom::massGeom
boost::optional< double > massGeom
Definition: mjcf-graph.hpp:301
meshcat-viewer.overrideMaterial
overrideMaterial
Definition: meshcat-viewer.py:65
hpp::fcl::BVHModelPtr_t
shared_ptr< BVHModelBase > BVHModelPtr_t
radius
FCL_REAL radius
pinocchio::mjcf::details::MjcfTexture
All informations related to a texture are stored here.
Definition: mjcf-graph.hpp:217
pinocchio::model
JointCollectionTpl & model
Definition: joint-configuration.hpp:1082
pinocchio::mjcf::details::MjcfSite::fill
void fill(const ptree &el, const MjcfBody &currentBody, const MjcfGraph &currentGraph)
Definition: mjcf-graph-geom.cpp:486
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27
pinocchio::mjcf::details::MjcfGeom::VISUAL
@ VISUAL
Definition: mjcf-graph.hpp:257
pinocchio::mjcf::details::MjcfGeom::density
double density
Definition: mjcf-graph.hpp:292
pinocchio::mjcf::details::MjcfGeom::contype
int contype
Definition: mjcf-graph.hpp:271


pinocchio
Author(s):
autogenerated on Tue Jan 7 2025 03:41:46