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" |
| 7 | #include "frc971/control_loops/drivetrain/drivetrain_goal_generated.h" |
Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 8 | #include "frc971/input/joystick_state_generated.h" |
Maxwell Henderson | ad31234 | 2023-01-10 12:07:47 -0800 | [diff] [blame] | 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 | |
| 16 | namespace y2023 { |
Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 17 | namespace autonomous { |
Maxwell Henderson | ad31234 | 2023-01-10 12:07:47 -0800 | [diff] [blame] | 18 | |
| 19 | class AutonomousSplines { |
| 20 | public: |
James Kuszmaul | 713c5ce | 2023-03-04 18:23:24 -0800 | [diff] [blame] | 21 | AutonomousSplines() |
milind-u | 0f9c211 | 2023-03-11 20:36:19 -0800 | [diff] [blame] | 22 | : test_spline_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 23 | "splines/test_spline.json")), |
| 24 | spline_1_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
milind-u | 0f9c211 | 2023-03-11 20:36:19 -0800 | [diff] [blame] | 25 | "splines/spline.0.json")), |
Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 26 | spline_2_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
milind-u | 0f9c211 | 2023-03-11 20:36:19 -0800 | [diff] [blame] | 27 | "splines/spline.1.json")), |
Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 28 | spline_3_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
milind-u | 0f9c211 | 2023-03-11 20:36:19 -0800 | [diff] [blame] | 29 | "splines/spline.2.json")), |
Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 30 | spline_4_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
Maxwell Henderson | 2537883 | 2023-04-07 14:37:41 -0700 | [diff] [blame] | 31 | "splines/spline.3.json")), |
| 32 | splinecable_1_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
| 33 | "splines/splinecable.0.json")), |
| 34 | splinecable_2_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
| 35 | "splines/splinecable.1.json")), |
| 36 | splinecable_3_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
| 37 | "splines/splinecable.2.json")), |
| 38 | splinecable_4_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>( |
| 39 | "splines/splinecable.3.json")) {} |
Maxwell Henderson | ad31234 | 2023-01-10 12:07:47 -0800 | [diff] [blame] | 40 | static flatbuffers::Offset<frc971::MultiSpline> BasicSSpline( |
James Kuszmaul | 713c5ce | 2023-03-04 18:23:24 -0800 | [diff] [blame] | 41 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 42 | *builder, |
| 43 | aos::Alliance alliance); |
Maxwell Henderson | ad31234 | 2023-01-10 12:07:47 -0800 | [diff] [blame] | 44 | static flatbuffers::Offset<frc971::MultiSpline> StraightLine( |
James Kuszmaul | 713c5ce | 2023-03-04 18:23:24 -0800 | [diff] [blame] | 45 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 46 | *builder, |
| 47 | aos::Alliance alliance); |
| 48 | |
| 49 | flatbuffers::Offset<frc971::MultiSpline> TestSpline( |
| 50 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 51 | *builder, |
| 52 | aos::Alliance alliance); |
Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 53 | flatbuffers::Offset<frc971::MultiSpline> Spline1( |
| 54 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 55 | *builder, |
| 56 | aos::Alliance alliance); |
| 57 | flatbuffers::Offset<frc971::MultiSpline> Spline2( |
| 58 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 59 | *builder, |
| 60 | aos::Alliance alliance); |
| 61 | flatbuffers::Offset<frc971::MultiSpline> Spline3( |
| 62 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 63 | *builder, |
| 64 | aos::Alliance alliance); |
| 65 | flatbuffers::Offset<frc971::MultiSpline> Spline4( |
| 66 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 67 | *builder, |
| 68 | aos::Alliance alliance); |
Maxwell Henderson | 2537883 | 2023-04-07 14:37:41 -0700 | [diff] [blame] | 69 | flatbuffers::Offset<frc971::MultiSpline> SplineCable1( |
| 70 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 71 | *builder, |
| 72 | aos::Alliance alliance); |
| 73 | flatbuffers::Offset<frc971::MultiSpline> SplineCable2( |
| 74 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 75 | *builder, |
| 76 | aos::Alliance alliance); |
| 77 | flatbuffers::Offset<frc971::MultiSpline> SplineCable3( |
| 78 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 79 | *builder, |
| 80 | aos::Alliance alliance); |
| 81 | flatbuffers::Offset<frc971::MultiSpline> SplineCable4( |
| 82 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 83 | *builder, |
| 84 | aos::Alliance alliance); |
Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 85 | |
James Kuszmaul | 713c5ce | 2023-03-04 18:23:24 -0800 | [diff] [blame] | 86 | private: |
| 87 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> test_spline_; |
Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 88 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> spline_1_; |
| 89 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> spline_2_; |
| 90 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> spline_3_; |
| 91 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> spline_4_; |
Maxwell Henderson | 2537883 | 2023-04-07 14:37:41 -0700 | [diff] [blame] | 92 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> splinecable_1_; |
| 93 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> splinecable_2_; |
| 94 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> splinecable_3_; |
| 95 | aos::FlatbufferDetachedBuffer<frc971::MultiSpline> splinecable_4_; |
Maxwell Henderson | ad31234 | 2023-01-10 12:07:47 -0800 | [diff] [blame] | 96 | }; |
| 97 | |
Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 98 | } // namespace autonomous |
Maxwell Henderson | ad31234 | 2023-01-10 12:07:47 -0800 | [diff] [blame] | 99 | } // namespace y2023 |
| 100 | |
Maxwell Henderson | 64f3745 | 2023-03-11 13:39:21 -0800 | [diff] [blame] | 101 | #endif // Y2023_AUTONOMOUS_AUTO_SPLINES_H_ |