aligator  0.10.0
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
Loading...
Searching...
No Matches
fly-high.hpp
Go to the documentation of this file.
1#pragma once
2
3#ifdef ALIGATOR_WITH_PINOCCHIO
5#include "./fwd.hpp"
6#include <proxsuite-nlp/modelling/spaces/multibody.hpp>
7
8namespace aligator {
9
11template <typename _Scalar>
12struct FlyHighResidualTpl : UnaryFunctionTpl<_Scalar>, frame_api {
13 using Scalar = _Scalar;
15 static constexpr int NR = 2;
16
17 using Base = UnaryFunctionTpl<Scalar>;
18 using BaseData = StageFunctionDataTpl<Scalar>;
19 using Model = pinocchio::ModelTpl<Scalar>;
20
21 struct Data;
22
23 FlyHighResidualTpl(const int ndx, const Model &model,
24 const pinocchio::FrameIndex frame_id, Scalar slope,
25 int nu);
26
27 void evaluate(const ConstVectorRef &x, BaseData &data) const;
28 void computeJacobians(const ConstVectorRef &x, BaseData &data) const;
29
30 shared_ptr<BaseData> createData() const {
31 return std::make_shared<Data>(*this);
32 }
33
34 const auto &getModel() const { return pin_model_; }
35
36 Scalar slope_;
37
38private:
39 Model pin_model_;
40};
41
42template <typename Scalar>
43using FlyHighResidualDataTpl = typename FlyHighResidualTpl<Scalar>::Data;
44
45template <typename Scalar>
46struct FlyHighResidualTpl<Scalar>::Data : StageFunctionDataTpl<Scalar> {
47 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
48 using BaseData::ndx1;
49 using BaseData::nr;
50 using BaseData::nu;
51
52 Data(FlyHighResidualTpl const &model)
53 : BaseData(model.ndx1, model.nu, model.nr), pdata_(model.pin_model_),
54 d_dq(6, model.pin_model_.nv), d_dv(6, model.pin_model_.nv),
55 l_dnu_dq(6, model.pin_model_.nv), l_dnu_dv(6, model.pin_model_.nv),
56 o_dv_dq(3, model.pin_model_.nv), o_dv_dv(3, model.pin_model_.nv),
57 vxJ(3, model.pin_model_.nv) {
58 d_dq.setZero();
59 d_dv.setZero();
60 l_dnu_dq.setZero();
61 l_dnu_dv.setZero();
62 o_dv_dq.setZero();
63 o_dv_dv.setZero();
64 vxJ.setZero();
65 }
66
67 pinocchio::DataTpl<Scalar> pdata_;
68 Matrix6Xs d_dq, d_dv;
69 Matrix6Xs l_dnu_dq, l_dnu_dv;
70 Matrix3Xs o_dv_dq, o_dv_dv, vxJ;
71 Scalar ez;
72};
73
74} // namespace aligator
75
76#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
77#include "aligator/modelling/multibody/fly-high.txx"
78#endif
79#endif
#define ALIGATOR_DYNAMIC_TYPEDEFS(Scalar)
Definition math.hpp:8
Main package namespace.