aligator
0.19.0
A versatile and efficient C++ library for real-time constrained trajectory optimization.
Toggle main menu visibility
Loading...
Searching...
No Matches
expose-croco-compat.cpp
Go to the documentation of this file.
1
3
#ifdef ALIGATOR_WITH_CROCODDYL_COMPAT
4
#include "
aligator/python/fwd.hpp
"
5
6
#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
7
#include "
aligator/core/traj-opt-problem.hpp
"
8
#include "
aligator/compat/crocoddyl/action-model-wrap.hpp
"
9
#include "
aligator/compat/crocoddyl/problem-wrap.hpp
"
10
#include "
aligator/compat/crocoddyl/state-wrap.hpp
"
11
#endif
12
13
namespace
aligator
{
14
namespace
python
{
15
16
void
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<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(bp::init<shared_ptr<StateAbstract>>(bp::args(
"self"
,
"state"
)))
55
.def_readonly(
"croc_state"
, &StateWrapper::croc_state)
56
.def(
PolymorphicMultiBaseVisitor<context::Manifold>
());
57
}
58
59
}
// namespace python
60
}
// namespace aligator
61
#endif
action-model-wrap.hpp
fwd.hpp
aligator::compat::croc::context::CrocActionModel
crocoddyl::ActionModelAbstractTpl< Scalar > CrocActionModel
Definition
context.hpp:25
aligator::context::Scalar
double Scalar
Definition
context.hpp:9
aligator::python
The Python bindings.
Definition
blk-matrix.hpp:7
aligator
Main package namespace.
Definition
action-model-wrap.hpp:14
problem-wrap.hpp
state-wrap.hpp
aligator::python::PolymorphicMultiBaseVisitor
Definition
polymorphic.hpp:107
traj-opt-problem.hpp
bindings
python
src
compat
expose-croco-compat.cpp
Generated by
1.17.0