DCAITI Robot Hardware  1.0
Classes | Macros
MotorWheel.h File Reference
#include <PID_Beta6.h>
#include <PinChangeInt.h>
Include dependency graph for MotorWheel.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ISRVars
 
class  Motor
 
class  GearedMotor
 
class  MotorWheel
 

Macros

#define DIR_ADVANCE   HIGH
 
#define DIR_BACKOFF   LOW
 
#define PIN_UNDEFINED   255
 
#define REF_VOLT   12
 
#define MAX_PWM   255
 
#define TRIGGER   CHANGE
 
#define CPR   24
 
#define DIR_INVERSE   !
 
#define REDUCTION_RATIO   64
 
#define MAX_SPEEDRPM   8000
 
#define SEC_PER_MIN   60
 
#define MICROS_PER_SEC   1000000
 
#define SPEEDPPS2SPEEDRPM(freq)   ((unsigned long)(freq)*(SEC_PER_MIN)/(CPR))
 
#define KC   0.31
 
#define TAUI   0.02
 
#define TAUD   0.00
 
#define SAMPLETIME   5
 
#define Baudrate   19200
 
#define debug()   {}
 
#define irqISR(y, x)
 
#define PI   3.1416
 
#define CIRMM   314
 

Macro Definition Documentation

◆ Baudrate

#define Baudrate   19200

◆ CIRMM

#define CIRMM   314

◆ CPR

#define CPR   24

◆ debug

#define debug ( )    {}

◆ DIR_ADVANCE

#define DIR_ADVANCE   HIGH

◆ DIR_BACKOFF

#define DIR_BACKOFF   LOW

◆ DIR_INVERSE

#define DIR_INVERSE   !

◆ irqISR

#define irqISR (   y,
 
)
Value:
void x(); \
struct ISRVars y={x}; \
void x() { \
static bool first_pulse=true; \
y.pulseEndMicros=micros(); \
if(first_pulse==false && y.pulseEndMicros>y.pulseStartMicros) { \
y.speedPPS=MICROS_PER_SEC/(y.pulseEndMicros-y.pulseStartMicros); \
/* y.accPPSS=(y.speedPPS-y.lastSpeedPPS)*y.speedPPS; */ \
} else first_pulse=false; \
y.pulseStartMicros=y.pulseEndMicros; \
/* y.lastSpeedPPS=y.speedPPS; */ \
if(y.pinIRQB!=PIN_UNDEFINED) \
y.currDirection=DIR_INVERSE(digitalRead(y.pinIRQ)^digitalRead(y.pinIRQB)); \
y.currDirection==DIR_ADVANCE?++y.pulses:--y.pulses; \
}
#define DIR_INVERSE
Definition: MotorWheel.h:76
#define DIR_ADVANCE
Definition: MotorWheel.h:53
#define MICROS_PER_SEC
Definition: MotorWheel.h:86
#define PIN_UNDEFINED
Definition: MotorWheel.h:56
Definition: MotorWheel.h:131
volatile unsigned long pulseEndMicros
Definition: MotorWheel.h:136

◆ KC

#define KC   0.31

◆ MAX_PWM

#define MAX_PWM   255

◆ MAX_SPEEDRPM

#define MAX_SPEEDRPM   8000

◆ MICROS_PER_SEC

#define MICROS_PER_SEC   1000000

◆ PI

#define PI   3.1416

◆ PIN_UNDEFINED

#define PIN_UNDEFINED   255

◆ REDUCTION_RATIO

#define REDUCTION_RATIO   64

◆ REF_VOLT

#define REF_VOLT   12

◆ SAMPLETIME

#define SAMPLETIME   5

◆ SEC_PER_MIN

#define SEC_PER_MIN   60

◆ SPEEDPPS2SPEEDRPM

#define SPEEDPPS2SPEEDRPM (   freq)    ((unsigned long)(freq)*(SEC_PER_MIN)/(CPR))

◆ TAUD

#define TAUD   0.00

◆ TAUI

#define TAUI   0.02

◆ TRIGGER

#define TRIGGER   CHANGE