LRT14  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator
Drivetrain.h
1 #ifndef DRIVETRAIN_H_
2 #define DRIVETRAIN_H_
3 
4 #include "../Config/Configurable.h"
5 #include "Component.h"
6 #include "../Control/PID.h"
7 #include "../ComponentData/DrivetrainData.h"
8 #include "../Communication/LiveNetworkSendable.h"
9 #include "../Control/LinearFilter.h"
10 #include "../Actuators/LRTTalon.h"
11 
12 class DriveESC;
13 
14 class DriveEncoders;
15 
19 class Drivetrain : public Component, public Configurable, public LiveNetworkSendable
20 {
21 public:
22  enum Side
23  {
24  LEFT = 0,
25  RIGHT = 1
26  };
27 
28  Drivetrain();
29  ~Drivetrain();
30 
31  void OnEnabled();
32  void OnDisabled();
33 
34  void UpdateEnabled();
35  void UpdateDisabled();
36 
37  void Configure();
38 
39  void Send();
40 
41 private:
42  double ComputeOutput(DrivetrainData::Axis);
43  void ConfigurePIDObject(PID *pid, std::string objName, bool feedForward);
44  void ConfigureForwardCurrentLimit();
45  void ConfigureReverseCurrentLimit();
46 
47  const static int POSITION = 0;
48  const static int VELOCITY = 1;
49  PID m_PIDs[2][2];
50  DrivetrainData* m_drivetrainData;
51  DriveEncoders* m_driveEncoders;
52  DriveESC* m_escs[2];
53  LRTTalon* m_talonLeftA;
54  LRTTalon* m_talonLeftB;
55  LRTTalon* m_talonRightA;
56  LRTTalon* m_talonRightB;
57  double Kv;
58 };
59 
60 #endif