19 bp::register_ptr_to_python<shared_ptr<StageData>>();
20 StdVectorPythonVisitor<std::vector<shared_ptr<StageData>>,
true>::expose(
23 bp::class_<StageData>(
"StageData",
"Data struct for StageModel objects.",
24 bp::init<const StageModel &>())
25 .def_readonly(
"cost_data", &StageData::cost_data)
26 .def_readwrite(
"dynamics_data", &StageData::dynamics_data)
27 .def_readwrite(
"constraint_data", &StageData::constraint_data);
44 using StageVec = std::vector<PolyStage>;
45 StdVectorPythonVisitor<StageVec, true>::expose(
47 eigenpy::details::overload_base_get_item_for_std_vector<StageVec>());
49#pragma GCC diagnostic push
50#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
51 bp::class_<StageModel>(
53 "A stage of the control problem. Holds costs, dynamics, and constraints.",
55 .def(bp::init<const PolyCost &, const PolyDynamics &>(
56 (
"self"_a,
"cost",
"dynamics")))
57 .def<void (StageModel::*)(
const context::StageConstraint &)>(
58 "addConstraint", &StageModel::addConstraint,
59 eigenpy::deprecated_member<>(
"This method has been deprecated since "
60 "StageConstraint is deprecated."),
61 (
"self"_a,
"constraint"),
"Add an existing constraint to the stage.")
62 .def<void (StageModel::*)(
const PolyFunction &,
const PolyCstrSet &)>(
63 "addConstraint", &StageModel::addConstraint,
64 (
"self"_a,
"func",
"cstr_set"),
65 "Constructs a new constraint (from the underlying function and set) "
66 "and adds it to the stage.")
67 .def_readonly(
"constraints", &StageModel::constraints_,
68 "Get the set of constraints.")
69 .def_readonly(
"dynamics", &StageModel::dynamics_,
"Stage dynamics.")
70 .add_property(
"xspace",
71 bp::make_getter(&StageModel::xspace_,
72 bp::return_internal_reference<>()),
73 "State space for the current state :math:`x_k`.")
74 .add_property(
"xspace_next",
75 bp::make_getter(&StageModel::xspace_next_,
76 bp::return_internal_reference<>()),
77 "State space corresponding to next state :math:`x_{k+1}`.")
78 .add_property(
"uspace",
79 bp::make_getter(&StageModel::uspace_,
80 bp::return_internal_reference<>()),
83 bp::make_getter(&StageModel::cost_,
84 bp::return_internal_reference<>()),
86 .def(
"evaluate", &StageModel::evaluate, (
"self"_a,
"x",
"u",
"y",
"data"),
87 "Evaluate the stage cost, dynamics, constraints.")
88 .def(
"computeFirstOrderDerivatives",
89 &StageModel::computeFirstOrderDerivatives,
90 (
"self"_a,
"x",
"u",
"y",
"data"),
91 "Compute gradients of the stage cost and jacobians of the dynamics "
94 .def(
"computeSecondOrderDerivatives",
95 &StageModel::computeSecondOrderDerivatives,
96 (
"self"_a,
"x",
"u",
"data"),
"Compute Hessians of the stage cost.")
97 .add_property(
"ndx1", &StageModel::ndx1)
98 .add_property(
"ndx2", &StageModel::ndx2)
99 .add_property(
"nu", &StageModel::nu,
"Control space dimension.")
100 .add_property(
"num_primal", &StageModel::numPrimal,
101 "Number of primal variables.")
102 .add_property(
"num_dual", &StageModel::numDual,
103 "Number of dual variables.")
108#pragma GCC diagnostic pop
StageModelTpl< Scalar > StageModel
ManifoldAbstractTpl< Scalar > Manifold
StageDataTpl< Scalar > StageData
ConstraintSetTpl< Scalar > ConstraintSet