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 
11 
12 namespace pinocchio
13 {
26  template<typename Scalar, int Options, template<typename, int> class JointCollectionTpl>
27  inline void copy(
28  const ModelTpl<Scalar, Options, JointCollectionTpl> & model,
29  const DataTpl<Scalar, Options, JointCollectionTpl> & origin,
30  DataTpl<Scalar, Options, JointCollectionTpl> & dest,
31  KinematicLevel kinematic_level);
32 
33 } // namespace pinocchio
34 
35 /* --- Details -------------------------------------------------------------------- */
36 // #include "pinocchio/algorithm/copy.hxx"
37 
39 namespace pinocchio
40 {
41  template<typename Scalar, int Options, template<typename, int> class JointCollectionTpl>
42  inline void copy(
46  KinematicLevel kinematic_level)
47  {
49  typedef typename Model::JointIndex JointIndex;
50 
51  PINOCCHIO_CHECK_INPUT_ARGUMENT(kinematic_level >= POSITION);
52 
53  for (JointIndex jid = 1; jid < (JointIndex)model.njoints; ++jid)
54  {
55  dest.oMi[jid] = origin.oMi[jid];
56  if (kinematic_level >= VELOCITY)
57  {
58  dest.v[jid] = origin.v[jid];
59  }
60  if (kinematic_level >= ACCELERATION)
61  {
62  dest.a[jid] = origin.a[jid];
63  dest.a_gf[jid] = origin.a_gf[jid];
64  dest.f[jid] = origin.f[jid];
65  }
66  }
67  }
68 
69 } // namespace pinocchio
71 
72 #endif // ifndef __pinocchio_copy_hpp__
pinocchio::DataTpl
Definition: context/generic.hpp:25
PINOCCHIO_CHECK_INPUT_ARGUMENT
#define PINOCCHIO_CHECK_INPUT_ARGUMENT(...)
Macro to check an assert-like condition and throw a std::invalid_argument exception (with a message) ...
Definition: include/pinocchio/macros.hpp:192
pinocchio::ACCELERATION
@ ACCELERATION
Definition: multibody/fwd.hpp:65
pinocchio::KinematicLevel
KinematicLevel
List of Kinematics Level supported by Pinocchio.
Definition: multibody/fwd.hpp:59
model.hpp
pinocchio::ModelTpl::JointIndex
pinocchio::JointIndex JointIndex
Definition: multibody/model.hpp:67
data.hpp
check.hpp
pinocchio::copy
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:42
pinocchio::JointIndex
Index JointIndex
Definition: multibody/fwd.hpp:26
pinocchio::POSITION
@ POSITION
Definition: multibody/fwd.hpp:61
pinocchio::VELOCITY
@ VELOCITY
Definition: multibody/fwd.hpp:63
pinocchio::ModelTpl
Definition: context/generic.hpp:20
pinocchio::Model
ModelTpl< context::Scalar, context::Options > Model
Definition: multibody/fwd.hpp:33
pinocchio::model
JointCollectionTpl & model
Definition: joint-configuration.hpp:1082
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27


pinocchio
Author(s):
autogenerated on Mon Dec 16 2024 03:41:01