Austin Schuh | 6bcc230 | 2019-03-23 22:28:06 -0700 | [diff] [blame] | 1 | #include "y2019/actors/auto_splines.h" |
| 2 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 3 | #include "frc971/control_loops/control_loops_generated.h" |
Austin Schuh | 6bcc230 | 2019-03-23 22:28:06 -0700 | [diff] [blame] | 4 | |
Stephan Pleines | f63bde8 | 2024-01-13 15:59:33 -0800 | [diff] [blame] | 5 | namespace y2019::actors { |
Austin Schuh | 6bcc230 | 2019-03-23 22:28:06 -0700 | [diff] [blame] | 6 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 7 | void MaybeFlipSpline( |
James Kuszmaul | 75a18c5 | 2021-03-10 22:02:07 -0800 | [diff] [blame] | 8 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 9 | *builder, |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 10 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_y_offset, |
| 11 | bool is_left) { |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 12 | flatbuffers::Vector<float> *spline_y = |
| 13 | GetMutableTemporaryPointer(*builder->fbb(), spline_y_offset); |
| 14 | |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 15 | if (!is_left) { |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 16 | for (size_t i = 0; i < spline_y->size(); i++) { |
| 17 | spline_y->Mutate(i, -spline_y->Get(i)); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 18 | } |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | // Path off of level 2 to the far side of the rocket with a panel |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 23 | flatbuffers::Offset<frc971::MultiSpline> AutonomousSplines::HABToFarRocket( |
James Kuszmaul | 75a18c5 | 2021-03-10 22:02:07 -0800 | [diff] [blame] | 24 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 25 | *builder, |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 26 | bool is_left) { |
| 27 | flatbuffers::Offset<frc971::Constraint> longitudinal_constraint_offset; |
| 28 | flatbuffers::Offset<frc971::Constraint> lateral_constraint_offset; |
| 29 | flatbuffers::Offset<frc971::Constraint> voltage_constraint_offset; |
| 30 | flatbuffers::Offset<frc971::Constraint> velocity_constraint_offset; |
James Kuszmaul | bc83787 | 2019-04-07 12:01:47 -0700 | [diff] [blame] | 31 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 32 | { |
| 33 | frc971::Constraint::Builder longitudinal_constraint_builder = |
| 34 | builder->MakeBuilder<frc971::Constraint>(); |
| 35 | longitudinal_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 36 | frc971::ConstraintType::LONGITUDINAL_ACCELERATION); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 37 | longitudinal_constraint_builder.add_value(2.0); |
| 38 | longitudinal_constraint_offset = longitudinal_constraint_builder.Finish(); |
| 39 | } |
James Kuszmaul | bc83787 | 2019-04-07 12:01:47 -0700 | [diff] [blame] | 40 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 41 | { |
| 42 | frc971::Constraint::Builder lateral_constraint_builder = |
| 43 | builder->MakeBuilder<frc971::Constraint>(); |
| 44 | lateral_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 45 | frc971::ConstraintType::LATERAL_ACCELERATION); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 46 | lateral_constraint_builder.add_value(2.0); |
| 47 | lateral_constraint_offset = lateral_constraint_builder.Finish(); |
| 48 | } |
James Kuszmaul | bc83787 | 2019-04-07 12:01:47 -0700 | [diff] [blame] | 49 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 50 | { |
| 51 | frc971::Constraint::Builder voltage_constraint_builder = |
| 52 | builder->MakeBuilder<frc971::Constraint>(); |
| 53 | voltage_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 54 | frc971::ConstraintType::VOLTAGE); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 55 | voltage_constraint_builder.add_value(11.0); |
| 56 | voltage_constraint_offset = voltage_constraint_builder.Finish(); |
| 57 | } |
James Kuszmaul | bc83787 | 2019-04-07 12:01:47 -0700 | [diff] [blame] | 58 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 59 | { |
| 60 | frc971::Constraint::Builder velocity_constraint_builder = |
| 61 | builder->MakeBuilder<frc971::Constraint>(); |
| 62 | velocity_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 63 | frc971::ConstraintType::VELOCITY); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 64 | velocity_constraint_builder.add_value(4.0); |
| 65 | velocity_constraint_builder.add_start_distance(0.0); |
| 66 | velocity_constraint_builder.add_end_distance(10.0); |
| 67 | velocity_constraint_offset = velocity_constraint_builder.Finish(); |
| 68 | } |
James Kuszmaul | bc83787 | 2019-04-07 12:01:47 -0700 | [diff] [blame] | 69 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 70 | flatbuffers::Offset< |
| 71 | flatbuffers::Vector<flatbuffers::Offset<frc971::Constraint>>> |
| 72 | constraints_offset = |
| 73 | builder->fbb()->CreateVector<flatbuffers::Offset<frc971::Constraint>>( |
| 74 | {longitudinal_constraint_offset, lateral_constraint_offset, |
| 75 | voltage_constraint_offset, velocity_constraint_offset}); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 76 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 77 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_x_offset = |
| 78 | builder->fbb()->CreateVector<float>({1.14763818102, 1.66, 3.10, 4.05, |
| 79 | 4.45, 5.11, 5.77, 6.71, 7.27, 7.19, |
| 80 | 6.57}); |
| 81 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_y_offset = |
| 82 | builder->fbb()->CreateVector<float>({1.30261224364, 1.30217320136, 1.39, |
| 83 | 1.47, 1.56346705393, 1.69, 1.81, |
| 84 | 1.97, 2.18, 2.84, 3.33}); |
| 85 | MaybeFlipSpline(builder, spline_y_offset, is_left); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 86 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 87 | frc971::MultiSpline::Builder multispline_builder = |
| 88 | builder->MakeBuilder<frc971::MultiSpline>(); |
| 89 | |
| 90 | multispline_builder.add_spline_count(2); |
| 91 | multispline_builder.add_constraints(constraints_offset); |
| 92 | multispline_builder.add_spline_x(spline_x_offset); |
| 93 | multispline_builder.add_spline_y(spline_y_offset); |
| 94 | |
| 95 | return multispline_builder.Finish(); |
James Kuszmaul | bc83787 | 2019-04-07 12:01:47 -0700 | [diff] [blame] | 96 | } |
| 97 | |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 98 | // Path from the far side of the rocket to the loading station to pickup |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 99 | flatbuffers::Offset<frc971::MultiSpline> AutonomousSplines::FarRocketToHP( |
James Kuszmaul | 75a18c5 | 2021-03-10 22:02:07 -0800 | [diff] [blame] | 100 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 101 | *builder, |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 102 | bool is_left) { |
| 103 | flatbuffers::Offset<frc971::Constraint> longitudinal_constraint_offset; |
| 104 | flatbuffers::Offset<frc971::Constraint> lateral_constraint_offset; |
| 105 | flatbuffers::Offset<frc971::Constraint> voltage_constraint_offset; |
| 106 | flatbuffers::Offset<frc971::Constraint> velocity_constraint_offset; |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 107 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 108 | { |
| 109 | frc971::Constraint::Builder longitudinal_constraint_builder = |
| 110 | builder->MakeBuilder<frc971::Constraint>(); |
| 111 | longitudinal_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 112 | frc971::ConstraintType::LONGITUDINAL_ACCELERATION); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 113 | longitudinal_constraint_builder.add_value(3.0); |
| 114 | longitudinal_constraint_offset = longitudinal_constraint_builder.Finish(); |
| 115 | } |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 116 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 117 | { |
| 118 | frc971::Constraint::Builder lateral_constraint_builder = |
| 119 | builder->MakeBuilder<frc971::Constraint>(); |
| 120 | lateral_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 121 | frc971::ConstraintType::LATERAL_ACCELERATION); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 122 | lateral_constraint_builder.add_value(2.0); |
| 123 | lateral_constraint_offset = lateral_constraint_builder.Finish(); |
| 124 | } |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 125 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 126 | { |
| 127 | frc971::Constraint::Builder voltage_constraint_builder = |
| 128 | builder->MakeBuilder<frc971::Constraint>(); |
| 129 | voltage_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 130 | frc971::ConstraintType::VOLTAGE); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 131 | voltage_constraint_builder.add_value(11.0); |
| 132 | voltage_constraint_offset = voltage_constraint_builder.Finish(); |
| 133 | } |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 134 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 135 | { |
| 136 | frc971::Constraint::Builder velocity_constraint_builder = |
| 137 | builder->MakeBuilder<frc971::Constraint>(); |
| 138 | velocity_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 139 | frc971::ConstraintType::VELOCITY); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 140 | velocity_constraint_builder.add_value(4.5); |
| 141 | velocity_constraint_builder.add_start_distance(0.0); |
| 142 | velocity_constraint_builder.add_end_distance(10.0); |
| 143 | velocity_constraint_offset = velocity_constraint_builder.Finish(); |
| 144 | } |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 145 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 146 | flatbuffers::Offset< |
| 147 | flatbuffers::Vector<flatbuffers::Offset<frc971::Constraint>>> |
| 148 | constraints_offset = |
| 149 | builder->fbb()->CreateVector<flatbuffers::Offset<frc971::Constraint>>( |
| 150 | {longitudinal_constraint_offset, lateral_constraint_offset, |
| 151 | voltage_constraint_offset, velocity_constraint_offset}); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 152 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 153 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_x_offset = |
| 154 | builder->fbb()->CreateVector<float>( |
| 155 | {6.6, 7.511, 6.332, 4.590, 1.561, 0.179}); |
| 156 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_y_offset = |
| 157 | builder->fbb()->CreateVector<float>( |
| 158 | {3.391, 2.826, 1.384, 3.395 - 0.20, 3.429 - 0.20, 3.434 - 0.20}); |
| 159 | MaybeFlipSpline(builder, spline_y_offset, is_left); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 160 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 161 | frc971::MultiSpline::Builder multispline_builder = |
| 162 | builder->MakeBuilder<frc971::MultiSpline>(); |
| 163 | |
| 164 | multispline_builder.add_spline_count(1); |
| 165 | multispline_builder.add_constraints(constraints_offset); |
| 166 | multispline_builder.add_spline_x(spline_x_offset); |
| 167 | multispline_builder.add_spline_y(spline_y_offset); |
| 168 | |
| 169 | return multispline_builder.Finish(); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 170 | } |
| 171 | |
| 172 | // Path from the human player station to the far side of the rocket with a panel |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 173 | flatbuffers::Offset<frc971::MultiSpline> AutonomousSplines::HPToFarRocket( |
James Kuszmaul | 75a18c5 | 2021-03-10 22:02:07 -0800 | [diff] [blame] | 174 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 175 | *builder, |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 176 | bool is_left) { |
| 177 | flatbuffers::Offset<frc971::Constraint> longitudinal_constraint_offset; |
| 178 | flatbuffers::Offset<frc971::Constraint> lateral_constraint_offset; |
| 179 | flatbuffers::Offset<frc971::Constraint> voltage_constraint_offset; |
| 180 | flatbuffers::Offset<frc971::Constraint> velocity_constraint_offset; |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 181 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 182 | { |
| 183 | frc971::Constraint::Builder longitudinal_constraint_builder = |
| 184 | builder->MakeBuilder<frc971::Constraint>(); |
| 185 | longitudinal_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 186 | frc971::ConstraintType::LONGITUDINAL_ACCELERATION); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 187 | longitudinal_constraint_builder.add_value(3.0); |
| 188 | longitudinal_constraint_offset = longitudinal_constraint_builder.Finish(); |
| 189 | } |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 190 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 191 | { |
| 192 | frc971::Constraint::Builder lateral_constraint_builder = |
| 193 | builder->MakeBuilder<frc971::Constraint>(); |
| 194 | lateral_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 195 | frc971::ConstraintType::LATERAL_ACCELERATION); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 196 | lateral_constraint_builder.add_value(3.0); |
| 197 | lateral_constraint_offset = lateral_constraint_builder.Finish(); |
| 198 | } |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 199 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 200 | { |
| 201 | frc971::Constraint::Builder voltage_constraint_builder = |
| 202 | builder->MakeBuilder<frc971::Constraint>(); |
| 203 | voltage_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 204 | frc971::ConstraintType::VOLTAGE); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 205 | voltage_constraint_builder.add_value(11.0); |
| 206 | voltage_constraint_offset = voltage_constraint_builder.Finish(); |
| 207 | } |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 208 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 209 | { |
| 210 | frc971::Constraint::Builder velocity_constraint_builder = |
| 211 | builder->MakeBuilder<frc971::Constraint>(); |
| 212 | velocity_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 213 | frc971::ConstraintType::VELOCITY); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 214 | velocity_constraint_builder.add_value(4.0); |
| 215 | velocity_constraint_builder.add_start_distance(7.0); |
| 216 | velocity_constraint_builder.add_end_distance(15.0); |
| 217 | velocity_constraint_offset = velocity_constraint_builder.Finish(); |
| 218 | } |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 219 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 220 | flatbuffers::Offset< |
| 221 | flatbuffers::Vector<flatbuffers::Offset<frc971::Constraint>>> |
| 222 | constraints_offset = |
| 223 | builder->fbb()->CreateVector<flatbuffers::Offset<frc971::Constraint>>( |
| 224 | {longitudinal_constraint_offset, lateral_constraint_offset, |
| 225 | voltage_constraint_offset, velocity_constraint_offset}); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 226 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 227 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_x_offset = |
| 228 | builder->fbb()->CreateVector<float>({0.895115737979, 2.9155615909, |
| 229 | 5.02361983866, 6.40346237218, |
| 230 | 7.1260656844, 7.83907559509}); |
| 231 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_y_offset = |
| 232 | builder->fbb()->CreateVector<float>({3.43030859063, 3.44230565037, |
| 233 | 2.8824369646, 2.81000389973, |
| 234 | 3.08853311072, 2.6933085577}); |
| 235 | MaybeFlipSpline(builder, spline_y_offset, is_left); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 236 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 237 | frc971::MultiSpline::Builder multispline_builder = |
| 238 | builder->MakeBuilder<frc971::MultiSpline>(); |
| 239 | |
| 240 | multispline_builder.add_spline_count(1); |
| 241 | multispline_builder.add_constraints(constraints_offset); |
| 242 | multispline_builder.add_spline_x(spline_x_offset); |
| 243 | multispline_builder.add_spline_y(spline_y_offset); |
| 244 | |
| 245 | return multispline_builder.Finish(); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 246 | } |
| 247 | |
| 248 | // Path from the far side of the rocket to close to the loading station |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 249 | flatbuffers::Offset<frc971::MultiSpline> AutonomousSplines::FarRocketToNearHP( |
James Kuszmaul | 75a18c5 | 2021-03-10 22:02:07 -0800 | [diff] [blame] | 250 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 251 | *builder, |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 252 | bool is_left) { |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 253 | // TODO(theo): Add some real constraints. |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 254 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_x_offset = |
| 255 | builder->fbb()->CreateVector<float>({6.51652191988, 6.83156293562, |
| 256 | 5.74513904409, 2.2337653586, |
| 257 | 1.94766705864, 0.727526876557}); |
| 258 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_y_offset = |
| 259 | builder->fbb()->CreateVector<float>({3.2465107468, 2.88277456846, |
| 260 | 1.93458779243, 3.44064777429, |
| 261 | 3.44377880106, 3.43326367284}); |
| 262 | MaybeFlipSpline(builder, spline_y_offset, is_left); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 263 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 264 | frc971::MultiSpline::Builder multispline_builder = |
| 265 | builder->MakeBuilder<frc971::MultiSpline>(); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 266 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 267 | multispline_builder.add_spline_count(1); |
| 268 | multispline_builder.add_spline_x(spline_x_offset); |
| 269 | multispline_builder.add_spline_y(spline_y_offset); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 270 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 271 | return multispline_builder.Finish(); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 272 | } |
| 273 | |
| 274 | // Path from level 2 to 2nd cargo ship bay with a hatch panel |
James Kuszmaul | 75a18c5 | 2021-03-10 22:02:07 -0800 | [diff] [blame] | 275 | flatbuffers::Offset<frc971::MultiSpline> |
| 276 | AutonomousSplines::HABToSecondCargoShipBay( |
| 277 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 278 | *builder, |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 279 | bool is_left) { |
| 280 | flatbuffers::Offset<frc971::Constraint> longitudinal_constraint_offset; |
| 281 | flatbuffers::Offset<frc971::Constraint> voltage_constraint_offset; |
| 282 | flatbuffers::Offset<frc971::Constraint> velocity_constraint_offset; |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 283 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 284 | { |
| 285 | frc971::Constraint::Builder longitudinal_constraint_builder = |
| 286 | builder->MakeBuilder<frc971::Constraint>(); |
| 287 | longitudinal_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 288 | frc971::ConstraintType::LONGITUDINAL_ACCELERATION); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 289 | longitudinal_constraint_builder.add_value(2.0); |
| 290 | longitudinal_constraint_offset = longitudinal_constraint_builder.Finish(); |
| 291 | } |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 292 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 293 | { |
| 294 | frc971::Constraint::Builder voltage_constraint_builder = |
| 295 | builder->MakeBuilder<frc971::Constraint>(); |
| 296 | voltage_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 297 | frc971::ConstraintType::VOLTAGE); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 298 | voltage_constraint_builder.add_value(10.0); |
| 299 | voltage_constraint_offset = voltage_constraint_builder.Finish(); |
| 300 | } |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 301 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 302 | { |
| 303 | frc971::Constraint::Builder velocity_constraint_builder = |
| 304 | builder->MakeBuilder<frc971::Constraint>(); |
| 305 | velocity_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 306 | frc971::ConstraintType::VELOCITY); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 307 | velocity_constraint_builder.add_value(1.6); |
| 308 | velocity_constraint_builder.add_start_distance(4.0); |
| 309 | velocity_constraint_builder.add_end_distance(10.0); |
| 310 | velocity_constraint_offset = velocity_constraint_builder.Finish(); |
| 311 | } |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 312 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 313 | flatbuffers::Offset< |
| 314 | flatbuffers::Vector<flatbuffers::Offset<frc971::Constraint>>> |
| 315 | constraints_offset = |
| 316 | builder->fbb()->CreateVector<flatbuffers::Offset<frc971::Constraint>>( |
| 317 | {longitudinal_constraint_offset, voltage_constraint_offset, |
| 318 | velocity_constraint_offset}); |
| 319 | |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 320 | constexpr double kLess = 0.06; |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 321 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_x_offset = |
| 322 | builder->fbb()->CreateVector<float>( |
| 323 | {1.0, 2.53944573074, 5.75526086906, 6.52583747973 - kLess, |
| 324 | 7.12318661548 - kLess, 7.22595029399 - kLess}); |
| 325 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_y_offset = |
| 326 | builder->fbb()->CreateVector<float>({1.5, 1.48, 2.05178220103, |
| 327 | 2.56666687655, 1.79340280288, |
| 328 | 1.16170693058}); |
| 329 | MaybeFlipSpline(builder, spline_y_offset, is_left); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 330 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 331 | frc971::MultiSpline::Builder multispline_builder = |
| 332 | builder->MakeBuilder<frc971::MultiSpline>(); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 333 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 334 | multispline_builder.add_spline_count(1); |
| 335 | multispline_builder.add_constraints(constraints_offset); |
| 336 | multispline_builder.add_spline_x(spline_x_offset); |
| 337 | multispline_builder.add_spline_y(spline_y_offset); |
| 338 | |
| 339 | return multispline_builder.Finish(); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 340 | } |
| 341 | |
| 342 | // Path from 2nd cargo ship bay to loading station |
James Kuszmaul | 75a18c5 | 2021-03-10 22:02:07 -0800 | [diff] [blame] | 343 | flatbuffers::Offset<frc971::MultiSpline> |
| 344 | AutonomousSplines::SecondCargoShipBayToHP( |
| 345 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 346 | *builder, |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 347 | bool is_left) { |
| 348 | flatbuffers::Offset<frc971::Constraint> voltage_constraint_offset; |
| 349 | flatbuffers::Offset<frc971::Constraint> velocity_constraint_offset; |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 350 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 351 | { |
| 352 | frc971::Constraint::Builder voltage_constraint_builder = |
| 353 | builder->MakeBuilder<frc971::Constraint>(); |
| 354 | voltage_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 355 | frc971::ConstraintType::VOLTAGE); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 356 | voltage_constraint_builder.add_value(11.0); |
| 357 | voltage_constraint_offset = voltage_constraint_builder.Finish(); |
| 358 | } |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 359 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 360 | { |
| 361 | frc971::Constraint::Builder velocity_constraint_builder = |
| 362 | builder->MakeBuilder<frc971::Constraint>(); |
| 363 | velocity_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 364 | frc971::ConstraintType::VELOCITY); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 365 | velocity_constraint_builder.add_value(4.0); |
| 366 | velocity_constraint_builder.add_start_distance(0.0); |
| 367 | velocity_constraint_builder.add_end_distance(10.0); |
| 368 | velocity_constraint_offset = velocity_constraint_builder.Finish(); |
| 369 | } |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 370 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 371 | flatbuffers::Offset< |
| 372 | flatbuffers::Vector<flatbuffers::Offset<frc971::Constraint>>> |
| 373 | constraints_offset = |
| 374 | builder->fbb()->CreateVector<flatbuffers::Offset<frc971::Constraint>>( |
| 375 | {voltage_constraint_offset, velocity_constraint_offset}); |
| 376 | |
| 377 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_x_offset = |
| 378 | builder->fbb()->CreateVector<float>({7.22595029399, 7.1892447864, |
| 379 | 6.5373977907, 5.55997590982, |
| 380 | 1.22953437637, 0.32521840905}); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 381 | constexpr double kYShift = 0.1; |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 382 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_y_offset = |
| 383 | builder->fbb()->CreateVector<float>( |
| 384 | {1.2, 1.44543230529, 2.00646674662, 3.43762336271 - kYShift, |
| 385 | 3.44125430793 - kYShift, 3.4360348159 - kYShift}); |
| 386 | MaybeFlipSpline(builder, spline_y_offset, is_left); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 387 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 388 | frc971::MultiSpline::Builder multispline_builder = |
| 389 | builder->MakeBuilder<frc971::MultiSpline>(); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 390 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 391 | multispline_builder.add_spline_count(1); |
| 392 | multispline_builder.add_constraints(constraints_offset); |
| 393 | multispline_builder.add_spline_x(spline_x_offset); |
| 394 | multispline_builder.add_spline_y(spline_y_offset); |
| 395 | |
| 396 | return multispline_builder.Finish(); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 397 | } |
| 398 | |
| 399 | // Path from loading station to 3rd cargo ship bay with a hatch panel |
James Kuszmaul | 75a18c5 | 2021-03-10 22:02:07 -0800 | [diff] [blame] | 400 | flatbuffers::Offset<frc971::MultiSpline> |
| 401 | AutonomousSplines::HPToThirdCargoShipBay( |
| 402 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 403 | *builder, |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 404 | bool is_left) { |
| 405 | flatbuffers::Offset<frc971::Constraint> voltage_constraint_offset; |
| 406 | flatbuffers::Offset<frc971::Constraint> velocity_constraint_offset; |
| 407 | flatbuffers::Offset<frc971::Constraint> velocity_constraint2_offset; |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 408 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 409 | { |
| 410 | frc971::Constraint::Builder voltage_constraint_builder = |
| 411 | builder->MakeBuilder<frc971::Constraint>(); |
| 412 | voltage_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 413 | frc971::ConstraintType::VOLTAGE); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 414 | voltage_constraint_builder.add_value(10.0); |
| 415 | voltage_constraint_offset = voltage_constraint_builder.Finish(); |
| 416 | } |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 417 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 418 | { |
| 419 | frc971::Constraint::Builder velocity_constraint_builder = |
| 420 | builder->MakeBuilder<frc971::Constraint>(); |
| 421 | velocity_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 422 | frc971::ConstraintType::VELOCITY); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 423 | velocity_constraint_builder.add_value(3.5); |
| 424 | velocity_constraint_builder.add_start_distance(0.0); |
| 425 | velocity_constraint_builder.add_end_distance(10.0); |
| 426 | velocity_constraint_offset = velocity_constraint_builder.Finish(); |
| 427 | } |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 428 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 429 | { |
| 430 | frc971::Constraint::Builder velocity_constraint2_builder = |
| 431 | builder->MakeBuilder<frc971::Constraint>(); |
| 432 | velocity_constraint2_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 433 | frc971::ConstraintType::VELOCITY); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 434 | velocity_constraint2_builder.add_value(2.0); |
| 435 | velocity_constraint2_builder.add_start_distance(6.0); |
| 436 | velocity_constraint2_builder.add_end_distance(10.0); |
| 437 | velocity_constraint2_offset = velocity_constraint2_builder.Finish(); |
| 438 | } |
| 439 | |
| 440 | flatbuffers::Offset< |
| 441 | flatbuffers::Vector<flatbuffers::Offset<frc971::Constraint>>> |
| 442 | constraints_offset = |
| 443 | builder->fbb()->CreateVector<flatbuffers::Offset<frc971::Constraint>>( |
| 444 | {voltage_constraint_offset, velocity_constraint_offset, |
| 445 | velocity_constraint2_offset}); |
| 446 | |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 447 | constexpr double kEndMove = 0.25; |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 448 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_x_offset = |
| 449 | builder->fbb()->CreateVector<float>({0.75, 1.112, 5.576, 7.497 - kEndMove, |
| 450 | 7.675 - kEndMove, 7.768 - kEndMove}); |
| 451 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_y_offset = |
| 452 | builder->fbb()->CreateVector<float>( |
| 453 | {3.431, 3.434, 2.712, 2.874, 1.786, 1.168}); |
| 454 | MaybeFlipSpline(builder, spline_y_offset, is_left); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 455 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 456 | frc971::MultiSpline::Builder multispline_builder = |
| 457 | builder->MakeBuilder<frc971::MultiSpline>(); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 458 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 459 | multispline_builder.add_spline_count(1); |
| 460 | multispline_builder.add_constraints(constraints_offset); |
| 461 | multispline_builder.add_spline_x(spline_x_offset); |
| 462 | multispline_builder.add_spline_y(spline_y_offset); |
| 463 | |
| 464 | return multispline_builder.Finish(); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 465 | } |
| 466 | |
| 467 | // Path from 3rd cargo ship bay to near the loading station |
James Kuszmaul | 75a18c5 | 2021-03-10 22:02:07 -0800 | [diff] [blame] | 468 | flatbuffers::Offset<frc971::MultiSpline> |
| 469 | AutonomousSplines::ThirdCargoShipBayToNearHP( |
| 470 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 471 | *builder, |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 472 | bool is_left) { |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 473 | flatbuffers::Offset<frc971::Constraint> velocity_constraint_offset; |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 474 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 475 | { |
| 476 | frc971::Constraint::Builder velocity_constraint_builder = |
| 477 | builder->MakeBuilder<frc971::Constraint>(); |
| 478 | velocity_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 479 | frc971::ConstraintType::VELOCITY); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 480 | velocity_constraint_builder.add_value(0.5); |
| 481 | velocity_constraint_builder.add_start_distance(0.0); |
| 482 | velocity_constraint_builder.add_end_distance(10.0); |
| 483 | velocity_constraint_offset = velocity_constraint_builder.Finish(); |
| 484 | } |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 485 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 486 | flatbuffers::Offset< |
| 487 | flatbuffers::Vector<flatbuffers::Offset<frc971::Constraint>>> |
| 488 | constraints_offset = |
| 489 | builder->fbb()->CreateVector<flatbuffers::Offset<frc971::Constraint>>( |
| 490 | {velocity_constraint_offset}); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 491 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 492 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_x_offset = |
| 493 | builder->fbb()->CreateVector<float>({7.75823205276, 7.58356294646, |
| 494 | 5.95536035287, 2.12377989323, |
| 495 | 1.29347361128, 0.598613577531}); |
| 496 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_y_offset = |
| 497 | builder->fbb()->CreateVector<float>({1.16791407107, 1.94564064915, |
| 498 | 2.54565614767, 3.43728005786, |
| 499 | 3.43775494434, 3.43119598027}); |
| 500 | MaybeFlipSpline(builder, spline_y_offset, is_left); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 501 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 502 | frc971::MultiSpline::Builder multispline_builder = |
| 503 | builder->MakeBuilder<frc971::MultiSpline>(); |
| 504 | |
| 505 | multispline_builder.add_spline_count(1); |
| 506 | multispline_builder.add_constraints(constraints_offset); |
| 507 | multispline_builder.add_spline_x(spline_x_offset); |
| 508 | multispline_builder.add_spline_y(spline_y_offset); |
| 509 | |
| 510 | return multispline_builder.Finish(); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 511 | } |
| 512 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 513 | flatbuffers::Offset<frc971::MultiSpline> AutonomousSplines::HabToFarRocketTest( |
James Kuszmaul | 75a18c5 | 2021-03-10 22:02:07 -0800 | [diff] [blame] | 514 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 515 | *builder, |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 516 | bool is_left) { |
| 517 | flatbuffers::Offset<frc971::Constraint> longitudinal_constraint_offset; |
| 518 | flatbuffers::Offset<frc971::Constraint> lateral_constraint_offset; |
| 519 | flatbuffers::Offset<frc971::Constraint> voltage_constraint_offset; |
| 520 | flatbuffers::Offset<frc971::Constraint> velocity_constraint_offset; |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 521 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 522 | { |
| 523 | frc971::Constraint::Builder longitudinal_constraint_builder = |
| 524 | builder->MakeBuilder<frc971::Constraint>(); |
| 525 | longitudinal_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 526 | frc971::ConstraintType::LONGITUDINAL_ACCELERATION); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 527 | longitudinal_constraint_builder.add_value(2.0); |
| 528 | longitudinal_constraint_offset = longitudinal_constraint_builder.Finish(); |
| 529 | } |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 530 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 531 | { |
| 532 | frc971::Constraint::Builder lateral_constraint_builder = |
| 533 | builder->MakeBuilder<frc971::Constraint>(); |
| 534 | lateral_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 535 | frc971::ConstraintType::LATERAL_ACCELERATION); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 536 | lateral_constraint_builder.add_value(2.0); |
| 537 | lateral_constraint_offset = lateral_constraint_builder.Finish(); |
| 538 | } |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 539 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 540 | { |
| 541 | frc971::Constraint::Builder voltage_constraint_builder = |
| 542 | builder->MakeBuilder<frc971::Constraint>(); |
| 543 | voltage_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 544 | frc971::ConstraintType::VOLTAGE); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 545 | voltage_constraint_builder.add_value(11.0); |
| 546 | voltage_constraint_offset = voltage_constraint_builder.Finish(); |
| 547 | } |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 548 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 549 | { |
| 550 | frc971::Constraint::Builder velocity_constraint_builder = |
| 551 | builder->MakeBuilder<frc971::Constraint>(); |
| 552 | velocity_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 553 | frc971::ConstraintType::VELOCITY); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 554 | velocity_constraint_builder.add_value(1.7); |
| 555 | velocity_constraint_builder.add_start_distance(0.0); |
| 556 | velocity_constraint_builder.add_end_distance(0.8); |
| 557 | velocity_constraint_offset = velocity_constraint_builder.Finish(); |
| 558 | } |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 559 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 560 | flatbuffers::Offset< |
| 561 | flatbuffers::Vector<flatbuffers::Offset<frc971::Constraint>>> |
| 562 | constraints_offset = |
| 563 | builder->fbb()->CreateVector<flatbuffers::Offset<frc971::Constraint>>( |
| 564 | {longitudinal_constraint_offset, lateral_constraint_offset, |
| 565 | voltage_constraint_offset, velocity_constraint_offset}); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 566 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 567 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_x_offset = |
| 568 | builder->fbb()->CreateVector<float>({1.14763818102, 2.53944573074, |
| 569 | 3.74586892131, 5.22352745444, |
| 570 | 6.70255737219, 7.35784750785}); |
| 571 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_y_offset = |
| 572 | builder->fbb()->CreateVector<float>({1.30261224364, 1.28295363394, |
| 573 | 1.27450357714, 2.89953366429, |
| 574 | 3.10734391012, 2.90125929705}); |
| 575 | MaybeFlipSpline(builder, spline_y_offset, is_left); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 576 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 577 | frc971::MultiSpline::Builder multispline_builder = |
| 578 | builder->MakeBuilder<frc971::MultiSpline>(); |
| 579 | |
| 580 | multispline_builder.add_spline_count(1); |
| 581 | multispline_builder.add_constraints(constraints_offset); |
| 582 | multispline_builder.add_spline_x(spline_x_offset); |
| 583 | multispline_builder.add_spline_y(spline_y_offset); |
| 584 | |
| 585 | return multispline_builder.Finish(); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 586 | } |
| 587 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 588 | flatbuffers::Offset<frc971::MultiSpline> AutonomousSplines::FarRocketToHPTest( |
James Kuszmaul | 75a18c5 | 2021-03-10 22:02:07 -0800 | [diff] [blame] | 589 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 590 | *builder) { |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 591 | flatbuffers::Offset<frc971::Constraint> longitudinal_constraint_offset; |
| 592 | flatbuffers::Offset<frc971::Constraint> lateral_constraint_offset; |
| 593 | flatbuffers::Offset<frc971::Constraint> voltage_constraint_offset; |
| 594 | flatbuffers::Offset<frc971::Constraint> velocity_constraint_offset; |
James Kuszmaul | bc83787 | 2019-04-07 12:01:47 -0700 | [diff] [blame] | 595 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 596 | { |
| 597 | frc971::Constraint::Builder longitudinal_constraint_builder = |
| 598 | builder->MakeBuilder<frc971::Constraint>(); |
| 599 | longitudinal_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 600 | frc971::ConstraintType::LONGITUDINAL_ACCELERATION); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 601 | longitudinal_constraint_builder.add_value(1.5); |
| 602 | longitudinal_constraint_offset = longitudinal_constraint_builder.Finish(); |
| 603 | } |
James Kuszmaul | bc83787 | 2019-04-07 12:01:47 -0700 | [diff] [blame] | 604 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 605 | { |
| 606 | frc971::Constraint::Builder lateral_constraint_builder = |
| 607 | builder->MakeBuilder<frc971::Constraint>(); |
| 608 | lateral_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 609 | frc971::ConstraintType::LATERAL_ACCELERATION); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 610 | lateral_constraint_builder.add_value(1.0); |
| 611 | lateral_constraint_offset = lateral_constraint_builder.Finish(); |
| 612 | } |
James Kuszmaul | bc83787 | 2019-04-07 12:01:47 -0700 | [diff] [blame] | 613 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 614 | { |
| 615 | frc971::Constraint::Builder voltage_constraint_builder = |
| 616 | builder->MakeBuilder<frc971::Constraint>(); |
| 617 | voltage_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 618 | frc971::ConstraintType::VOLTAGE); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 619 | voltage_constraint_builder.add_value(11.0); |
| 620 | voltage_constraint_offset = voltage_constraint_builder.Finish(); |
| 621 | } |
James Kuszmaul | bc83787 | 2019-04-07 12:01:47 -0700 | [diff] [blame] | 622 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 623 | { |
| 624 | frc971::Constraint::Builder velocity_constraint_builder = |
| 625 | builder->MakeBuilder<frc971::Constraint>(); |
| 626 | velocity_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 627 | frc971::ConstraintType::VELOCITY); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 628 | velocity_constraint_builder.add_value(0.5); |
| 629 | velocity_constraint_builder.add_start_distance(9.5); |
| 630 | velocity_constraint_builder.add_end_distance(10.0); |
| 631 | velocity_constraint_offset = velocity_constraint_builder.Finish(); |
| 632 | } |
James Kuszmaul | bc83787 | 2019-04-07 12:01:47 -0700 | [diff] [blame] | 633 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 634 | flatbuffers::Offset< |
| 635 | flatbuffers::Vector<flatbuffers::Offset<frc971::Constraint>>> |
| 636 | constraints_offset = |
| 637 | builder->fbb()->CreateVector<flatbuffers::Offset<frc971::Constraint>>( |
| 638 | {longitudinal_constraint_offset, lateral_constraint_offset, |
| 639 | voltage_constraint_offset, velocity_constraint_offset}); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 640 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 641 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_x_offset = |
| 642 | builder->fbb()->CreateVector<float>({6.53, 7.8, 7.8, 4.0, 2.0, 0.4}); |
| 643 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_y_offset = |
| 644 | builder->fbb()->CreateVector<float>({3.47, 3.0, 1.5, 3.0, 3.4, 3.4}); |
| 645 | |
| 646 | frc971::MultiSpline::Builder multispline_builder = |
| 647 | builder->MakeBuilder<frc971::MultiSpline>(); |
| 648 | |
| 649 | multispline_builder.add_spline_count(1); |
| 650 | multispline_builder.add_constraints(constraints_offset); |
| 651 | multispline_builder.add_spline_x(spline_x_offset); |
| 652 | multispline_builder.add_spline_y(spline_y_offset); |
| 653 | |
| 654 | return multispline_builder.Finish(); |
James Kuszmaul | bc83787 | 2019-04-07 12:01:47 -0700 | [diff] [blame] | 655 | } |
| 656 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 657 | flatbuffers::Offset<frc971::MultiSpline> AutonomousSplines::HPToNearRocketTest( |
James Kuszmaul | 75a18c5 | 2021-03-10 22:02:07 -0800 | [diff] [blame] | 658 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 659 | *builder) { |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 660 | flatbuffers::Offset<frc971::Constraint> longitudinal_constraint_offset; |
| 661 | flatbuffers::Offset<frc971::Constraint> lateral_constraint_offset; |
| 662 | flatbuffers::Offset<frc971::Constraint> voltage_constraint_offset; |
| 663 | flatbuffers::Offset<frc971::Constraint> velocity_constraint_offset; |
Austin Schuh | 6bcc230 | 2019-03-23 22:28:06 -0700 | [diff] [blame] | 664 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 665 | { |
| 666 | frc971::Constraint::Builder longitudinal_constraint_builder = |
| 667 | builder->MakeBuilder<frc971::Constraint>(); |
| 668 | longitudinal_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 669 | frc971::ConstraintType::LONGITUDINAL_ACCELERATION); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 670 | longitudinal_constraint_builder.add_value(1.0); |
| 671 | longitudinal_constraint_offset = longitudinal_constraint_builder.Finish(); |
| 672 | } |
Austin Schuh | 6bcc230 | 2019-03-23 22:28:06 -0700 | [diff] [blame] | 673 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 674 | { |
| 675 | frc971::Constraint::Builder lateral_constraint_builder = |
| 676 | builder->MakeBuilder<frc971::Constraint>(); |
| 677 | lateral_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 678 | frc971::ConstraintType::LATERAL_ACCELERATION); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 679 | lateral_constraint_builder.add_value(1.0); |
| 680 | lateral_constraint_offset = lateral_constraint_builder.Finish(); |
| 681 | } |
Austin Schuh | 6bcc230 | 2019-03-23 22:28:06 -0700 | [diff] [blame] | 682 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 683 | { |
| 684 | frc971::Constraint::Builder voltage_constraint_builder = |
| 685 | builder->MakeBuilder<frc971::Constraint>(); |
| 686 | voltage_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 687 | frc971::ConstraintType::VOLTAGE); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 688 | voltage_constraint_builder.add_value(11.0); |
| 689 | voltage_constraint_offset = voltage_constraint_builder.Finish(); |
| 690 | } |
James Kuszmaul | bc83787 | 2019-04-07 12:01:47 -0700 | [diff] [blame] | 691 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 692 | { |
| 693 | frc971::Constraint::Builder velocity_constraint_builder = |
| 694 | builder->MakeBuilder<frc971::Constraint>(); |
| 695 | velocity_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 696 | frc971::ConstraintType::VELOCITY); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 697 | velocity_constraint_builder.add_value(0.5); |
| 698 | velocity_constraint_builder.add_start_distance(2.7); |
| 699 | velocity_constraint_builder.add_end_distance(10.0); |
| 700 | velocity_constraint_offset = velocity_constraint_builder.Finish(); |
| 701 | } |
Austin Schuh | 6bcc230 | 2019-03-23 22:28:06 -0700 | [diff] [blame] | 702 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 703 | flatbuffers::Offset< |
| 704 | flatbuffers::Vector<flatbuffers::Offset<frc971::Constraint>>> |
| 705 | constraints_offset = |
| 706 | builder->fbb()->CreateVector<flatbuffers::Offset<frc971::Constraint>>( |
| 707 | {longitudinal_constraint_offset, lateral_constraint_offset, |
| 708 | voltage_constraint_offset, velocity_constraint_offset}); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 709 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 710 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_x_offset = |
| 711 | builder->fbb()->CreateVector<float>({1.5, 2.0, 3.0, 4.0, 4.5, 5.12}); |
| 712 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_y_offset = |
| 713 | builder->fbb()->CreateVector<float>({3.4, 3.4, 3.4, 3.0, 3.0, 3.43}); |
| 714 | |
| 715 | frc971::MultiSpline::Builder multispline_builder = |
| 716 | builder->MakeBuilder<frc971::MultiSpline>(); |
| 717 | |
| 718 | multispline_builder.add_spline_count(1); |
| 719 | multispline_builder.add_constraints(constraints_offset); |
| 720 | multispline_builder.add_spline_x(spline_x_offset); |
| 721 | multispline_builder.add_spline_y(spline_y_offset); |
| 722 | |
| 723 | return multispline_builder.Finish(); |
Austin Schuh | 6bcc230 | 2019-03-23 22:28:06 -0700 | [diff] [blame] | 724 | } |
| 725 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 726 | flatbuffers::Offset<frc971::MultiSpline> AutonomousSplines::BasicSSpline( |
James Kuszmaul | 75a18c5 | 2021-03-10 22:02:07 -0800 | [diff] [blame] | 727 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 728 | *builder) { |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 729 | flatbuffers::Offset<frc971::Constraint> longitudinal_constraint_offset; |
| 730 | flatbuffers::Offset<frc971::Constraint> lateral_constraint_offset; |
| 731 | flatbuffers::Offset<frc971::Constraint> voltage_constraint_offset; |
Austin Schuh | 6bcc230 | 2019-03-23 22:28:06 -0700 | [diff] [blame] | 732 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 733 | { |
| 734 | frc971::Constraint::Builder longitudinal_constraint_builder = |
| 735 | builder->MakeBuilder<frc971::Constraint>(); |
| 736 | longitudinal_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 737 | frc971::ConstraintType::LONGITUDINAL_ACCELERATION); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 738 | longitudinal_constraint_builder.add_value(1.0); |
| 739 | longitudinal_constraint_offset = longitudinal_constraint_builder.Finish(); |
| 740 | } |
Austin Schuh | 6bcc230 | 2019-03-23 22:28:06 -0700 | [diff] [blame] | 741 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 742 | { |
| 743 | frc971::Constraint::Builder lateral_constraint_builder = |
| 744 | builder->MakeBuilder<frc971::Constraint>(); |
| 745 | lateral_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 746 | frc971::ConstraintType::LATERAL_ACCELERATION); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 747 | lateral_constraint_builder.add_value(1.0); |
| 748 | lateral_constraint_offset = lateral_constraint_builder.Finish(); |
| 749 | } |
Austin Schuh | 6bcc230 | 2019-03-23 22:28:06 -0700 | [diff] [blame] | 750 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 751 | { |
| 752 | frc971::Constraint::Builder voltage_constraint_builder = |
| 753 | builder->MakeBuilder<frc971::Constraint>(); |
| 754 | voltage_constraint_builder.add_constraint_type( |
Austin Schuh | 872723c | 2019-12-25 14:38:09 -0800 | [diff] [blame] | 755 | frc971::ConstraintType::VOLTAGE); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 756 | voltage_constraint_builder.add_value(6.0); |
| 757 | voltage_constraint_offset = voltage_constraint_builder.Finish(); |
| 758 | } |
Austin Schuh | 6bcc230 | 2019-03-23 22:28:06 -0700 | [diff] [blame] | 759 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 760 | flatbuffers::Offset< |
| 761 | flatbuffers::Vector<flatbuffers::Offset<frc971::Constraint>>> |
| 762 | constraints_offset = |
| 763 | builder->fbb()->CreateVector<flatbuffers::Offset<frc971::Constraint>>( |
| 764 | {longitudinal_constraint_offset, lateral_constraint_offset, |
| 765 | voltage_constraint_offset}); |
| 766 | |
Austin Schuh | 6bcc230 | 2019-03-23 22:28:06 -0700 | [diff] [blame] | 767 | const float startx = 0.4; |
| 768 | const float starty = 3.4; |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 769 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_x_offset = |
| 770 | builder->fbb()->CreateVector<float>({0.0f + startx, 0.6f + startx, |
| 771 | 0.6f + startx, 0.4f + startx, |
| 772 | 0.4f + startx, 1.0f + startx}); |
| 773 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_y_offset = |
| 774 | builder->fbb()->CreateVector<float>({starty - 0.0f, starty - 0.0f, |
| 775 | starty - 0.3f, starty - 0.7f, |
| 776 | starty - 1.0f, starty - 1.0f}); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 777 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 778 | frc971::MultiSpline::Builder multispline_builder = |
| 779 | builder->MakeBuilder<frc971::MultiSpline>(); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 780 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 781 | multispline_builder.add_spline_count(1); |
| 782 | multispline_builder.add_constraints(constraints_offset); |
| 783 | multispline_builder.add_spline_x(spline_x_offset); |
| 784 | multispline_builder.add_spline_y(spline_y_offset); |
| 785 | |
| 786 | return multispline_builder.Finish(); |
Austin Schuh | 6bcc230 | 2019-03-23 22:28:06 -0700 | [diff] [blame] | 787 | } |
| 788 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 789 | flatbuffers::Offset<frc971::MultiSpline> AutonomousSplines::StraightLine( |
James Kuszmaul | 75a18c5 | 2021-03-10 22:02:07 -0800 | [diff] [blame] | 790 | aos::Sender<frc971::control_loops::drivetrain::SplineGoal>::Builder |
| 791 | *builder) { |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 792 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_x_offset = |
| 793 | builder->fbb()->CreateVector<float>( |
| 794 | {-12.3, -11.9, -11.5, -11.1, -10.6, -10.0}); |
| 795 | flatbuffers::Offset<flatbuffers::Vector<float>> spline_y_offset = |
| 796 | builder->fbb()->CreateVector<float>({1.25, 1.25, 1.25, 1.25, 1.25, 1.25}); |
Austin Schuh | 6bcc230 | 2019-03-23 22:28:06 -0700 | [diff] [blame] | 797 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 798 | frc971::MultiSpline::Builder multispline_builder = |
| 799 | builder->MakeBuilder<frc971::MultiSpline>(); |
Austin Schuh | 6bcc230 | 2019-03-23 22:28:06 -0700 | [diff] [blame] | 800 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 801 | multispline_builder.add_spline_count(1); |
| 802 | multispline_builder.add_spline_x(spline_x_offset); |
| 803 | multispline_builder.add_spline_y(spline_y_offset); |
Austin Schuh | b5b79a5 | 2019-05-08 20:32:07 -0700 | [diff] [blame] | 804 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 805 | return multispline_builder.Finish(); |
Austin Schuh | 6bcc230 | 2019-03-23 22:28:06 -0700 | [diff] [blame] | 806 | } |
| 807 | |
Stephan Pleines | f63bde8 | 2024-01-13 15:59:33 -0800 | [diff] [blame] | 808 | } // namespace y2019::actors |