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