util.h
Go to the documentation of this file.
1 
32 #ifndef CREATE_UTIL_H
33 #define CREATE_UTIL_H
34 
35 #define COUT(prefix,msg) (std::cout<<prefix<<msg<<std::endl)
36 #define CERR(prefix,msg) (std::cerr<<prefix<<msg<<std::endl)
37 
38 namespace create {
39  namespace util {
40 
41  static const uint8_t STREAM_HEADER = 19;
42  static const float V_3_TICKS_PER_REV = 508.8;
43  static const uint32_t V_3_MAX_ENCODER_TICKS = 65535;
44  static const float MAX_RADIUS = 2.0;
45  static const float STRAIGHT_RADIUS = 32.768;
46  static const float IN_PLACE_RADIUS = 0.001;
47  static const float PI = 3.14159;
48  static const float TWO_PI = 6.28318;
49  static const float EPS = 0.0001;
50 
51  inline float normalizeAngle(const float& angle) {
52  float a = angle;
53  while (a < -PI) a += TWO_PI;
54  while (a > PI) a -= TWO_PI;
55  return a;
56  }
57 
58  inline bool willFloatOverflow(const float a, const float b) {
59  return ( (a < 0.0) == (b < 0.0) && std::abs(b) > std::numeric_limits<float>::max() - std::abs(a) );
60  }
61  } // namespace util
62 } // namespace create
63 
64 #endif // CREATE_UTIL_H
static const float PI
Definition: util.h:47
static const float IN_PLACE_RADIUS
Definition: util.h:46
static const float TWO_PI
Definition: util.h:48
Definition: create.h:47
static const float V_3_TICKS_PER_REV
Definition: util.h:42
static const uint32_t V_3_MAX_ENCODER_TICKS
Definition: util.h:43
static const float MAX_RADIUS
Definition: util.h:44
bool willFloatOverflow(const float a, const float b)
Definition: util.h:58
static const float EPS
Definition: util.h:49
static const float STRAIGHT_RADIUS
Definition: util.h:45
float normalizeAngle(const float &angle)
Definition: util.h:51
static const uint8_t STREAM_HEADER
Definition: util.h:41


libcreate
Author(s): Jacob Perron
autogenerated on Thu Dec 5 2019 04:03:13