27 using ManifoldPtr = xyz::polymorphic<context::Manifold>;
29 register_polymorphic_to_python<
30 xyz::polymorphic<ContinuousDynamicsAbstract>>();
33 bp::class_<PyContinuousDynamics<>, boost::noncopyable>(
34 "ContinuousDynamicsAbstract",
35 "Base class for continuous-time dynamical models (DAEs and ODEs).",
36 bp::init<ManifoldPtr, int>(
"Default constructor: provide the working "
37 "manifold and control space "
39 bp::args(
"self",
"space",
"nu")))
40 .add_property(
"ndx", &ContinuousDynamicsAbstract::ndx,
41 "State space dimension.")
42 .add_property(
"nu", &ContinuousDynamicsAbstract::nu,
43 "Control space dimension.")
44 .def(
"evaluate", bp::pure_virtual(&ContinuousDynamicsAbstract::evaluate),
45 bp::args(
"self",
"x",
"u",
"xdot",
"data"),
46 "Evaluate the DAE functions.")
47 .def(
"computeJacobians",
48 bp::pure_virtual(&ContinuousDynamicsAbstract::computeJacobians),
49 bp::args(
"self",
"x",
"u",
"xdot",
"data"),
50 "Evaluate the DAE function derivatives.")
51 .add_property(
"space",
52 bp::make_function(&ContinuousDynamicsAbstract::space,
53 bp::return_internal_reference<>()),
54 "Get the state space.")
57 .def(conversion_visitor);
59 bp::register_ptr_to_python<shared_ptr<ContinuousDynamicsData>>();
61 bp::class_<ContinousDataWrapper, boost::noncopyable>(
62 "ContinuousDynamicsData",
63 "Data struct for continuous dynamics/DAE models.",
64 bp::init<int, int>(bp::args(
"self",
"ndx",
"nu")))
65 .add_property(
"value",
66 bp::make_getter(&ContinuousDynamicsData::value_,
67 bp::return_internal_reference<>()),
68 "Vector value of the DAE residual.")
70 bp::make_getter(&ContinuousDynamicsData::Jx_,
71 bp::return_internal_reference<>()),
72 "Jacobian with respect to state.")
74 bp::make_getter(&ContinuousDynamicsData::Ju_,
75 bp::return_internal_reference<>()),
76 "Jacobian with respect to controls.")
77 .add_property(
"Jxdot",
78 bp::make_getter(&ContinuousDynamicsData::Jxdot_,
79 bp::return_internal_reference<>()),
80 "Jacobian with respect to :math:`\\dot{x}`.")
82 bp::make_getter(&ContinuousDynamicsData::xdot_,
83 bp::return_internal_reference<>()),
84 "Time derivative :math:`\\dot{x}`.");
87 bp::scope().attr(
"ODEData") = cont_data_cls;
dynamics::ContinuousDynamicsAbstractTpl< Scalar > ContinuousDynamicsAbstract
dynamics::ContinuousDynamicsDataTpl< Scalar > ContinuousDynamicsData