blob: 27442f36e2a3e07212ecc56c4c3e6279919f7c9a [file] [log] [blame]
Maxwell Henderson64f37452023-03-11 13:39:21 -08001#ifndef Y2023_AUTONOMOUS_AUTO_SPLINES_H_
2#define Y2023_AUTONOMOUS_AUTO_SPLINES_H_
Maxwell Hendersonad312342023-01-10 12:07:47 -08003
4#include "aos/events/event_loop.h"
Maxwell Henderson64f37452023-03-11 13:39:21 -08005#include "aos/flatbuffer_merge.h"
Maxwell Hendersonad312342023-01-10 12:07:47 -08006#include "frc971/control_loops/control_loops_generated.h"
James Kuszmaul713c5ce2023-03-04 18:23:24 -08007#include "frc971/input/joystick_state_generated.h"
Maxwell Hendersonad312342023-01-10 12:07:47 -08008#include "frc971/control_loops/drivetrain/drivetrain_goal_generated.h"
Maxwell Henderson64f37452023-03-11 13:39:21 -08009#include "frc971/input/joystick_state_generated.h"
Maxwell Hendersonad312342023-01-10 12:07:47 -080010/*
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
17namespace y2023 {
Maxwell Henderson64f37452023-03-11 13:39:21 -080018namespace autonomous {
Maxwell Hendersonad312342023-01-10 12:07:47 -080019
20class AutonomousSplines {
21 public:
James Kuszmaul713c5ce2023-03-04 18:23:24 -080022 AutonomousSplines()
milind-u0f9c2112023-03-11 20:36:19 -080023 : test_spline_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>(
Maxwell Henderson64f37452023-03-11 13:39:21 -080024 "splines/test_spline.json")),
25 spline_1_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>(
milind-u0f9c2112023-03-11 20:36:19 -080026 "splines/spline.0.json")),
Maxwell Henderson64f37452023-03-11 13:39:21 -080027 spline_2_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>(
milind-u0f9c2112023-03-11 20:36:19 -080028 "splines/spline.1.json")),
Maxwell Henderson64f37452023-03-11 13:39:21 -080029 spline_3_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>(
milind-u0f9c2112023-03-11 20:36:19 -080030 "splines/spline.2.json")),
Maxwell Henderson64f37452023-03-11 13:39:21 -080031 spline_4_(aos::JsonFileToFlatbuffer<frc971::MultiSpline>(
Maxwell Henderson3d0beaf2023-03-23 11:32:44 -070032 "splines/spline.3.json")) {}
Maxwell Hendersonad312342023-01-10 12:07:47 -080033 static flatbuffers::Offset<frc971::MultiSpline> BasicSSpline(
James Kuszmaul713c5ce2023-03-04 18:23:24 -080034 aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder
35 *builder,
36 aos::Alliance alliance);
Maxwell Hendersonad312342023-01-10 12:07:47 -080037 static flatbuffers::Offset<frc971::MultiSpline> StraightLine(
James Kuszmaul713c5ce2023-03-04 18:23:24 -080038 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 Henderson64f37452023-03-11 13:39:21 -080046 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 Henderson64f37452023-03-11 13:39:21 -080062
James Kuszmaul713c5ce2023-03-04 18:23:24 -080063 private:
64 aos::FlatbufferDetachedBuffer<frc971::MultiSpline> test_spline_;
Maxwell Henderson64f37452023-03-11 13:39:21 -080065 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 Hendersonad312342023-01-10 12:07:47 -080069};
70
Maxwell Henderson64f37452023-03-11 13:39:21 -080071} // namespace autonomous
Maxwell Hendersonad312342023-01-10 12:07:47 -080072} // namespace y2023
73
Maxwell Henderson64f37452023-03-11 13:39:21 -080074#endif // Y2023_AUTONOMOUS_AUTO_SPLINES_H_