joints-model.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2019 INRIA
3 //
4 
5 #ifndef __pinocchio_serialization_joints_model_hpp__
6 #define __pinocchio_serialization_joints_model_hpp__
7 
8 namespace pinocchio
9 {
10  template<typename Scalar, int Options, template<typename S, int O> class JointCollectionTpl>
11  struct Serialize< JointModelCompositeTpl<Scalar,Options,JointCollectionTpl> >
12  {
13  template<typename Archive>
14  static void run(Archive & ar,
16  {
18 
19  ar & make_nvp("m_nq",joint.m_nq);
20  ar & make_nvp("m_nv",joint.m_nv);
21  ar & make_nvp("m_idx_q",joint.m_idx_q);
22  ar & make_nvp("m_nqs",joint.m_nqs);
23  ar & make_nvp("m_idx_v",joint.m_idx_v);
24  ar & make_nvp("m_nvs",joint.m_nvs);
25  ar & make_nvp("njoints",joint.njoints);
26 
27  ar & make_nvp("joints",joint.joints);
28  ar & make_nvp("jointPlacements",joint.jointPlacements);
29  }
30  };
31 }
32 
33 namespace boost
34 {
35  namespace serialization
36  {
37 
38  // For some older version of gcc, we have to rely on an additional namespace
39  // to avoid ambiguous call to boost::serialization::serialize
40  namespace fix
41  {
42  template <class Archive, typename Derived>
43  void serialize(Archive & ar,
45  const unsigned int version)
46  {
47  split_free(ar, joint, version);
48  }
49  }
50 
51  template<class Archive, typename Derived>
52  void save(Archive & ar,
54  const unsigned int /*version*/)
55  {
56  const pinocchio::JointIndex i_id = joint.id();
57  const int i_q = joint.idx_q(), i_v = joint.idx_v();
58 
59  ar & make_nvp("i_id",i_id);
60  ar & make_nvp("i_q",i_q);
61  ar & make_nvp("i_v",i_v);
62  }
63 
64  template<class Archive, typename Derived>
65  void load(Archive & ar,
67  const unsigned int /*version*/)
68  {
70  int i_q, i_v;
71 
72  ar & make_nvp("i_id",i_id);
73  ar & make_nvp("i_q",i_q);
74  ar & make_nvp("i_v",i_v);
75 
76  joint.setIndexes(i_id,i_q,i_v);
77  }
78 
79  template <class Archive, typename Scalar, int Options, int axis>
80  void serialize(Archive & ar,
82  const unsigned int version)
83  {
85 // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType> >(joint));
86  fix::serialize(ar,*static_cast<pinocchio::JointModelBase<JointType> *>(&joint),version);
87  }
88 
89  template <class Archive, typename Scalar, int Options, int axis>
90  void serialize(Archive & ar,
92  const unsigned int version)
93  {
95 // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType> >(joint));
96  fix::serialize(ar,*static_cast<pinocchio::JointModelBase<JointType> *>(&joint),version);
97  }
98 
99  template <class Archive, typename Scalar, int Options, int axis>
100  void serialize(Archive & ar,
102  const unsigned int version)
103  {
105 // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType> >(joint));
106  fix::serialize(ar,*static_cast<pinocchio::JointModelBase<JointType> *>(&joint),version);
107  }
108 
109  template <class Archive, typename Scalar, int Options>
110  void serialize(Archive & ar,
112  const unsigned int version)
113  {
115 // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType> >(joint));
116  fix::serialize(ar,*static_cast<pinocchio::JointModelBase<JointType> *>(&joint),version);
117  }
118 
119  template <class Archive, typename Scalar, int Options>
120  void serialize(Archive & ar,
122  const unsigned int version)
123  {
125 // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType> >(joint));
126  fix::serialize(ar,*static_cast<pinocchio::JointModelBase<JointType> *>(&joint),version);
127  }
128 
129  template <class Archive, typename Scalar, int Options>
130  void serialize(Archive & ar,
132  const unsigned int version)
133  {
135 // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType> >(joint));
136  fix::serialize(ar,*static_cast<pinocchio::JointModelBase<JointType> *>(&joint),version);
137  }
138 
139  template <class Archive, typename Scalar, int Options>
140  void serialize(Archive & ar,
142  const unsigned int version)
143  {
145 // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType> >(joint));
146  fix::serialize(ar,*static_cast<pinocchio::JointModelBase<JointType> *>(&joint),version);
147  }
148 
149  template <class Archive, typename Scalar, int Options>
150  void serialize(Archive & ar,
152  const unsigned int version)
153  {
155 // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType> >(joint));
156  fix::serialize(ar,*static_cast<pinocchio::JointModelBase<JointType> *>(&joint),version);
157  }
158 
159  template <class Archive, typename Scalar, int Options>
160  void serialize(Archive & ar,
162  const unsigned int version)
163  {
165 // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType> >(joint));
166  fix::serialize(ar,*static_cast<pinocchio::JointModelBase<JointType> *>(&joint),version);
167  ar & make_nvp("axis",joint.axis);
168  }
169 
170  template <class Archive, typename Scalar, int Options>
171  void serialize(Archive & ar,
173  const unsigned int version)
174  {
176  // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType> >(joint));
177  fix::serialize(ar,*static_cast<pinocchio::JointModelBase<JointType> *>(&joint),version);
178  ar & make_nvp("axis",joint.axis);
179  }
180 
181  template <class Archive, typename Scalar, int Options>
182  void serialize(Archive & ar,
184  const unsigned int version)
185  {
187 // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType> >(joint));
188  fix::serialize(ar,*static_cast<pinocchio::JointModelBase<JointType> *>(&joint),version);
189  ar & make_nvp("axis",joint.axis);
190  }
191 
192  template <class Archive, typename Scalar, int Options, template<typename S, int O> class JointCollectionTpl>
193  void serialize(Archive & ar,
195  const unsigned int version)
196  {
198 // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType> >(joint));
199  fix::serialize(ar,*static_cast<pinocchio::JointModelBase<JointType> *>(&joint),version);
200 
202  }
203 
204  template <class Archive, typename Scalar, int Options, template<typename S, int O> class JointCollectionTpl>
205  void serialize(Archive & ar,
207  const unsigned int version)
208  {
210 // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType> >(joint));
211  fix::serialize(ar,*static_cast<pinocchio::JointModelBase<JointType> *>(&joint),version);
212 
214  ar & make_nvp("base_variant",base_object<JointModelVariant>(joint));
215  }
216 
217  template <class Archive, typename JointModel>
218  void serialize(Archive & ar,
220  const unsigned int version)
221  {
222  typedef pinocchio::JointModelMimic<JointModel> JointType;
223  // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType> >(joint));
224  fix::serialize(ar,*static_cast<pinocchio::JointModelBase<JointType> *>(&joint),version);
225 
226  ar & make_nvp("jmodel",joint.jmodel());
227  ar & make_nvp("scaling",joint.scaling());
228  ar & make_nvp("offset",joint.offset());
229  }
230 
231  }
232 }
233 
234 #endif // ifndef __pinocchio_serialization_joints_model_hpp__
235 
static void run(Archive &ar, JointModelCompositeTpl< Scalar, Options, JointCollectionTpl > &joint)
void save(Archive &ar, const pinocchio::JointModelBase< Derived > &joint, const unsigned int)
std::vector< int > m_nvs
Dimension of the segment in the tangent vector.
int m_nq
Dimensions of the config and tangent space of the composite joint.
void setIndexes(JointIndex id, int q, int v)
std::vector< int > m_idx_q
Keep information of both the dimension and the position of the joints in the composition.
SE3::Scalar Scalar
Definition: conversions.cpp:13
const Scalar & offset() const
JointModelVector joints
Vector of joints contained in the joint composite.
void load(Archive &ar, pinocchio::JointModelBase< Derived > &joint, const unsigned int)
const nvp< typename pinocchio::container::aligned_vector< T >::vector_base > make_nvp(const char *name, pinocchio::container::aligned_vector< T > &t)
std::vector< int > m_nqs
Dimension of the segment in the config vector.
int njoints
Number of joints contained in the JointModelComposite.
Main pinocchio namespace.
Definition: timings.cpp:28
JointCollectionDefault::JointModelVariant JointModelVariant
const JointModel & jmodel() const
std::vector< int > m_idx_v
Index in the tangent vector.
static void run(Archive &ar, T &object)
const Scalar & scaling() const
void serialize(Archive &ar, pinocchio::JointModelMimic< JointModel > &joint, const unsigned int version)


pinocchio
Author(s):
autogenerated on Fri Jun 23 2023 02:38:31