9 #ifndef YARP_ROSMSG_IMPL_HELPER_H
10 #define YARP_ROSMSG_IMPL_HELPER_H
27 constexpr
double PI = 3.1415926535897932384626433;
32 return degrees / 180.0 *
PI;
37 for(
size_t i=0; i<degrees.size(); i++)
46 quaternion[0] = -sin(eulerXYZ[0]/2) * sin(eulerXYZ[1]/2) * sin(eulerXYZ[2]/2) + cos(eulerXYZ[0]/2) * cos(eulerXYZ[1]/2) * cos(eulerXYZ[2]/2);
47 quaternion[1] = sin(eulerXYZ[0]/2) * cos(eulerXYZ[1]/2) * cos(eulerXYZ[2]/2) + cos(eulerXYZ[0]/2) * sin(eulerXYZ[1]/2) * sin(eulerXYZ[2]/2);
48 quaternion[2] = -sin(eulerXYZ[0]/2) * cos(eulerXYZ[1]/2) * sin(eulerXYZ[2]/2) + cos(eulerXYZ[0]/2) * sin(eulerXYZ[1]/2) * cos(eulerXYZ[2]/2);
49 quaternion[3] = sin(eulerXYZ[0]/2) * sin(eulerXYZ[1]/2) * cos(eulerXYZ[2]/2) + cos(eulerXYZ[0]/2) * cos(eulerXYZ[1]/2) * sin(eulerXYZ[2]/2);
54 for(
int i=0; i<4; i++)
56 norma += quaternion[i] * quaternion[i];
60 if((norma -1) >= 0.05)
62 yError(
"convertEulerAngleYXZrads_to_quaternion: Error on quaternion conversion.");
77 #endif // YARP_ROSMSG_IMPL_HELPER_H