lib/geartrain.h File Reference

Geartrain calculations and conversions. More...

#include <math.h>


Defines

#define CM_TO_TICKS(cm)   (uint32_t)((cm)*TICKS_PER_CM)
 Convert from centimeters to encoder ticks.
#define DEG_TO_CM_IN_PLACE(deg)   ((M_PI*WHEEL_TRACK)*(deg)/360.0)
 Convert from degrees to cm of wheel rotation [rotation in place].
#define DEG_TO_TICKS_IN_PLACE(deg)   (CM_TO_TICKS(DEG_TO_CM_IN_PLACE(deg)))
 Convert from degrees to encoder ticks [rotation in place].
#define DEG_TO_CM_CORNER(deg)   ((M_PI*2.0*WHEEL_TRACK)*(deg)/360.0)
 Convert from degrees to cm of wheel rotation [rotation around one wheel].
#define DEG_TO_TICKS_CORNER(deg)   (CM_TO_TICKS(DEG_TO_CM_CORNER(deg)))
 Convert from degrees to encoder ticks [rotation around one wheel].

Detailed Description

This file defines a number of useful geartrain/distance/rotaion calculation and conversion routines.

To use these functions the user must define the following values before including geartrain.h

For the example robot:

  #define ENCODER_TO_WHEEL_RATIO 3
  #define WHEEL_CIRCUMFERENCE 10.0
  #define WHEEL_TRACK 20.0

  #include <lib/geartrain.h>