blob: 2a2870c480846bf5b9b1ab51eb1f4103bd6dd358 [file] [log] [blame]
Austin Schuhbcce26a2018-03-26 23:41:24 -07001#include "frc971/control_loops/drivetrain/drivetrain_uc.q.h"
Tyler Chatowbf0609c2021-07-31 16:13:27 -07002
3#include <cinttypes>
Austin Schuhbcce26a2018-03-26 23:41:24 -07004
5namespace frc971 {
6namespace control_loops {
7
8GearLogging::GearLogging() { Zero(); }
9
10void GearLogging::Zero() {
11 controller_index = 0;
12 left_loop_high = false;
13 right_loop_high = false;
14 left_state = 0;
15 right_state = 0;
16}
17
18CIMLogging::CIMLogging() { Zero(); }
19
20void CIMLogging::Zero() {
21 left_in_gear = false;
22 right_in_gear = false;
23 left_motor_speed = 0.0f;
24 right_motor_speed = 0.0f;
25 left_velocity = 0.0f;
26 right_velocity = 0.0f;
27}
28
29void DrivetrainQueue_Goal::Zero() {
30 wheel = 0.0f;
31 wheel_velocity = 0.0f;
32 wheel_torque = 0.0f;
33 throttle = 0.0f;
34 throttle_velocity = 0.0f;
35 throttle_torque = 0.0f;
36 highgear = false;
37 quickturn = false;
38 control_loop_driving = false;
39 left_goal = 0.0f;
40 right_goal = 0.0f;
Austin Schuhbcce26a2018-03-26 23:41:24 -070041 max_ss_voltage = 0.0f;
Austin Schuhd749d932020-12-30 21:38:40 -080042 // linear.max_velocity = 0.0f;
43 // linear.max_acceleration = 0.0f;
44 // angular.max_velocity = 0.0f;
45 // angular.max_acceleration = 0.0f;
Austin Schuhbcce26a2018-03-26 23:41:24 -070046}
47
48DrivetrainQueue_Goal::DrivetrainQueue_Goal() { Zero(); }
49
50void DrivetrainQueue_Position::Zero() {
51 left_encoder = 0.0f;
52 right_encoder = 0.0f;
53 left_speed = 0.0f;
54 right_speed = 0.0f;
55 left_shifter_position = 0.0f;
56 right_shifter_position = 0.0f;
57 low_left_hall = 0.0f;
58 high_left_hall = 0.0f;
59 low_right_hall = 0.0f;
60 high_right_hall = 0.0f;
61}
62
63DrivetrainQueue_Position::DrivetrainQueue_Position() { Zero(); }
64
65void DrivetrainQueue_Output::Zero() {
66 left_voltage = 0.0f;
67 right_voltage = 0.0f;
68 left_high = false;
69 right_high = false;
70}
71
72DrivetrainQueue_Output::DrivetrainQueue_Output() { Zero(); }
73
74void DrivetrainQueue_Status::Zero() {
75 robot_speed = 0.0f;
76 estimated_left_position = 0.0f;
77 estimated_right_position = 0.0f;
78 estimated_left_velocity = 0.0f;
79 estimated_right_velocity = 0.0f;
80 uncapped_left_voltage = 0.0f;
81 uncapped_right_voltage = 0.0f;
Austin Schuhbcce26a2018-03-26 23:41:24 -070082 left_voltage_error = 0.0f;
83 right_voltage_error = 0.0f;
84 profiled_left_position_goal = 0.0f;
85 profiled_right_position_goal = 0.0f;
86 profiled_left_velocity_goal = 0.0f;
87 profiled_right_velocity_goal = 0.0f;
88 estimated_angular_velocity_error = 0.0f;
89 estimated_heading = 0.0f;
90 output_was_capped = false;
91 ground_angle = 0.0f;
92 gear_logging.controller_index = 0;
93 gear_logging.left_loop_high = false;
94 gear_logging.right_loop_high = false;
95 gear_logging.left_state = 0;
96 gear_logging.right_state = 0;
97 cim_logging.left_in_gear = false;
98 cim_logging.right_in_gear = false;
99 cim_logging.left_motor_speed = 0.0f;
100 cim_logging.right_motor_speed = 0.0f;
101 cim_logging.left_velocity = 0.0f;
102 cim_logging.right_velocity = 0.0f;
103}
104
105DrivetrainQueue_Status::DrivetrainQueue_Status() { Zero(); }
106
107} // namespace control_loops
108} // namespace frc971