ASMESDC2018
/home/swerve/Github/sdc_2018/omni_robot/OmniRobot.h
Go to the documentation of this file.
1 
8 #ifndef OMNI_ROBOT_H_
9 #define OMNI_ROBOT_H_
10 
11 #include "LED.h" // LED status class
12 #include "Motor.h" // Motor class
13 #include "RCController6CH.h" // 6 channel RC controller class
14 // #include "Sensor.h" // Sensor class
15 
16 #define PIN_PWM_LEFT 2
17 #define PIN_PWM_RIGHT 3
18 #define PIN_PWM_TAIL 4
19 
20 #define PIN_A_TAIL 33
21 #define PIN_B_TAIL 34
22 #define PIN_A_RIGHT 35
23 #define PIN_B_RIGHT 36
24 #define PIN_A_LEFT 37
25 #define PIN_B_LEFT 38
26 
27 #define PIN_CH_1 27
28 
29 #define PIN_LEFT_RED 9
30 #define PIN_LEFT_GREEN 8
31 #define PIN_LEFT_BLUE 10
32 #define PIN_RIGHT_RED 22
33 #define PIN_RIGHT_GREEN 23
34 #define PIN_RIGHT_BLUE 21
35 
36 #define SPEED_MIN 0
37 #define SPEED_MAX 100
38 #define DEAD_ZONE 10
39 #define SPIN_GAIN 0.3
40 
41 void updateController(void);
42 
44  volatile int body_spin;
45  volatile double body_speed;
46  volatile double body_direction;
47 
48  volatile int wheel_speed_left;
49  volatile int wheel_speed_right;
50  volatile int wheel_speed_tail;
51 };
52 
53 class OmniRobot {
54 public:
55 
56  bool ready = false;
57 
58  /* Constructor Functions */
59  OmniRobot(void);
66  /* Public Functions */
67  void runRobotModel(void);
74  void displayRobotState(void);
81  void displayRCChannels(void);
88  void updateRCChannels(void);
95  void updateLED(void);
102 protected:
103 
105 
107 
109 
113 
114  // Sensor compass();
115  // Sensor current(); // current being used by the whole robot
116  // Sensor ir_ball(); // sensor used to tell if a ball has been captured
117  // Sensor ir_capture(); // sensor used to tell if a ball is infront of the robot or not
118 
119 private:
120 
121  static void _applyDeadZone(int*, int*, int*);
128 };
129 
130 #endif /* OMNI_ROBOT_H_ */
131 
132 
RCController6CH rc_controller
Definition: OmniRobot.h:106
Motor drive_tail
Definition: OmniRobot.h:112
volatile int wheel_speed_right
Definition: OmniRobot.h:49
Motor drive_right
Definition: OmniRobot.h:111
Motor drive_left
Definition: OmniRobot.h:110
void updateController(void)
Header file for RCController6CH class
Definition: LED.h:51
Header file for Motor class
volatile int body_spin
Definition: OmniRobot.h:44
volatile int wheel_speed_left
Definition: OmniRobot.h:48
volatile int wheel_speed_tail
Definition: OmniRobot.h:50
Definition: Motor.h:53
OmniRobotState state
Definition: OmniRobot.h:104
volatile double body_direction
Definition: OmniRobot.h:46
volatile double body_speed
Definition: OmniRobot.h:45
Header file for LED class