Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 1 | #ifndef Y2023_AUTONOMOUS_AUTO_SPLINES_H_ |
| 2 | #define Y2023_AUTONOMOUS_AUTO_SPLINES_H_ |
Maxwell Henderson | ad31234 | 2023-01-10 12:07:47 -0800 | [diff] [blame] | 3 | |
| 4 | #include "aos/events/event_loop.h" |
Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 5 | #include "aos/flatbuffer_merge.h" |
Maxwell Henderson | ad31234 | 2023-01-10 12:07:47 -0800 | [diff] [blame] | 6 | #include "frc971/control_loops/control_loops_generated.h" |
James Kuszmaul | 713c5ce | 2023-03-04 18:23:24 -0800 | [diff] [blame] | 7 | #include "frc971/input/joystick_state_generated.h" |
Maxwell Henderson | ad31234 | 2023-01-10 12:07:47 -0800 | [diff] [blame] | 8 | #include "frc971/control_loops/drivetrain/drivetrain_goal_generated.h" |
Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 9 | #include "frc971/input/joystick_state_generated.h" |
Maxwell Henderson | ad31234 | 2023-01-10 12:07:47 -0800 | [diff] [blame] | 10 | /* |
| 11 | |
| 12 | The cooridinate system for the autonomous splines is the same as the spline |
| 13 | python generator and drivetrain spline systems. |
| 14 | |
| 15 | */ |
| 16 | |
| 17 | namespace y2023 { |
Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 18 | namespace autonomous { |
Maxwell Henderson | ad31234 | 2023-01-10 12:07:47 -0800 | [diff] [blame] | 19 | |
| 20 | class AutonomousSplines { |
| 21 | public: |
James Kuszmaul | 713c5ce | 2023-03-04 18:23:24 -0800 | [diff] [blame] | 22 | AutonomousSplines() |
milind-u | 0f9c211 | 2023-03-11 20:36:19 -0800 | [diff] [blame] | 23 | : test_spline_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 24 | "splines/test_spline.json")), |
| 25 | spline_1_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
milind-u | 0f9c211 | 2023-03-11 20:36:19 -0800 | [diff] [blame] | 26 | "splines/spline.0.json")), |
Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 27 | spline_2_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
milind-u | 0f9c211 | 2023-03-11 20:36:19 -0800 | [diff] [blame] | 28 | "splines/spline.1.json")), |
Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 29 | spline_3_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
milind-u | 0f9c211 | 2023-03-11 20:36:19 -0800 | [diff] [blame] | 30 | "splines/spline.2.json")), |
Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 31 | spline_4_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
Maxwell Henderson | 3d0beaf | 2023-03-23 11:32:44 -0700 | [diff] [blame] | 32 | "splines/spline.3.json")) {} |
Maxwell Henderson | ad31234 | 2023-01-10 12:07:47 -0800 | [diff] [blame] | 33 | static flatbuffers::Offset<frc971::MultiSpline> BasicSSpline( |
James Kuszmaul | 713c5ce | 2023-03-04 18:23:24 -0800 | [diff] [blame] | 34 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 35 | *builder, |
| 36 | aos::Alliance alliance); |
Maxwell Henderson | ad31234 | 2023-01-10 12:07:47 -0800 | [diff] [blame] | 37 | static flatbuffers::Offset<frc971::MultiSpline> StraightLine( |
James Kuszmaul | 713c5ce | 2023-03-04 18:23:24 -0800 | [diff] [blame] | 38 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 39 | *builder, |
| 40 | aos::Alliance alliance); |
| 41 | |
| 42 | flatbuffers::Offset<frc971::MultiSpline> TestSpline( |
| 43 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 44 | *builder, |
| 45 | aos::Alliance alliance); |
Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 46 | flatbuffers::Offset<frc971::MultiSpline> Spline1( |
| 47 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 48 | *builder, |
| 49 | aos::Alliance alliance); |
| 50 | flatbuffers::Offset<frc971::MultiSpline> Spline2( |
| 51 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 52 | *builder, |
| 53 | aos::Alliance alliance); |
| 54 | flatbuffers::Offset<frc971::MultiSpline> Spline3( |
| 55 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 56 | *builder, |
| 57 | aos::Alliance alliance); |
| 58 | flatbuffers::Offset<frc971::MultiSpline> Spline4( |
| 59 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 60 | *builder, |
| 61 | aos::Alliance alliance); |
Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 62 | |
James Kuszmaul | 713c5ce | 2023-03-04 18:23:24 -0800 | [diff] [blame] | 63 | private: |
| 64 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> test_spline_; |
Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 65 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> spline_1_; |
| 66 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> spline_2_; |
| 67 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> spline_3_; |
| 68 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> spline_4_; |
Maxwell Henderson | ad31234 | 2023-01-10 12:07:47 -0800 | [diff] [blame] | 69 | }; |
| 70 | |
Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 71 | } // namespace autonomous |
Maxwell Henderson | ad31234 | 2023-01-10 12:07:47 -0800 | [diff] [blame] | 72 | } // namespace y2023 |
| 73 | |
Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 74 | #endif // Y2023_AUTONOMOUS_AUTO_SPLINES_H_ |