brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 1 | package frc971.control_loops; |
| 2 | |
Brian | a6553ed | 2014-04-02 21:26:46 -0700 | [diff] [blame] | 3 | import "aos/common/controls/control_loops.q"; |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 4 | |
Brian Silverman | 61e41fd | 2014-02-16 19:08:50 -0800 | [diff] [blame] | 5 | struct GearLogging { |
| 6 | int8_t controller_index; |
| 7 | bool left_loop_high; |
| 8 | bool right_loop_high; |
| 9 | int8_t left_state; |
| 10 | int8_t right_state; |
| 11 | }; |
| 12 | |
| 13 | struct CIMLogging { |
| 14 | bool left_in_gear; |
| 15 | bool right_in_gear; |
| 16 | double left_motor_speed; |
| 17 | double right_motor_speed; |
| 18 | double left_velocity; |
| 19 | double right_velocity; |
| 20 | }; |
| 21 | |
Brian Silverman | ada5f2c | 2015-02-01 02:41:14 -0500 | [diff] [blame] | 22 | queue_group DrivetrainQueue { |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 23 | implements aos.control_loops.ControlLoop; |
| 24 | |
| 25 | message Goal { |
Brian Silverman | b94069c | 2014-04-17 14:34:24 -0700 | [diff] [blame] | 26 | double steering; |
| 27 | double throttle; |
Brian Silverman | 93335ae | 2015-01-26 20:43:39 -0500 | [diff] [blame] | 28 | //bool highgear; |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 29 | bool quickturn; |
| 30 | bool control_loop_driving; |
Brian Silverman | b94069c | 2014-04-17 14:34:24 -0700 | [diff] [blame] | 31 | double left_goal; |
| 32 | double left_velocity_goal; |
| 33 | double right_goal; |
| 34 | double right_velocity_goal; |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 35 | }; |
| 36 | |
| 37 | message Position { |
| 38 | double left_encoder; |
| 39 | double right_encoder; |
Brian Silverman | 93335ae | 2015-01-26 20:43:39 -0500 | [diff] [blame] | 40 | //double left_shifter_position; |
| 41 | //double right_shifter_position; |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 42 | }; |
| 43 | |
| 44 | message Output { |
Brian Silverman | b94069c | 2014-04-17 14:34:24 -0700 | [diff] [blame] | 45 | double left_voltage; |
| 46 | double right_voltage; |
Ben Fredrickson | 890c3fe | 2014-03-02 00:15:16 +0000 | [diff] [blame] | 47 | bool left_high; |
| 48 | bool right_high; |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 49 | }; |
| 50 | |
| 51 | message Status { |
Ben Fredrickson | 890c3fe | 2014-03-02 00:15:16 +0000 | [diff] [blame] | 52 | double robot_speed; |
Austin Schuh | 577edf6 | 2014-04-13 10:33:05 -0700 | [diff] [blame] | 53 | double filtered_left_position; |
| 54 | double filtered_right_position; |
Austin Schuh | 913c2f2 | 2015-04-18 22:57:19 -0700 | [diff] [blame] | 55 | double filtered_left_velocity; |
| 56 | double filtered_right_velocity; |
Brian Silverman | b94069c | 2014-04-17 14:34:24 -0700 | [diff] [blame] | 57 | |
| 58 | double uncapped_left_voltage; |
| 59 | double uncapped_right_voltage; |
| 60 | bool output_was_capped; |
| 61 | |
| 62 | bool is_done; |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 63 | }; |
| 64 | |
| 65 | queue Goal goal; |
| 66 | queue Position position; |
| 67 | queue Output output; |
| 68 | queue Status status; |
| 69 | }; |
| 70 | |
Brian Silverman | ada5f2c | 2015-02-01 02:41:14 -0500 | [diff] [blame] | 71 | queue_group DrivetrainQueue drivetrain_queue; |