pinocchio  3.9.0
A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
Loading...
Searching...
No Matches
joint-composite.hpp
1//
2// Copyright (c) 2016-2021 CNRS INRIA
3//
4
5#ifndef __pinocchio_multibody_joint_composite_hpp__
6#define __pinocchio_multibody_joint_composite_hpp__
7
8#include "pinocchio/multibody/joint/fwd.hpp"
9#include "pinocchio/multibody/joint/joint-collection.hpp"
10#include "pinocchio/multibody/joint/joint-basic-visitors.hpp"
11#include "pinocchio/container/aligned-vector.hpp"
12#include "pinocchio/spatial/act-on-set.hpp"
13
14#include "pinocchio/serialization/fwd.hpp"
15
16namespace pinocchio
17{
18
19 template<typename Scalar, int Options, template<typename S, int O> class JointCollectionTpl>
21
22 template<typename _Scalar, int _Options, template<typename S, int O> class JointCollectionTpl>
23 struct traits<JointCompositeTpl<_Scalar, _Options, JointCollectionTpl>>
24 {
25 typedef _Scalar Scalar;
26
27 enum
28 {
29 Options = _Options,
30 NQ = Eigen::Dynamic,
31 NV = Eigen::Dynamic,
32 NVExtended = Eigen::Dynamic
33 };
34
35 typedef JointCollectionTpl<Scalar, Options> JointCollection;
39 typedef SE3Tpl<Scalar, Options> Transformation_t;
40 typedef MotionTpl<Scalar, Options> Motion_t;
41 typedef MotionTpl<Scalar, Options> Bias_t;
42
43 // [ABA]
44 typedef Eigen::Matrix<Scalar, 6, Eigen::Dynamic, Options> U_t;
45 typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Options> D_t;
46 typedef Eigen::Matrix<Scalar, 6, Eigen::Dynamic, Options> UD_t;
47
48 typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1, Options> ConfigVector_t;
49 typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1, Options> TangentVector_t;
50
51 typedef boost::mpl::false_ is_mimicable_t;
52
53 PINOCCHIO_JOINT_DATA_BASE_ACCESSOR_DEFAULT_RETURN_TYPE
54 };
55
56 template<typename _Scalar, int _Options, template<typename S, int O> class JointCollectionTpl>
57 struct traits<JointModelCompositeTpl<_Scalar, _Options, JointCollectionTpl>>
58 {
60 typedef _Scalar Scalar;
61 };
62
63 template<typename _Scalar, int _Options, template<typename S, int O> class JointCollectionTpl>
64 struct traits<JointDataCompositeTpl<_Scalar, _Options, JointCollectionTpl>>
65 {
67 typedef _Scalar Scalar;
68 };
69
70 template<typename _Scalar, int _Options, template<typename S, int O> class JointCollectionTpl>
71 struct JointDataCompositeTpl
72 : public JointDataBase<JointDataCompositeTpl<_Scalar, _Options, JointCollectionTpl>>
73 {
74 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
75
78 PINOCCHIO_JOINT_DATA_TYPEDEF_TEMPLATE(JointDerived);
79 PINOCCHIO_JOINT_DATA_BASE_DEFAULT_ACCESSOR
80
81 typedef JointCollectionTpl<Scalar, Options> JointCollection;
83
84 typedef PINOCCHIO_ALIGNED_STD_VECTOR(JointDataVariant) JointDataVector;
85
86 // JointDataComposite() {} // can become necessary if we want a vector of JointDataComposite ?
87
88 JointDataCompositeTpl()
89 : joints()
90 , iMlast(0)
91 , pjMi(0)
92 , joint_q(ConfigVector_t::Zero(0))
93 , joint_v(TangentVector_t::Zero(0))
94 , S(0)
95 , M(Transformation_t::Identity())
96 , v(Motion_t::Zero())
97 , c(Motion_t::Zero())
98 , U(6, 0)
99 , Dinv(0, 0)
100 , UDinv(6, 0)
101 , StU(0, 0)
102 {
103 }
104
105 JointDataCompositeTpl(const JointDataVector & joint_data, const int nq, const int nv)
106 : joints(joint_data)
107 , iMlast(joint_data.size())
108 , pjMi(joint_data.size())
109 , joint_q(ConfigVector_t::Zero(nq))
110 , joint_v(TangentVector_t::Zero(nv))
111 , S(Constraint_t::Zero(nv))
112 , M(Transformation_t::Identity())
113 , v(Motion_t::Zero())
114 , c(Motion_t::Zero())
115 , U(U_t::Zero(6, nv))
116 , Dinv(D_t::Zero(nv, nv))
117 , UDinv(UD_t::Zero(6, nv))
118 , StU(D_t::Zero(nv, nv))
119 {
120 }
121
123 JointDataVector joints;
124
126 PINOCCHIO_ALIGNED_STD_VECTOR(Transformation_t) iMlast;
127
129 PINOCCHIO_ALIGNED_STD_VECTOR(Transformation_t) pjMi;
130
131 ConfigVector_t joint_q;
132 TangentVector_t joint_v;
133
134 Constraint_t S;
135 Transformation_t M;
136 Motion_t v;
137 Bias_t c;
138
139 // // [ABA] specific data
140 U_t U;
141 D_t Dinv;
142 UD_t UDinv;
143 D_t StU;
144
145 static std::string classname()
146 {
147 return std::string("JointDataComposite");
148 }
149 std::string shortname() const
150 {
151 return classname();
152 }
153
154 void disp(std::ostream & os) const
155 {
156 os << "JointDataComposite containing following models:\n";
157 for (typename JointDataVector::const_iterator it = joints.begin(); it != joints.end(); ++it)
158 os << " " << it->shortname() << std::endl;
159 }
160 };
161
162 template<
163 typename NewScalar,
164 typename Scalar,
165 int Options,
166 template<typename S, int O> class JointCollectionTpl>
167 struct CastType<NewScalar, JointModelCompositeTpl<Scalar, Options, JointCollectionTpl>>
168 {
170 };
171
172 template<typename _Scalar, int _Options, template<typename S, int O> class JointCollectionTpl>
173 struct JointModelCompositeTpl
174 : public JointModelBase<JointModelCompositeTpl<_Scalar, _Options, JointCollectionTpl>>
175 {
176 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
177
180 PINOCCHIO_JOINT_TYPEDEF_TEMPLATE(JointDerived);
181
182 typedef JointCollectionTpl<Scalar, Options> JointCollection;
184
185 typedef SE3Tpl<Scalar, Options> SE3;
186 typedef MotionTpl<Scalar, Options> Motion;
187 typedef InertiaTpl<Scalar, Options> Inertia;
188
189 typedef PINOCCHIO_ALIGNED_STD_VECTOR(JointModelVariant) JointModelVector;
190
191 using Base::id;
192 using Base::idx_q;
193 using Base::idx_v;
194 using Base::idx_vExtended;
195 using Base::nq;
196 using Base::nv;
197 using Base::nvExtended;
198 using Base::setIndexes;
199
202 : joints()
203 , jointPlacements()
204 , m_nq(0)
205 , m_nv(0)
206 , m_nvExtended(0)
207 , njoints(0)
208 , jointNames()
209 {
210 }
211
213 JointModelCompositeTpl(const size_t size)
214 : joints()
215 , jointPlacements()
216 , m_nq(0)
217 , m_nv(0)
218 , m_nvExtended(0)
219 , njoints(0)
220 , jointNames()
221 {
222 joints.reserve(size);
223 jointPlacements.reserve(size);
224 m_idx_q.reserve(size);
225 m_idx_v.reserve(size);
226 m_idx_vExtended.reserve(size);
227 m_nqs.reserve(size);
228 m_nvs.reserve(size);
229 m_nvExtendeds.reserve(size);
230 jointNames.reserve(size);
231 }
232
240 template<typename JointModel>
242 const JointModelBase<JointModel> & jmodel,
243 const SE3 & placement = SE3::Identity(),
244 const std::string & name = "joint_1")
245 : joints(1, (JointModelVariant)jmodel.derived())
246 , jointPlacements(1, placement)
247 , m_nq(jmodel.nq())
248 , m_nv(jmodel.nv())
249 , m_nvExtended(jmodel.nvExtended())
250 , m_idx_q(1, 0)
251 , m_nqs(1, jmodel.nq())
252 , m_idx_v(1, 0)
253 , m_nvs(1, jmodel.nv())
254 , m_idx_vExtended(1, 0)
255 , m_nvExtendeds(1, jmodel.nvExtended())
256 , njoints(1)
257 , jointNames(1, name)
258 {
259 }
260
266 JointModelCompositeTpl(const JointModelCompositeTpl & other)
267 : Base(other)
268 , joints(other.joints)
269 , jointPlacements(other.jointPlacements)
270 , m_nq(other.m_nq)
271 , m_nv(other.m_nv)
272 , m_nvExtended(other.m_nvExtended)
273 , m_idx_q(other.m_idx_q)
274 , m_nqs(other.m_nqs)
275 , m_idx_v(other.m_idx_v)
276 , m_nvs(other.m_nvs)
279 , njoints(other.njoints)
280 , jointNames(other.jointNames)
281 {
282 }
283
293 template<typename JointModel>
294 JointModelDerived & addJoint(
295 const JointModelBase<JointModel> & jmodel,
296 const SE3 & placement = SE3::Identity(),
297 const std::string & name = "")
298 {
299 joints.push_back((JointModelVariant)jmodel.derived());
300 jointPlacements.push_back(placement);
301
302 m_nq += jmodel.nq();
303 m_nv += jmodel.nv();
304 m_nvExtended += jmodel.nvExtended();
305
307 njoints++;
308
309 std::string final_name = name;
310 if (name.empty())
311 {
312 final_name = "joint_" + std::to_string(njoints + 1);
313 }
314 jointNames.push_back(final_name);
315
316 return *this;
317 }
318
319 JointDataDerived createData() const
320 {
321 typename JointDataDerived::JointDataVector jdata(joints.size());
322 for (int i = 0; i < (int)joints.size(); ++i)
323 jdata[(size_t)i] =
324 ::pinocchio::createData<Scalar, Options, JointCollectionTpl>(joints[(size_t)i]);
325 return JointDataDerived(jdata, nq(), nv());
326 }
327
328 const std::vector<bool> hasConfigurationLimit() const
329 {
330 std::vector<bool> vec;
331 for (size_t i = 0; i < joints.size(); ++i)
332 {
333 const std::vector<bool> & joint_cf_limit = joints[i].hasConfigurationLimit();
334 vec.insert(vec.end(), joint_cf_limit.begin(), joint_cf_limit.end());
335 }
336 return vec;
337 }
338
339 const std::vector<bool> hasConfigurationLimitInTangent() const
340 {
341 std::vector<bool> vec;
342 for (size_t i = 0; i < joints.size(); ++i)
343 {
344 const std::vector<bool> & joint_cf_limit = joints[i].hasConfigurationLimitInTangent();
345 vec.insert(vec.end(), joint_cf_limit.begin(), joint_cf_limit.end());
346 }
347 return vec;
348 }
349
350 template<typename, int, template<typename S, int O> class, typename>
351 friend struct JointCompositeCalcZeroOrderStep;
352
353 template<typename ConfigVectorType>
354 void calc(JointDataDerived & data, const Eigen::MatrixBase<ConfigVectorType> & qs) const;
355
356 template<typename, int, template<typename S, int O> class, typename, typename>
357 friend struct JointCompositeCalcFirstOrderStep;
358
359 template<typename ConfigVectorType, typename TangentVectorType>
360 void calc(
361 JointDataDerived & data,
362 const Eigen::MatrixBase<ConfigVectorType> & qs,
363 const Eigen::MatrixBase<TangentVectorType> & vs) const;
364
365 template<typename TangentVectorType>
366 void calc(
367 JointDataDerived & data,
368 const Blank blank,
369 const Eigen::MatrixBase<TangentVectorType> & vs) const;
370
371 template<typename VectorLike, typename Matrix6Like>
372 void calc_aba(
373 JointDataDerived & data,
374 const Eigen::MatrixBase<VectorLike> & armature,
375 const Eigen::MatrixBase<Matrix6Like> & I,
376 const bool update_I) const
377 {
378 data.U.noalias() = I * data.S.matrix();
379 data.StU.noalias() = data.S.matrix().transpose() * data.U;
380 data.StU.diagonal() += armature;
381
382 internal::PerformStYSInversion<Scalar>::run(data.StU, data.Dinv);
383 data.UDinv.noalias() = data.U * data.Dinv;
384
385 if (update_I)
386 PINOCCHIO_EIGEN_CONST_CAST(Matrix6Like, I).noalias() -= data.UDinv * data.U.transpose();
387 }
388
389 int nv_impl() const
390 {
391 return m_nv;
392 }
393 int nq_impl() const
394 {
395 return m_nq;
396 }
397 int nvExtended_impl() const
398 {
399 return m_nvExtended;
400 }
401
405 void setIndexes_impl(JointIndex id, int q, int v, int vExtended)
406 {
407 Base::setIndexes_impl(id, q, v, vExtended);
409 }
410
411 static std::string classname()
412 {
413 return std::string("JointModelComposite");
414 }
415 std::string shortname() const
416 {
417 return classname();
418 }
419
420 JointModelCompositeTpl & operator=(const JointModelCompositeTpl & other)
421 {
422 Base::operator=(other);
423 m_nq = other.m_nq;
424 m_nv = other.m_nv;
425 m_nvExtended = other.m_nvExtended;
426 m_idx_q = other.m_idx_q;
427 m_idx_v = other.m_idx_v;
428 m_idx_vExtended = other.m_idx_vExtended;
429 m_nqs = other.m_nqs;
430 m_nvs = other.m_nvs;
431 m_nvExtendeds = other.m_nvExtendeds;
432 joints = other.joints;
433 jointPlacements = other.jointPlacements;
434 njoints = other.njoints;
435 jointNames = other.jointNames;
436
437 return *this;
438 }
439
440 using Base::isEqual;
441 bool isEqual(const JointModelCompositeTpl & other) const
442 {
443 return Base::isEqual(other) && internal::comparison_eq(nq(), other.nq())
444 && internal::comparison_eq(nv(), other.nv())
445 && internal::comparison_eq(nvExtended(), other.nvExtended())
446 && internal::comparison_eq(m_idx_q, other.m_idx_q)
447 && internal::comparison_eq(m_idx_v, other.m_idx_v)
448 && internal::comparison_eq(m_idx_vExtended, other.m_idx_vExtended)
449 && internal::comparison_eq(m_nqs, other.m_nqs)
450 && internal::comparison_eq(m_nvs, other.m_nvs)
451 && internal::comparison_eq(m_nvExtendeds, other.m_nvExtendeds)
452 && internal::comparison_eq(joints, other.joints)
453 && internal::comparison_eq(jointPlacements, other.jointPlacements)
454 && internal::comparison_eq(njoints, other.njoints)
455 && internal::comparison_eq(jointNames, other.jointNames);
456 }
457
459 template<typename NewScalar>
460 JointModelCompositeTpl<NewScalar, Options, JointCollectionTpl> cast() const
461 {
462 typedef JointModelCompositeTpl<NewScalar, Options, JointCollectionTpl> ReturnType;
463 ReturnType res((size_t)njoints);
464 res.setIndexes(id(), idx_q(), idx_v(), idx_vExtended());
465 res.m_nq = m_nq;
466 res.m_nv = m_nv;
467 res.m_nvExtended = m_nvExtended;
468 res.m_idx_q = m_idx_q;
469 res.m_idx_v = m_idx_v;
470 res.m_idx_vExtended = m_idx_vExtended;
471 res.m_nqs = m_nqs;
472 res.m_nvs = m_nvs;
473 res.m_nvExtendeds = m_nvExtendeds;
474 res.njoints = njoints;
475 res.jointNames = jointNames;
476
477 res.joints.resize(joints.size());
478 res.jointPlacements.resize(jointPlacements.size());
479 for (size_t k = 0; k < jointPlacements.size(); ++k)
480 {
481 res.joints[k] = joints[k].template cast<NewScalar>();
482 res.jointPlacements[k] = jointPlacements[k].template cast<NewScalar>();
483 }
484
485 return res;
486 }
487
488 JointIndex getJointId(const std::string & joint_name) const
489 {
490 auto it = std::find(jointNames.begin(), jointNames.end(), joint_name);
491
492 if (it == jointNames.end())
493 PINOCCHIO_THROW_PRETTY(std::invalid_argument, "JointComposite - joint_name not found");
494
495 return JointIndex(std::distance(jointNames.begin(), it));
496 }
497
499 JointModelVector joints;
502 PINOCCHIO_ALIGNED_STD_VECTOR(SE3) jointPlacements;
503
504 template<typename D>
505 typename SizeDepType<NQ>::template SegmentReturn<D>::ConstType
506 JointMappedConfigSelector(const Eigen::MatrixBase<D> & a) const
507 {
508 return a.segment(Base::i_q, nq());
509 }
510 template<typename D>
511 typename SizeDepType<NQ>::template SegmentReturn<D>::Type
512 JointMappedConfigSelector(Eigen::MatrixBase<D> & a) const
513 {
514 return a.segment(Base::i_q, nq());
515 }
516
517 template<typename D>
518 typename SizeDepType<NQ>::template SegmentReturn<D>::ConstType
519 jointConfigSelector(const Eigen::MatrixBase<D> & a) const
520 {
521 return a.segment(Base::i_q, nq());
522 }
523 template<typename D>
524 typename SizeDepType<NQ>::template SegmentReturn<D>::Type
525 jointConfigSelector(Eigen::MatrixBase<D> & a) const
526 {
527 return a.segment(Base::i_q, nq());
528 }
529
530 template<typename D>
531 typename SizeDepType<NV>::template SegmentReturn<D>::ConstType
532 JointMappedVelocitySelector(const Eigen::MatrixBase<D> & a) const
533 {
534 return a.segment(Base::i_v, nv());
535 }
536 template<typename D>
537 typename SizeDepType<NV>::template SegmentReturn<D>::Type
538 JointMappedVelocitySelector(Eigen::MatrixBase<D> & a) const
539 {
540 return a.segment(Base::i_v, nv());
541 }
542
543 template<typename D>
544 typename SizeDepType<NV>::template SegmentReturn<D>::ConstType
545 jointVelocitySelector(const Eigen::MatrixBase<D> & a) const
546 {
547 return a.segment(Base::i_v, nv());
548 }
549 template<typename D>
550 typename SizeDepType<NV>::template SegmentReturn<D>::Type
551 jointVelocitySelector(Eigen::MatrixBase<D> & a) const
552 {
553 return a.segment(Base::i_v, nv());
554 }
555
556 template<typename D>
557 typename SizeDepType<NV>::template ColsReturn<D>::ConstType
558 jointCols(const Eigen::MatrixBase<D> & A) const
559 {
560 return A.middleCols(Base::i_v, nv());
561 }
562 template<typename D>
563 typename SizeDepType<NV>::template ColsReturn<D>::ConstType
564 jointExtendedModelCols(const Eigen::MatrixBase<D> & A) const
565 {
566 return A.middleCols(Base::i_vExtended, nvExtended());
567 }
568 template<typename D>
569 typename SizeDepType<NV>::template ColsReturn<D>::Type jointCols(Eigen::MatrixBase<D> & A) const
570 {
571 return A.middleCols(Base::i_v, nv());
572 }
573 template<typename D>
574 typename SizeDepType<NV>::template ColsReturn<D>::Type
575 jointExtendedModelCols(Eigen::MatrixBase<D> & A) const
576 {
577 return A.middleCols(Base::i_vExtended, nvExtended());
578 }
579
580 template<typename D>
581 typename SizeDepType<Eigen::Dynamic>::template SegmentReturn<D>::ConstType
582 jointConfigSelector_impl(const Eigen::MatrixBase<D> & a) const
583 {
584 return a.segment(Base::i_q, nq());
585 }
586 template<typename D>
587 typename SizeDepType<Eigen::Dynamic>::template SegmentReturn<D>::Type
588 jointConfigSelector_impl(Eigen::MatrixBase<D> & a) const
589 {
590 return a.segment(Base::i_q, nq());
591 }
592
593 template<typename D>
594 typename SizeDepType<Eigen::Dynamic>::template SegmentReturn<D>::ConstType
595 JointMappedConfigSelector_impl(const Eigen::MatrixBase<D> & a) const
596 {
597 return a.segment(Base::i_q, nq());
598 }
599 template<typename D>
600 typename SizeDepType<Eigen::Dynamic>::template SegmentReturn<D>::Type
601 JointMappedConfigSelector_impl(Eigen::MatrixBase<D> & a) const
602 {
603 return a.segment(Base::i_q, nq());
604 }
605
606 template<typename D>
607 typename SizeDepType<Eigen::Dynamic>::template SegmentReturn<D>::ConstType
608 JointMappedVelocitySelector_impl(const Eigen::MatrixBase<D> & a) const
609 {
610 return a.segment(Base::i_v, nv());
611 }
612 template<typename D>
613 typename SizeDepType<Eigen::Dynamic>::template SegmentReturn<D>::Type
614 JointMappedVelocitySelector_impl(Eigen::MatrixBase<D> & a) const
615 {
616 return a.segment(Base::i_v, nv());
617 }
618
619 template<typename D>
620 typename SizeDepType<Eigen::Dynamic>::template SegmentReturn<D>::ConstType
621 jointVelocitySelector_impl(const Eigen::MatrixBase<D> & a) const
622 {
623 return a.segment(Base::i_v, nv());
624 }
625 template<typename D>
626 typename SizeDepType<Eigen::Dynamic>::template SegmentReturn<D>::Type
627 jointVelocitySelector_impl(Eigen::MatrixBase<D> & a) const
628 {
629 return a.segment(Base::i_v, nv());
630 }
631
632 template<typename D>
633 typename SizeDepType<Eigen::Dynamic>::template ColsReturn<D>::ConstType
634 jointCols_impl(const Eigen::MatrixBase<D> & A) const
635 {
636 return A.middleCols(Base::i_v, nv());
637 }
638 template<typename D>
639 typename SizeDepType<Eigen::Dynamic>::template ColsReturn<D>::ConstType
640 jointExtendedModelCols_impl(const Eigen::MatrixBase<D> & A) const
641 {
642 return A.middleCols(Base::i_vExtended, nvExtended());
643 }
644 template<typename D>
645 typename SizeDepType<Eigen::Dynamic>::template ColsReturn<D>::Type
646 jointCols_impl(Eigen::MatrixBase<D> & A) const
647 {
648 return A.middleCols(Base::i_v, nv());
649 }
650 template<typename D>
651 typename SizeDepType<Eigen::Dynamic>::template ColsReturn<D>::Type
652 jointExtendedModelCols_impl(Eigen::MatrixBase<D> & A) const
653 {
654 return A.middleCols(Base::i_vExtended, nvExtended());
655 }
656
657 void disp(std::ostream & os) const
658 {
659 typedef typename JointModelCompositeTpl<Scalar, Options, JointCollectionTpl>::JointModelVector
660 JointModelVector;
661
662 os << "JointModelComposite containing following models:\n";
663 for (typename JointModelVector::const_iterator it = joints.begin(); it != joints.end(); ++it)
664 os << " " << it->shortname() << std::endl;
665 }
666
667 protected:
668 friend struct Serialize<JointModelCompositeTpl>;
669
670 template<typename, int, template<typename, int> class>
671 friend struct JointModelCompositeTpl;
672
676 {
677 int idx_q = this->idx_q();
678 int idx_v = this->idx_v();
679 int idx_vExtended = this->idx_vExtended();
680
681 m_idx_q.resize(joints.size());
682 m_idx_v.resize(joints.size());
683 m_idx_vExtended.resize(joints.size());
684 m_nqs.resize(joints.size());
685 m_nvs.resize(joints.size());
686 m_nvExtendeds.resize(joints.size());
687
688 for (size_t i = 0; i < joints.size(); ++i)
689 {
690 JointModelVariant & joint = joints[i];
691
692 m_idx_q[i] = idx_q;
693 m_idx_v[i] = idx_v;
694 m_idx_vExtended[i] = idx_vExtended;
695 ::pinocchio::setIndexes(joint, i, idx_q, idx_v, idx_vExtended);
696 m_nqs[i] = ::pinocchio::nq(joint);
697 m_nvs[i] = ::pinocchio::nv(joint);
699 idx_q += m_nqs[i];
700 idx_v += m_nvs[i];
701 idx_vExtended += m_nvExtendeds[i];
702 }
703 }
704
706 int m_nq, m_nv, m_nvExtended;
707
709
711 std::vector<int> m_idx_q;
713 std::vector<int> m_nqs;
715 std::vector<int> m_idx_v;
717 std::vector<int> m_nvs;
719 std::vector<int> m_idx_vExtended;
721 std::vector<int> m_nvExtendeds;
723 std::vector<std::string> jointNames;
724
725 public:
728 };
729
730} // namespace pinocchio
731
732#include <boost/type_traits.hpp>
733
734namespace boost
735{
736 template<typename Scalar, int Options, template<typename S, int O> class JointCollectionTpl>
737 struct has_nothrow_constructor<
738 ::pinocchio::JointModelCompositeTpl<Scalar, Options, JointCollectionTpl>>
739 : public integral_constant<bool, true>
740 {
741 };
742
743 template<typename Scalar, int Options, template<typename S, int O> class JointCollectionTpl>
744 struct has_nothrow_copy<::pinocchio::JointModelCompositeTpl<Scalar, Options, JointCollectionTpl>>
745 : public integral_constant<bool, true>
746 {
747 };
748
749 template<typename Scalar, int Options, template<typename S, int O> class JointCollectionTpl>
750 struct has_nothrow_constructor<
751 ::pinocchio::JointDataCompositeTpl<Scalar, Options, JointCollectionTpl>>
752 : public integral_constant<bool, true>
753 {
754 };
755
756 template<typename Scalar, int Options, template<typename S, int O> class JointCollectionTpl>
757 struct has_nothrow_copy<::pinocchio::JointDataCompositeTpl<Scalar, Options, JointCollectionTpl>>
758 : public integral_constant<bool, true>
759 {
760 };
761} // namespace boost
762
763/* --- Details -------------------------------------------------------------- */
764/* --- Details -------------------------------------------------------------- */
765/* --- Details -------------------------------------------------------------- */
766#include "pinocchio/multibody/joint/joint-composite.hxx"
767
768#endif // ifndef __pinocchio_multibody_joint_composite_hpp__
Main pinocchio namespace.
Definition treeview.dox:11
int nv(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointNvVisitor to get the dimension of the joint tangent space.
std::string shortname(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointShortnameVisitor to get the shortname of the derived joint model.
int nq(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointNqVisitor to get the dimension of the joint configuration space.
std::string name(const LieGroupGenericTpl< LieGroupCollection > &lg)
Visit a LieGroupVariant to get the name of it.
void setIndexes(JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel, JointIndex id, int q, int v, int vExtended)
Visit a JointModelTpl through JointSetIndexesVisitor to set the indexes of the joint in the kinematic...
int nvExtended(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointNvExtendVisitor to get the dimension of the joint extended tangent...
Type of the cast of a class C templated by Scalar and Options, to a new NewScalar type....
Definition fwd.hpp:99
JointDataVector joints
Vector of joints.
PINOCCHIO_ALIGNED_STD_VECTOR(Transformation_t) pjMi
Transforms from previous joint to joint i.
PINOCCHIO_ALIGNED_STD_VECTOR(Transformation_t) iMlast
Transforms from previous joint to last joint.
JointModelBase & operator=(const JointModelBase &clone)
JointModelCompositeTpl(const size_t size)
Default contructor with a defined size.
void setIndexes_impl(JointIndex id, int q, int v, int vExtended)
Update the indexes of subjoints in the stack.
JointModelCompositeTpl()
Default contructor.
JointModelCompositeTpl(const JointModelCompositeTpl &other)
Copy constructor.
PINOCCHIO_ALIGNED_STD_VECTOR(SE3) jointPlacements
Vector of joint placements. Those placements correspond to the origin of the joint relatively to thei...
JointModelDerived & addJoint(const JointModelBase< JointModel > &jmodel, const SE3 &placement=SE3::Identity(), const std::string &name="")
Add a joint to the vector of joints.
JointModelCompositeTpl(const JointModelBase< JointModel > &jmodel, const SE3 &placement=SE3::Identity(), const std::string &name="joint_1")
Constructor with one joint.
JointModelCompositeTpl< NewScalar, Options, JointCollectionTpl > cast() const
void updateJointIndexes()
Update the indexes of the joints contained in the composition according to the position of the joint ...
Common traits structure to fully define base classes for CRTP.
Definition fwd.hpp:72