timings-jacobian.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2015-2018 CNRS
3 //
4 
12 
13 #include <iostream>
14 
16 
17 int main(int argc, const char ** argv)
18 {
19  using namespace Eigen;
20  using namespace pinocchio;
21 
23 #ifdef NDEBUG
24  const int NBT = 1000 * 100;
25 #else
26  const int NBT = 1;
27  std::cout << "(the time score in debug mode is not relevant) " << std::endl;
28 #endif
29 
31 
32  std::string filename = PINOCCHIO_MODEL_DIR + std::string("/simple_humanoid.urdf");
33  if (argc > 1)
34  filename = argv[1];
35 
36  bool with_ff = true;
37  if (argc > 2)
38  {
39  const std::string ff_option = argv[2];
40  if (ff_option == "-no-ff")
41  with_ff = false;
42  }
43 
44  if (filename == "HS")
46  else if (with_ff)
48  else
50  std::cout << "nq = " << model.nq << std::endl;
51 
53  VectorXd qmax = Eigen::VectorXd::Ones(model.nq);
54 
56  J.setZero();
58 
59  PINOCCHIO_ALIGNED_STD_VECTOR(VectorXd) qs(NBT);
60  for (size_t i = 0; i < NBT; ++i)
61  {
62  qs[i] = randomConfiguration(model, -qmax, qmax);
63  }
64 
65  timer.tic();
66  SMOOTH(NBT)
67  {
68  forwardKinematics(model, data, qs[_smooth]);
69  }
70  std::cout << "Zero Order Kinematics = \t";
71  timer.toc(std::cout, NBT);
72 
73  timer.tic();
74  SMOOTH(NBT)
75  {
77  }
78  std::cout << "computeJointJacobian = \t\t";
79  timer.toc(std::cout, NBT);
80 
81  timer.tic();
82  SMOOTH(NBT)
83  {
84  computeJointJacobians(model, data, qs[_smooth]);
85  }
86  std::cout << "computeJointJacobians(q) = \t";
87  timer.toc(std::cout, NBT);
88 
89  timer.tic();
90  SMOOTH(NBT)
91  {
93  }
94  std::cout << "computeJointJacobians() = \t";
95  timer.toc(std::cout, NBT);
96 
97  timer.tic();
98  SMOOTH(NBT)
99  {
101  }
102  std::cout << "getJointJacobian(LOCAL) = \t";
103  timer.toc(std::cout, NBT);
104 
105  timer.tic();
106  SMOOTH(NBT)
107  {
109  }
110  std::cout << "getJointJacobian(WORLD) = \t";
111  timer.toc(std::cout, NBT);
112 
113  std::cout << "--" << std::endl;
114  return 0;
115 }
pinocchio::WORLD
@ WORLD
Definition: multibody/fwd.hpp:48
PinocchioTicToc::toc
double toc()
Definition: timer.hpp:88
Eigen
pinocchio::DataTpl
Definition: context/generic.hpp:25
pinocchio::forwardKinematics
void forwardKinematics(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q)
Update the joint placements according to the current joint configuration.
inverse-kinematics.i
int i
Definition: inverse-kinematics.py:17
kinematics.hpp
model.hpp
setup.data
data
Definition: cmake/cython/setup.in.py:48
inverse-kinematics-3d.J
J
Definition: inverse-kinematics-3d.py:28
pinocchio::buildModels::humanoidRandom
void humanoidRandom(ModelTpl< Scalar, Options, JointCollectionTpl > &model, bool usingFF=true)
Create a humanoid kinematic tree with 6-DOF limbs and random joint placements.
pinocchio::python::context::JointModelFreeFlyer
JointModelFreeFlyerTpl< Scalar > JointModelFreeFlyer
Definition: bindings/python/context/generic.hpp:126
pinocchio::computeJointJacobians
const DataTpl< Scalar, Options, JointCollectionTpl >::Matrix6x & computeJointJacobians(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q)
Computes the full model Jacobian, i.e. the stack of all motion subspace expressed in the world frame....
pinocchio::randomConfiguration
void randomConfiguration(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const Eigen::MatrixBase< ConfigVectorIn1 > &lowerLimits, const Eigen::MatrixBase< ConfigVectorIn2 > &upperLimits, const Eigen::MatrixBase< ReturnType > &qout)
Generate a configuration vector uniformly sampled among provided limits.
Definition: joint-configuration.hpp:315
timer.hpp
anymal-simulation.model
model
Definition: anymal-simulation.py:8
pinocchio::ModelTpl::JointIndex
pinocchio::JointIndex JointIndex
Definition: multibody/model.hpp:67
SMOOTH
#define SMOOTH(s)
Definition: timer.hpp:38
joint-configuration.hpp
pinocchio::getJointJacobian
void getJointJacobian(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const JointIndex joint_id, const ReferenceFrame reference_frame, const Eigen::MatrixBase< Matrix6Like > &J)
Computes the Jacobian of a specific joint frame expressed in one of the pinocchio::ReferenceFrame opt...
filename
filename
urdf.hpp
data.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...
PinocchioTicToc::US
@ US
Definition: timer.hpp:53
pinocchio::computeJointJacobian
void computeJointJacobian(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const JointIndex joint_id, const Eigen::MatrixBase< Matrix6Like > &J)
Computes the Jacobian of a specific joint frame expressed in the local frame of the joint and store t...
pinocchio::JointIndex
Index JointIndex
Definition: multibody/fwd.hpp:26
pinocchio::DataTpl::Matrix6x
Eigen::Matrix< Scalar, 6, Eigen::Dynamic, Options > Matrix6x
The 6d jacobian type (temporary)
Definition: multibody/data.hpp:92
inverse-kinematics-3d.JOINT_ID
int JOINT_ID
Definition: inverse-kinematics-3d.py:8
PINOCCHIO_ALIGNED_STD_VECTOR
#define PINOCCHIO_ALIGNED_STD_VECTOR(Type)
Definition: container/aligned-vector.hpp:11
main
int main(int argc, const char **argv)
Definition: timings-jacobian.cpp:17
sample-models.hpp
jacobian.hpp
pinocchio::ModelTpl
Definition: context/generic.hpp:20
PinocchioTicToc
Definition: timer.hpp:47
meshcat-viewer.qs
qs
Definition: meshcat-viewer.py:128
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27
PINOCCHIO_MODEL_DIR
#define PINOCCHIO_MODEL_DIR
Definition: build-reduced-model.cpp:11
PinocchioTicToc::tic
void tic()
Definition: timer.hpp:82
pinocchio::LOCAL
@ LOCAL
Definition: multibody/fwd.hpp:50


pinocchio
Author(s):
autogenerated on Sun Dec 22 2024 03:41:12