aligator  0.9.0
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
Loading...
Searching...
No Matches
explicit-dynamics.hpp
Go to the documentation of this file.
1
3#pragma once
4
7
10
11#include "proxsuite-nlp/python/polymorphic.hpp"
12
13namespace aligator {
14namespace python {
16
21template <class ExplicitBase = context::ExplicitDynamics>
23 : ExplicitBase,
24 proxsuite::nlp::python::PolymorphicWrapper<
25 PyExplicitDynamics<ExplicitBase>, ExplicitBase> {
28 // All functions in the interface take this type for output
30
31 using ExplicitBase::ExplicitBase;
32
33 void forward(const ConstVectorRef &x, const ConstVectorRef &u,
34 Data &data) const {
35 ALIGATOR_PYTHON_OVERRIDE_PURE(void, "forward", x, u, boost::ref(data));
36 }
37
38 void dForward(const ConstVectorRef &x, const ConstVectorRef &u,
39 Data &data) const {
40 ALIGATOR_PYTHON_OVERRIDE_PURE(void, "dForward", x, u, boost::ref(data));
41 }
42
43 shared_ptr<DynamicsData> createData() const {
44 ALIGATOR_PYTHON_OVERRIDE(shared_ptr<DynamicsData>, ExplicitBase,
45 createData, );
46 }
47
48 shared_ptr<DynamicsData> default_createData() const {
49 return ExplicitBase::createData();
50 }
51};
52
53} // namespace python
54} // namespace aligator
55
56namespace boost::python::objects {
57
58template <>
59struct value_holder<aligator::python::PyExplicitDynamics<>>
60 : proxsuite::nlp::python::OwningNonOwningHolder<
61 aligator::python::PyExplicitDynamics<>> {
62 using OwningNonOwningHolder::OwningNonOwningHolder;
63};
64
65template <>
66struct value_holder<aligator::python::PyExplicitDynamics<
67 aligator::context::ExplicitIntegratorAbstract>>
68 : proxsuite::nlp::python::OwningNonOwningHolder<
69 aligator::python::PyExplicitDynamics<
70 aligator::context::ExplicitIntegratorAbstract>> {
71 using OwningNonOwningHolder::OwningNonOwningHolder;
72};
73
74} // namespace boost::python::objects
#define ALIGATOR_PYTHON_OVERRIDE(ret_type, cname, fname,...)
Define the body of a virtual function override. This is meant to reduce boilerplate code when exposin...
Definition macros.hpp:45
#define ALIGATOR_PYTHON_OVERRIDE_PURE(ret_type, pyname,...)
Define the body of a virtual function override. This is meant to reduce boilerplate code when exposin...
Definition macros.hpp:37
Base definitions for explicit integrators.
DynamicsDataTpl< Scalar > DynamicsData
Definition context.hpp:28
Main package namespace.
Specific data struct for explicit dynamics ExplicitDynamicsModelTpl.
Definition fwd.hpp:83
shared_ptr< DynamicsData > createData() const
void forward(const ConstVectorRef &x, const ConstVectorRef &u, Data &data) const
Evaluate the forward discrete dynamics.
shared_ptr< DynamicsData > default_createData() const
void dForward(const ConstVectorRef &x, const ConstVectorRef &u, Data &data) const
Compute the Jacobians of the forward dynamics.