aligator  0.6.1
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
Loading...
Searching...
No Matches
expose-integrators.cpp
Go to the documentation of this file.
1
5
11
12namespace aligator {
13namespace python {
14
16 using context::Scalar;
17 using namespace aligator::dynamics;
18
19 using IntegratorAbstract = IntegratorAbstractTpl<Scalar>;
20 using DAEType = ContinuousDynamicsAbstractTpl<Scalar>;
21 using ODEType = ODEAbstractTpl<Scalar>;
22
24
25 using PyIntegratorAbstract = internal::PyStageFunction<IntegratorAbstract>;
26 bp::class_<PyIntegratorAbstract, bp::bases<context::DynamicsModel>,
27 boost::noncopyable>("IntegratorAbstract",
28 "Base class for numerical integrators.",
29 bp::init<const shared_ptr<DAEType> &>(
30 "Construct the integrator from a DAE.",
31 bp::args("self", "cont_dynamics")))
32 .def_readwrite("continuous_dynamics",
33 &IntegratorAbstract::continuous_dynamics_,
34 "The underlying ODE or DAE.")
35 .add_property("space",
36 bp::make_function(&IntegratorAbstract::space,
37 bp::return_internal_reference<>()),
38 "Return the state manifold.");
39
40 bp::register_ptr_to_python<shared_ptr<IntegratorDataTpl<Scalar>>>();
41 bp::class_<IntegratorDataTpl<Scalar>, bp::bases<DynamicsDataTpl<Scalar>>>(
42 "IntegratorData", "Base class for integrators' data.", bp::no_init)
43 .def_readwrite("continuous_data",
45
47
48 using ExplicitIntegratorAbstract = ExplicitIntegratorAbstractTpl<Scalar>;
49 using PyExplicitIntegrator =
50 internal::PyExplicitDynamics<ExplicitIntegratorAbstract>;
51
52 bp::class_<PyExplicitIntegrator, bp::bases<ExplicitDynamicsModelTpl<Scalar>>,
53 boost::noncopyable>("ExplicitIntegratorAbstract",
54 bp::init<const shared_ptr<ODEType> &>(
55 "Construct the integrator from an ODE.",
56 bp::args("self", "cont_dynamics")))
57 .def_readonly("nx2", &ExplicitIntegratorAbstract::nx2,
58 "Next state dimension.")
59 .def_readwrite("differential_dynamics", &ExplicitIntegratorAbstract::ode_,
60 "The underlying differential equation.");
61
62 bp::register_ptr_to_python<shared_ptr<ExplicitIntegratorDataTpl<Scalar>>>();
63 bp::class_<ExplicitIntegratorDataTpl<Scalar>,
64 bp::bases<ExplicitDynamicsDataTpl<Scalar>>>(
65 "ExplicitIntegratorData", "Data struct for explicit time integrators.",
66 bp::no_init)
67 .def_readwrite("continuous_data",
69
70 bp::class_<IntegratorEulerTpl<Scalar>, bp::bases<ExplicitIntegratorAbstract>>(
71 "IntegratorEuler",
72 "The explicit Euler integrator :math:`x' = x \\oplus \\Delta t f(x, u)`; "
73 "this integrator has error :math:`O(\\Delta t)` "
74 "in the time step :math:`\\Delta t`.",
75 bp::init<shared_ptr<ODEType>, Scalar>(
76 bp::args("self", "ode", "timestep")))
77 .def_readwrite("timestep", &IntegratorEulerTpl<Scalar>::timestep_,
78 "Time step.");
79
80 bp::class_<IntegratorSemiImplEulerTpl<Scalar>,
81 bp::bases<ExplicitIntegratorAbstract>>(
82 "IntegratorSemiImplEuler", "The semi implicit Euler integrator.",
83 bp::init<shared_ptr<ODEType>, Scalar>(
84 bp::args("self", "ode", "timestep")))
85 .def_readwrite("timestep", &IntegratorSemiImplEulerTpl<Scalar>::timestep_,
86 "Time step.");
87 bp::class_<IntegratorSemiImplDataTpl<Scalar>,
88 bp::bases<ExplicitIntegratorDataTpl<Scalar>>>(
89 "IntegratorSemiImplData", bp::no_init);
90
91 bp::class_<IntegratorRK2Tpl<Scalar>, bp::bases<ExplicitIntegratorAbstract>>(
92 "IntegratorRK2", bp::init<shared_ptr<ODEType>, Scalar>(
93 bp::args("self", "ode", "timestep")))
94 .def_readwrite("timestep", &IntegratorRK2Tpl<Scalar>::timestep_,
95 "Time step.");
96
97 bp::class_<IntegratorRK2DataTpl<Scalar>,
98 bp::bases<ExplicitIntegratorDataTpl<Scalar>>>("IntegratorRK2Data",
99 bp::no_init);
100
101 using MidpointType = IntegratorMidpointTpl<Scalar>;
102 bp::class_<MidpointType, bp::bases<IntegratorAbstract>>(
103 "IntegratorMidpoint", bp::init<shared_ptr<DAEType>, Scalar>(
104 bp::args("self", "dae", "timestep")))
105 .def_readwrite("timestep", &MidpointType::timestep_, "Time step.");
106
107 bp::register_ptr_to_python<shared_ptr<IntegratorMidpointDataTpl<Scalar>>>();
108 bp::class_<IntegratorMidpointDataTpl<Scalar>,
109 bp::bases<IntegratorDataTpl<Scalar>>>("IntegratorMidpointData",
110 bp::no_init);
111}
112
113} // namespace python
114} // namespace aligator
Base definitions for numerical integrators.
Define the explicit Euler integrator.
Namespace for modelling system dynamics.
void exposeIntegrators()
Expose numerical integrators.
Main package namespace.
Data class for numerical integrators (IntegratorAbstractTpl).
Second-order Runge-Kutta integrator.