28 using PolyDynamicsModel = xyz::polymorphic<DynamicsModel>;
30 register_polymorphic_to_python<PolyDynamicsModel>();
31 StdVectorPythonVisitor<std::vector<PolyDynamicsModel>,
true>::expose(
33 eigenpy::details::overload_base_get_item_for_std_vector<
34 std::vector<PolyDynamicsModel>>{});
35 bp::class_<PyDynamicsModel, boost::noncopyable>(
37 "Dynamics models are specific ternary functions f(x,u,x') which map "
38 "to the tangent bundle of the next state variable x'.",
39 bp::init<PolyManifold, int>((
"self"_a,
"space",
"nu")))
40 .def(bp::init<PolyManifold, int, PolyManifold>(
41 bp::args(
"self",
"space",
"nu",
"space_next")))
42 .def_readonly(
"space", &DynamicsModel::space_)
43 .def_readonly(
"space_next", &DynamicsModel::space_next_)
44 .add_property(
"nx1", &DynamicsModel::nx1)
45 .add_property(
"nx2", &DynamicsModel::nx2)
46 .def_readonly(
"ndx1", &DynamicsModel::ndx1)
47 .def_readonly(
"nu", &DynamicsModel::nu)
48 .def_readonly(
"ndx2", &DynamicsModel::ndx2)
49 .add_property(
"isExplicit", &DynamicsModel::isExplicit,
50 "Return whether the current model is explicit.")
51 .def(
"evaluate", &DynamicsModel::evaluate,
52 (
"self"_a,
"x",
"u",
"y",
"data"))
53 .def(
"computeJacobians", &DynamicsModel::computeJacobians,
54 (
"self"_a,
"x",
"u",
"y",
"data"))
55 .def(
"computeVectorHessianProducts",
56 &DynamicsModel::computeVectorHessianProducts,
57 (
"self"_a,
"x",
"u",
"y",
"lbda",
"data"))
60 .enable_pickling_(
true);
62 bp::register_ptr_to_python<shared_ptr<DynamicsData>>();
63 bp::class_<DynamicsData, boost::noncopyable>(
"DynamicsData", bp::no_init)
64 .def(bp::init<const DynamicsModel &>((
"self"_a,
"model")))
67 bp::make_getter(&DynamicsData::valref_,
68 bp::return_value_policy<bp::return_by_value>()),
70 .add_property(
"jac_buffer",
72 "Buffer of the full function Jacobian wrt (x,u,y).")
75 bp::make_getter(&DynamicsData::Jx_,
76 bp::return_value_policy<bp::return_by_value>()),
77 "Jacobian with respect to $x$.")
80 bp::make_getter(&DynamicsData::Ju_,
81 bp::return_value_policy<bp::return_by_value>()),
82 "Jacobian with respect to $u$.")
85 bp::make_getter(&DynamicsData::Jy_,
86 bp::return_value_policy<bp::return_by_value>()),
87 "Jacobian with respect to $y$.")
89 "Hessian with respect to $(x, x)$.")
91 "Hessian with respect to $(x, u)$.")
93 "Hessian with respect to $(x, y)$.")
95 "Hessian with respect to $(u, u)$.")
97 "Hessian with respect to $(x, y)$.")
99 "Hessian with respect to $(y, y)$.")