6 #define _USE_MATH_DEFINES
31 double clamp(
double x,
double min,
double max);
42 tf::Transform transform;
43 if (input.size() != 6) {
44 throw std::runtime_error(
"The input does not have 6 elements x,y,z, r,p,y");
46 transform.setOrigin(tf::Vector3(input[0], input[1], input[2]));
47 transform.setRotation(
48 tf::createQuaternionFromRPY(input[3], input[4], input[5]));
69 if (input.size() % 6 != 0) {
70 throw std::runtime_error(
71 "The input does not have a multiple of 6 elements x,y,z, r,p,y");
74 std::vector<tf::Transform> transforms(input.size() / 6);
75 for (
int i = 0, j = 0; i < input.size(); i += 6, j++) {
76 transforms.at(j).setOrigin(
77 tf::Vector3(input[i + 0], input[i + 1], input[i + 2]));
78 transforms.at(j).setRotation(
79 tf::createQuaternionFromRPY(input[i + 3], input[i + 4], input[i + 5]));
double clamp(double x, double min, double max)
Clip a number to bewteen a min and max value.
Definition: math.cpp:18
double angleWrap(double x)
Wrap an angle to be in the range [-pi, pi)
Definition: math.cpp:11
tf::Transform getTransformFromVector(const T &input)
Generate a tf transform from a vector of xyzrpy.
Definition: math.h:41
std::vector< tf::Transform > getTransformsFromVector(const T &input)
Generate a vector of tf transforms from a vector of xyzrpy.
Definition: math.h:68