blob: f72b4be3ab8b80bed7a3533159d232aa8c902a51 [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>
John Park33858a32018-09-28 23:05:48 -07004#include "aos/macros.h"
Austin Schuhbcce26a2018-03-26 23:41:24 -07005
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;
Austin Schuhbcce26a2018-03-26 23:41:24 -070047 float max_ss_voltage;
48};
49
50struct DrivetrainQueue_Position {
51 DrivetrainQueue_Position();
52 void Zero();
53
54 float left_encoder;
55 float right_encoder;
56 float left_speed;
57 float right_speed;
58 float left_shifter_position;
59 float right_shifter_position;
60 float low_left_hall;
61 float high_left_hall;
62 float low_right_hall;
63 float high_right_hall;
64};
65
66struct DrivetrainQueue_Output {
67 DrivetrainQueue_Output();
68 void Zero();
69
70 float left_voltage;
71 float right_voltage;
72 bool left_high;
73 bool right_high;
74};
75
76struct DrivetrainQueue_Status {
77 DrivetrainQueue_Status();
78 void Zero();
79
80 float robot_speed;
81 float estimated_left_position;
82 float estimated_right_position;
83 float estimated_left_velocity;
84 float estimated_right_velocity;
85 float uncapped_left_voltage;
86 float uncapped_right_voltage;
Austin Schuhbcce26a2018-03-26 23:41:24 -070087 float left_voltage_error;
88 float right_voltage_error;
89 float profiled_left_position_goal;
90 float profiled_right_position_goal;
91 float profiled_left_velocity_goal;
92 float profiled_right_velocity_goal;
93 float estimated_angular_velocity_error;
94 float estimated_heading;
95 bool output_was_capped;
96 float ground_angle;
97 ::frc971::control_loops::GearLogging gear_logging;
98 ::frc971::control_loops::CIMLogging cim_logging;
99};
100
101class DrivetrainQueue {
102 public:
103 typedef DrivetrainQueue_Goal Goal;
104 DrivetrainQueue_Goal goal;
105 typedef DrivetrainQueue_Position Position;
106 DrivetrainQueue_Position position;
107 typedef DrivetrainQueue_Output Output;
108 DrivetrainQueue_Output output;
109 typedef DrivetrainQueue_Status Status;
110 DrivetrainQueue_Status status;
111};
112
113} // namespace control_loops
114} // namespace frc971
115
116#endif // FRC971_CONTROL_LOOPS_DRIVETRAIN_DRIVETRAIN_Q_H_