pinocchio_read_model.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2015 CNRS
3 //
4 //
5 // Code adapted from https://bitbucket.org/rbdl/rbdl
6 
7 #include <iostream>
8 
10 
11 #ifdef PINOCCHIO_WITH_URDFDOM
13 #endif
14 
16 
17 using namespace std;
18 
19 void usage(const char * application_name)
20 {
21  cerr << "Usage: " << application_name << " [-v] [-h] <model.extension>" << endl;
22  cerr << " -v | --verbose default parser verbosity" << endl;
23  cerr << " -h | --help print this help" << endl;
24  exit(1);
25 }
26 
27 int main(int argc, char * argv[])
28 {
29  if (argc < 2 || argc > 4)
30  {
31  usage(argv[0]);
32  }
33 
34  std::string filename;
35 
36  bool verbose = false;
37 
38  for (int i = 1; i < argc; i++)
39  {
40  if (string(argv[i]) == "-v" || string(argv[i]) == "--verbose")
41  verbose = true;
42  else if (string(argv[i]) == "-h" || string(argv[i]) == "--help")
43  usage(argv[0]);
44  else
45  filename = argv[i];
46  }
47 
48  // Check extension of the file
51 
52  switch (extension_type)
53  {
54  case pinocchio::URDF:
55 #ifdef PINOCCHIO_WITH_URDFDOM
57 #else
58  std::cerr << "It seems that the URDFDOM module has not been found during the Cmake process."
59  << std::endl;
60 #endif
61  break;
62  case pinocchio::UNKNOWN:
63  std::cerr << "Unknown extension of " << filename << std::endl;
64  return -1;
65  break;
66  }
67  return 0;
68 }
pinocchio::checkModelFileExtension
ModelFileExtensionType checkModelFileExtension(const std::string &filename)
Extract the type of the given model file according to its extension.
Definition: utils.hpp:39
main
int main(int argc, char *argv[])
Definition: pinocchio_read_model.cpp:27
pinocchio::ModelFileExtensionType
ModelFileExtensionType
Supported model file extensions.
Definition: utils.hpp:26
utils.hpp
inverse-kinematics.i
int i
Definition: inverse-kinematics.py:17
model.hpp
pinocchio::UNKNOWN
@ UNKNOWN
Definition: utils.hpp:28
anymal-simulation.model
model
Definition: anymal-simulation.py:8
usage
void usage(const char *application_name)
Definition: pinocchio_read_model.cpp:19
pinocchio::URDF
@ URDF
Definition: utils.hpp:29
filename
filename
urdf.hpp
pinocchio::urdf::buildModel
ModelTpl< Scalar, Options, JointCollectionTpl > & buildModel(const std::string &filename, const typename ModelTpl< Scalar, Options, JointCollectionTpl >::JointModel &rootJoint, const std::string &rootJointName, ModelTpl< Scalar, Options, JointCollectionTpl > &model, const bool verbose=false)
Build the model from a URDF file with a particular joint as root of the model tree inside the model g...
std
Definition: autodiff/casadi/utils/static-if.hpp:64
pinocchio::ModelTpl
Definition: context/generic.hpp:20
verbose
bool verbose


pinocchio
Author(s):
autogenerated on Wed Dec 25 2024 03:41:18