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