| 9 | namespace aligator { |
| 10 | namespace python { |
| 11 | void exposeProblem() { |
| 12 | using context::ConstVectorRef; |
| 13 | using context::CostAbstract; |
| 14 | using context::Manifold; |
| 15 | using context::Scalar; |
| 16 | using context::StageData; |
| 17 | using context::StageModel; |
| 18 | using context::TrajOptData; |
| 19 | using context::TrajOptProblem; |
| 20 | using context::UnaryFunction; |
| 21 | |
| 22 | using PolyUnaryFunction = xyz::polymorphic<UnaryFunction>; |
| 23 | using PolyFunction = xyz::polymorphic<context::StageFunction>; |
| 24 | using PolyStage = xyz::polymorphic<StageModel>; |
| 25 | using PolyCost = xyz::polymorphic<CostAbstract>; |
| 26 | using PolyManifold = xyz::polymorphic<Manifold>; |
| 27 | using PolySet = xyz::polymorphic<context::ConstraintSet>; |
| 28 | |
| 29 | bp::class_<TrajOptProblem>("TrajOptProblem", "Define a shooting problem.", |
| 30 | bp::no_init) |
| 31 | .def( |
| 32 | bp::init<PolyUnaryFunction, const std::vector<PolyStage> &, PolyCost>( |
| 33 | "Constructor adding the initial constraint explicitly.", |
| 34 | ("self"_a, "init_constraint", "stages", "term_cost"))) |
| 35 | .def(bp::init<ConstVectorRef, const std::vector<PolyStage> &, PolyCost>( |
| 36 | "Constructor for an initial value problem.", |
| 37 | ("self"_a, "x0", "stages", "term_cost"))) |
| 38 | .def(bp::init<PolyUnaryFunction, PolyCost>( |
| 39 | "Constructor adding the initial constraint explicitly (without " |
| 40 | "stages).", |
| 41 | ("self"_a, "init_constraint", "term_cost"))) |
| 42 | .def(bp::init<ConstVectorRef, const int, PolyManifold, PolyCost>( |
| 43 | "Constructor for an initial value problem (without pre-allocated " |
| 44 | "stages).", |
| 45 | ("self"_a, "x0", "nu", "space", "term_cost"))) |
| 46 | .def<void (TrajOptProblem::*)(const PolyStage &)>( |
| 47 | "addStage", &TrajOptProblem::addStage, ("self"_a, "new_stage"), |
| 48 | "Add a stage to the problem.") |
| 49 | .def_readonly("stages", &TrajOptProblem::stages_, |
| 50 | "Stages of the shooting problem.") |
| 51 | .def_readwrite("term_cost", &TrajOptProblem::term_cost_, |
| 52 | "Problem terminal cost.") |
| 53 | .def_readwrite("term_constraints", &TrajOptProblem::term_cstrs_, |
| 54 | "Set of terminal constraints.") |
| 55 | .add_property("num_steps", &TrajOptProblem::numSteps, |
| 56 | "Number of stages in the problem.CostPtr") |
| 57 | .add_property("x0_init", &TrajOptProblem::getInitState, |
| 58 | &TrajOptProblem::setInitState, "Initial state.") |
| 59 | .add_property("init_constraint", &TrajOptProblem::init_constraint_, |
| 60 | "Get initial state constraint.") |
| 61 | .def<void (TrajOptProblem::*)(const PolyFunction &, const PolySet &)>( |
| 62 | "addTerminalConstraint", &TrajOptProblem::addTerminalConstraint, |
| 63 | ("self"_a, "func", "set"), "Add a terminal constraint.") |
| 64 | .def("removeTerminalConstraint", |
| 65 | &TrajOptProblem::removeTerminalConstraints, |
| 66 | eigenpy::deprecated_member<>( |
| 67 | "This method is deprecated (due to a typo which was fixed). Use " |
| 68 | "removeTerminalConstraints instead."), |
no outgoing calls
no test coverage detected