opw_utilities.h
Go to the documentation of this file.
1 #ifndef OPW_UTILITIES_H
2 #define OPW_UTILITIES_H
3 
4 #include <cmath>
5 
6 namespace opw_kinematics
7 {
8 
9 template <typename T>
10 inline bool isValid(const T* qs)
11 {
12  return std::isfinite(qs[0]) && std::isfinite(qs[1]) && std::isfinite(qs[2]) && std::isfinite(qs[3]) &&
13  std::isfinite(qs[4]) && std::isfinite(qs[5]);
14 }
15 
16 template <typename T>
17 inline void harmonizeTowardZero(T* qs)
18 {
19  const static T pi = T(M_PI);
20  const static T two_pi = T(2.0 * M_PI);
21 
22  for (int i = 0; i < 6; i++) // TODO: Unroll manually?
23  {
24  if (qs[i] > pi) qs[i] -= two_pi;
25  else if (qs[i] < -pi) qs[i] += two_pi;
26  }
27 }
28 
29 }
30 
31 #endif // OPW_UTILITIES_H
#define M_PI
bool isValid(const T *qs)
Definition: opw_utilities.h:10
void harmonizeTowardZero(T *qs)
Definition: opw_utilities.h:17


moveit_opw_kinematics_plugin
Author(s): Jeroen De Maeyer, Simon Schmeisser (isys vision)
autogenerated on Wed Jun 3 2020 03:17:14