expose-contact-inverse-dynamics.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2024 INRIA
3 //
4 
5 #define BOOST_PYTHON_MAX_ARITY 24
6 
10 
12 
13 namespace pinocchio
14 {
15  namespace python
16  {
17 
18 #ifndef PINOCCHIO_PYTHON_SKIP_ALGORITHM_CONSTRAINED_DYNAMICS
19  typedef context::Scalar Scalar;
21  typedef const Eigen::Ref<const VectorXs> ConstRefVectorXs;
22  enum
23  {
25  };
26 
30  const ConstRefVectorXs & c_ref,
31  const context::RigidConstraintModelVector & contact_models,
32  context::RigidConstraintDataVector & contact_datas,
33  const context::CoulombFrictionConeVector & cones,
34  const ConstRefVectorXs & R,
35  const ConstRefVectorXs & constraint_correction,
36  ProximalSettingsTpl<Scalar> & settings,
37  const boost::optional<ConstRefVectorXs> & lambda_guess = boost::none)
38  {
40  model, data, c_ref, contact_models, contact_datas, cones, R, constraint_correction,
41  settings, lambda_guess);
42  }
43 
50  Scalar dt,
51  const context::RigidConstraintModelVector & contact_models,
52  context::RigidConstraintDataVector & contact_datas,
53  const context::CoulombFrictionConeVector & cones,
54  ConstRefVectorXs & R,
55  ConstRefVectorXs & constraint_correction,
56  ProximalSettingsTpl<Scalar> & settings,
57  const boost::optional<ConstRefVectorXs> & lambda_guess = boost::none)
58  {
60  model, data, q, v, a, dt, contact_models, contact_datas, cones, R, constraint_correction,
61  settings, lambda_guess);
62  }
63 #endif // PINOCCHIO_PYTHON_SKIP_ALGORITHM_CONSTRAINED_DYNAMICS
64 
66  {
67 #ifndef PINOCCHIO_PYTHON_SKIP_ALGORITHM_CONSTRAINED_DYNAMICS
68  bp::def(
69  "computeContactForces", computeContactImpulses_wrapper,
70  (bp::arg("model"), "data", "c_ref", "contact_models", "contact_datas", "cones", "R",
71  "constraint_correction", bp::arg("settings"), bp::arg("lambda_guess") = boost::none),
72  "Compute the inverse dynamics with frictional contacts, store the result in Data and "
73  "return it.\n\n"
74  "Parameters:\n"
75  "\tmodel: model of the kinematic tree\n"
76  "\tdata: data related to the model\n"
77  "\tc_ref: the reference velocity of contact points\n"
78  "\tcontact_models: list of contact models\n"
79  "\tcontact_datas: list of contact datas\n"
80  "\tcones: list of friction cones\n"
81  "\tR: vector representing the diagonal of the compliance matrix\n"
82  "\tconstraint_correction: vector representing the constraint correction\n"
83  "\tsettings: the settings of the proximal algorithm\n"
84  "\tlambda_guess: initial guess for contact forces\n",
86 
87  bp::def(
88  "contactInverseDynamics", contactInverseDynamics_wrapper,
89  (bp::arg("model"), "data", "q", "v", "a", "dt", "contact_models", "contact_datas", "cones",
90  "R", "constraint_correction", bp::arg("settings"), bp::arg("lambda_guess") = boost::none),
91  "Compute the inverse dynamics with frictional contacts, store the result in Data and "
92  "return it.\n\n"
93  "Parameters:\n"
94  "\tmodel: model of the kinematic tree\n"
95  "\tdata: data related to the model\n"
96  "\tq: the joint configuration vector (size model.nq)\n"
97  "\tv: the joint velocity vector (size model.nv)\n"
98  "\ta: the joint acceleration vector (size model.nv)\n"
99  "\tdt: the time step\n"
100  "\tcontact_models: list of contact models\n"
101  "\tcontact_datas: list of contact datas\n"
102  "\tcones: list of friction cones\n"
103  "\tR: vector representing the diagonal of the compliance matrix\n"
104  "\tconstraint_correction: vector representing the constraint correction\n"
105  "\tsettings: the settings of the proximal algorithm\n"
106  "\tlambda_guess: initial guess for contact forces\n",
108 #endif // PINOCCHIO_PYTHON_SKIP_ALGORITHM_CONSTRAINED_DYNAMICS
109  }
110  } // namespace python
111 } // namespace pinocchio
pinocchio::DataTpl
Definition: context/generic.hpp:25
pinocchio::python::contactInverseDynamics_wrapper
static ConstRefVectorXs contactInverseDynamics_wrapper(const ModelTpl< Scalar, Options, JointCollectionDefaultTpl > &model, DataTpl< Scalar, Options, JointCollectionDefaultTpl > &data, ConstRefVectorXs &q, ConstRefVectorXs &v, ConstRefVectorXs &a, Scalar dt, const context::RigidConstraintModelVector &contact_models, context::RigidConstraintDataVector &contact_datas, const context::CoulombFrictionConeVector &cones, ConstRefVectorXs &R, ConstRefVectorXs &constraint_correction, ProximalSettingsTpl< Scalar > &settings, const boost::optional< ConstRefVectorXs > &lambda_guess=boost::none)
Definition: expose-contact-inverse-dynamics.cpp:44
pinocchio::python::exposeContactInverseDynamics
void exposeContactInverseDynamics()
Definition: expose-contact-inverse-dynamics.cpp:65
pinocchio::python::Options
@ Options
Definition: expose-contact-inverse-dynamics.cpp:24
pinocchio::contactInverseDynamics
const DataTpl< Scalar, Options, JointCollectionTpl >::TangentVectorType & contactInverseDynamics(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, Scalar dt, const std::vector< RigidConstraintModelTpl< Scalar, Options >, ConstraintModelAllocator > &contact_models, std::vector< RigidConstraintDataTpl< Scalar, Options >, ConstraintDataAllocator > &contact_datas, const std::vector< CoulombFrictionConeTpl< Scalar >, CoulombFrictionConelAllocator > &cones, const Eigen::MatrixBase< VectorLikeR > &R, const Eigen::MatrixBase< VectorLikeGamma > &constraint_correction, ProximalSettingsTpl< Scalar > &settings, const boost::optional< VectorLikeLam > &lambda_guess=boost::none)
The Contact Inverse Dynamics algorithm. It computes the inverse dynamics in the presence of contacts,...
Definition: contact-inverse-dynamics.hpp:190
setup.data
data
Definition: cmake/cython/setup.in.py:48
pinocchio::python::Scalar
context::Scalar Scalar
Definition: admm-solver.cpp:29
pinocchio::python::computeContactImpulses_wrapper
static ConstRefVectorXs computeContactImpulses_wrapper(const ModelTpl< Scalar, Options, JointCollectionDefaultTpl > &model, DataTpl< Scalar, Options, JointCollectionDefaultTpl > &data, const ConstRefVectorXs &c_ref, const context::RigidConstraintModelVector &contact_models, context::RigidConstraintDataVector &contact_datas, const context::CoulombFrictionConeVector &cones, const ConstRefVectorXs &R, const ConstRefVectorXs &constraint_correction, ProximalSettingsTpl< Scalar > &settings, const boost::optional< ConstRefVectorXs > &lambda_guess=boost::none)
Definition: expose-contact-inverse-dynamics.cpp:27
pinocchio::python::ConstRefVectorXs
const typedef Eigen::Ref< const VectorXs > ConstRefVectorXs
Definition: admm-solver.cpp:31
R
R
pinocchio::python::VectorXs
context::VectorXs VectorXs
Definition: admm-solver.cpp:30
simulation-contact-dynamics.contact_datas
list contact_datas
Definition: simulation-contact-dynamics.py:60
pinocchio::python::context::Options
@ Options
Definition: bindings/python/context/generic.hpp:40
pinocchio::ProximalSettingsTpl
Structure containing all the settings parameters for the proximal algorithms.
Definition: algorithm/fwd.hpp:13
algorithms.hpp
python
pinocchio::python::v
const Vector3Like & v
Definition: bindings/python/spatial/explog.hpp:66
pinocchio::q
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > & q
Definition: joint-configuration.hpp:1083
a
Vec3f a
pinocchio::python::mimic_not_supported_function
Definition: model-checker.hpp:22
contact-inverse-dynamics.hpp
pinocchio::computeContactImpulses
const DataTpl< Scalar, Options, JointCollectionTpl >::TangentVectorType & computeContactImpulses(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< VectorLikeC > &c_ref, const std::vector< RigidConstraintModelTpl< Scalar, Options >, ConstraintModelAllocator > &contact_models, std::vector< RigidConstraintDataTpl< Scalar, Options >, ConstraintDataAllocator > &contact_datas, const std::vector< CoulombFrictionConeTpl< Scalar >, CoulombFrictionConelAllocator > &cones, const Eigen::MatrixBase< VectorLikeR > &R, const Eigen::MatrixBase< VectorLikeGamma > &constraint_correction, ProximalSettingsTpl< Scalar > &settings, const boost::optional< VectorLikeImp > &impulse_guess=boost::none)
Compute the contact impulses given a target velocity of contact points.
Definition: contact-inverse-dynamics.hpp:56
contact-cholesky.contact_models
list contact_models
Definition: contact-cholesky.py:22
std-vector.hpp
model-checker.hpp
pinocchio::ModelTpl
Definition: context/generic.hpp:20
cartpole.dt
float dt
Definition: cartpole.py:145
pinocchio::python::context::Scalar
PINOCCHIO_PYTHON_SCALAR_TYPE Scalar
Definition: bindings/python/context/generic.hpp:37
pinocchio::model
JointCollectionTpl & model
Definition: joint-configuration.hpp:1082
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:33


pinocchio
Author(s):
autogenerated on Wed Apr 16 2025 02:41:46