blob: e93af265d014c013341a3f5d33b127d93213cf8b [file] [log] [blame]
Austin Schuhbcce26a2018-03-26 23:41:24 -07001#ifndef FRC971_CONTROL_LOOPS_DRIVETRAIN_DRIVETRAIN_Q_H_
2#define FRC971_CONTROL_LOOPS_DRIVETRAIN_DRIVETRAIN_Q_H_
3#include <array>
4#include "aos/common/macros.h"
5
6namespace frc971 {
7namespace control_loops {
8
9struct GearLogging {
10 GearLogging();
11 void Zero();
12
13 int8_t controller_index;
14 bool left_loop_high;
15 bool right_loop_high;
16 int8_t left_state;
17 int8_t right_state;
18};
19
20struct CIMLogging {
21 CIMLogging();
22 void Zero();
23
24 bool left_in_gear;
25 bool right_in_gear;
26 float left_motor_speed;
27 float right_motor_speed;
28 float left_velocity;
29 float right_velocity;
30};
31
32struct DrivetrainQueue_Goal {
33 DrivetrainQueue_Goal();
34 void Zero();
35
36 float wheel;
37 float wheel_velocity;
38 float wheel_torque;
39 float throttle;
40 float throttle_velocity;
41 float throttle_torque;
42 bool highgear;
43 bool quickturn;
44 bool control_loop_driving;
45 float left_goal;
46 float right_goal;
47 float left_velocity_goal;
48 float right_velocity_goal;
49 float max_ss_voltage;
50};
51
52struct DrivetrainQueue_Position {
53 DrivetrainQueue_Position();
54 void Zero();
55
56 float left_encoder;
57 float right_encoder;
58 float left_speed;
59 float right_speed;
60 float left_shifter_position;
61 float right_shifter_position;
62 float low_left_hall;
63 float high_left_hall;
64 float low_right_hall;
65 float high_right_hall;
66};
67
68struct DrivetrainQueue_Output {
69 DrivetrainQueue_Output();
70 void Zero();
71
72 float left_voltage;
73 float right_voltage;
74 bool left_high;
75 bool right_high;
76};
77
78struct DrivetrainQueue_Status {
79 DrivetrainQueue_Status();
80 void Zero();
81
82 float robot_speed;
83 float estimated_left_position;
84 float estimated_right_position;
85 float estimated_left_velocity;
86 float estimated_right_velocity;
87 float uncapped_left_voltage;
88 float uncapped_right_voltage;
89 float left_velocity_goal;
90 float right_velocity_goal;
91 float left_voltage_error;
92 float right_voltage_error;
93 float profiled_left_position_goal;
94 float profiled_right_position_goal;
95 float profiled_left_velocity_goal;
96 float profiled_right_velocity_goal;
97 float estimated_angular_velocity_error;
98 float estimated_heading;
99 bool output_was_capped;
100 float ground_angle;
101 ::frc971::control_loops::GearLogging gear_logging;
102 ::frc971::control_loops::CIMLogging cim_logging;
103};
104
105class DrivetrainQueue {
106 public:
107 typedef DrivetrainQueue_Goal Goal;
108 DrivetrainQueue_Goal goal;
109 typedef DrivetrainQueue_Position Position;
110 DrivetrainQueue_Position position;
111 typedef DrivetrainQueue_Output Output;
112 DrivetrainQueue_Output output;
113 typedef DrivetrainQueue_Status Status;
114 DrivetrainQueue_Status status;
115};
116
117} // namespace control_loops
118} // namespace frc971
119
120#endif // FRC971_CONTROL_LOOPS_DRIVETRAIN_DRIVETRAIN_Q_H_