ReferenceFrame.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 {
13 
15 {
16  if (this == desiredFrame.get())
17  {
19  }
20 
21  verifyFramesHaveSameRoot(desiredFrame);
22 
23  return desiredFrame->getInverseTransformToRoot() * getTransformToRoot();
24 }
25 
27 {
28  if (parentFrame == nullptr)
29  {
30  return;
31  }
32 
33  inverseTransformToRoot = transformFromParent * parentFrame->getInverseTransformToRoot();
35 }
36 
38 {
39  checkReferenceFramesMatch(referenceFrame.get());
40 }
41 
43 {
44  if (referenceFrame == nullptr)
45  {
46  throw ReferenceFrameException("Reference frame is nullptr!");
47  }
48 
49  if (referenceFrame != this)
50  {
51  throw ReferenceFrameException("Reference frames do not match!");
52  }
53 }
54 
56 {
57  if (rootFrame != frame->getRootFrame())
58  {
59  std::string msg = "Frames " + frame->getName() + " and " + this->getName() + " have mismatched roots!";
60  throw ReferenceFrameException(msg);
61  }
62 }
63 } // namespace RobotDynamics
std::string getName() const
Get the frame name.
static ReferenceFramePtr worldFrame
A custom exception for frame operations.
RobotDynamics::Math::SpatialTransform transformToRoot
void checkReferenceFramesMatch(ReferenceFramePtr referenceFrame) const
Check if the argument ReferenceFrame equals this.
RobotDynamics::Math::SpatialTransform transformFromParent
RobotDynamics::Math::SpatialTransform inverseTransformToRoot
std::shared_ptr< ReferenceFrame > ReferenceFramePtr
Compact representation of spatial transformations.
SpatialTransform inverse() const
Returns inverse of transform.
virtual RobotDynamics::Math::SpatialTransform getTransformToRoot()
Get this frames ReferenceFrame::transformToRoot.
void verifyFramesHaveSameRoot(ReferenceFramePtr frame)
Check if two frames have the same roots.
ReferenceFrame object used to tell what frame objects are expressed in. Every ReferenceFrame has a po...
void getTransformToDesiredFrame(RobotDynamics::Math::SpatialTransform &transformToPack, ReferenceFramePtr desiredFrame)
Get the spatial transform from this frame to desiredFrame and store it in transformToPack.
static ReferenceFramePtr createAWorldFrame(const std::string &frameName="world")
Helper method to create a world frame.
Namespace for all structures of the RobotDynamics library.
Definition: Body.h:21
void update()
Recalculates this frames ReferenceFrame::transformToRoot and ReferenceFrame::inverseTransformToRoot w...


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