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