26 const std::string& child,
36 translation{inTX, inTY, inTZ},
37 rotation(inRX, inRY, inRZ, inRW)
45 if (rotation.isValid()==
false) {
return false;}
53 translation.set(X, Y, Z);
58 double rot[3] = { R, P, Y };
65 rotation.fromRotationMatrix(rotM);
72 rotM = rotation.toRotationMatrix4x4();
81 t_mat = rotation.toRotationMatrix4x4();
82 t_mat[0][3] = translation.tX;
83 t_mat[1][3] = translation.tY;
84 t_mat[2][3] = translation.tZ;
90 if (mat.
cols() != 4 || mat.
rows() != 4)
92 yCError(FRAMETRANSFORM,
"FrameTransform::fromMatrix() failed, matrix should be = 4x4");
99 translation.tX = mat[0][3];
100 translation.tY = mat[1][3];
101 translation.tZ = mat[2][3];
102 rotation.fromRotationMatrix(mat);
112 if (format == rotation_as_quaternion)
114 sprintf(buff,
"%s -> %s \n tran: %f %f %f \n rot quaternion: %f %f %f %f\n\n",
115 src_frame_id.c_str(),
116 dst_frame_id.c_str(),
139 else if (format == rotation_as_matrix)
142 rotM = rotation.toRotationMatrix4x4();
143 rotM[0][3] = translation.tX;
144 rotM[1][3] = translation.tY;
145 rotM[2][3] = translation.tZ;
146 std::string s_rotm =rotM.
toString();
147 sprintf(buff,
"%s -> %s \n transformation matrix:\n %s \n\n",
148 src_frame_id.c_str(),
149 dst_frame_id.c_str(),
152 else if (format == rotation_as_rpy)
156 rotM = rotation.toRotationMatrix3x3();
160 std::string s_rotmr = rotVrad.
toString();
161 std::string s_rotmd = rotVdeg.
toString();
162 sprintf(buff,
"%s -> %s \n tran: %f %f %f \n rotation rpy: %s (deg %s)\n\n",
163 src_frame_id.c_str(),
164 dst_frame_id.c_str(),
171 return std::string(buff);
#define BOTTLE_TAG_FLOAT64
#define BOTTLE_TAG_STRING
An interface for reading from a network connection.
virtual std::string expectString()
Read a string from the network connection.
virtual std::int32_t expectInt32()=0
Read a 32-bit integer from the network connection.
virtual bool convertTextMode()=0
Reads in a standard description in text mode, and converts it to a standard description in binary.
virtual bool isError() const =0
virtual std::int8_t expectInt8()=0
Read a 8-bit integer from the network connection.
virtual yarp::conf::float64_t expectFloat64()=0
Read a 64-bit floating point number from the network connection.
An interface for writing to a network connection.
virtual bool isError() const =0
virtual void appendInt8(std::int8_t data)=0
Send a representation of a 8-bit integer to the network connection.
virtual bool convertTextMode()=0
Converts a standard description in binary into a textual description, if the connection is in text-mo...
virtual void appendInt32(std::int32_t data)=0
Send a representation of a 32-bit integer to the network connection.
virtual void appendFloat64(yarp::conf::float64_t data)=0
Send a representation of a 64-bit floating point number to the network connection.
void appendString(const std::string &str)
Send a string to the network connection.
size_t cols() const
Return number of columns.
size_t rows() const
Return number of rows.
std::string toString(int precision=-1, int width=-1, const char *endRowStr="\n") const
Print matrix to a string.
std::string toString(int precision=-1, int width=-1) const
Creates a string object containing a text representation of the object.
#define yCError(component,...)
#define yCAssert(component, x)
#define YARP_LOG_COMPONENT(name,...)
yarp::sig::Matrix rpy2dcm(const yarp::sig::Vector &rpy)
Converts roll-pitch-yaw angles in the corresponding dcm (direction cosine matrix) rotation matrix (de...
yarp::sig::Vector dcm2rpy(const yarp::sig::Matrix &R)
Converts a dcm (direction cosine matrix) rotation matrix to roll-pitch-yaw angles (defined in Math....
VectorOf< double > Vector