Wyatt  1.0.1
DriveMotorRPM.h
1 //
2 // Created by Tucker Haydon on 4/27/17.
3 //
4 
5 #pragma once
6 #include "../hardwareinterface/MotorAdapter.h"
7 #include "../sensors/EncoderSensor.h"
8 #include "../Communicator.h"
9 #include "Command.h"
10 #include "../DriveConstants.h"
11 #include <stdlib.h>
12 #include <math.h>
13 
17 class DriveMotorRPM: public Command {
18 
19 public:
20 
29  DriveMotorRPM(Communicator* comm, Hardware motorHardware, EncoderSensor* encoder, int desiredRPM, int direction);
30 
35 
40  bool execute() override;
41 
47  bool cleanup(bool canceled) override;
48 
49 private:
50  int desiredRPM;
51  int direction;
52  Hardware motorHardware;
53  EncoderSensor* encoder;
54  Communicator* comm;
55 
56  double k_p = 1.0;
57  double k_d = 0.0;
58 
59  double lastDiff = 0;
60  double setpoint = 0;
61 
62 };
DriveMotorRPM(Communicator *comm, Hardware motorHardware, EncoderSensor *encoder, int desiredRPM, int direction)
bool execute() override
bool cleanup(bool canceled) override
Definition: Command.h:6