aligator  0.10.0
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
Loading...
Searching...
No Matches
expose-explicit-integrators.cpp
Go to the documentation of this file.
1
3
6
11
12namespace aligator {
13namespace python {
14using context::Scalar;
15using namespace aligator::dynamics;
22using xyz::polymorphic;
23
25 using ODEType = ODEAbstractTpl<Scalar>;
26
28
29 using PyExplicitIntegrator = PyExplicitDynamics<ExplicitIntegratorAbstract>;
30
31 PolymorphicMultiBaseVisitor<ExplicitIntegratorAbstract, ExplicitDynamics,
32 DynamicsModel>
33 conversions_visitor;
34
35 register_polymorphic_to_python<polymorphic<ExplicitIntegratorAbstract>>();
36 bp::class_<PyExplicitIntegrator, bp::bases<ExplicitDynamics>,
37 boost::noncopyable>("ExplicitIntegratorAbstract",
38 bp::init<const polymorphic<ODEType> &>(
39 "Construct the integrator from an ODE.",
40 bp::args("self", "cont_dynamics")))
41 .def_readonly("nx2", &ExplicitIntegratorAbstract::nx2,
42 "Next state dimension.")
43 .def_readwrite("differential_dynamics", &ExplicitIntegratorAbstract::ode_,
44 "The underlying differential equation.")
45 // required visitor to allow casting custom Python integrator to
46 // polymorphic<Base>
47 .def(conversions_visitor);
48
49 bp::register_ptr_to_python<shared_ptr<ExplicitIntegratorData>>();
50 bp::class_<ExplicitIntegratorData, bp::bases<ExplicitDynamicsData>>(
51 "ExplicitIntegratorData", "Data struct for explicit time integrators.",
52 bp::no_init)
53 .def_readwrite("continuous_data",
54 &ExplicitIntegratorData::continuous_data);
55
56 bp::class_<IntegratorEulerTpl<Scalar>, bp::bases<ExplicitIntegratorAbstract>>(
57 "IntegratorEuler",
58 "The explicit Euler integrator :math:`x' = x \\oplus \\Delta t f(x, u)`; "
59 "this integrator has error :math:`O(\\Delta t)` "
60 "in the time step :math:`\\Delta t`.",
61 bp::init<const polymorphic<ODEType> &, Scalar>(
62 bp::args("self", "ode", "timestep")))
63 .def_readwrite("timestep", &IntegratorEulerTpl<Scalar>::timestep_,
64 "Time step.")
65 .def(conversions_visitor);
66
67 bp::class_<IntegratorSemiImplEulerTpl<Scalar>,
68 bp::bases<ExplicitIntegratorAbstract>>(
69 "IntegratorSemiImplEuler", "The semi implicit Euler integrator.",
70 bp::init<const polymorphic<ODEType> &, Scalar>(
71 bp::args("self", "ode", "timestep")))
72 .def_readwrite("timestep", &IntegratorSemiImplEulerTpl<Scalar>::timestep_,
73 "Time step.")
74 .def(conversions_visitor);
75 bp::class_<IntegratorSemiImplDataTpl<Scalar>,
76 bp::bases<ExplicitIntegratorData>>("IntegratorSemiImplData",
77 bp::no_init);
78
79 bp::class_<IntegratorRK2Tpl<Scalar>, bp::bases<ExplicitIntegratorAbstract>>(
80 "IntegratorRK2", bp::init<const polymorphic<ODEType> &, Scalar>(
81 bp::args("self", "ode", "timestep")))
82 .def_readwrite("timestep", &IntegratorRK2Tpl<Scalar>::timestep_,
83 "Time step.")
84 .def(conversions_visitor);
85
86 bp::class_<IntegratorRK2DataTpl<Scalar>, bp::bases<ExplicitIntegratorData>>(
87 "IntegratorRK2Data", bp::no_init);
88}
89
90} // namespace python
91} // namespace aligator
Define the explicit Euler integrator.
Namespace for modelling system dynamics.
Main package namespace.
Dynamics model: describes system dynamics through an implicit relation .
Definition fwd.hpp:68
Specific data struct for explicit dynamics ExplicitDynamicsModelTpl.
Definition fwd.hpp:80
Explicit forward dynamics model .
Definition fwd.hpp:77
Base class for (implicit) numerical integrators.
Second-order Runge-Kutta integrator.
Base class for ODE dynamics .