TRC Library for FRC (2011) 2011
TRC Library Code Project

C:/Users/Michael/Frc/2011/code/trclib/common.h File Reference

Go to the source code of this file.

Defines

#define _COMMON_H
#define PI   3.141592653589793
#define FEET_PER_METER   3.280839895
#define METERS_PER_FOOT   (1.0/FEET_PER_METER)
#define GRAVITY_CONSTANT   9.80665
#define GYRO_SENSITIVITY_2009   0.0125
#define GYRO_SENSITIVITY_2010   0.007
#define __in
#define __out
#define __inout
#define ARRAYSIZE(a)   (sizeof(a)/sizeof(a[0]))
#define SAFE_DELETE(p)
#define MAGNITUDE(x, y)   sqrt(pow(x, 2) + pow(y, 2))
#define RADIANS_TO_DEGREES(n)   ((n)*180.0/PI)
#define DIR_RADIANS(x, y)   (((x == 0.0) && (y == 0.0))? 0.0: atan2(x, y))
#define DIR_DEGREES(x, y)   RADIANS_TO_DEGREES(DIR_RADIANS(x, y))
#define GetMsecTime()   (GetFPGATime()/1000)
#define BOUND(n, l, h)   (((n) < (l))? (l): ((n) > (h))? (h): (n))
#define NORMALIZE(n, sl, sh, tl, th)   (((n) - (sl))*((th) - (tl))/((sh) - (sl)) + (tl))
#define NORMALIZE_DRIVE(n, m)   NORMALIZE(n, -1.0, 1.0, -(m), (m))
#define ABS(n)   (((n) < 0)? -(n): (n))
#define DEADBAND(n, t)   ((ABS(n) > (t))? (n): 0)
#define BOUND_INPUT(n)   BOUND(n, -1.0, 1.0)

Define Documentation

#define __in

Definition at line 31 of file common.h.

#define __inout

Definition at line 33 of file common.h.

#define __out

Definition at line 32 of file common.h.

#define _COMMON_H

Definition at line 16 of file common.h.

#define ABS (   n)    (((n) < 0)? -(n): (n))

Definition at line 68 of file common.h.

#define ARRAYSIZE (   a)    (sizeof(a)/sizeof(a[0]))

Definition at line 35 of file common.h.

#define BOUND (   n,
  l,
 
)    (((n) < (l))? (l): ((n) > (h))? (h): (n))

Definition at line 53 of file common.h.

#define BOUND_INPUT (   n)    BOUND(n, -1.0, 1.0)

Definition at line 77 of file common.h.

#define DEADBAND (   n,
 
)    ((ABS(n) > (t))? (n): 0)

Definition at line 69 of file common.h.

#define DIR_DEGREES (   x,
 
)    RADIANS_TO_DEGREES(DIR_RADIANS(x, y))

Definition at line 45 of file common.h.

#define DIR_RADIANS (   x,
 
)    (((x == 0.0) && (y == 0.0))? 0.0: atan2(x, y))

Definition at line 44 of file common.h.

#define FEET_PER_METER   3.280839895

Definition at line 22 of file common.h.

#define GetMsecTime ( )    (GetFPGATime()/1000)

Definition at line 47 of file common.h.

#define GRAVITY_CONSTANT   9.80665

Definition at line 24 of file common.h.

#define GYRO_SENSITIVITY_2009   0.0125

Definition at line 25 of file common.h.

#define GYRO_SENSITIVITY_2010   0.007

Definition at line 26 of file common.h.

#define MAGNITUDE (   x,
 
)    sqrt(pow(x, 2) + pow(y, 2))

Definition at line 41 of file common.h.

#define METERS_PER_FOOT   (1.0/FEET_PER_METER)

Definition at line 23 of file common.h.

#define NORMALIZE (   n,
  sl,
  sh,
  tl,
  th 
)    (((n) - (sl))*((th) - (tl))/((sh) - (sl)) + (tl))

Definition at line 59 of file common.h.

#define NORMALIZE_DRIVE (   n,
 
)    NORMALIZE(n, -1.0, 1.0, -(m), (m))

Definition at line 60 of file common.h.

#define PI   3.141592653589793

Definition at line 21 of file common.h.

#define RADIANS_TO_DEGREES (   n)    ((n)*180.0/PI)

Definition at line 42 of file common.h.

#define SAFE_DELETE (   p)
Value:
if (p != NULL) \
                                { \
                                    delete p; \
                                    p = NULL; \
                                }

Definition at line 36 of file common.h.

 All Classes Files Functions Variables Defines