motorControl.h 930 Bytes
Newer Older
Manuel Pitz's avatar
Manuel Pitz committed
1
2
3
4
/////////////////////////////////////////////////////////
///// This file does not need any modification, /////////
///// if needed it can be extended //////////////////////
///////////////////////////////////////////////////////// 
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#pragma once

#include "PID.h"

enum class MOTOR_STATES{STOP,RUN};

class MotorControl {
  
  public:
    
    MotorControl(unsigned int,unsigned int,pidParameterSet);
    void setSpeed(double);
    void updateMotor(void);
    void setState(MOTOR_STATES);
    void updateController(double);
    void setup();
Manuel Pitz's avatar
Manuel Pitz committed
21
22
23
24
25
26
    double getControllerP();
    double getControllerI();
    double getControllerD();
    void setControllerP(double parameterP);
    void setControllerI(double parameterI);
    void setControllerD(double parameterD);
27
28
29
30
31
32
33
34
35
    
  private:
    unsigned int motorPin;
    unsigned int deadManSwitchPin;
    int motorDuty;
    PID controller;
    MOTOR_STATES motorState=MOTOR_STATES::STOP;
};