BE@R lab / motion_control

Dependencies:   motor_relay

Dependents:   dog_V3_3_testmotor

Committer:
soulx
Date:
Fri Jul 17 12:07:01 2015 +0000
Revision:
0:77ab14788110
Child:
1:5b313fd2ca6f
create motion control. No test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
soulx 0:77ab14788110 1 #ifndef MBED_MOTOR_RE_H
soulx 0:77ab14788110 2 #define MBED_MOTOR_RE_H
soulx 0:77ab14788110 3
soulx 0:77ab14788110 4 #include "mbed.h"
soulx 0:77ab14788110 5 #include "motor_relay.h"
soulx 0:77ab14788110 6
soulx 0:77ab14788110 7 class MOTION_CONTROL
soulx 0:77ab14788110 8 {
soulx 0:77ab14788110 9 public:
soulx 0:77ab14788110 10 MOTION_CONTROL(PinName dirA, PinName dirB, PinName limitUp, PinName limitDown, PinName vr );
soulx 0:77ab14788110 11
soulx 0:77ab14788110 12 int8_t limit_motor(uint8_t dirction);
soulx 0:77ab14788110 13 int8_t position_control(uint16_t current, uint16_t target);
soulx 0:77ab14788110 14 void calibration();
soulx 0:77ab14788110 15
soulx 0:77ab14788110 16 int8_t GetLimitUp();
soulx 0:77ab14788110 17 int8_t GetLimitDown();
soulx 0:77ab14788110 18 void SetMargin(int16_t data);
soulx 0:77ab14788110 19
soulx 0:77ab14788110 20 private:
soulx 0:77ab14788110 21
soulx 0:77ab14788110 22 MOTOR_RELAY *motor;
soulx 0:77ab14788110 23
soulx 0:77ab14788110 24 DigitalIn _limit_up;
soulx 0:77ab14788110 25 DigitalIn _limit_down;
soulx 0:77ab14788110 26 AnalogIn _position;
soulx 0:77ab14788110 27
soulx 0:77ab14788110 28 int16_t error;
soulx 0:77ab14788110 29 int16_t MARGIN;
soulx 0:77ab14788110 30
soulx 0:77ab14788110 31 int16_t MAX_POSITION;
soulx 0:77ab14788110 32 int16_t MIN_POSITION;
soulx 0:77ab14788110 33
soulx 0:77ab14788110 34 float Kp;
soulx 0:77ab14788110 35 float Ki;
soulx 0:77ab14788110 36 float Kd;
soulx 0:77ab14788110 37 float margin_pid;
soulx 0:77ab14788110 38
soulx 0:77ab14788110 39 };
soulx 0:77ab14788110 40
soulx 0:77ab14788110 41 #endif