Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 1 | #include "frc971/control_loops/drivetrain/drivetrain_uc.q.h" |
Tyler Chatow | bf0609c | 2021-07-31 16:13:27 -0700 | [diff] [blame^] | 2 | |
| 3 | #include <cinttypes> |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 4 | |
| 5 | namespace frc971 { |
| 6 | namespace control_loops { |
| 7 | |
| 8 | GearLogging::GearLogging() { Zero(); } |
| 9 | |
| 10 | void 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 | |
| 18 | CIMLogging::CIMLogging() { Zero(); } |
| 19 | |
| 20 | void 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 | |
| 29 | void 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 Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 41 | max_ss_voltage = 0.0f; |
Austin Schuh | d749d93 | 2020-12-30 21:38:40 -0800 | [diff] [blame] | 42 | // linear.max_velocity = 0.0f; |
| 43 | // linear.max_acceleration = 0.0f; |
| 44 | // angular.max_velocity = 0.0f; |
| 45 | // angular.max_acceleration = 0.0f; |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | DrivetrainQueue_Goal::DrivetrainQueue_Goal() { Zero(); } |
| 49 | |
| 50 | void 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 | |
| 63 | DrivetrainQueue_Position::DrivetrainQueue_Position() { Zero(); } |
| 64 | |
| 65 | void DrivetrainQueue_Output::Zero() { |
| 66 | left_voltage = 0.0f; |
| 67 | right_voltage = 0.0f; |
| 68 | left_high = false; |
| 69 | right_high = false; |
| 70 | } |
| 71 | |
| 72 | DrivetrainQueue_Output::DrivetrainQueue_Output() { Zero(); } |
| 73 | |
| 74 | void 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 Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 82 | 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 | |
| 105 | DrivetrainQueue_Status::DrivetrainQueue_Status() { Zero(); } |
| 106 | |
| 107 | } // namespace control_loops |
| 108 | } // namespace frc971 |