Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 1 | #ifndef Y2024_AUTONOMOUS_AUTO_SPLINES_H_ |
| 2 | #define Y2024_AUTONOMOUS_AUTO_SPLINES_H_ |
| 3 | |
| 4 | #include "aos/events/event_loop.h" |
| 5 | #include "aos/flatbuffer_merge.h" |
| 6 | #include "frc971/control_loops/control_loops_generated.h" |
| 7 | #include "frc971/control_loops/drivetrain/drivetrain_goal_generated.h" |
| 8 | #include "frc971/input/joystick_state_generated.h" |
| 9 | /* |
| 10 | |
| 11 | The cooridinate system for the autonomous splines is the same as the spline |
| 12 | python generator and drivetrain spline systems. |
| 13 | |
| 14 | */ |
| 15 | |
Maxwell Henderson | 09a4b02 | 2024-01-19 21:39:51 -0800 | [diff] [blame] | 16 | namespace y2024::autonomous { |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 17 | |
| 18 | class AutonomousSplines { |
| 19 | public: |
| 20 | AutonomousSplines() |
| 21 | : test_spline_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
James Kuszmaul | b5f1183 | 2024-03-15 22:30:59 -0700 | [diff] [blame] | 22 | "splines/test_spline.json")), |
| 23 | mobility_and_shoot_spline_( |
| 24 | aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
| 25 | "splines/mobilityandshoot.0.json")), |
| 26 | four_piece_spline_1_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
| 27 | "splines/five_note.0.json")), |
| 28 | four_piece_spline_2_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
| 29 | "splines/five_note.1.json")), |
| 30 | four_piece_spline_3_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
| 31 | "splines/five_note.2.json")), |
| 32 | four_piece_spline_4_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
| 33 | "splines/five_note.3.json")), |
| 34 | four_piece_spline_5_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
Maxwell Henderson | a2dadd0 | 2024-03-24 13:57:09 -0700 | [diff] [blame] | 35 | "splines/five_note.4.json")), |
| 36 | two_piece_steal_spline_1_( |
| 37 | aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
James Kuszmaul | 58f5143 | 2024-03-24 15:00:06 -0700 | [diff] [blame] | 38 | "splines/2_piece_steal.0.json")), |
Maxwell Henderson | a2dadd0 | 2024-03-24 13:57:09 -0700 | [diff] [blame] | 39 | two_piece_steal_spline_2_( |
| 40 | aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
James Kuszmaul | 58f5143 | 2024-03-24 15:00:06 -0700 | [diff] [blame] | 41 | "splines/2_piece_steal.1.json")), |
Maxwell Henderson | a2dadd0 | 2024-03-24 13:57:09 -0700 | [diff] [blame] | 42 | two_piece_steal_spline_3_( |
| 43 | aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
James Kuszmaul | 58f5143 | 2024-03-24 15:00:06 -0700 | [diff] [blame] | 44 | "splines/2_piece_steal.2.json")), |
Maxwell Henderson | a2dadd0 | 2024-03-24 13:57:09 -0700 | [diff] [blame] | 45 | two_piece_steal_spline_4_( |
| 46 | aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
James Kuszmaul | 337e3a5 | 2024-05-04 14:06:52 -0700 | [diff] [blame^] | 47 | "splines/2_piece_steal.3.json")), |
| 48 | two_piece_via_stage_spline_1_( |
| 49 | aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
| 50 | "splines/2_piece_via_stage.0.json")), |
| 51 | two_piece_via_stage_spline_2_( |
| 52 | aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
| 53 | "splines/2_piece_via_stage.1.json")), |
| 54 | two_piece_via_stage_spline_3_( |
| 55 | aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
| 56 | "splines/2_piece_via_stage.2.json")), |
| 57 | two_piece_via_stage_spline_4_( |
| 58 | aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
| 59 | "splines/2_piece_via_stage.3.json")) {} |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 60 | static flatbuffers::Offset<frc971::MultiSpline> BasicSSpline( |
| 61 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 62 | *builder, |
| 63 | aos::Alliance alliance); |
| 64 | static flatbuffers::Offset<frc971::MultiSpline> StraightLine( |
| 65 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 66 | *builder, |
| 67 | aos::Alliance alliance); |
| 68 | |
| 69 | flatbuffers::Offset<frc971::MultiSpline> TestSpline( |
| 70 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 71 | *builder, |
| 72 | aos::Alliance alliance); |
James Kuszmaul | b5f1183 | 2024-03-15 22:30:59 -0700 | [diff] [blame] | 73 | flatbuffers::Offset<frc971::MultiSpline> MobilityAndShootSpline( |
| 74 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 75 | *builder, |
| 76 | aos::Alliance alliance); |
| 77 | flatbuffers::Offset<frc971::MultiSpline> FourPieceSpline1( |
| 78 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 79 | *builder, |
| 80 | aos::Alliance alliance); |
| 81 | flatbuffers::Offset<frc971::MultiSpline> FourPieceSpline2( |
| 82 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 83 | *builder, |
| 84 | aos::Alliance alliance); |
| 85 | flatbuffers::Offset<frc971::MultiSpline> FourPieceSpline3( |
| 86 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 87 | *builder, |
| 88 | aos::Alliance alliance); |
| 89 | flatbuffers::Offset<frc971::MultiSpline> FourPieceSpline4( |
| 90 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 91 | *builder, |
| 92 | aos::Alliance alliance); |
| 93 | flatbuffers::Offset<frc971::MultiSpline> FourPieceSpline5( |
| 94 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 95 | *builder, |
| 96 | aos::Alliance alliance); |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 97 | |
Maxwell Henderson | a2dadd0 | 2024-03-24 13:57:09 -0700 | [diff] [blame] | 98 | flatbuffers::Offset<frc971::MultiSpline> TwoPieceStealSpline1( |
| 99 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 100 | *builder, |
| 101 | aos::Alliance alliance); |
| 102 | flatbuffers::Offset<frc971::MultiSpline> TwoPieceStealSpline2( |
| 103 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 104 | *builder, |
| 105 | aos::Alliance alliance); |
| 106 | flatbuffers::Offset<frc971::MultiSpline> TwoPieceStealSpline3( |
| 107 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 108 | *builder, |
| 109 | aos::Alliance alliance); |
| 110 | flatbuffers::Offset<frc971::MultiSpline> TwoPieceStealSpline4( |
| 111 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 112 | *builder, |
| 113 | aos::Alliance alliance); |
| 114 | |
James Kuszmaul | 337e3a5 | 2024-05-04 14:06:52 -0700 | [diff] [blame^] | 115 | flatbuffers::Offset<frc971::MultiSpline> TwoPieceViaStageSpline1( |
| 116 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 117 | *builder, |
| 118 | aos::Alliance alliance); |
| 119 | flatbuffers::Offset<frc971::MultiSpline> TwoPieceViaStageSpline2( |
| 120 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 121 | *builder, |
| 122 | aos::Alliance alliance); |
| 123 | flatbuffers::Offset<frc971::MultiSpline> TwoPieceViaStageSpline3( |
| 124 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 125 | *builder, |
| 126 | aos::Alliance alliance); |
| 127 | flatbuffers::Offset<frc971::MultiSpline> TwoPieceViaStageSpline4( |
| 128 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 129 | *builder, |
| 130 | aos::Alliance alliance); |
| 131 | |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 132 | private: |
| 133 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> test_spline_; |
James Kuszmaul | b5f1183 | 2024-03-15 22:30:59 -0700 | [diff] [blame] | 134 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> mobility_and_shoot_spline_; |
| 135 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> four_piece_spline_1_; |
| 136 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> four_piece_spline_2_; |
| 137 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> four_piece_spline_3_; |
| 138 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> four_piece_spline_4_; |
| 139 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> four_piece_spline_5_; |
Maxwell Henderson | a2dadd0 | 2024-03-24 13:57:09 -0700 | [diff] [blame] | 140 | |
| 141 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> two_piece_steal_spline_1_; |
| 142 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> two_piece_steal_spline_2_; |
| 143 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> two_piece_steal_spline_3_; |
| 144 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> two_piece_steal_spline_4_; |
James Kuszmaul | 337e3a5 | 2024-05-04 14:06:52 -0700 | [diff] [blame^] | 145 | |
| 146 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> |
| 147 | two_piece_via_stage_spline_1_; |
| 148 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> |
| 149 | two_piece_via_stage_spline_2_; |
| 150 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> |
| 151 | two_piece_via_stage_spline_3_; |
| 152 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> |
| 153 | two_piece_via_stage_spline_4_; |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 154 | }; |
| 155 | |
Maxwell Henderson | 09a4b02 | 2024-01-19 21:39:51 -0800 | [diff] [blame] | 156 | } // namespace y2024::autonomous |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 157 | |
| 158 | #endif // Y2024_AUTONOMOUS_AUTO_SPLINES_H_ |