| 29 | using ContactMap = ContactMapTpl<Scalar>; |
| 30 | |
| 31 | void exposeODEs() { |
| 32 | register_polymorphic_to_python<xyz::polymorphic<ODEAbstract>>(); |
| 33 | PolymorphicMultiBaseVisitor<ODEAbstract, ContinuousDynamicsAbstract> |
| 34 | ode_visitor; |
| 35 | |
| 36 | bp::class_<PyODEAbstract<>, bp::bases<ContinuousDynamicsAbstract>, |
| 37 | boost::noncopyable>( |
| 38 | "ODEAbstract", |
| 39 | "Continuous dynamics described by ordinary differential equations " |
| 40 | "(ODEs).", |
| 41 | bp::init<const PolyManifold &, int>(bp::args("self", "space", "nu"))) |
| 42 | .def("forward", bp::pure_virtual(&ODEAbstract::forward), |
| 43 | bp::args("self", "x", "u", "data"), |
| 44 | "Compute the value of the ODE vector field, i.e. the " |
| 45 | "state time derivative :math:`\\dot{x}`.") |
| 46 | .def("dForward", bp::pure_virtual(&ODEAbstract::dForward), |
| 47 | bp::args("self", "x", "u", "data"), |
| 48 | "Compute the derivatives of the ODE vector field with respect " |
| 49 | "to the state-control pair :math:`(x, u)`.") |
| 50 | .def(CreateDataPolymorphicPythonVisitor<ODEAbstract, PyODEAbstract<>>()) |
| 51 | .def(ode_visitor); |
| 52 | |
| 53 | bp::class_<LinearODETpl<Scalar>, bp::bases<ODEAbstract>>( |
| 54 | "LinearODE", |
| 55 | "Linear ordinary differential equation, :math:`\\dot{x} = Ax + Bu`.", |
| 56 | bp::init<PolyManifold, MatrixXs, MatrixXs, VectorXs>( |
| 57 | bp::args("self", "A", "B", "c"))) |
| 58 | .def(bp::init<MatrixXs, MatrixXs, VectorXs>( |
| 59 | "Constructor with just the matrices; a Euclidean state space is " |
| 60 | "assumed.", |
| 61 | bp::args("self", "A", "B", "c"))) |
| 62 | .def_readonly("A", &LinearODETpl<Scalar>::A_, "State transition matrix.") |
| 63 | .def_readonly("B", &LinearODETpl<Scalar>::B_, "Control matrix.") |
| 64 | .def_readonly("c", &LinearODETpl<Scalar>::c_, "Constant drift term.") |
| 65 | .def(ode_visitor); |
| 66 | |
| 67 | bp::class_<CentroidalFwdDynamics, bp::bases<ODEAbstract>>( |
| 68 | "CentroidalFwdDynamics", |
| 69 | "Nonlinear centroidal dynamics with preplanned feet positions", |
| 70 | bp::init<const VectorSpace &, const double, const Vector3s &, |
| 71 | const ContactMap &, const int>( |
| 72 | bp::args("self", "space", "total mass", "gravity", "contact_map", |
| 73 | "force_size"))) |
| 74 | .def_readwrite("contact_map", &CentroidalFwdDynamics::contact_map_) |
| 75 | .def(CreateDataPythonVisitor<CentroidalFwdDynamics>()) |
| 76 | .def(ode_visitor); |
| 77 | |
| 78 | bp::register_ptr_to_python<shared_ptr<CentroidalFwdDataTpl<Scalar>>>(); |
| 79 | bp::class_<CentroidalFwdDataTpl<Scalar>, bp::bases<ODEData>>( |
| 80 | "CentroidalFwdData", bp::no_init); |
| 81 | |
| 82 | bp::class_<ContinuousCentroidalFwdDynamics, bp::bases<ODEAbstract>>( |
| 83 | "ContinuousCentroidalFwdDynamics", |
| 84 | "Nonlinear centroidal dynamics with preplanned feet positions and smooth " |
| 85 | "forces", |
| 86 | bp::init<const VectorSpace &, const double, const Vector3s &, |
| 87 | const ContactMap &, const int>( |
| 88 | bp::args("self", "space", "total mass", "gravity", "contact_map", |
no outgoing calls
no test coverage detected