9#include <eigenpy/optional.hpp>
15#ifdef ALIGATOR_WITH_CROCODDYL_COMPAT
16void exposeCrocoddylCompat();
20#define _c(Enum, name) value(#name, Enum::name)
22 bp::enum_<VerboseLevel>(
"VerboseLevel",
23 "Verbosity level to be used in solvers.")
29 bp::enum_<MultiplierUpdateMode>(
30 "MultiplierUpdateMode",
"Enum for the kind of multiplier update to use.")
35 bp::enum_<LinesearchMode>(
"LinesearchMode",
"Linesearch mode.")
39 bp::enum_<RolloutType>(
"RolloutType",
"Rollout type.")
44 bp::enum_<HessianApprox>(
"HessianApprox",
45 "Level of approximation for the Hessian.")
51 bp::enum_<StepAcceptanceStrategy>(
"StepAcceptanceStrategy",
52 "Step acceptance strategy.")
54 .value(
"SA_LINESEARCH_NONMONOTONE",
62template <
typename MatType,
bool NoProxy = false>
64 using vector_type = std::vector<MatType>;
65 auto full_name = std::string(
"StdVec_").append(name);
66 eigenpy::StdVectorPythonVisitor<vector_type, NoProxy>::expose(
68 eigenpy::details::overload_base_get_item_for_std_vector<vector_type>());
72 using VecXBool = Eigen::Matrix<bool, Eigen::Dynamic, 1>;
73 using context::MatrixRef;
74 using context::MatrixXs;
76 using context::Vector3s;
77 using context::VectorRef;
78 using context::VectorXs;
80 eigenpy::StdContainerFromPythonList<
81 std::vector<std::string>>::register_converter();
82 StdVectorPythonVisitor<std::vector<long>,
true>::expose(
"StdVec_long");
83 StdVectorPythonVisitor<std::vector<bool>,
true>::expose(
"StdVec_bool");
84 StdVectorPythonVisitor<std::vector<int>,
true>::expose(
"StdVec_int");
85 StdVectorPythonVisitor<std::vector<Scalar>,
true>::expose(
"StdVec_Scalar");
92 StdVectorPythonVisitor<std::vector<VectorRef>,
true>::expose(
"StdVec_VecRef");
93 StdVectorPythonVisitor<std::vector<MatrixRef>,
true>::expose(
"StdVec_MatRef");
104 using aligator::context::ConstVectorRef;
106 bp::docstring_options module_docstring_options(
true,
true,
true);
108 bp::scope().attr(
"__version__") = ALIGATOR_VERSION;
109#ifdef ALIGATOR_MULTITHREADING
111 "Get the number of available threads.");
113 "Get the current number of threads.");
115 (
"num_threads"_a,
"dynamic"_a =
true));
117 eigenpy::enableEigenPy();
119 eigenpy::OptionalConverter<ConstVectorRef, std::optional>::registration();
120 eigenpy::detail::NoneToPython<std::nullopt_t>::registration();
123 eigenpy::StdVectorPythonVisitor<std::vector<std::string_view>,
true>::expose(
124 "StdVec_StringView");
126 bp::import(
"warnings");
127#ifdef ALIGATOR_WITH_PINOCCHIO
128 bp::import(
"pinocchio");
132 "has_pinocchio_features",
133 +[]()
constexpr ->
bool {
135#ifdef ALIGATOR_WITH_PINOCCHIO
141 "Whether Aligator (and its Python bindings) were compiled with support "
170#ifdef ALIGATOR_WITH_PINOCCHIO
176#ifdef ALIGATOR_WITH_CROCODDYL_COMPAT
179 exposeCrocoddylCompat();
BOOST_PYTHON_MODULE(MODULE_NAME)
Namespace for modelling system dynamics.
std::size_t get_current_threads()
Get the current number of threads.
void set_default_options(std::size_t num_threads, bool dynamic=true)
std::size_t get_available_threads()
void exposeStdVectorEigenStdAlloc(const char *name)
void exposeGAR()
Expose GAR module.
void exposeConstraint()
Expose constraints.
void exposeStage()
Expose StageModel and StageData.
void register_string_view_converter()
static void exposeEnums()
static void exposeContainers()
void exposeUtils()
Expose utils.
void exposeCosts()
Expose cost functions.
void exposeManifolds()
Expose manifolds.
bp::object get_namespace(const std::string &name)
Create or retrieve a Python scope (that is, a class or module namespace).
void exposeSolvers()
Expose solvers.
void exposeDynamics()
Expose discrete dynamics.
void exposeIntegrators()
Expose numerical integrators.
void exposePinocchioDynamics()
void exposeCallbacks()
Expose solver callbacks.
void exposePinocchioFunctions()
void exposeFilter()
Expose filter strategy.
void exposeProblem()
Expose TrajOptProblem.
void exposeContinuousDynamics()
Expose continuous dynamics.
void exposeAutodiff()
Expose autodiff helpers.
void exposeFunctions()
Expose stagewise function classes.
void exposeExplicitIntegrators()
void exposePinocchioSpaces()
VerboseLevel
Verbosity level.
@ NONLINEAR
Nonlinear rollout, using the full dynamics.
@ GAUSS_NEWTON
Use the Gauss-Newton approximation.
@ BFGS
Use a BFGS-type approximation.
@ EXACT
Use exact Hessian.
LinesearchMode
Whether to use merit functions in primal or primal-dual mode.