expose-constrained-dynamics.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020-2021 INRIA
3 //
4 
9 
12 
14 
15 namespace bp = boost::python;
16 
17 namespace pinocchio
18 {
19  namespace python
20  {
21 
23  RigidConstraintModelVector;
25  RigidConstraintDataVector;
26 
27 #ifndef PINOCCHIO_PYTHON_SKIP_ALGORITHM_CONSTRAINED_DYNAMICS
28 
30  const context::Model & model,
32  const context::VectorXs & q,
33  const context::VectorXs & v,
34  const context::VectorXs & tau,
35  const RigidConstraintModelVector & contact_models,
36  RigidConstraintDataVector & contact_datas,
38  {
39  return constraintDynamics(
41  }
42 
44  const context::Model & model,
46  const context::VectorXs & q,
47  const context::VectorXs & v,
48  const context::VectorXs & tau,
49  const RigidConstraintModelVector & contact_models,
50  RigidConstraintDataVector & contact_datas)
51  {
53  }
54 
55 #endif // PINOCCHIO_PYTHON_SKIP_ALGORITHM_CONSTRAINED_DYNAMICS
56 
58  {
59  using namespace Eigen;
60 
61  // Expose type of contacts
62  if (!register_symbolic_link_to_registered_type<ContactType>())
63  {
64  bp::enum_<ContactType>("ContactType")
65  .value("CONTACT_3D", CONTACT_3D)
66  .value("CONTACT_6D", CONTACT_6D)
67  .value("CONTACT_UNDEFINED", CONTACT_UNDEFINED);
68  }
69 
71 
74 
76 
78 
79 #ifndef PINOCCHIO_PYTHON_SKIP_ALGORITHM_CONSTRAINED_DYNAMICS
81 
82  bp::def(
83  "initConstraintDynamics",
86  typename RigidConstraintModelVector::allocator_type>,
87  bp::args("model", "data", "contact_models"),
88  "This function allows to allocate the memory before hand for contact dynamics algorithms.\n"
89  "This allows to avoid online memory allocation when running these algorithms.");
90 
91  bp::def(
92  "constraintDynamics", constraintDynamics_proxy,
93  bp::args(
94  "model", "data", "q", "v", "tau", "contact_models", "contact_datas", "prox_settings"),
95  "Computes the forward dynamics with contact constraints according to a given list of "
96  "Contact information.\n"
97  "When using constraintDynamics for the first time, you should call first "
98  "initConstraintDynamics to initialize the internal memory used in the algorithm.\n"
99  "This function returns joint acceleration of the system. The contact forces are "
100  "stored in the list data.contact_forces.");
101 
102  bp::def(
103  "constraintDynamics", constraintDynamics_proxy_default,
104  bp::args("model", "data", "q", "v", "tau", "contact_models", "contact_datas"),
105  "Computes the forward dynamics with contact constraints according to a given list of "
106  "Contact information.\n"
107  "When using constraintDynamics for the first time, you should call first "
108  "initConstraintDynamics to initialize the internal memory used in the algorithm.\n"
109  "This function returns joint acceleration of the system. The contact forces are "
110  "stored in the list data.contact_forces.");
111 
112 #endif // PINOCCHIO_PYTHON_SKIP_ALGORITHM_CONSTRAINED_DYNAMICS
113  }
114  } // namespace python
115 } // namespace pinocchio
proximal.hpp
pinocchio::python::constraintDynamics_proxy
static const context::VectorXs constraintDynamics_proxy(const context::Model &model, context::Data &data, const context::VectorXs &q, const context::VectorXs &v, const context::VectorXs &tau, const RigidConstraintModelVector &contact_models, RigidConstraintDataVector &contact_datas, context::ProximalSettings &prox_settings)
Definition: expose-constrained-dynamics.cpp:29
boost::python
Eigen
pinocchio::python::context::RigidConstraintData
RigidConstraintDataTpl< Scalar, Options > RigidConstraintData
Definition: bindings/python/context/generic.hpp:146
pinocchio::python::ProximalSettingsPythonVisitor::expose
static void expose()
Definition: bindings/python/algorithm/proximal.hpp:60
pinocchio::DataTpl
Definition: context/generic.hpp:25
registration.hpp
pinocchio::CONTACT_UNDEFINED
@ CONTACT_UNDEFINED
&#160;
Definition: algorithm/contact-info.hpp:23
setup.data
data
Definition: cmake/cython/setup.in.py:48
pinocchio::python::constraintDynamics_proxy_default
static const context::VectorXs constraintDynamics_proxy_default(const context::Model &model, context::Data &data, const context::VectorXs &q, const context::VectorXs &v, const context::VectorXs &tau, const RigidConstraintModelVector &contact_models, RigidConstraintDataVector &contact_datas)
Definition: expose-constrained-dynamics.cpp:43
pinocchio::CONTACT_6D
@ CONTACT_6D
Point contact model.
Definition: algorithm/contact-info.hpp:22
pinocchio::python::ContactCholeskyDecompositionPythonVisitor::expose
static void expose()
Definition: bindings/python/algorithm/contact-cholesky.hpp:155
simulation-contact-dynamics.contact_datas
list contact_datas
Definition: simulation-contact-dynamics.py:60
forward-dynamics-derivatives.tau
tau
Definition: forward-dynamics-derivatives.py:25
pinocchio::context::VectorXs
Eigen::Matrix< Scalar, Eigen::Dynamic, 1, Options > VectorXs
Definition: context/generic.hpp:47
pinocchio::ProximalSettingsTpl
Structure containing all the settings parameters for the proximal algorithms.
Definition: algorithm/fwd.hpp:13
algorithms.hpp
pinocchio::python::exposeConstraintDynamics
void exposeConstraintDynamics()
Definition: expose-constrained-dynamics.cpp:57
python
pinocchio::python::v
const Vector3Like & v
Definition: bindings/python/spatial/explog.hpp:66
pinocchio::initConstraintDynamics
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.
pinocchio::python::RigidConstraintModelPythonVisitor::expose
static void expose()
Definition: bindings/python/algorithm/contact-info.hpp:130
pinocchio::q
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > & q
Definition: joint-configuration.hpp:1083
pinocchio::python::context::Options
@ Options
Definition: bindings/python/context/generic.hpp:40
eigenpy::StdVectorPythonVisitor::expose
static void expose(const std::string &class_name, const bp::def_visitor< DerivedVisitor > &visitor)
pinocchio::python::PINOCCHIO_STD_VECTOR_WITH_EIGEN_ALLOCATOR
typedef PINOCCHIO_STD_VECTOR_WITH_EIGEN_ALLOCATOR(context::RigidConstraintModel) RigidConstraintModelVector
pinocchio::python::RigidConstraintDataPythonVisitor::expose
static void expose()
Definition: bindings/python/algorithm/contact-info.hpp:214
contact-info.hpp
contact-cholesky.contact_models
list contact_models
Definition: contact-cholesky.py:22
std-vector.hpp
pinocchio::JointCollectionDefaultTpl
Definition: context/generic.hpp:15
pinocchio::ModelTpl
Definition: context/generic.hpp:20
contact-cholesky.hpp
constrained-dynamics.hpp
simulation-closed-kinematic-chains.prox_settings
prox_settings
Definition: simulation-closed-kinematic-chains.py:163
pinocchio::CONTACT_3D
@ CONTACT_3D
Definition: algorithm/contact-info.hpp:21
pinocchio::constraintDynamics
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...
pinocchio::python::context::RigidConstraintModel
RigidConstraintModelTpl< Scalar, Options > RigidConstraintModel
Definition: bindings/python/context/generic.hpp: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:27


pinocchio
Author(s):
autogenerated on Thu Dec 19 2024 03:41:29