Comran Morshed | 25f81a0 | 2016-01-23 13:40:10 +0000 | [diff] [blame] | 1 | #include "y2016/control_loops/superstructure/superstructure.h" |
Austin Schuh | 10c2d11 | 2016-02-14 13:42:28 -0800 | [diff] [blame] | 2 | #include "y2016/control_loops/superstructure/superstructure_controls.h" |
Comran Morshed | 25f81a0 | 2016-01-23 13:40:10 +0000 | [diff] [blame] | 3 | |
| 4 | #include "aos/common/controls/control_loops.q.h" |
| 5 | #include "aos/common/logging/logging.h" |
| 6 | |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 7 | #include "y2016/control_loops/superstructure/integral_intake_plant.h" |
| 8 | #include "y2016/control_loops/superstructure/integral_arm_plant.h" |
| 9 | |
| 10 | #include "y2016/constants.h" |
| 11 | |
Comran Morshed | 25f81a0 | 2016-01-23 13:40:10 +0000 | [diff] [blame] | 12 | namespace y2016 { |
| 13 | namespace control_loops { |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 14 | namespace superstructure { |
Comran Morshed | 25f81a0 | 2016-01-23 13:40:10 +0000 | [diff] [blame] | 15 | |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 16 | namespace { |
Adam Snaider | 0677972 | 2016-02-14 15:26:22 -0800 | [diff] [blame^] | 17 | constexpr double kIntakeEncoderIndexDifference = |
| 18 | constants::Values::kIntakeEncoderIndexDifference; |
| 19 | constexpr double kWristEncoderIndexDifference = |
| 20 | constants::Values::kWristEncoderIndexDifference; |
| 21 | constexpr double kShoulderEncoderIndexDifference = |
| 22 | constants::Values::kShoulderEncoderIndexDifference; |
| 23 | |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 24 | constexpr double kZeroingVoltage = 4.0; |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 25 | } // namespace |
| 26 | |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 27 | Superstructure::Superstructure( |
| 28 | control_loops::SuperstructureQueue *superstructure_queue) |
| 29 | : aos::controls::ControlLoop<control_loops::SuperstructureQueue>( |
| 30 | superstructure_queue) {} |
| 31 | |
Adam Snaider | 0677972 | 2016-02-14 15:26:22 -0800 | [diff] [blame^] | 32 | bool Superstructure::IsArmNear(double shoulder_tolerance, |
| 33 | double wrist_tolerance) { |
| 34 | return ((arm_.unprofiled_goal() - arm_.X_hat()) |
| 35 | .block<2, 1>(0, 0) |
| 36 | .lpNorm<Eigen::Infinity>() < shoulder_tolerance) && |
| 37 | ((arm_.unprofiled_goal() - arm_.X_hat()) |
| 38 | .block<4, 1>(0, 0) |
| 39 | .lpNorm<Eigen::Infinity>() < wrist_tolerance) && |
| 40 | ((arm_.unprofiled_goal() - arm_.goal()) |
| 41 | .block<4, 1>(0, 0) |
| 42 | .lpNorm<Eigen::Infinity>() < 1e-6); |
| 43 | } |
| 44 | |
| 45 | bool Superstructure::IsArmNear(double tolerance) { |
| 46 | return ((arm_.unprofiled_goal() - arm_.X_hat()) |
| 47 | .block<4, 1>(0, 0) |
| 48 | .lpNorm<Eigen::Infinity>() < tolerance) && |
| 49 | ((arm_.unprofiled_goal() - arm_.goal()) |
| 50 | .block<4, 1>(0, 0) |
| 51 | .lpNorm<Eigen::Infinity>() < 1e-6); |
| 52 | } |
| 53 | |
| 54 | bool Superstructure::IsIntakeNear(double tolerance) { |
| 55 | return ((intake_.unprofiled_goal() - intake_.X_hat()) |
| 56 | .block<2, 1>(0, 0) |
| 57 | .lpNorm<Eigen::Infinity>() < tolerance); |
| 58 | } |
| 59 | |
| 60 | double Superstructure::MoveButKeepAbove(double reference_angle, |
| 61 | double current_angle, |
| 62 | double move_distance) { |
| 63 | return -MoveButKeepBelow(-reference_angle, -current_angle, -move_distance); |
| 64 | } |
| 65 | |
| 66 | double Superstructure::MoveButKeepBelow(double reference_angle, |
| 67 | double current_angle, |
| 68 | double move_distance) { |
| 69 | // There are 3 interesting places to move to. |
| 70 | const double small_negative_move = current_angle - move_distance; |
| 71 | const double small_positive_move = current_angle + move_distance; |
| 72 | // And the reference angle. |
| 73 | |
| 74 | // Move the the highest one that is below reference_angle. |
| 75 | if (small_negative_move > reference_angle) { |
| 76 | return reference_angle; |
| 77 | } else if (small_positive_move > reference_angle) { |
| 78 | return small_negative_move; |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 79 | } else { |
Adam Snaider | 0677972 | 2016-02-14 15:26:22 -0800 | [diff] [blame^] | 80 | return small_positive_move; |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 81 | } |
| 82 | } |
| 83 | |
Adam Snaider | 0677972 | 2016-02-14 15:26:22 -0800 | [diff] [blame^] | 84 | constexpr double Superstructure::kShoulderMiddleAngle; |
| 85 | constexpr double Superstructure::kLooseTolerance; |
| 86 | constexpr double Superstructure::kIntakeUpperClear; |
| 87 | constexpr double Superstructure::kIntakeLowerClear; |
| 88 | constexpr double Superstructure::kShoulderUpAngle; |
| 89 | constexpr double Superstructure::kShoulderLanded; |
| 90 | constexpr double Superstructure::kTightTolerance; |
| 91 | constexpr double Superstructure::kWristAlmostLevel; |
| 92 | constexpr double Superstructure::kShoulderWristClearAngle; |
| 93 | |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 94 | void Superstructure::RunIteration( |
| 95 | const control_loops::SuperstructureQueue::Goal *unsafe_goal, |
| 96 | const control_loops::SuperstructureQueue::Position *position, |
| 97 | control_loops::SuperstructureQueue::Output *output, |
| 98 | control_loops::SuperstructureQueue::Status *status) { |
Adam Snaider | 0677972 | 2016-02-14 15:26:22 -0800 | [diff] [blame^] | 99 | const State state_before_switch = state_; |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 100 | if (WasReset()) { |
| 101 | LOG(ERROR, "WPILib reset, restarting\n"); |
| 102 | arm_.Reset(); |
| 103 | intake_.Reset(); |
| 104 | state_ = UNINITIALIZED; |
| 105 | } |
| 106 | |
| 107 | // Bool to track if we should turn the motors on or not. |
| 108 | bool disable = output == nullptr; |
| 109 | |
| 110 | arm_.Correct(position->shoulder, position->wrist); |
| 111 | intake_.Correct(position->intake); |
| 112 | |
Adam Snaider | 0677972 | 2016-02-14 15:26:22 -0800 | [diff] [blame^] | 113 | // There are 2 main zeroing paths, HIGH_ARM_ZERO and LOW_ARM_ZERO. |
| 114 | // |
| 115 | // HIGH_ARM_ZERO works by lifting the arm all the way up so it is clear, |
| 116 | // moving the shooter to be horizontal, moving the intake out, and then moving |
| 117 | // the arm back down. |
| 118 | // |
| 119 | // LOW_ARM_ZERO works by moving the intake out of the way, lifting the arm up, |
| 120 | // leveling the shooter, and then moving back down. |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 121 | |
| 122 | switch (state_) { |
| 123 | case UNINITIALIZED: |
Adam Snaider | 0677972 | 2016-02-14 15:26:22 -0800 | [diff] [blame^] | 124 | // Wait in the uninitialized state until both the arm and intake are |
| 125 | // initialized. |
| 126 | LOG(DEBUG, "Uninitialized, waiting for intake and arm\n"); |
| 127 | if (arm_.initialized() && intake_.initialized()) { |
| 128 | state_ = DISABLED_INITIALIZED; |
| 129 | } |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 130 | disable = true; |
| 131 | break; |
| 132 | |
Adam Snaider | 0677972 | 2016-02-14 15:26:22 -0800 | [diff] [blame^] | 133 | case DISABLED_INITIALIZED: |
| 134 | // Wait here until we are either fully zeroed while disabled, or we become |
| 135 | // enabled. At that point, figure out if we should HIGH_ARM_ZERO or |
| 136 | // LOW_ARM_ZERO. |
| 137 | if (disable) { |
| 138 | if (arm_.zeroed() && intake_.zeroed()) { |
| 139 | state_ = SLOW_RUNNING; |
| 140 | } |
| 141 | } else { |
| 142 | if (arm_.shoulder_angle() >= kShoulderMiddleAngle) { |
| 143 | state_ = HIGH_ARM_ZERO_LIFT_ARM; |
| 144 | } else { |
| 145 | state_ = LOW_ARM_ZERO_LOWER_INTAKE; |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | // Set the goals to where we are now so when we start back up, we don't |
| 150 | // jump. |
| 151 | intake_.ForceGoal(intake_.angle()); |
| 152 | arm_.ForceGoal(arm_.shoulder_angle(), arm_.wrist_angle()); |
| 153 | // Set up the profile to be the zeroing profile. |
| 154 | intake_.AdjustProfile(0.5, 10); |
| 155 | arm_.AdjustProfile(0.5, 10, 0.5, 10); |
| 156 | |
| 157 | // We are not ready to start doing anything yet. |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 158 | disable = true; |
Adam Snaider | 0677972 | 2016-02-14 15:26:22 -0800 | [diff] [blame^] | 159 | break; |
| 160 | |
| 161 | case HIGH_ARM_ZERO_LIFT_ARM: |
| 162 | if (disable) { |
| 163 | state_ = DISABLED_INITIALIZED; |
| 164 | } else { |
| 165 | // Raise the shoulder up out of the way. |
| 166 | arm_.set_unprofiled_goal(kShoulderUpAngle, arm_.wrist_angle()); |
| 167 | if (IsArmNear(kLooseTolerance)) { |
| 168 | // Close enough, start the next move. |
| 169 | state_ = HIGH_ARM_ZERO_LEVEL_SHOOTER; |
| 170 | } |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 171 | } |
| 172 | break; |
| 173 | |
Adam Snaider | 0677972 | 2016-02-14 15:26:22 -0800 | [diff] [blame^] | 174 | case HIGH_ARM_ZERO_LEVEL_SHOOTER: |
| 175 | if (disable) { |
| 176 | state_ = DISABLED_INITIALIZED; |
| 177 | } else { |
| 178 | // Move the shooter to be level. |
| 179 | arm_.set_unprofiled_goal(kShoulderUpAngle, 0.0); |
| 180 | |
| 181 | if (IsArmNear(kLooseTolerance)) { |
| 182 | // Close enough, start the next move. |
| 183 | state_ = HIGH_ARM_ZERO_MOVE_INTAKE_OUT; |
| 184 | } |
| 185 | } |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 186 | break; |
| 187 | |
Adam Snaider | 0677972 | 2016-02-14 15:26:22 -0800 | [diff] [blame^] | 188 | case HIGH_ARM_ZERO_MOVE_INTAKE_OUT: |
| 189 | if (disable) { |
| 190 | state_ = DISABLED_INITIALIZED; |
| 191 | } else { |
| 192 | // If we were just asked to move the intake, make sure it moves far |
| 193 | // enough. |
| 194 | if (last_state_ != HIGH_ARM_ZERO_MOVE_INTAKE_OUT) { |
| 195 | intake_.set_unprofiled_goal( |
| 196 | MoveButKeepBelow(kIntakeUpperClear, intake_.angle(), |
| 197 | kIntakeEncoderIndexDifference * 2.5)); |
| 198 | } |
| 199 | |
| 200 | if (IsIntakeNear(kLooseTolerance)) { |
| 201 | // Close enough, start the next move. |
| 202 | state_ = HIGH_ARM_ZERO_LOWER_ARM; |
| 203 | } |
| 204 | } |
| 205 | break; |
| 206 | |
| 207 | case HIGH_ARM_ZERO_LOWER_ARM: |
| 208 | if (disable) { |
| 209 | state_ = DISABLED_INITIALIZED; |
| 210 | } else { |
| 211 | // Land the shooter in the belly-pan. It should be zeroed by the time |
| 212 | // it gets there. If not, just estop. |
| 213 | arm_.set_unprofiled_goal(kShoulderLanded, 0.0); |
| 214 | if (arm_.zeroed() && intake_.zeroed()) { |
| 215 | state_ = RUNNING; |
| 216 | } else if (IsArmNear(kLooseTolerance)) { |
| 217 | LOG(ERROR, |
| 218 | "Failed to zero while executing the HIGH_ARM_ZERO sequence. " |
| 219 | "Arm: %d Intake %d\n", |
| 220 | arm_.zeroed(), intake_.zeroed()); |
| 221 | state_ = ESTOP; |
| 222 | } |
| 223 | } |
| 224 | break; |
| 225 | |
| 226 | case LOW_ARM_ZERO_LOWER_INTAKE: |
| 227 | if (disable) { |
| 228 | state_ = DISABLED_INITIALIZED; |
| 229 | } else { |
| 230 | // Move the intake down out of the way of the arm. Make sure to move it |
| 231 | // far enough to zero. |
| 232 | if (last_state_ != LOW_ARM_ZERO_LOWER_INTAKE) { |
| 233 | intake_.set_unprofiled_goal( |
| 234 | MoveButKeepBelow(kIntakeLowerClear, intake_.angle(), |
| 235 | kIntakeEncoderIndexDifference * 2.5)); |
| 236 | } |
| 237 | if (IsIntakeNear(kLooseTolerance)) { |
| 238 | if (::std::abs(arm_.wrist_angle()) < kWristAlmostLevel) { |
| 239 | state_ = LOW_ARM_ZERO_MAYBE_LEVEL_SHOOTER; |
| 240 | } else { |
| 241 | state_ = LOW_ARM_ZERO_LIFT_SHOULDER; |
| 242 | } |
| 243 | } |
| 244 | } |
| 245 | break; |
| 246 | |
| 247 | case LOW_ARM_ZERO_MAYBE_LEVEL_SHOOTER: |
| 248 | if (disable) { |
| 249 | state_ = DISABLED_INITIALIZED; |
| 250 | } else { |
| 251 | // If we are supposed to level the shooter, set it to level, and wait |
| 252 | // until it is very close to level. |
| 253 | arm_.set_unprofiled_goal(arm_.unprofiled_goal(0, 0), 0.0); |
| 254 | if (IsArmNear(kLooseTolerance, kTightTolerance)) { |
| 255 | state_ = LOW_ARM_ZERO_LIFT_SHOULDER; |
| 256 | } |
| 257 | } |
| 258 | break; |
| 259 | |
| 260 | case LOW_ARM_ZERO_LIFT_SHOULDER: |
| 261 | if (disable) { |
| 262 | state_ = DISABLED_INITIALIZED; |
| 263 | } else { |
| 264 | // Decide where to move to. We need to move far enough to see an index |
| 265 | // pulse, but must also get high enough that we can safely level the |
| 266 | // shooter. |
| 267 | if (last_state_ != LOW_ARM_ZERO_LIFT_SHOULDER) { |
| 268 | arm_.set_unprofiled_goal( |
| 269 | MoveButKeepAbove(kShoulderWristClearAngle, arm_.shoulder_angle(), |
| 270 | ::std::max(kWristEncoderIndexDifference, |
| 271 | kShoulderEncoderIndexDifference) * |
| 272 | 2.5), |
| 273 | arm_.unprofiled_goal(2, 0)); |
| 274 | } |
| 275 | |
| 276 | // Wait until we are level and then go for it. |
| 277 | if (IsArmNear(kLooseTolerance)) { |
| 278 | state_ = LOW_ARM_ZERO_LEVEL_SHOOTER; |
| 279 | } |
| 280 | } |
| 281 | break; |
| 282 | |
| 283 | case LOW_ARM_ZERO_LEVEL_SHOOTER: |
| 284 | if (disable) { |
| 285 | state_ = DISABLED_INITIALIZED; |
| 286 | } else { |
| 287 | // Move the shooter level (and keep the same height). We don't want to |
| 288 | // got to RUNNING until we are completely level so that we don't |
| 289 | // give control back in a weird case where we might crash. |
| 290 | arm_.set_unprofiled_goal(arm_.unprofiled_goal(0, 0), 0.0); |
| 291 | if (IsArmNear(kLooseTolerance)) { |
| 292 | if (arm_.zeroed() && intake_.zeroed()) { |
| 293 | state_ = RUNNING; |
| 294 | } else { |
| 295 | LOG(ERROR, |
| 296 | "Failed to zero while executing the LOW_ARM_ZERO sequence. " |
| 297 | "Arm: %d Intake %d\n", |
| 298 | arm_.zeroed(), intake_.zeroed()); |
| 299 | state_ = ESTOP; |
| 300 | } |
| 301 | } |
| 302 | } |
| 303 | break; |
| 304 | |
| 305 | case SLOW_RUNNING: |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 306 | case RUNNING: |
Adam Snaider | 0677972 | 2016-02-14 15:26:22 -0800 | [diff] [blame^] | 307 | // TODO(austin): Exit SLOW_RUNNING if we are not collided. |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 308 | if (unsafe_goal) { |
| 309 | arm_.AdjustProfile(unsafe_goal->max_angular_velocity_shoulder, |
Adam Snaider | 0677972 | 2016-02-14 15:26:22 -0800 | [diff] [blame^] | 310 | unsafe_goal->max_angular_acceleration_shoulder, |
| 311 | unsafe_goal->max_angular_velocity_wrist, |
| 312 | unsafe_goal->max_angular_acceleration_wrist); |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 313 | intake_.AdjustProfile(unsafe_goal->max_angular_velocity_wrist, |
Adam Snaider | 0677972 | 2016-02-14 15:26:22 -0800 | [diff] [blame^] | 314 | unsafe_goal->max_angular_acceleration_intake); |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 315 | |
| 316 | arm_.set_unprofiled_goal(unsafe_goal->angle_shoulder, |
Adam Snaider | 0677972 | 2016-02-14 15:26:22 -0800 | [diff] [blame^] | 317 | unsafe_goal->angle_wrist); |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 318 | intake_.set_unprofiled_goal(unsafe_goal->angle_intake); |
| 319 | } |
| 320 | |
Adam Snaider | 0677972 | 2016-02-14 15:26:22 -0800 | [diff] [blame^] | 321 | // ESTOP if we hit any of the limits. It is safe(ish) to hit the limits |
| 322 | // while zeroing since we use such low power. |
| 323 | if (state_ == RUNNING || state_ == SLOW_RUNNING) { |
| 324 | // ESTOP if we hit the hard limits. |
| 325 | if ((arm_.CheckHardLimits() || intake_.CheckHardLimits()) && output) { |
| 326 | state_ = ESTOP; |
| 327 | } |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 328 | } |
| 329 | break; |
| 330 | |
| 331 | case ESTOP: |
| 332 | LOG(ERROR, "Estop\n"); |
| 333 | disable = true; |
| 334 | break; |
| 335 | } |
| 336 | |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 337 | // Set the voltage limits. |
| 338 | const double max_voltage = state_ == RUNNING ? 12.0 : kZeroingVoltage; |
| 339 | arm_.set_max_voltage(max_voltage, max_voltage); |
| 340 | intake_.set_max_voltage(max_voltage); |
| 341 | |
| 342 | // Calculate the loops for a cycle. |
| 343 | arm_.Update(disable); |
| 344 | intake_.Update(disable); |
| 345 | |
| 346 | // Write out all the voltages. |
| 347 | if (output) { |
| 348 | output->voltage_intake = intake_.intake_voltage(); |
| 349 | output->voltage_shoulder = arm_.shoulder_voltage(); |
| 350 | output->voltage_wrist = arm_.wrist_voltage(); |
| 351 | } |
| 352 | |
| 353 | // Save debug/internal state. |
| 354 | // TODO(austin): Save the voltage errors. |
| 355 | status->zeroed = state_ == RUNNING; |
| 356 | |
| 357 | status->shoulder.angle = arm_.X_hat(0, 0); |
| 358 | status->shoulder.angular_velocity = arm_.X_hat(1, 0); |
| 359 | status->shoulder.goal_angle = arm_.goal(0, 0); |
| 360 | status->shoulder.goal_angular_velocity = arm_.goal(1, 0); |
Austin Schuh | 39fd610 | 2016-02-13 22:59:48 -0800 | [diff] [blame] | 361 | status->shoulder.unprofiled_goal_angle = arm_.unprofiled_goal(0, 0); |
| 362 | status->shoulder.unprofiled_goal_angular_velocity = |
| 363 | arm_.unprofiled_goal(1, 0); |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 364 | status->shoulder.estimator_state = arm_.ShoulderEstimatorState(); |
| 365 | |
| 366 | status->wrist.angle = arm_.X_hat(2, 0); |
| 367 | status->wrist.angular_velocity = arm_.X_hat(3, 0); |
| 368 | status->wrist.goal_angle = arm_.goal(2, 0); |
| 369 | status->wrist.goal_angular_velocity = arm_.goal(3, 0); |
Austin Schuh | 39fd610 | 2016-02-13 22:59:48 -0800 | [diff] [blame] | 370 | status->wrist.unprofiled_goal_angle = arm_.unprofiled_goal(2, 0); |
| 371 | status->wrist.unprofiled_goal_angular_velocity = arm_.unprofiled_goal(3, 0); |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 372 | status->wrist.estimator_state = arm_.WristEstimatorState(); |
| 373 | |
| 374 | status->intake.angle = intake_.X_hat(0, 0); |
| 375 | status->intake.angular_velocity = intake_.X_hat(1, 0); |
| 376 | status->intake.goal_angle = intake_.goal(0, 0); |
| 377 | status->intake.goal_angular_velocity = intake_.goal(1, 0); |
Austin Schuh | 39fd610 | 2016-02-13 22:59:48 -0800 | [diff] [blame] | 378 | status->intake.unprofiled_goal_angle = intake_.unprofiled_goal(0, 0); |
| 379 | status->intake.unprofiled_goal_angular_velocity = |
| 380 | intake_.unprofiled_goal(1, 0); |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 381 | status->intake.estimator_state = intake_.IntakeEstimatorState(); |
| 382 | |
| 383 | status->estopped = (state_ == ESTOP); |
| 384 | |
| 385 | status->state = state_; |
| 386 | |
Adam Snaider | 0677972 | 2016-02-14 15:26:22 -0800 | [diff] [blame^] | 387 | last_state_ = state_before_switch; |
Austin Schuh | 2fc10fa | 2016-02-08 00:44:34 -0800 | [diff] [blame] | 388 | } |
| 389 | |
| 390 | } // namespace superstructure |
Comran Morshed | 25f81a0 | 2016-01-23 13:40:10 +0000 | [diff] [blame] | 391 | } // namespace control_loops |
| 392 | } // namespace y2016 |