aligator  0.10.0
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
Loading...
Searching...
No Matches
expose-croco-compat.cpp
Go to the documentation of this file.
1
3#ifdef ALIGATOR_WITH_CROCODDYL_COMPAT
5
6#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
11#endif
12
13namespace aligator {
14namespace python {
15
16void exposeCrocoddylCompat() {
17 bp::import("crocoddyl");
18
19 using context::Scalar;
20 namespace ns_croc = ::aligator::compat::croc;
21 bp::def("convertCrocoddylProblem",
22 &ns_croc::convertCrocoddylProblem<context::Scalar>,
23 bp::args("croc_problem"),
24 "Convert a Crocoddyl problem to an aligator problem.");
25
26 using CrocActionModel = crocoddyl::ActionModelAbstractTpl<Scalar>;
27 using StateAbstract = crocoddyl::StateAbstractTpl<Scalar>;
28 using ns_croc::context::ActionDataWrapper;
29 using ns_croc::context::ActionModelWrapper;
30 using ns_croc::context::DynamicsDataWrapper;
31 using ns_croc::context::StateWrapper;
32
33 bp::class_<ActionModelWrapper, bp::bases<context::StageModel>>(
34 "ActionModelWrapper", "Wrapper for Crocoddyl action models.",
35 bp::init<boost::shared_ptr<CrocActionModel>>(bp::args("action_model")))
36 .def_readonly("action_model", &ActionModelWrapper::action_model_,
37 "Underlying Crocoddyl ActionModel.")
38 .def(PolymorphicMultiBaseVisitor<context::StageModel>());
39
40 bp::register_ptr_to_python<shared_ptr<ActionDataWrapper>>();
41 bp::class_<ActionDataWrapper, bp::bases<context::StageData>>(
42 "ActionDataWrapper", bp::no_init)
43 .def(bp::init<const ActionModelWrapper &>(
44 bp::args("self", "croc_action_model")))
45 .def_readonly("croc_action_data", &ActionDataWrapper::croc_action_data,
46 "Underlying Crocoddyl action data.");
47
48 bp::class_<DynamicsDataWrapper, bp::bases<context::StageFunctionData>>(
49 "DynamicsDataWrapper", bp::no_init)
50 .def(bp::init<const CrocActionModel &>(bp::args("self", "action_model")));
51
52 bp::class_<StateWrapper, bp::bases<context::Manifold>>(
53 "StateWrapper", "Wrapper for a Crocoddyl state.", bp::no_init)
54 .def(
55 bp::init<boost::shared_ptr<StateAbstract>>(bp::args("self", "state")))
56 .def_readonly("croc_state", &StateWrapper::croc_state)
57 .def(PolymorphicMultiBaseVisitor<context::Manifold>());
58}
59
60} // namespace python
61} // namespace aligator
62#endif
crocoddyl::ActionModelAbstractTpl< Scalar > CrocActionModel
Definition context.hpp:25
Main package namespace.