MCPcopy Create free account
hub / github.com/Simple-Robotics/aligator / exposeFunctionBase

Function exposeFunctionBase

bindings/python/src/expose-functions.cpp:33–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31};
32
33void exposeFunctionBase() {
34 register_polymorphic_to_python<PolyFunction>();
35 bp::class_<PyStageFunction<>, boost::noncopyable>(
36 "StageFunction",
37 "Base class for ternary functions f(x,u,x') on a stage of the problem.",
38 bp::no_init)
39 .def(bp::init<const int, const int, const int>(
40 ("self"_a, "ndx", "nu", "nr")))
41 .def("evaluate", bp::pure_virtual(&StageFunction::evaluate),
42 ("self"_a, "x", "u", "data"))
43 .def("computeJacobians",
44 bp::pure_virtual(&StageFunction::computeJacobians),
45 ("self"_a, "x", "u", "data"))
46 .def("computeVectorHessianProducts",
47 &StageFunction::computeVectorHessianProducts,
48 ("self"_a, "x", "u", "lbda", "data"))
49 .def_readonly("ndx1", &StageFunction::ndx1, "Current state space.")
50 .def_readonly("nu", &StageFunction::nu, "Control dimension.")
51 .def_readonly("nr", &StageFunction::nr, "Function codimension.")
52 .def(SlicingVisitor<StageFunction>())
53 .def(func_visitor)
54 .def(CreateDataPolymorphicPythonVisitor<StageFunction,
55 PyStageFunction<>>())
56 .enable_pickling_(true);
57
58 bp::register_ptr_to_python<shared_ptr<StageFunctionData>>();
59
60 bp::class_<FunctionDataWrapper, boost::noncopyable>(
61 "StageFunctionData", "Data struct for holding data about functions.",
62 bp::no_init)
63 .def(bp::init<const StageFunction &>(("self"_a, "model")))
64 .def(bp::init<int, int, int>(bp::args("self", "ndx", "nu", "nr")))
65 .add_property(
66 "value",
67 bp::make_getter(&StageFunctionData::valref_,
68 bp::return_value_policy<bp::return_by_value>()),
69 "Function value.")
70 .add_property("jac_buffer",
71 make_getter_eigen_matrix(&StageFunctionData::jac_buffer_),
72 "Buffer of the full function Jacobian wrt (x,u,y).")
73 .add_property(
74 "vhp_buffer",
75 make_getter_eigen_matrix(&StageFunctionData::vhp_buffer_),
76 "Buffer of the full function vector-Hessian product wrt (x,u,y).")
77 .add_property(
78 "Jx",
79 bp::make_getter(&StageFunctionData::Jx_,
80 bp::return_value_policy<bp::return_by_value>()),
81 "Jacobian with respect to $x$.")
82 .add_property(
83 "Ju",
84 bp::make_getter(&StageFunctionData::Ju_,
85 bp::return_value_policy<bp::return_by_value>()),
86 "Jacobian with respect to $u$.")
87 .add_property(
88 "Hxx",
89 bp::make_getter(&StageFunctionData::Hxx_,
90 bp::return_value_policy<bp::return_by_value>()),

Callers 1

exposeFunctionsFunction · 0.85

Calls 1

make_getter_eigen_matrixFunction · 0.85

Tested by

no test coverage detected