aligator  0.12.0
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
 
Loading...
Searching...
No Matches
frame-collision.hpp
Go to the documentation of this file.
1#pragma once
2
4#include "./fwd.hpp"
5
6#include <pinocchio/multibody/geometry.hpp>
7#include <pinocchio/multibody/model.hpp>
8#include <pinocchio/multibody/frame.hpp>
9#include <pinocchio/algorithm/geometry.hpp>
10
11#include <proxsuite-nlp/third-party/polymorphic_cxx14.hpp>
12
13namespace aligator {
14
15template <typename Scalar> struct FrameCollisionDataTpl;
16
17template <typename _Scalar>
19public:
20 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
21 using Scalar = _Scalar;
24 using BaseData = typename Base::Data;
25 using Model = pinocchio::ModelTpl<Scalar>;
26 using ManifoldPtr = xyz::polymorphic<ManifoldAbstractTpl<Scalar>>;
27 using SE3 = pinocchio::SE3Tpl<Scalar>;
29 using GeometryModel = pinocchio::GeometryModel;
30
33
34 FrameCollisionResidualTpl(const int ndx, const int nu, const Model &model,
35 const GeometryModel &geom_model,
36 const pinocchio::PairIndex frame_pair_id)
37 : Base(ndx, nu, 1), pin_model_(model), geom_model_(geom_model),
38 frame_pair_id_(frame_pair_id) {
40 geom_model
41 .geometryObjects[geom_model.collisionPairs[frame_pair_id_].first]
42 .parentFrame;
44 geom_model
45 .geometryObjects[geom_model.collisionPairs[frame_pair_id_].second]
46 .parentFrame;
47 }
48
49 void evaluate(const ConstVectorRef &x, BaseData &data) const;
50
51 void computeJacobians(const ConstVectorRef &x, BaseData &data) const;
52
53 shared_ptr<BaseData> createData() const {
54 return allocate_shared_eigen_aligned<Data>(*this);
55 }
56
57protected:
58 pinocchio::PairIndex frame_pair_id_;
59 pinocchio::FrameIndex frame_id1_;
60 pinocchio::FrameIndex frame_id2_;
61};
62
63template <typename Scalar>
65 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
67 using PinData = pinocchio::DataTpl<Scalar>;
68 using PinGeom = pinocchio::GeometryData;
69 using pinPlacement = pinocchio::SE3;
70
74 pinocchio::GeometryData geometry_;
76 typename math_types<Scalar>::Matrix6Xs Jcol_;
77 typename math_types<Scalar>::Matrix6Xs Jcol2_;
82 typename math_types<Scalar>::Vector3s distance_;
83 typename math_types<Scalar>::Vector3s distance2_;
84
86};
87
88} // namespace aligator
89
90#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
91#include "aligator/modelling/multibody/frame-collision.txx"
92#endif
Main package namespace.
FrameCollisionDataTpl(const FrameCollisionResidualTpl< Scalar > &model)
pinPlacement jointToP1_
Placement of collision point to joint.
math_types< Scalar >::Matrix6Xs Jcol2_
StageFunctionDataTpl< Scalar > Base
math_types< Scalar >::Matrix6Xs Jcol_
Jacobian of the collision point.
pinocchio::DataTpl< Scalar > PinData
PinData pin_data_
Pinocchio data object.
pinocchio::GeometryData geometry_
Pinocchio geometry object.
pinocchio::GeometryData PinGeom
math_types< Scalar >::Vector3s distance_
Distance from nearest point to joint for each collision frame.
math_types< Scalar >::Vector3s distance2_
pinocchio::SE3Tpl< Scalar > SE3
xyz::polymorphic< ManifoldAbstractTpl< Scalar > > ManifoldPtr
shared_ptr< BaseData > createData() const
Instantiate a Data object.
FrameCollisionResidualTpl(const int ndx, const int nu, const Model &model, const GeometryModel &geom_model, const pinocchio::PairIndex frame_pair_id)
void computeJacobians(const ConstVectorRef &x, BaseData &data) const
pinocchio::ModelTpl< Scalar > Model
FrameCollisionDataTpl< Scalar > Data
void evaluate(const ConstVectorRef &x, BaseData &data) const
pinocchio::GeometryModel GeometryModel
StageFunctionDataTpl(const int ndx, const int nu, const int nr)
const int nu
Control dimension.
StageFunctionDataTpl< Scalar > Data
Represents unary functions of the form , with no control (or next-state) arguments.
StageFunctionTpl< Scalar > Base