EEROS  0.4.1.0
API for the EEROS Real-Time Robotics Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Utils.hpp
Go to the documentation of this file.
1 #ifndef ORG_EEROS_TEST_CONTROL_UTILS_HPP_
2 #define ORG_EEROS_TEST_CONTROL_UTILS_HPP_
3 
4 class Utils {
5  public:
6 
7  static bool compareApprox(double ref, double val, double tolerance) {
8  if(ref == val) {
9  return true;
10  }
11  else {
12  double diff = abs(ref - val);
13  return (diff < abs(tolerance));
14  }
15  }
16 
17  static double abs(double a) {
18  if(a >= 0) {
19  return a;
20  }
21  else {
22  return -a;
23  }
24  }
25 };
26 
27 #endif // ORG_EEROS_TEST_CONTROL_UTILS_HPP_
static double abs(double a)
Definition: Utils.hpp:17
static bool compareApprox(double ref, double val, double tolerance)
Definition: Utils.hpp:7
Definition: Utils.hpp:4