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 {
15 namespace math {
16 
18 {
19 public:
22  double timestamp = 0;
23  bool isStatic = false;
24 
26  {
27  double tX;
28  double tY;
29  double tZ;
30 
31  void set(double x, double y, double z)
32  {
33  tX = x;
34  tY = y;
35  tZ = z;
36  }
37  } translation;
38 
40 
42 
43  FrameTransform(const std::string& parent,
44  const std::string& child,
45  double inTX,
46  double inTY,
47  double inTZ,
48  double inRX,
49  double inRY,
50  double inRZ,
51  double inRW);
52 
54 
55  void transFromVec(double X, double Y, double Z);
56  void rotFromRPY(double R, double P, double Y);
57  yarp::sig::Vector getRPYRot() const;
58 
59  yarp::sig::Matrix toMatrix() const;
60  bool fromMatrix(const yarp::sig::Matrix& mat);
61 
63  {
64  rotation_as_quaternion=0,
65  rotation_as_matrix=1,
66  rotation_as_rpy=2
67  };
68 
69  std::string toString(display_transform_mode_t format= rotation_as_quaternion) const;
70 
72  /*
73  * Read data from a connection.
74  * return true iff data was read correctly
75  */
76  bool read(yarp::os::ConnectionReader& connection) override;
77 
82  bool write(yarp::os::ConnectionWriter& connection) const override;
83 
84  yarp::os::Type getType() const override
85  {
86  return yarp::os::Type::byName("yarp/frameTransform");
87  }
88 };
89 
90 } // namespace sig
91 } // namespace yarp
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:26
static Type byName(const char *name)
Definition: Type.cpp:171
A class for a Matrix.
Definition: Matrix.h:43
std::string toString(const T &value)
convert an arbitrary type to string.
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
Definition: ImageFile.cpp:923
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
Definition: ImageFile.cpp:1099
The main, catch-all namespace for YARP.
Definition: dirs.h:16
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:336
#define YARP_math_API
Definition: api.h:17