unittest/casadi/aba-derivatives.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2019-2020 INRIA
3 //
4 
7 
13 
15 
16 #include <casadi/casadi.hpp>
17 
18 #include <iostream>
19 #include <boost/test/unit_test.hpp>
20 #include <boost/utility/binary.hpp>
21 
22 BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
23 
24 BOOST_AUTO_TEST_CASE(test_aba_derivatives_casadi_algo)
25 {
26  typedef double Scalar;
29  typedef typename Model::ConfigVectorType ConfigVector;
30  typedef typename Model::TangentVectorType TangentVector;
31 
32  Model model;
34  model.lowerPositionLimit.head<3>().fill(-1.);
35  model.upperPositionLimit.head<3>().fill(1.);
37 
38  ConfigVector q(model.nq);
40  TangentVector v(TangentVector::Random(model.nv));
41  TangentVector tau(TangentVector::Random(model.nv));
42 
45  data.Minv.triangularView<Eigen::StrictlyLower>() =
46  data.Minv.transpose().triangularView<Eigen::StrictlyLower>();
47 
49  ad_casadi.initLib();
50  ad_casadi.loadLib();
51 
52  ad_casadi.evalFunction(q, v, tau);
53 
54  BOOST_CHECK(ad_casadi.ddq.isApprox(data.ddq));
55  BOOST_CHECK(ad_casadi.ddq_dq.isApprox(data.ddq_dq));
56  BOOST_CHECK(ad_casadi.ddq_dv.isApprox(data.ddq_dv));
57  BOOST_CHECK(ad_casadi.ddq_dtau.isApprox(data.Minv));
58 }
59 
60 BOOST_AUTO_TEST_SUITE_END()
pinocchio::DataTpl
Definition: context/generic.hpp:25
pinocchio::Convention::WORLD
@ WORLD
pinocchio.casadi::AutoDiffABADerivatives
Definition: casadi-algo.hpp:296
rnea-derivatives.hpp
setup.data
data
Definition: cmake/cython/setup.in.py:48
pinocchio::python::Scalar
context::Scalar Scalar
Definition: admm-solver.cpp:29
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::aba
const DataTpl< Scalar, Options, JointCollectionTpl >::TangentVectorType & aba(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVectorType1 > &v, const Eigen::MatrixBase< TangentVectorType2 > &tau, const Convention convention=Convention::LOCAL)
The Articulated-Body algorithm. It computes the forward dynamics, aka the joint accelerations given t...
pinocchio::python::context::Model
ModelTpl< Scalar, Options > Model
Definition: bindings/python/context/generic.hpp:63
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
rnea.hpp
aba-derivatives.hpp
casadi-algo.hpp
aba.hpp
anymal-simulation.model
model
Definition: anymal-simulation.py:8
forward-dynamics-derivatives.tau
tau
Definition: forward-dynamics-derivatives.py:25
joint-configuration.hpp
pinocchio::python::context::Data
DataTpl< Scalar, Options > Data
Definition: bindings/python/context/generic.hpp:64
cartpole.v
v
Definition: cartpole.py:153
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(test_aba_derivatives_casadi_algo)
Definition: unittest/casadi/aba-derivatives.cpp:24
q
q
pinocchio::computeABADerivatives
void computeABADerivatives(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVectorType1 > &v, const Eigen::MatrixBase< TangentVectorType2 > &tau, const Eigen::MatrixBase< MatrixType1 > &aba_partial_dq, const Eigen::MatrixBase< MatrixType2 > &aba_partial_dv, const Eigen::MatrixBase< MatrixType3 > &aba_partial_dtau)
The derivatives of the Articulated-Body algorithm.
fill
fill
casadi.hpp
sample-models.hpp
pinocchio::ModelTpl
Definition: context/generic.hpp:20


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