proxsuite-nlp  0.10.0
A primal-dual augmented Lagrangian-type solver for nonlinear programming on manifolds.
Loading...
Searching...
No Matches
pinocchio-groups.hpp
Go to the documentation of this file.
1
3#pragma once
4
6
7#include <pinocchio/multibody/liegroup/liegroup-base.hpp>
8#include <pinocchio/algorithm/joint-configuration.hpp>
9
10namespace proxsuite {
11namespace nlp {
12
13namespace pin = pinocchio;
14
17template <typename _LieGroup>
19 : public ManifoldAbstractTpl<typename _LieGroup::Scalar,
20 _LieGroup::Options> {
21public:
22 using LieGroup = _LieGroup;
23 using Scalar = typename LieGroup::Scalar;
24 static constexpr int Options = LieGroup::Options;
27 static_assert(std::is_base_of_v<pin::LieGroupBase<LieGroup>, LieGroup>,
28 "LieGroup template argument should be a subclass of "
29 "pinocchio::LieGroupBase.");
30
33 PinocchioLieGroup(const LieGroup &lg) : lg_(lg) {}
34 PinocchioLieGroup(LieGroup &&lg) : lg_(std::move(lg)) {}
37
38 template <typename... Args>
39 PinocchioLieGroup(Args &&...args) : lg_(std::forward<Args>(args)...) {}
40
41 operator LieGroup() { return lg_; }
42
43 inline int nx() const { return lg_.nq(); }
44 inline int ndx() const { return lg_.nv(); }
45
47
48 void integrate_impl(const ConstVectorRef &x, const ConstVectorRef &v,
49 VectorRef out) const {
50 lg_.integrate(x, v, out);
51 }
52
53 void difference_impl(const ConstVectorRef &x0, const ConstVectorRef &x1,
54 VectorRef vout) const {
55 lg_.difference(x0, x1, vout);
56 }
57
58 void Jintegrate_impl(const ConstVectorRef &x, const ConstVectorRef &v,
59 MatrixRef Jout, int arg) const {
60 switch (arg) {
61 case 0:
62 lg_.dIntegrate_dq(x, v, Jout);
63 break;
64 case 1:
65 lg_.dIntegrate_dv(x, v, Jout);
66 break;
67 }
68 }
69
70 void JintegrateTransport(const ConstVectorRef &x, const ConstVectorRef &v,
71 MatrixRef Jout, int arg) const {
72 lg_.dIntegrateTransport(x, v, Jout, pin::ArgumentPosition(arg));
73 }
74
75 void Jdifference_impl(const ConstVectorRef &x0, const ConstVectorRef &x1,
76 MatrixRef Jout, int arg) const {
77 switch (arg) {
78 case 0:
79 lg_.dDifference(x0, x1, Jout, pin::ARG0);
80 break;
81 case 1:
82 lg_.dDifference(x0, x1, Jout, pin::ARG1);
83 break;
84 }
85 }
86
87 virtual void interpolate_impl(const ConstVectorRef &x0,
88 const ConstVectorRef &x1, const Scalar &u,
89 VectorRef out) const {
90 lg_.interpolate(x0, x1, u, out);
91 }
92
93 VectorXs neutral() const { return lg_.neutral(); }
94
95 VectorXs rand() const { return lg_.random(); }
96 bool isNormalized(const ConstVectorRef &x) const {
97 if (x.size() < nx())
98 return false;
99 return lg_.isNormalized(x);
100 }
101};
102
103template <int D, typename Scalar>
104using SETpl =
106
107template <int D, typename Scalar>
108using SOTpl =
110
111} // namespace nlp
112} // namespace proxsuite
#define PROXSUITE_NLP_DYNAMIC_TYPEDEFS(Scalar)
Definition math.hpp:26
Main package namespace.
Definition bcl-params.hpp:5
Wrap a Pinocchio Lie group into a ManifoldAbstractTpl object.
int nx() const
Get manifold representation dimension.
PinocchioLieGroup(PinocchioLieGroup &&lg)=default
void JintegrateTransport(const ConstVectorRef &x, const ConstVectorRef &v, MatrixRef Jout, int arg) const
Perform the parallel transport operation.
void difference_impl(const ConstVectorRef &x0, const ConstVectorRef &x1, VectorRef vout) const
Implementation of the manifold retraction operation.
VectorXs rand() const
Sample a random point on the manifold.
void Jintegrate_impl(const ConstVectorRef &x, const ConstVectorRef &v, MatrixRef Jout, int arg) const
typename LieGroup::Scalar Scalar
int ndx() const
Get manifold tangent space dimension.
virtual void interpolate_impl(const ConstVectorRef &x0, const ConstVectorRef &x1, const Scalar &u, VectorRef out) const
bool isNormalized(const ConstVectorRef &x) const
Check if the input vector x is a viable element of the manifold.
PinocchioLieGroup(const PinocchioLieGroup &lg)=default
void integrate_impl(const ConstVectorRef &x, const ConstVectorRef &v, VectorRef out) const
Perform the manifold integration operation.
void Jdifference_impl(const ConstVectorRef &x0, const ConstVectorRef &x1, MatrixRef Jout, int arg) const
VectorXs neutral() const
Get the neutral element from the manifold (if this makes sense).