pinocchio  2.4.4
A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
copy.hpp
1 //
2 // Copyright (c) 2016-2018 CNRS
3 //
4 
5 #ifndef __pinocchio_copy_hpp__
6 #define __pinocchio_copy_hpp__
7 
8 #include "pinocchio/multibody/model.hpp"
9 #include "pinocchio/multibody/data.hpp"
10 #include "pinocchio/algorithm/check.hpp"
11 
12 namespace pinocchio
13 {
25  template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
26  inline void
27  copy(const ModelTpl<Scalar,Options,JointCollectionTpl> & model,
28  const DataTpl<Scalar,Options,JointCollectionTpl> & origin,
29  DataTpl<Scalar,Options,JointCollectionTpl> & dest,
30  int LEVEL);
31 
32 } // namespace pinocchio
33 
34 /* --- Details -------------------------------------------------------------------- */
35 //#include "pinocchio/algorithm/copy.hxx"
36 
38 namespace pinocchio
39 {
40  template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
41  inline void
45  int LEVEL)
46  {
48  typedef typename Model::JointIndex JointIndex;
49 
50  for(JointIndex jid=1; jid<(JointIndex)model.njoints; ++jid)
51  {
52  PINOCCHIO_CHECK_INPUT_ARGUMENT(LEVEL>=0);
53 
54  dest.oMi[jid] = origin.oMi [jid];
55  if(LEVEL>=1)
56  {
57  dest.v[jid] = origin.v [jid];
58  }
59  if(LEVEL>=2)
60  {
61  dest.a[jid] = origin.a [jid];
62  dest.a_gf[jid] = origin.a_gf[jid];
63  dest.f[jid] = origin.f [jid];
64  }
65  }
66  }
67 
68 
69 } // namespace pinocchio
71 
72 #endif // ifndef __pinocchio_copy_hpp__
void copy(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &origin, DataTpl< Scalar, Options, JointCollectionTpl > &dest, int LEVEL)
Copy part of the data from origin to dest. Template parameter can be used to select at which differen...
Definition: copy.hpp:42
int njoints
Number of joints.
Definition: model.hpp:81
Main pinocchio namespace.
Definition: treeview.dox:24