SpatialMotion.cpp
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 
9 
10 namespace RobotDynamics
11 {
12 namespace Math
13 {
15 {
16  this->checkReferenceFramesMatch(&v);
17  this->bodyFrame->checkReferenceFramesMatch(v.baseFrame);
18 
19  this->wx() += v.wx();
20  this->wy() += v.wy();
21  this->wz() += v.wz();
22 
23  this->vx() += v.vx();
24  this->vy() += v.vy();
25  this->vz() += v.vz();
26 
27  this->bodyFrame = v.bodyFrame;
28 }
29 
31 {
33 
34  this->wx() -= v.wx();
35  this->wy() -= v.wy();
36  this->wz() -= v.wz();
37 
38  this->vx() -= v.vx();
39  this->vy() -= v.vy();
40  this->vz() -= v.vz();
41 
42  if (this->baseFrame == v.getBaseFrame())
43  {
44  this->baseFrame = v.bodyFrame;
45  }
46  else if (this->bodyFrame == v.bodyFrame)
47  {
48  this->bodyFrame = v.baseFrame;
49  }
50  else
51  {
52  throw ReferenceFrameException("Cannot perform -= operation on spatial motion vectors due to a reference frame mismatch!");
53  }
54 }
55 
57 {
59  this->bodyFrame->checkReferenceFramesMatch(v.getReferenceFrame());
60 
62 }
63 } // namespace Math
64 } // namespace RobotDynamics
MotionVector operator%=(const MotionVector &v)
Operator for performing the RBDA operator for two motion vectors, i.e. .
ReferenceFramePtr getReferenceFrame() const
Get a pointer to the reference frame this FrameObject is expressed in.
Definition: FrameObject.hpp:52
A custom exception for frame operations.
void operator-=(const SpatialMotion &v)
Overloaded -= operator. Frame checks are performed.
void operator%=(const SpatialMotion &v)
This is an operator for performing what is referred to in Featherstone as the spatial vector cross( )...
EIGEN_STRONG_INLINE double & vz()
Get a reference to the linear-z component.
EIGEN_STRONG_INLINE double & wx()
Get a reference to the angular-x component.
EIGEN_STRONG_INLINE double & wy()
Get a reference to the angular-y component.
void checkReferenceFramesMatch(const FrameObject *frameObject) const
Check if two ReferenceFrameHolders hold the same ReferenceFrame.
Definition: FrameObject.hpp:70
void operator+=(const SpatialMotion &v)
Overloaded += operator. Frame checks are performed.
EIGEN_STRONG_INLINE double & vx()
Get a reference to the linear-x component.
A SpatialMotion vector is a MotionVector with a RobotDynamics::ReferenceFrame it is expressed in...
ReferenceFramePtr getBaseFrame() const
Get a SpatialMotions SpatialMotion::baseFrame.
EIGEN_STRONG_INLINE double & wz()
Get a reference to the angular-z component.
EIGEN_STRONG_INLINE double & vy()
Get a reference to the linear-y component.
Namespace for all structures of the RobotDynamics library.
Definition: Body.h:21


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