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
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 } // namespace pinocchio
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(
44  Archive & ar, pinocchio::JointModelBase<Derived> & joint, const unsigned int version)
45  {
46  split_free(ar, joint, version);
47  }
48  } // namespace fix
49 
50  template<class Archive, typename Derived>
51  void save(
52  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
66  load(Archive & ar, pinocchio::JointModelBase<Derived> & joint, const unsigned int /*version*/)
67  {
69  int i_q, i_v;
70 
71  ar & make_nvp("i_id", i_id);
72  ar & make_nvp("i_q", i_q);
73  ar & make_nvp("i_v", i_v);
74 
75  joint.setIndexes(i_id, i_q, i_v);
76  }
77 
78  template<class Archive, typename Scalar, int Options, int axis>
79  void serialize(
80  Archive & ar,
82  const unsigned int version)
83  {
85  // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType>
86  // >(joint));
87  fix::serialize(ar, *static_cast<pinocchio::JointModelBase<JointType> *>(&joint), version);
88  }
89 
90  template<class Archive, typename Scalar, int Options, int axis>
91  void serialize(
92  Archive & ar,
94  const unsigned int version)
95  {
97  // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType>
98  // >(joint));
99  fix::serialize(ar, *static_cast<pinocchio::JointModelBase<JointType> *>(&joint), version);
100  }
101 
102  template<class Archive, typename Scalar, int Options, int axis>
103  void serialize(
104  Archive & ar,
106  const unsigned int version)
107  {
109  // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType>
110  // >(joint));
111  fix::serialize(ar, *static_cast<pinocchio::JointModelBase<JointType> *>(&joint), version);
112  }
113 
114  template<class Archive, typename Scalar, int Options, int axis>
115  void serialize(
116  Archive & ar,
118  const unsigned int version)
119  {
121  fix::serialize(ar, *static_cast<pinocchio::JointModelBase<JointType> *>(&joint), version);
122  ar & make_nvp("m_pitch", joint.m_pitch);
123  }
124 
125  template<class Archive, typename Scalar, int Options>
126  void serialize(
127  Archive & ar,
129  const unsigned int version)
130  {
132  fix::serialize(ar, *static_cast<pinocchio::JointModelBase<JointType> *>(&joint), version);
133  ar & make_nvp("axis", joint.axis);
134  ar & make_nvp("m_pitch", joint.m_pitch);
135  }
136 
137  template<class Archive, typename Scalar, int Options>
138  void serialize(
139  Archive & ar,
141  const unsigned int version)
142  {
144  // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType>
145  // >(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(
151  Archive & ar,
153  const unsigned int version)
154  {
156  // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType>
157  // >(joint));
158  fix::serialize(ar, *static_cast<pinocchio::JointModelBase<JointType> *>(&joint), version);
159  }
160 
161  template<class Archive, typename Scalar, int Options>
162  void serialize(
163  Archive & ar,
165  const unsigned int version)
166  {
168  // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType>
169  // >(joint));
170  fix::serialize(ar, *static_cast<pinocchio::JointModelBase<JointType> *>(&joint), version);
171  }
172 
173  template<class Archive, typename Scalar, int Options>
174  void serialize(
175  Archive & ar,
177  const unsigned int version)
178  {
180  // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType>
181  // >(joint));
182  fix::serialize(ar, *static_cast<pinocchio::JointModelBase<JointType> *>(&joint), version);
183  }
184 
185  template<class Archive, typename Scalar, int Options>
186  void serialize(
187  Archive & ar,
189  const unsigned int version)
190  {
192  // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType>
193  // >(joint));
194  fix::serialize(ar, *static_cast<pinocchio::JointModelBase<JointType> *>(&joint), version);
195  }
196 
197  template<class Archive, typename Scalar, int Options>
198  void serialize(
199  Archive & ar,
201  const unsigned int version)
202  {
204  // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType>
205  // >(joint));
206  fix::serialize(ar, *static_cast<pinocchio::JointModelBase<JointType> *>(&joint), version);
207  ar & make_nvp("axis", joint.axis);
208  }
209 
210  template<class Archive, typename Scalar, int Options>
211  void serialize(
212  Archive & ar,
214  const unsigned int version)
215  {
217  // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType>
218  // >(joint));
219  fix::serialize(ar, *static_cast<pinocchio::JointModelBase<JointType> *>(&joint), version);
220  ar & make_nvp("axis", joint.axis);
221  }
222 
223  template<class Archive, typename Scalar, int Options>
224  void serialize(
225  Archive & ar,
227  const unsigned int version)
228  {
230  // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType>
231  // >(joint));
232  fix::serialize(ar, *static_cast<pinocchio::JointModelBase<JointType> *>(&joint), version);
233  ar & make_nvp("axis", joint.axis);
234  }
235 
236  template<class Archive, typename Scalar, int Options>
237  void serialize(
238  Archive & ar,
240  const unsigned int version)
241  {
243  // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType>
244  // >(joint));
245  fix::serialize(ar, *static_cast<pinocchio::JointModelBase<JointType> *>(&joint), version);
246  ar & make_nvp("axis1", joint.axis1);
247  ar & make_nvp("axis2", joint.axis2);
248  }
249 
250  template<
251  class Archive,
252  typename Scalar,
253  int Options,
254  template<typename S, int O> class JointCollectionTpl>
255  void serialize(
256  Archive & ar,
258  const unsigned int version)
259  {
261  // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType>
262  // >(joint));
263  fix::serialize(ar, *static_cast<pinocchio::JointModelBase<JointType> *>(&joint), version);
264 
266  }
267 
268  template<
269  class Archive,
270  typename Scalar,
271  int Options,
272  template<typename S, int O> class JointCollectionTpl>
273  void serialize(
274  Archive & ar,
276  const unsigned int version)
277  {
279  // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType>
280  // >(joint));
281  fix::serialize(ar, *static_cast<pinocchio::JointModelBase<JointType> *>(&joint), version);
282 
284  ar & make_nvp("base_variant", base_object<JointModelVariant>(joint));
285  }
286 
287  template<class Archive, typename JointModel>
288  void serialize(
289  Archive & ar, pinocchio::JointModelMimic<JointModel> & joint, const unsigned int version)
290  {
291  typedef pinocchio::JointModelMimic<JointModel> JointType;
292  // ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType>
293  // >(joint));
294  fix::serialize(ar, *static_cast<pinocchio::JointModelBase<JointType> *>(&joint), version);
295 
296  ar & make_nvp("jmodel", joint.jmodel());
297  ar & make_nvp("scaling", joint.scaling());
298  ar & make_nvp("offset", joint.offset());
299  }
300 
301  } // namespace serialization
302 } // namespace boost
303 
304 #endif // ifndef __pinocchio_serialization_joints_model_hpp__
pinocchio::JointModelUniversalTpl
Definition: multibody/joint/fwd.hpp:102
pinocchio::Serialize::run
static void run(Archive &ar, T &object)
pinocchio::Serialize
Definition: serialization/fwd.hpp:18
pinocchio::JointModelRevoluteUnboundedUnalignedTpl
Definition: multibody/joint/fwd.hpp:46
pinocchio::JointModelHelicalTpl
Definition: multibody/joint/fwd.hpp:60
pinocchio::JointModelUniversalTpl::axis2
Vector3 axis2
Definition: joint-universal.hpp:610
boost::serialization::fix::serialize
void serialize(Archive &ar, pinocchio::JointDataBase< Derived > &joint_data, const unsigned int)
Definition: joints-data.hpp:46
boost::serialization::serialize
void serialize(Archive &ar, Eigen::Map< PlainObjectBase, MapOptions, StrideType > &m, const unsigned int version)
Definition: serialization/eigen.hpp:222
pinocchio::JointModelMimic
Definition: joint-mimic.hpp:307
pinocchio::JointModelPlanarTpl
Definition: multibody/joint/fwd.hpp:118
pinocchio::JointModelMimic::scaling
const Scalar & scaling() const
Definition: joint-mimic.hpp:728
pinocchio::JointModelBase
Definition: joint-model-base.hpp:75
pinocchio::Serialize< JointModelCompositeTpl< Scalar, Options, JointCollectionTpl > >::run
static void run(Archive &ar, JointModelCompositeTpl< Scalar, Options, JointCollectionTpl > &joint)
Definition: joints-model.hpp:15
pinocchio::Options
Options
Definition: joint-configuration.hpp:1082
boost::serialization::save
void save(Archive &ar, const Eigen::Map< PlainObjectBase, MapOptions, StrideType > &m, const unsigned int)
Definition: serialization/eigen.hpp:192
version
Definition: version.py:1
pinocchio::JointModelCompositeTpl::m_idx_q
std::vector< int > m_idx_q
Keep information of both the dimension and the position of the joints in the composition.
Definition: joint-composite.hpp:565
pinocchio::python::Scalar
context::Scalar Scalar
Definition: admm-solver.cpp:29
boost
boost::serialization::load
void load(Archive &ar, Eigen::Map< PlainObjectBase, MapOptions, StrideType > &m, const unsigned int)
Definition: serialization/eigen.hpp:206
pinocchio::JointModelBase::setIndexes
void setIndexes(JointIndex id, int q, int v)
Definition: joint-model-base.hpp:186
pinocchio::JointModelMimic::offset
const Scalar & offset() const
Definition: joint-mimic.hpp:737
pinocchio::JointModelTranslationTpl
Definition: multibody/joint/fwd.hpp:126
pinocchio::JointModelFreeFlyerTpl
Definition: multibody/joint/fwd.hpp:110
pinocchio::JointModelHelicalUnalignedTpl::axis
Vector3 axis
Definition: joint-helical-unaligned.hpp:765
boost::serialization::make_nvp
const nvp< pinocchio::container::aligned_vector< T > > make_nvp(const char *name, pinocchio::container::aligned_vector< T > &t)
Definition: serialization/aligned-vector.hpp:37
pinocchio::python::Options
@ Options
Definition: expose-contact-inverse-dynamics.cpp:22
pinocchio::JointModelCompositeTpl::joints
JointModelVector joints
Vector of joints contained in the joint composite.
Definition: joint-composite.hpp:446
pinocchio::JointModelPrismaticTpl
Definition: multibody/joint/fwd.hpp:89
pinocchio::JointModelVariant
JointCollectionDefault::JointModelVariant JointModelVariant
Definition: joint-collection.hpp:205
pinocchio::JointModelTpl
Definition: multibody/joint/fwd.hpp:155
pinocchio::JointModelHelicalUnalignedTpl
Definition: multibody/joint/fwd.hpp:65
pinocchio::JointModelSphericalTpl
Definition: multibody/joint/fwd.hpp:73
pinocchio::JointModelRevoluteUnboundedUnalignedTpl::axis
Vector3 axis
axis of rotation of the joint.
Definition: joint-revolute-unbounded-unaligned.hpp:257
pinocchio::JointModelCompositeTpl::njoints
int njoints
Number of joints contained in the JointModelComposite.
Definition: joint-composite.hpp:575
pinocchio::JointModelRevoluteTpl
Definition: multibody/joint/fwd.hpp:33
pinocchio::JointModelCompositeTpl::m_nq
int m_nq
Dimensions of the config and tangent space of the composite joint.
Definition: joint-composite.hpp:560
pinocchio::JointModelMimic::jmodel
const JointModel & jmodel() const
Definition: joint-mimic.hpp:719
pinocchio::JointModelBase::idx_v
int idx_v() const
Definition: joint-model-base.hpp:164
pinocchio::JointModelCompositeTpl::m_nv
int m_nv
Definition: joint-composite.hpp:560
pinocchio::JointModelRevoluteUnalignedTpl
Definition: multibody/joint/fwd.hpp:38
pinocchio::JointModelPrismaticUnalignedTpl
Definition: multibody/joint/fwd.hpp:94
pinocchio::JointModelCompositeTpl
Definition: multibody/joint/fwd.hpp:141
pinocchio::JointModelBase::idx_q
int idx_q() const
Definition: joint-model-base.hpp:160
pinocchio::JointModelHelicalUnalignedTpl::m_pitch
Scalar m_pitch
Definition: joint-helical-unaligned.hpp:766
pinocchio::JointModelCompositeTpl::m_nvs
std::vector< int > m_nvs
Dimension of the segment in the tangent vector.
Definition: joint-composite.hpp:571
pinocchio::JointModelHelicalTpl::m_pitch
Scalar m_pitch
Definition: joint-helical.hpp:954
pinocchio::JointModelSphericalZYXTpl
Definition: multibody/joint/fwd.hpp:81
serialization
Definition: serialization.py:1
pinocchio::JointModelPrismaticUnalignedTpl::axis
Vector3 axis
3d main axis of the joint.
Definition: joint-prismatic-unaligned.hpp:706
pinocchio::JointModelCompositeTpl::m_nqs
std::vector< int > m_nqs
Dimension of the segment in the config vector.
Definition: joint-composite.hpp:567
pinocchio::JointIndex
Index JointIndex
Definition: multibody/fwd.hpp:26
pinocchio::JointModelCompositeTpl::m_idx_v
std::vector< int > m_idx_v
Index in the tangent vector.
Definition: joint-composite.hpp:569
pinocchio::JointModelRevoluteUnalignedTpl::axis
Vector3 axis
3d main axis of the joint.
Definition: joint-revolute-unaligned.hpp:730
pinocchio::JointModelRevoluteUnboundedTpl
Definition: multibody/joint/fwd.hpp:55
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27
pinocchio::JointModelUniversalTpl::axis1
Vector3 axis1
3d main axii of the joint.
Definition: joint-universal.hpp:609
pinocchio::JointModelBase::id
JointIndex id() const
Definition: joint-model-base.hpp:168


pinocchio
Author(s):
autogenerated on Thu Dec 19 2024 03:41:31