SpatialMomentum.hpp
Go to the documentation of this file.
1 /*
2  * RDL - Robot Dynamics Library
3  * Copyright (c) 2017 Jordan Lack <jlack1987@gmail.com>
4  *
5  * Licensed under the zlib license. See LICENSE for more details.
6  */
7 
8 #ifndef __RDL_SPATIAL_MOMENTUM_HP__
9 #define __RDL_SPATIAL_MOMENTUM_HP__
10 
21 
22 namespace RobotDynamics
23 {
24 namespace Math
25 {
32 class SpatialMomentum : public Momentum, public FrameObject
33 {
34  public:
39  {
40  }
41 
52  SpatialMomentum(ReferenceFramePtr referenceFrame, const double kx, const double ky, const double kz, const double lx, const double ly, const double lz)
53  : Momentum(kx, ky, kz, lx, ly, lz), FrameObject(referenceFrame)
54  {
55  }
56 
64  : Momentum(k.x(), k.y(), k.z(), l.x(), l.y(), l.z()), FrameObject(referenceFrame)
65  {
66  }
67 
73  {
74  }
75 
81  SpatialMomentum(ReferenceFramePtr referenceFrame, const ForceVector& forceVector) : Momentum(forceVector), FrameObject(referenceFrame)
82  {
83  }
84 
90  {
91  }
92 
99  SpatialMomentum(const SpatialInertia& inertia, const SpatialMotion& vector) : Momentum(), FrameObject(inertia.getReferenceFrame())
100  {
101  set(inertia, vector);
102  }
103 
110  void set(const SpatialInertia& inertia, const SpatialMotion& vector)
111  {
112  inertia.getReferenceFrame()->checkReferenceFramesMatch(vector.getReferenceFrame());
113  this->referenceFrame = inertia.getReferenceFrame();
114  computeMomentum(inertia, vector);
115  }
116 
126  {
127  this->referenceFrame = referenceFrame;
128  computeMomentum(inertia, vector);
129  }
130 
137  {
138  this->referenceFrame = referenceFrame;
139  ForceVector::set(f);
140  }
141 
147  inline double operator*(const SpatialMotion& vector)
148  {
149  this->checkReferenceFramesMatch(&vector);
150  return Momentum::operator*(vector);
151  }
152 
153  protected:
155  {
156  return this;
157  }
158 };
159 
167 inline SpatialMomentum operator*(const SpatialInertia& inertia, const SpatialMotion& vector)
168 {
169  inertia.getReferenceFrame()->checkReferenceFramesMatch(vector.getReferenceFrame());
170  SpatialMomentum m(inertia, vector);
171 
172  return m;
173 }
174 typedef std::vector<SpatialMomentum, Eigen::aligned_allocator<SpatialMomentum>> SpatialMomentumV;
175 } // namespace Math
176 } // namespace RobotDynamics
177 
178 #endif //__RDL_SPATIAL_MOMENTUM_HP__
ReferenceFramePtr getReferenceFrame() const
Get a pointer to the reference frame this FrameObject is expressed in.
Definition: FrameObject.hpp:52
EIGEN_STRONG_INLINE double & ly()
Definition: Momentum.hpp:119
SpatialMomentum(ReferenceFramePtr referenceFrame, const ForceVector &forceVector)
Constructor.
SpatialMomentum(const SpatialInertia &inertia, const SpatialMotion &vector)
Constructor. Momentum is computed from SpatialInertia and SpatialMotion by . Frame checks are perform...
std::vector< SpatialMomentum, Eigen::aligned_allocator< SpatialMomentum > > SpatialMomentumV
SpatialMomentum(ReferenceFramePtr referenceFrame)
Constructor.
ReferenceFramePtr referenceFrame
Definition: FrameObject.hpp:81
A ForceVector is a SpatialVector containing 3 moments and 3 linear forces.
Definition: ForceVector.hpp:27
EIGEN_STRONG_INLINE double & kz()
Definition: Momentum.hpp:94
void computeMomentum(const RigidBodyInertia &I, const MotionVector &v)
Computes momentum from inertia and velocity.
Definition: Momentum.hpp:181
void checkReferenceFramesMatch(const FrameObject *frameObject) const
Check if two ReferenceFrameHolders hold the same ReferenceFrame.
Definition: FrameObject.hpp:70
A SpatialMomentum is a Momentum expressed in a RobotDynamics::ReferenceFrame. The angular portion of ...
The TransformableGeometricObject class is an essential interface because it forces all geometric obje...
Definition: rdl_eigenmath.h:43
std::shared_ptr< ReferenceFrame > ReferenceFramePtr
Momentum is mass/inertia multiplied by velocity.
Definition: Momentum.hpp:27
This class stores a bodies mass, center of mass, and inertia information. The inertia elements are st...
A SpatialMotion vector is a MotionVector with a RobotDynamics::ReferenceFrame it is expressed in...
SpatialMomentum(ReferenceFramePtr referenceFrame, const double kx, const double ky, const double kz, const double lx, const double ly, const double lz)
Costructor.
EIGEN_STRONG_INLINE double & kx()
Definition: Momentum.hpp:84
A Math::SpatialInertia is a RigidBodyInertia explicitly expressed in a RobotDynamics::ReferenceFrame...
EIGEN_STRONG_INLINE double operator*(const MotionVector &vector)
Operator for computing kinetic energy. With momentum, and Math::MotionVector, this performs perform...
Definition: Momentum.hpp:170
EIGEN_STRONG_INLINE double & lx()
Definition: Momentum.hpp:114
SpatialMomentum(ReferenceFramePtr referenceFrame, const Vector3d &k, const Vector3d l)
Constructor.
TransformableGeometricObject * getTransformableGeometricObject()
Pure virtual method that FrameObjects are required to implement so the FrameObject::changeFrame metho...
void setIncludingFrame(ReferenceFramePtr referenceFrame, const RigidBodyInertia &inertia, const MotionVector &vector)
Set a momentum by multiplying the supplied motion vector by the supplied inertia. Set the stored Robo...
double operator*(const SpatialMotion &vector)
Operator that returns the kinetic energy. Given a momentum, and motion vector , the resulting kineti...
EIGEN_STRONG_INLINE double & lz()
Definition: Momentum.hpp:124
SpatialMomentum()
Constructor. RobotDynamics::ReferenceFrame is initialized to nullptr.
SpatialMomentum(const SpatialMomentum &SpatialMomentum)
Copy constructor.
EIGEN_STRONG_INLINE double & ky()
Definition: Momentum.hpp:89
An interface that objects with a ReferenceFrame extend to inherit the FrameObject::changeFrame method...
Definition: FrameObject.hpp:28
Namespace for all structures of the RobotDynamics library.
Definition: Body.h:21
EIGEN_STRONG_INLINE void set(const ForceVector &f)
Setter.
Definition: ForceVector.hpp:87
void setIncludingFrame(ReferenceFramePtr referenceFrame, const ForceVector &f)
Constructor.


rdl_dynamics
Author(s):
autogenerated on Tue Apr 20 2021 02:25:28