pinocchio  3.7.0
A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
 
Loading...
Searching...
No Matches
generic.hpp
1//
2// Copyright (c) 2022-2025 INRIA
3//
4
5#ifndef __pinocchio_context_generic_hpp__
6#define __pinocchio_context_generic_hpp__
7
8#include <Eigen/Core>
9#include "pinocchio/container/aligned-vector.hpp"
10
11namespace pinocchio
12{
13
14 template<typename _Scalar, int _Options>
15 struct JointCollectionDefaultTpl;
16 template<
17 typename _Scalar,
18 int _Options = PINOCCHIO_OPTIONS_DEFAULT,
19 template<typename S, int O> class JointCollectionTpl = JointCollectionDefaultTpl>
20 struct ModelTpl;
21 template<
22 typename _Scalar,
23 int _Options = PINOCCHIO_OPTIONS_DEFAULT,
24 template<typename S, int O> class JointCollectionTpl = JointCollectionDefaultTpl>
25 struct DataTpl;
26 template<typename _Scalar, int _Options = PINOCCHIO_OPTIONS_DEFAULT>
27 struct SE3Tpl;
28 template<typename _Scalar, int _Options = PINOCCHIO_OPTIONS_DEFAULT>
29 class MotionTpl;
30 template<typename _Scalar, int _Options = PINOCCHIO_OPTIONS_DEFAULT>
31 class ForceTpl;
32 template<typename _Scalar, int _Options = PINOCCHIO_OPTIONS_DEFAULT>
33 struct InertiaTpl;
34 template<typename _Scalar, int _Options>
35 struct RigidConstraintModelTpl;
36 template<typename _Scalar, int _Options>
37 struct RigidConstraintDataTpl;
38
39 template<typename _Scalar>
40 struct CoulombFrictionConeTpl;
41 template<typename _Scalar>
42 struct DualCoulombFrictionConeTpl;
43
44#define PINOCCHIO_COMMON_TYPEDEF(Scalar, Options) \
45 typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1, Options> VectorXs; \
46 typedef Eigen::Matrix<Scalar, 6, Eigen::Dynamic, Options> Matrix6xs; \
47 typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Options> MatrixXs; \
48 typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor | Options> \
49 RowMatrixXs; \
50 typedef Eigen::Matrix<Scalar, 3, Eigen::Dynamic, Options> Matrix3x; \
51 typedef Eigen::Matrix<Scalar, 3, 1, Options> Vector3; \
52 typedef Eigen::Matrix<Scalar, 6, 10, Options> BodyRegressorType; \
53 \
54 typedef ModelTpl<Scalar, Options> Model; \
55 typedef DataTpl<Scalar, Options> Data; \
56 \
57 typedef CoulombFrictionConeTpl<Scalar> CoulombFrictionCone; \
58 typedef DualCoulombFrictionConeTpl<Scalar> DualCoulombFrictionCone; \
59 \
60 typedef RigidConstraintModelTpl<Scalar, Options> RigidConstraintModel; \
61 typedef RigidConstraintDataTpl<Scalar, Options> RigidConstraintData; \
62 \
63 typedef PINOCCHIO_STD_VECTOR_WITH_EIGEN_ALLOCATOR(CoulombFrictionCone) \
64 CoulombFrictionConeVector; \
65 typedef PINOCCHIO_STD_VECTOR_WITH_EIGEN_ALLOCATOR(DualCoulombFrictionCone) \
66 DualCoulombFrictionConeVector; \
67 typedef PINOCCHIO_STD_VECTOR_WITH_EIGEN_ALLOCATOR(RigidConstraintModel) \
68 RigidConstraintModelVector; \
69 typedef PINOCCHIO_STD_VECTOR_WITH_EIGEN_ALLOCATOR(RigidConstraintData) \
70 RigidConstraintDataVector; \
71 \
72 typedef SE3Tpl<Scalar, Options> SE3; \
73 typedef MotionTpl<Scalar, Options> Motion; \
74 typedef ForceTpl<Scalar, Options> Force; \
75 typedef InertiaTpl<Scalar, Options> Inertia;
76
77 namespace context
78 {
79 typedef PINOCCHIO_SCALAR_TYPE Scalar;
80 enum
81 {
82 Options = PINOCCHIO_OPTIONS_DEFAULT
83 };
84
85 PINOCCHIO_COMMON_TYPEDEF(Scalar, Options)
86
87 } // namespace context
88
89 // Read and write
90 template<typename Derived>
91 Eigen::Ref<typename Derived::PlainObject> make_ref(const Eigen::MatrixBase<Derived> & x)
92 {
93 return Eigen::Ref<typename Derived::PlainObject>(x.const_cast_derived());
94 }
95
96 // Read-only
97 template<typename M>
98 auto make_const_ref(Eigen::MatrixBase<M> const & m) -> Eigen::Ref<typename M::PlainObject const>
99 {
100 return m;
101 }
102
103} // namespace pinocchio
104
105#endif // #ifndef __pinocchio_context_generic_hpp__
Main pinocchio namespace.
Definition treeview.dox:11