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


libcreate
Author(s): Jacob Perron
autogenerated on Sat May 8 2021 03:02:37