Go to the documentation of this file.
31 int main(
int argc,
const char ** argv)
33 using namespace Eigen;
38 const int NBT = 1000 * 100;
41 std::cout <<
"(the time score in debug mode is not relevant) " << std::endl;
52 const std::string ff_option = argv[2];
53 if (ff_option ==
"-no-ff")
64 std::cout <<
"nq = " <<
model.nq << std::endl;
65 std::cout <<
"nv = " <<
model.nv << std::endl;
66 std::cout <<
"--" << std::endl;
70 const std::string RF =
"RLEG_ANKLE_R";
71 const std::string LF =
"LLEG_ANKLE_R";
76 contact_models_6D6D.push_back(ci_RF);
77 contact_models_6D6D.push_back(ci_LF);
82 contact_datas_6D6D.push_back(cd_RF);
84 contact_datas_6D6D.push_back(cd_LF);
86 VectorXd qmax = Eigen::VectorXd::Ones(
model.nq);
105 rnea_derivatives_code_gen.
initLib();
106 rnea_derivatives_code_gen.
loadLib();
109 aba_derivatives_code_gen.
initLib();
110 aba_derivatives_code_gen.
loadLib();
113 model, contact_models_6D6D);
114 constraint_dynamics_derivatives_code_gen.
initLib();
115 constraint_dynamics_derivatives_code_gen.
loadLib();
122 for (
size_t i = 0;
i < NBT; ++
i)
125 qdots[
i] = Eigen::VectorXd::Random(
model.nv);
126 qddots[
i] = Eigen::VectorXd::Random(
model.nv);
127 taus[
i] = Eigen::VectorXd::Random(
model.nv);
135 std::cout <<
"RNEA = \t\t";
136 timer.
toc(std::cout, NBT);
141 rnea_code_gen.
evalFunction(
qs[_smooth], qdots[_smooth], qddots[_smooth]);
143 std::cout <<
"RNEA generated = \t\t";
144 timer.
toc(std::cout, NBT);
149 rnea_code_gen.
evalJacobian(
qs[_smooth], qdots[_smooth], qddots[_smooth]);
151 std::cout <<
"RNEA partial derivatives auto diff + code gen = \t\t";
152 timer.
toc(std::cout, NBT);
157 rnea_derivatives_code_gen.
evalFunction(
qs[_smooth], qdots[_smooth], qddots[_smooth]);
159 std::cout <<
"RNEA partial derivatives code gen = \t\t";
160 timer.
toc(std::cout, NBT);
174 std::cout <<
"CRBA = \t\t";
175 timer.
toc(std::cout, NBT);
182 std::cout <<
"CRBA generated = \t\t";
183 timer.
toc(std::cout, NBT);
190 std::cout <<
"Minv = \t\t";
191 timer.
toc(std::cout, NBT);
198 std::cout <<
"Minv generated = \t\t";
199 timer.
toc(std::cout, NBT);
206 std::cout <<
"ABA = \t\t";
207 timer.
toc(std::cout, NBT);
212 aba_code_gen.
evalFunction(
qs[_smooth], qdots[_smooth], taus[_smooth]);
214 std::cout <<
"ABA generated = \t\t";
215 timer.
toc(std::cout, NBT);
220 aba_code_gen.
evalJacobian(
qs[_smooth], qdots[_smooth], taus[_smooth]);
222 std::cout <<
"ABA partial derivatives auto diff + code gen = \t\t";
223 timer.
toc(std::cout, NBT);
228 aba_derivatives_code_gen.
evalFunction(
qs[_smooth], qdots[_smooth], qddots[_smooth]);
230 std::cout <<
"ABA partial derivatives code gen = \t\t";
231 timer.
toc(std::cout, NBT);
238 model,
data,
qs[_smooth], qdots[_smooth], qddots[_smooth], contact_models_6D6D,
241 model,
data, contact_models_6D6D, contact_datas_6D6D);
243 std::cout <<
"contact dynamics derivatives 6D,6D = \t\t";
244 timer.
toc(std::cout, NBT);
250 qs[_smooth], qdots[_smooth], qddots[_smooth]);
252 std::cout <<
"contact dynamics derivatives 6D,6D code gen = \t\t";
253 timer.
toc(std::cout, NBT);
void evalFunction(const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVector1 > &v, const Eigen::MatrixBase< TangentVector2 > &tau)
void computeConstraintDynamicsDerivatives(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const std::vector< RigidConstraintModelTpl< Scalar, Options >, ConstraintModelAllocator > &contact_models, std::vector< RigidConstraintDataTpl< Scalar, Options >, ConstraintDataAllocator > &contact_data, const ProximalSettingsTpl< Scalar > &settings, const Eigen::MatrixBase< MatrixType1 > &ddq_partial_dq, const Eigen::MatrixBase< MatrixType2 > &ddq_partial_dv, const Eigen::MatrixBase< MatrixType3 > &ddq_partial_dtau, const Eigen::MatrixBase< MatrixType4 > &lambda_partial_dq, const Eigen::MatrixBase< MatrixType5 > &lambda_partial_dv, const Eigen::MatrixBase< MatrixType6 > &lambda_partial_dtau)
void evalFunction(const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVector1 > &v, const Eigen::MatrixBase< TangentVector2 > &a)
void evalFunction(const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVector1 > &v, const Eigen::MatrixBase< TangentVector2 > &a)
void humanoidRandom(ModelTpl< Scalar, Options, JointCollectionTpl > &model, bool usingFF=true)
Create a humanoid kinematic tree with 6-DOF limbs and random joint placements.
JointModelFreeFlyerTpl< Scalar > JointModelFreeFlyer
const DataTpl< Scalar, Options, JointCollectionTpl >::MatrixXs & crba(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const Convention convention=Convention::LOCAL)
Computes the upper triangular part of the joint space inertia matrix M by using the Composite Rigid B...
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...
int main(int argc, const char **argv)
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.
@ CONTACT_6D
Point contact model.
const DataTpl< Scalar, Options, JointCollectionTpl >::RowMatrixXs & computeMinverse(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q)
Computes the inverse of the joint space inertia matrix using Articulated Body formulation.
void evalFunction(const Eigen::MatrixBase< ConfigVectorType > &q)
void loadLib(const bool generate_if_not_exist=true, const std::string &gcc_path="/usr/bin/gcc", const std::string &compile_options="-Ofast")
void initConstraintDynamics(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const std::vector< RigidConstraintModelTpl< Scalar, Options >, Allocator > &contact_models)
Init the forward dynamics data according to the contact information contained in contact_models.
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...
void evalFunction(const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVector1 > &v, const Eigen::MatrixBase< TangentVector2 > &tau)
#define PINOCCHIO_STD_VECTOR_WITH_EIGEN_ALLOCATOR(T)
void evalJacobian(const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVector1 > &v, const Eigen::MatrixBase< TangentVector2 > &tau)
std::vector< T, Eigen::aligned_allocator< T > > aligned_vector
void evalJacobian(const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVector1 > &v, const Eigen::MatrixBase< TangentVector2 > &a)
const DataTpl< Scalar, Options, JointCollectionTpl >::TangentVectorType & rnea(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 > &a)
The Recursive Newton-Euler algorithm. It computes the inverse dynamics, aka the joint torques accordi...
void evalFunction(const Eigen::MatrixBase< ConfigVectorType > &q)
void evalFunction(const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVector1 > &v, const Eigen::MatrixBase< TangentVector2 > &tau)
const DataTpl< Scalar, Options, JointCollectionTpl >::TangentVectorType & constraintDynamics(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 std::vector< RigidConstraintModelTpl< Scalar, Options >, ConstraintModelAllocator > &contact_models, std::vector< RigidConstraintDataTpl< Scalar, Options >, ConstraintDataAllocator > &contact_datas, ProximalSettingsTpl< Scalar > &settings)
Computes the forward dynamics with contact constraints according to a given list of contact informati...
Main pinocchio namespace.
#define PINOCCHIO_MODEL_DIR
pinocchio
Author(s):
autogenerated on Thu Dec 19 2024 03:41:33