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