copy.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2016-2020 CNRS INRIA
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  KinematicLevel kinematic_level);
31 
32  template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
33  PINOCCHIO_DEPRECATED inline void
37  int kinematic_level)
38  {
39  copy(model,origin,dest,static_cast<KinematicLevel>(kinematic_level));
40  }
41 
42 } // namespace pinocchio
43 
44 /* --- Details -------------------------------------------------------------------- */
45 //#include "pinocchio/algorithm/copy.hxx"
46 
48 namespace pinocchio
49 {
50  template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
51  inline void
55  KinematicLevel kinematic_level)
56  {
58  typedef typename Model::JointIndex JointIndex;
59 
60  PINOCCHIO_CHECK_INPUT_ARGUMENT(kinematic_level>=POSITION);
61 
62  for(JointIndex jid=1; jid<(JointIndex)model.njoints; ++jid)
63  {
64  dest.oMi[jid] = origin.oMi [jid];
65  if(kinematic_level >= VELOCITY)
66  {
67  dest.v[jid] = origin.v [jid];
68  }
69  if(kinematic_level >= ACCELERATION)
70  {
71  dest.a[jid] = origin.a [jid];
72  dest.a_gf[jid] = origin.a_gf[jid];
73  dest.f[jid] = origin.f [jid];
74  }
75  }
76  }
77 
78 
79 } // namespace pinocchio
81 
82 #endif // ifndef __pinocchio_copy_hpp__
Refers to the quantities related to the 2nd-order kinematics (joint accelerations, center of mass acceleration, etc.).
ModelTpl< double > Model
int njoints
Number of joints.
pinocchio::JointIndex JointIndex
KinematicLevel
List of Kinematics Level supported by Pinocchio.
Refers to the quantities related to the 1st-order kinematics (joint velocities, center of mass veloci...
Main pinocchio namespace.
Definition: timings.cpp:28
void copy(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &origin, DataTpl< Scalar, Options, JointCollectionTpl > &dest, KinematicLevel kinematic_level)
Copy part of the data from origin to dest. Template parameter can be used to select at which differen...
Definition: copy.hpp:52
#define PINOCCHIO_CHECK_INPUT_ARGUMENT(...)
Macro to check an assert-like condition and throw a std::invalid_argument exception (with a message) ...
Definition: src/macros.hpp:127
JointCollectionTpl & model
Refers to the quantities related to the 0-order kinematics (joint placements, center of mass position...


pinocchio
Author(s):
autogenerated on Fri Jun 23 2023 02:38:29