8 #ifndef __RDL_REFERENCE_FRAME_HPP__ 9 #define __RDL_REFERENCE_FRAME_HPP__ 121 : frameName(frameName)
122 , parentFrame(parentFrame)
123 , transformFromParent(transformFromParent)
125 , isBodyFrame(isBodyFrame)
126 , movableBodyId(movableBodyId)
128 if (parentFrame ==
nullptr)
130 throw ReferenceFrameException(
"You are not allowed to create a frame with parentFrame=nullptr. Only a root frame and the world frame may have " 131 "parentFrame=nullptr");
136 while (root->getParentFrame() !=
nullptr)
138 root = root->getParentFrame();
343 : frameName(frameName),
parentFrame(nullptr), isWorldFrame(isWorldFrame), isBodyFrame(isBodyFrame), movableBodyId(movableBodyId)
387 :
ReferenceFrame(frameName, parentFrame, transformFromParent, false, movableBodyId)
417 #endif // ifndef __RDL_REFERENCE_FRAME_HPP__ std::string getName() const
Get the frame name.
ReferenceFramePtr getParentFrame()
get a pointer to this frames parent
std::vector< ReferenceFramePtr > ReferenceFramePtrV
std::shared_ptr< FixedReferenceFrame > FixedReferenceFramePtr
ReferenceFrame(const std::string &frameName, bool isWorldFrame, unsigned int movableBodyId, bool isBodyFrame)
static ReferenceFramePtr worldFrame
unsigned int movableBodyId
A custom exception for frame operations.
ReferenceFrame()
Empty constructor. All contained ptrs will be initialize to nullptr.
static ReferenceFramePtr createARootFrame(const std::string &frameName)
Creates a root frame with ReferenceFrame::parentFrame=nullptr.
RobotDynamics::Math::SpatialTransform transformToRoot
void setTransformFromParent(const RobotDynamics::Math::SpatialTransform &transformFromParent)
Set a frames ReferenceFrame::transformToParent. For frames connected by a joint, this needs to be upd...
void checkReferenceFramesMatch(ReferenceFramePtr referenceFrame) const
Check if the argument ReferenceFrame equals this.
bool getIsBodyFrame() const
Get boolean telling if this frame is a body frame or not. If it is a body frame, A pointer to this fr...
std::vector< FixedReferenceFramePtr > FixedReferenceFramePtrV
static ReferenceFramePtr getWorldFrame()
Get a pointer to the world frame.
RobotDynamics::Math::SpatialTransform getTransformToParent()
Get spatial transform this frame to its parent.
RobotDynamics::Math::SpatialTransform getInverseTransformToRoot() override
Get this frames ReferenceFrame::inverseTransformToRoot.
RobotDynamics::Math::SpatialTransform transformFromParent
ReferenceFrame & operator=(const ReferenceFrame &other)
bool getIsWorldFrame() const
Get a boolean telling if this frame is the world frame.
ReferenceFrame(const ReferenceFrame &referenceFrameToCopy)
Copy constructor.
virtual ~ReferenceFrame()
Destructor.
RobotDynamics::Math::SpatialTransform inverseTransformToRoot
std::shared_ptr< ReferenceFrame > ReferenceFramePtr
unsigned int getMovableBodyId() const
Get the ID of the movable body this frame is attached to.
virtual RobotDynamics::Math::SpatialTransform getTransformToRoot()
Get this frames ReferenceFrame::transformToRoot.
void verifyFramesHaveSameRoot(ReferenceFramePtr frame)
Check if two frames have the same roots.
virtual RobotDynamics::Math::SpatialTransform getInverseTransformToRoot()
Get this frames ReferenceFrame::inverseTransformToRoot.
ReferenceFrame * getRootFrame()
ReferenceFrame object used to tell what frame objects are expressed in. Every ReferenceFrame has a po...
ReferenceFrame(const std::string &frameName, ReferenceFramePtr parentFrame, const RobotDynamics::Math::SpatialTransform &transformFromParent, bool isBodyFrame, unsigned int movableBodyId)
Constructor.
ReferenceFrame * rootFrame
FixedReferenceFrame(const std::string &frameName, ReferenceFramePtr parentFrame, const RobotDynamics::Math::SpatialTransform &transformFromParent, unsigned int movableBodyId)
void getTransformToDesiredFrame(RobotDynamics::Math::SpatialTransform &transformToPack, ReferenceFramePtr desiredFrame)
Get the spatial transform from this frame to desiredFrame and store it in transformToPack.
virtual ~FixedReferenceFrame()
RobotDynamics::Math::SpatialTransform getTransformToRoot() override
Get this frames ReferenceFrame::transformToRoot.
static ReferenceFramePtr createAWorldFrame(const std::string &frameName="world")
Helper method to create a world frame.
ReferenceFramePtr parentFrame
RobotDynamics::Math::SpatialTransform getTransformFromParent()
Get spatial transform from parent to this frame.
Namespace for all structures of the RobotDynamics library.
void update()
Recalculates this frames ReferenceFrame::transformToRoot and ReferenceFrame::inverseTransformToRoot w...