YARP
Yet Another Robot Platform
FrameTransform.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #ifndef YARP_MATH_TRANSFORM_H
7 #define YARP_MATH_TRANSFORM_H
8 
9 #include <yarp/sig/Vector.h>
10 #include <yarp/sig/Matrix.h>
11 #include <yarp/math/api.h>
12 #include <yarp/math/Quaternion.h>
13 
14 namespace yarp::math {
15 
17 {
18 public:
21  double timestamp = 0;
22  bool isStatic = false;
23 
25  {
26  double tX;
27  double tY;
28  double tZ;
29 
30  void set(double x, double y, double z)
31  {
32  tX = x;
33  tY = y;
34  tZ = z;
35  }
36  } translation;
37 
39 
40  bool isValid() const;
41 
43 
44  FrameTransform(const std::string& parent,
45  const std::string& child,
46  double inTX,
47  double inTY,
48  double inTZ,
49  double inRX,
50  double inRY,
51  double inRZ,
52  double inRW);
53 
55 
56  void transFromVec(double X, double Y, double Z);
57  void rotFromRPY(double R, double P, double Y);
58  yarp::sig::Vector getRPYRot() const;
59 
60  yarp::sig::Matrix toMatrix() const;
61  bool fromMatrix(const yarp::sig::Matrix& mat);
62 
64  {
65  rotation_as_quaternion=0,
66  rotation_as_matrix=1,
67  rotation_as_rpy=2
68  };
69 
70  std::string toString(display_transform_mode_t format= rotation_as_quaternion) const;
71 
73  /*
74  * Read data from a connection.
75  * return true iff data was read correctly
76  */
77  bool read(yarp::os::ConnectionReader& connection) override;
78 
83  bool write(yarp::os::ConnectionWriter& connection) const override;
84 
85  yarp::os::Type getType() const override
86  {
87  return yarp::os::Type::byName("yarp/frameTransform");
88  }
89 };
90 
91 } // namespace yarp::math
92 
93 #endif // YARP_MATH_TRANSFORM_H
contains the definition of a Matrix type
contains the definition of a Vector type
yarp::os::Type getType() const override
An interface for reading from a network connection.
An interface for writing to a network connection.
This is a base class for objects that can be both read from and be written to the YARP network.
Definition: Portable.h:25
static Type byName(const char *name)
Definition: Type.cpp:171
A class for a Matrix.
Definition: Matrix.h:39
std::string toString(const T &value)
convert an arbitrary type to string.
bool isValid()
Check if time is valid (non-zero).
Definition: Time.cpp:314
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
Definition: ImageFile.cpp:915
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
Definition: ImageFile.cpp:1091
void set(double x, double y, double z)
#define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x)
Suppress MSVC C4251 warning for the declaration.
Definition: system.h:338
#define YARP_math_API
Definition: api.h:17