pinocchio  UNKNOWN
copy.hpp
1 //
2 // Copyright (c) 2016-2018 CNRS
3 //
4 // This file is part of Pinocchio
5 // Pinocchio is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 //
10 // Pinocchio is distributed in the hope that it will be
11 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Lesser Public License for more details. You should have
14 // received a copy of the GNU Lesser General Public License along with
15 // Pinocchio If not, see
16 // <http://www.gnu.org/licenses/>.
17 
18 #ifndef __se3_copy_hpp__
19 #define __se3_copy_hpp__
20 
21 #include "pinocchio/multibody/model.hpp"
22 #include "pinocchio/multibody/data.hpp"
23 #include "pinocchio/algorithm/check.hpp"
24 
25 namespace se3
26 {
36  template<int level>
37  inline void
38  copy (const Model& model, const Data & origin, Data & dest );
39 
40 } // namespace se3
41 
42 /* --- Details -------------------------------------------------------------------- */
43 //#include "pinocchio/algorithm/copy.hxx"
44 
45 
46 namespace se3
47 {
48  template<int LEVEL>
49  inline void
50  copy (const Model& model, const Data & origin, Data & dest )
51  {
52  for( se3::JointIndex jid=1; int(jid)<model.njoints; ++ jid )
53  {
54  assert(LEVEL>=0);
55 
56  dest.oMi[jid] = origin.oMi [jid];
57  if(LEVEL>=1)
58  {
59  dest.v[jid] = origin.v [jid];
60  }
61  if(LEVEL>=2)
62  {
63  dest.a[jid] = origin.v [jid];
64  dest.a_gf[jid] = origin.a_gf[jid];
65  dest.f[jid] = origin.f [jid];
66  }
67  }
68  }
69 
70 
71 } // namespace se3
72 
73 #endif // ifndef __se3_copy_hpp__
container::aligned_vector< Motion > a
Vector of joint accelerations expressed at the centers of the joints.
Definition: data.hpp:58
container::aligned_vector< Motion > a_gf
Vector of joint accelerations due to the gravity field.
Definition: data.hpp:64
container::aligned_vector< SE3 > oMi
Vector of absolute joint placements (wrt the world).
Definition: data.hpp:87
container::aligned_vector< Force > f
Vector of body forces expressed in the local frame of the joint. For each body, the force represents ...
Definition: data.hpp:74
container::aligned_vector< Motion > v
Vector of joint velocities expressed at the centers of the joints.
Definition: data.hpp:67
int njoints
Number of joints.
Definition: model.hpp:55
void copy(const Model &model, const Data &origin, Data &dest)
Copy part of the data from <orig> to <dest>. Template parameter can be used to select at which differ...
Definition: copy.hpp:50