YARP
Yet Another Robot Platform
IFrameTransform.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
9 #ifndef YARP_DEV_IFRAMETRANSFORM_H
10 #define YARP_DEV_IFRAMETRANSFORM_H
11 
12 #include <string>
13 #include <vector>
14 
15 #include <yarp/dev/api.h>
16 #include <yarp/os/Vocab.h>
17 #include <yarp/sig/Matrix.h>
18 #include <yarp/sig/Vector.h>
19 #include <yarp/math/Quaternion.h>
20 
21 namespace yarp {
22  namespace dev {
23  class IFrameTransform;
24  }
25 }
26 
33 {
34 public:
35  enum
36  {
37  TRANSFORM_OK = 0,
38  TRANSFORM_GENERAL_ERROR = 1,
39  TRANSFORM_TIMEOUT = 2,
40  };
44  virtual ~IFrameTransform();
45 
51  virtual bool allFramesAsString(std::string &all_frames) = 0;
52 
59  virtual bool canTransform (const std::string &target_frame, const std::string &source_frame) = 0;
60 
65  virtual bool clear () = 0;
66 
74  virtual bool frameExists (const std::string &frame_id) = 0;
75 
81  virtual bool getAllFrameIds (std::vector< std::string > &ids) = 0;
82 
89  virtual bool getParent (const std::string &frame_id, std::string &parent_frame_id) = 0;
90 
98  virtual bool getTransform (const std::string &target_frame_id, const std::string &source_frame_id, yarp::sig::Matrix &transform) = 0;
99 
107  virtual bool setTransform (const std::string &target_frame_id, const std::string &source_frame_id, const yarp::sig::Matrix &transform) = 0;
108 
116  virtual bool setTransformStatic(const std::string &target_frame_id, const std::string &source_frame_id, const yarp::sig::Matrix &transform) = 0;
117 
124  virtual bool deleteTransform (const std::string &target_frame_id, const std::string &source_frame_id) = 0;
125 
134  virtual bool transformPoint (const std::string &target_frame_id, const std::string &source_frame_id, const yarp::sig::Vector &input_point, yarp::sig::Vector &transformed_point) = 0;
135 
144  virtual bool transformPose(const std::string &target_frame_id, const std::string &source_frame_id, const yarp::sig::Vector &input_pose, yarp::sig::Vector &transformed_pose) = 0;
145 
154  virtual bool transformQuaternion(const std::string &target_frame_id, const std::string &source_frame_id, const yarp::math::Quaternion &input_quaternion, yarp::math::Quaternion &transformed_quaternion) = 0;
155 
164  virtual bool waitForTransform(const std::string &target_frame_id, const std::string &source_frame_id, const double &timeout) = 0;
165 };
166 
171 
172 #endif // YARP_DEV_IFRAMETRANSFORM_H
yarp::dev::IFrameTransform::frameExists
virtual bool frameExists(const std::string &frame_id)=0
Check if a frame exists.
yarp::dev::IFrameTransform::setTransform
virtual bool setTransform(const std::string &target_frame_id, const std::string &source_frame_id, const yarp::sig::Matrix &transform)=0
Register a transform between two frames.
yarp::dev::IFrameTransform::canTransform
virtual bool canTransform(const std::string &target_frame, const std::string &source_frame)=0
Test if a transform exists.
yarp::os::createVocab
constexpr yarp::conf::vocab32_t createVocab(char a, char b=0, char c=0, char d=0)
Definition: Vocab.h:22
VOCAB_TRANSFORM_SET
constexpr yarp::conf::vocab32_t VOCAB_TRANSFORM_SET
Definition: IFrameTransform.h:168
Vector.h
contains the definition of a Vector type
yarp::dev::IFrameTransform::~IFrameTransform
virtual ~IFrameTransform()
Destructor.
yarp::dev::IFrameTransform::waitForTransform
virtual bool waitForTransform(const std::string &target_frame_id, const std::string &source_frame_id, const double &timeout)=0
Block until a transform from source_frame_id to target_frame_id is possible or it times out.
Matrix.h
contains the definition of a Matrix type
VOCAB_TRANSFORM_DELETE
constexpr yarp::conf::vocab32_t VOCAB_TRANSFORM_DELETE
Definition: IFrameTransform.h:169
yarp::dev::IFrameTransform
Transform Interface.
Definition: IFrameTransform.h:33
Quaternion.h
yarp::sig::VectorOf< double >
yarp::dev::IFrameTransform::transformPose
virtual bool transformPose(const std::string &target_frame_id, const std::string &source_frame_id, const yarp::sig::Vector &input_pose, yarp::sig::Vector &transformed_pose)=0
Transform a Stamped Pose into the target frame.
yarp::dev::IFrameTransform::setTransformStatic
virtual bool setTransformStatic(const std::string &target_frame_id, const std::string &source_frame_id, const yarp::sig::Matrix &transform)=0
Register a static transform between two frames.
yarp::math::Quaternion
Definition: Quaternion.h:27
yarp::dev::IFrameTransform::deleteTransform
virtual bool deleteTransform(const std::string &target_frame_id, const std::string &source_frame_id)=0
Deletes a transform between two frames.
yarp::dev::IFrameTransform::allFramesAsString
virtual bool allFramesAsString(std::string &all_frames)=0
Creates a debug string containing the list of all registered frames.
YARP_dev_API
#define YARP_dev_API
Definition: api.h:19
yarp::dev::IFrameTransform::getTransform
virtual bool getTransform(const std::string &target_frame_id, const std::string &source_frame_id, yarp::sig::Matrix &transform)=0
Get the transform between two frames.
yarp::dev::IFrameTransform::getAllFrameIds
virtual bool getAllFrameIds(std::vector< std::string > &ids)=0
Gets a vector containing all the registered frames.
yarp::dev::IFrameTransform::getParent
virtual bool getParent(const std::string &frame_id, std::string &parent_frame_id)=0
Get the parent of a frame.
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::conf::vocab32_t
std::int32_t vocab32_t
Definition: numeric.h:52
Vocab.h
yarp::dev::IFrameTransform::transformQuaternion
virtual bool transformQuaternion(const std::string &target_frame_id, const std::string &source_frame_id, const yarp::math::Quaternion &input_quaternion, yarp::math::Quaternion &transformed_quaternion)=0
Transform a quaternion into the target frame.
yarp::dev::IFrameTransform::clear
virtual bool clear()=0
Removes all the registered transforms.
api.h
yarp::dev::IFrameTransform::transformPoint
virtual bool transformPoint(const std::string &target_frame_id, const std::string &source_frame_id, const yarp::sig::Vector &input_point, yarp::sig::Vector &transformed_point)=0
Transform a point into the target frame.
VOCAB_TRANSFORM_DELETE_ALL
constexpr yarp::conf::vocab32_t VOCAB_TRANSFORM_DELETE_ALL
Definition: IFrameTransform.h:170
yarp::sig::Matrix
A class for a Matrix.
Definition: Matrix.h:46
VOCAB_ITRANSFORM
constexpr yarp::conf::vocab32_t VOCAB_ITRANSFORM
Definition: IFrameTransform.h:167