Eurobot2012_Primary

Dependencies:   mbed Eurobot_2012_Primary

Committer:
narshu
Date:
Wed Oct 17 22:22:47 2012 +0000
Revision:
26:0995f61cb7b8
Parent:
23:1901cb6d0d95
Eurobot 2012 Primary;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
narshu 2:cffa347bb943 1 #ifndef MOTORS_H
narshu 2:cffa347bb943 2 #define MOTORS_H
narshu 2:cffa347bb943 3
narshu 2:cffa347bb943 4 #include "mbed.h"
narshu 2:cffa347bb943 5 #include "QEI.h"
narshu 2:cffa347bb943 6 #include "PID.h"
narshu 2:cffa347bb943 7 #include "TSH.h"
narshu 2:cffa347bb943 8
narshu 2:cffa347bb943 9 class Motors {
narshu 2:cffa347bb943 10
narshu 2:cffa347bb943 11 public:
narshu 2:cffa347bb943 12 Motors();
narshu 2:cffa347bb943 13 Motors(TSI2C &i2cin);
narshu 2:cffa347bb943 14
narshu 2:cffa347bb943 15 //Functions declaration
narshu 2:cffa347bb943 16 void resetEncoders();
narshu 2:cffa347bb943 17 int getEncoder1();
narshu 2:cffa347bb943 18 int getEncoder2();
narshu 2:cffa347bb943 19 void move(int distance, int speed);
narshu 2:cffa347bb943 20 void turn(int angle, int speed);
narshu 2:cffa347bb943 21 int getSignOfInt(int direction);
narshu 2:cffa347bb943 22 void setSpeed(int speed);
narshu 2:cffa347bb943 23 void setSpeed(int speed1, int speed2);
narshu 2:cffa347bb943 24 void stop();
narshu 2:cffa347bb943 25 void setMode(int mode);
narshu 2:cffa347bb943 26 int encoderToDistance(int encoder);
narshu 2:cffa347bb943 27 int distanceToEncoder(int distance);
narshu 2:cffa347bb943 28 void sendCommand(char command);
narshu 2:cffa347bb943 29 void sendCommand(char command1, char command2 );
narshu 2:cffa347bb943 30 void speedRegulatorTask();
narshu 2:cffa347bb943 31 float _debug1;
narshu 2:cffa347bb943 32 float _debug2;
narshu 2:cffa347bb943 33 int accelerationRegister; //turns on acceleration control
narshu 23:1901cb6d0d95 34 void coastStop();
narshu 2:cffa347bb943 35
narshu 2:cffa347bb943 36 private:
narshu 23:1901cb6d0d95 37
narshu 2:cffa347bb943 38 void _setSpeed(int speed1, int speed2);
narshu 2:cffa347bb943 39 void _stop();
narshu 2:cffa347bb943 40 void _stop(int motor1, int motor2);
narshu 2:cffa347bb943 41 QEI Encoder1;
narshu 2:cffa347bb943 42 QEI Encoder2;
narshu 2:cffa347bb943 43 DigitalOut Motor1A;
narshu 2:cffa347bb943 44 DigitalOut Motor1B;
narshu 2:cffa347bb943 45 DigitalOut Motor2A;
narshu 2:cffa347bb943 46 DigitalOut Motor2B;
narshu 2:cffa347bb943 47 PwmOut Motor1Enable;
narshu 2:cffa347bb943 48 PwmOut Motor2Enable;
narshu 2:cffa347bb943 49 int _motorSpeed1;
narshu 2:cffa347bb943 50 int _motorSpeed2;
narshu 2:cffa347bb943 51 PID PIDControllerMotor1;
narshu 2:cffa347bb943 52 PID PIDControllerMotor2;
narshu 2:cffa347bb943 53 int _lastEncoder1;
narshu 2:cffa347bb943 54 int _lastEncoder2;
narshu 2:cffa347bb943 55 int _pidDataBufferIndex;
narshu 2:cffa347bb943 56 int _accelerationSpeed1;
narshu 2:cffa347bb943 57 int _accelerationSpeed2;
narshu 23:1901cb6d0d95 58 int _enableSpeed;
narshu 2:cffa347bb943 59 Ticker _ticker;
narshu 2:cffa347bb943 60
narshu 2:cffa347bb943 61 };
narshu 2:cffa347bb943 62
narshu 2:cffa347bb943 63 #endif