Line |
Branch |
Exec |
Source |
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 |
15 |
|
✗ |
run(Archive & ar, JointModelCompositeTpl<Scalar, Options, JointCollectionTpl> & joint) |
16 |
|
|
{ |
17 |
|
|
using boost::serialization::make_nvp; |
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, |
53 |
|
|
const pinocchio::JointModelBase<Derived> & joint, |
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 |
|
|
{ |
68 |
|
|
pinocchio::JointIndex i_id; |
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, |
81 |
|
|
pinocchio::JointModelRevoluteTpl<Scalar, Options, axis> & joint, |
82 |
|
|
const unsigned int version) |
83 |
|
|
{ |
84 |
|
|
typedef pinocchio::JointModelRevoluteTpl<Scalar, Options, axis> JointType; |
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, |
93 |
|
|
pinocchio::JointModelRevoluteUnboundedTpl<Scalar, Options, axis> & joint, |
94 |
|
|
const unsigned int version) |
95 |
|
|
{ |
96 |
|
|
typedef pinocchio::JointModelRevoluteUnboundedTpl<Scalar, Options, axis> JointType; |
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, |
105 |
|
|
pinocchio::JointModelPrismaticTpl<Scalar, Options, axis> & joint, |
106 |
|
|
const unsigned int version) |
107 |
|
|
{ |
108 |
|
|
typedef pinocchio::JointModelPrismaticTpl<Scalar, Options, axis> JointType; |
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, |
117 |
|
|
pinocchio::JointModelHelicalTpl<Scalar, Options, axis> & joint, |
118 |
|
|
const unsigned int version) |
119 |
|
|
{ |
120 |
|
|
typedef pinocchio::JointModelHelicalTpl<Scalar, Options, axis> JointType; |
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, |
128 |
|
|
pinocchio::JointModelHelicalUnalignedTpl<Scalar, Options> & joint, |
129 |
|
|
const unsigned int version) |
130 |
|
|
{ |
131 |
|
|
typedef pinocchio::JointModelHelicalUnalignedTpl<Scalar, Options> JointType; |
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, |
140 |
|
|
pinocchio::JointModelFreeFlyerTpl<Scalar, Options> & joint, |
141 |
|
|
const unsigned int version) |
142 |
|
|
{ |
143 |
|
|
typedef pinocchio::JointModelFreeFlyerTpl<Scalar, Options> JointType; |
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, |
152 |
|
|
pinocchio::JointModelPlanarTpl<Scalar, Options> & joint, |
153 |
|
|
const unsigned int version) |
154 |
|
|
{ |
155 |
|
|
typedef pinocchio::JointModelPlanarTpl<Scalar, Options> JointType; |
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, |
164 |
|
|
pinocchio::JointModelSphericalTpl<Scalar, Options> & joint, |
165 |
|
|
const unsigned int version) |
166 |
|
|
{ |
167 |
|
|
typedef pinocchio::JointModelSphericalTpl<Scalar, Options> JointType; |
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, |
176 |
|
|
pinocchio::JointModelSphericalZYXTpl<Scalar, Options> & joint, |
177 |
|
|
const unsigned int version) |
178 |
|
|
{ |
179 |
|
|
typedef pinocchio::JointModelSphericalZYXTpl<Scalar, Options> JointType; |
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, |
188 |
|
|
pinocchio::JointModelTranslationTpl<Scalar, Options> & joint, |
189 |
|
|
const unsigned int version) |
190 |
|
|
{ |
191 |
|
|
typedef pinocchio::JointModelTranslationTpl<Scalar, Options> JointType; |
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, |
200 |
|
|
pinocchio::JointModelRevoluteUnalignedTpl<Scalar, Options> & joint, |
201 |
|
|
const unsigned int version) |
202 |
|
|
{ |
203 |
|
|
typedef pinocchio::JointModelRevoluteUnalignedTpl<Scalar, Options> JointType; |
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, |
213 |
|
|
pinocchio::JointModelRevoluteUnboundedUnalignedTpl<Scalar, Options> & joint, |
214 |
|
|
const unsigned int version) |
215 |
|
|
{ |
216 |
|
|
typedef pinocchio::JointModelRevoluteUnboundedUnalignedTpl<Scalar, Options> JointType; |
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, |
226 |
|
|
pinocchio::JointModelPrismaticUnalignedTpl<Scalar, Options> & joint, |
227 |
|
|
const unsigned int version) |
228 |
|
|
{ |
229 |
|
|
typedef pinocchio::JointModelPrismaticUnalignedTpl<Scalar, Options> JointType; |
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, |
239 |
|
|
pinocchio::JointModelUniversalTpl<Scalar, Options> & joint, |
240 |
|
|
const unsigned int version) |
241 |
|
|
{ |
242 |
|
|
typedef pinocchio::JointModelUniversalTpl<Scalar, Options> JointType; |
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> |
255 |
|
|
class JointCollectionTpl> |
256 |
|
✗ |
void serialize( |
257 |
|
|
Archive & ar, |
258 |
|
|
pinocchio::JointModelCompositeTpl<Scalar, Options, JointCollectionTpl> & joint, |
259 |
|
|
const unsigned int version) |
260 |
|
|
{ |
261 |
|
|
typedef pinocchio::JointModelCompositeTpl<Scalar, Options, JointCollectionTpl> JointType; |
262 |
|
|
// ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType> |
263 |
|
|
// >(joint)); |
264 |
|
✗ |
fix::serialize(ar, *static_cast<pinocchio::JointModelBase<JointType> *>(&joint), version); |
265 |
|
|
|
266 |
|
✗ |
::pinocchio::Serialize<JointType>::run(ar, joint); |
267 |
|
|
} |
268 |
|
|
|
269 |
|
|
template< |
270 |
|
|
class Archive, |
271 |
|
|
typename Scalar, |
272 |
|
|
int Options, |
273 |
|
|
template<typename S, int O> |
274 |
|
|
class JointCollectionTpl> |
275 |
|
✗ |
void serialize( |
276 |
|
|
Archive & ar, |
277 |
|
|
pinocchio::JointModelTpl<Scalar, Options, JointCollectionTpl> & joint, |
278 |
|
|
const unsigned int version) |
279 |
|
|
{ |
280 |
|
|
typedef pinocchio::JointModelTpl<Scalar, Options, JointCollectionTpl> JointType; |
281 |
|
|
// ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType> |
282 |
|
|
// >(joint)); |
283 |
|
✗ |
fix::serialize(ar, *static_cast<pinocchio::JointModelBase<JointType> *>(&joint), version); |
284 |
|
|
|
285 |
|
|
typedef typename JointCollectionTpl<Scalar, Options>::JointModelVariant JointModelVariant; |
286 |
|
✗ |
ar & make_nvp("base_variant", base_object<JointModelVariant>(joint)); |
287 |
|
|
} |
288 |
|
|
|
289 |
|
|
template<class Archive, typename JointModel> |
290 |
|
✗ |
void serialize( |
291 |
|
|
Archive & ar, pinocchio::JointModelMimic<JointModel> & joint, const unsigned int version) |
292 |
|
|
{ |
293 |
|
|
typedef pinocchio::JointModelMimic<JointModel> JointType; |
294 |
|
|
// ar & make_nvp("base_class",base_object< pinocchio::JointModelBase<JointType> |
295 |
|
|
// >(joint)); |
296 |
|
✗ |
fix::serialize(ar, *static_cast<pinocchio::JointModelBase<JointType> *>(&joint), version); |
297 |
|
|
|
298 |
|
✗ |
ar & make_nvp("jmodel", joint.jmodel()); |
299 |
|
✗ |
ar & make_nvp("scaling", joint.scaling()); |
300 |
|
✗ |
ar & make_nvp("offset", joint.offset()); |
301 |
|
|
} |
302 |
|
|
|
303 |
|
|
} // namespace serialization |
304 |
|
|
} // namespace boost |
305 |
|
|
|
306 |
|
|
#endif // ifndef __pinocchio_serialization_joints_model_hpp__ |
307 |
|
|
|