Comran Morshed | e68e373 | 2016-03-12 14:12:11 +0000 | [diff] [blame] | 1 | #include "y2016/actors/autonomous_actor.h" |
| 2 | |
| 3 | #include <inttypes.h> |
| 4 | |
Austin Schuh | 8aec1ed | 2016-05-01 13:29:20 -0700 | [diff] [blame] | 5 | #include <chrono> |
Comran Morshed | b134e77 | 2016-03-16 21:05:05 +0000 | [diff] [blame] | 6 | #include <cmath> |
| 7 | |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 8 | #include "aos/logging/logging.h" |
James Kuszmaul | 651fc3f | 2019-05-15 21:14:25 -0700 | [diff] [blame] | 9 | #include "aos/util/phased_loop.h" |
Comran Morshed | 435f111 | 2016-03-12 14:20:45 +0000 | [diff] [blame] | 10 | |
| 11 | #include "frc971/control_loops/drivetrain/drivetrain.q.h" |
| 12 | #include "y2016/control_loops/drivetrain/drivetrain_base.h" |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 13 | #include "y2016/control_loops/shooter/shooter.q.h" |
Comran Morshed | b134e77 | 2016-03-16 21:05:05 +0000 | [diff] [blame] | 14 | #include "y2016/control_loops/superstructure/superstructure.q.h" |
Austin Schuh | 23b2180 | 2016-04-03 21:18:56 -0700 | [diff] [blame] | 15 | #include "y2016/queues/ball_detector.q.h" |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 16 | #include "y2016/vision/vision.q.h" |
Comran Morshed | e68e373 | 2016-03-12 14:12:11 +0000 | [diff] [blame] | 17 | |
| 18 | namespace y2016 { |
| 19 | namespace actors { |
Austin Schuh | f2a50ba | 2016-12-24 16:16:26 -0800 | [diff] [blame] | 20 | using ::aos::monotonic_clock; |
James Kuszmaul | 651fc3f | 2019-05-15 21:14:25 -0700 | [diff] [blame] | 21 | using ::frc971::control_loops::drivetrain_queue; |
Austin Schuh | f2a50ba | 2016-12-24 16:16:26 -0800 | [diff] [blame] | 22 | namespace chrono = ::std::chrono; |
| 23 | namespace this_thread = ::std::this_thread; |
Comran Morshed | 435f111 | 2016-03-12 14:20:45 +0000 | [diff] [blame] | 24 | |
| 25 | namespace { |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 26 | const ProfileParameters kSlowDrive = {0.8, 2.5}; |
| 27 | const ProfileParameters kLowBarDrive = {1.3, 2.5}; |
| 28 | const ProfileParameters kMoatDrive = {1.2, 3.5}; |
| 29 | const ProfileParameters kRealignDrive = {2.0, 2.5}; |
| 30 | const ProfileParameters kRockWallDrive = {0.8, 2.5}; |
Comran Morshed | 435f111 | 2016-03-12 14:20:45 +0000 | [diff] [blame] | 31 | const ProfileParameters kFastDrive = {3.0, 2.5}; |
| 32 | |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 33 | const ProfileParameters kSlowTurn = {0.8, 3.0}; |
Comran Morshed | 435f111 | 2016-03-12 14:20:45 +0000 | [diff] [blame] | 34 | const ProfileParameters kFastTurn = {3.0, 10.0}; |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 35 | const ProfileParameters kStealTurn = {4.0, 15.0}; |
Austin Schuh | 23b2180 | 2016-04-03 21:18:56 -0700 | [diff] [blame] | 36 | const ProfileParameters kSwerveTurn = {2.0, 7.0}; |
| 37 | const ProfileParameters kFinishTurn = {2.0, 5.0}; |
| 38 | |
| 39 | const ProfileParameters kTwoBallLowDrive = {1.7, 3.5}; |
| 40 | const ProfileParameters kTwoBallFastDrive = {3.0, 1.5}; |
| 41 | const ProfileParameters kTwoBallReturnDrive = {3.0, 1.9}; |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 42 | const ProfileParameters kTwoBallReturnSlow = {3.0, 2.5}; |
Austin Schuh | 23b2180 | 2016-04-03 21:18:56 -0700 | [diff] [blame] | 43 | const ProfileParameters kTwoBallBallPickup = {2.0, 1.75}; |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 44 | const ProfileParameters kTwoBallBallPickupAccel = {2.0, 2.5}; |
Austin Schuh | f2a50ba | 2016-12-24 16:16:26 -0800 | [diff] [blame] | 45 | |
Comran Morshed | 435f111 | 2016-03-12 14:20:45 +0000 | [diff] [blame] | 46 | } // namespace |
Comran Morshed | e68e373 | 2016-03-12 14:12:11 +0000 | [diff] [blame] | 47 | |
Austin Schuh | 1bf8a21 | 2019-05-26 22:13:14 -0700 | [diff] [blame] | 48 | AutonomousActor::AutonomousActor(::aos::EventLoop *event_loop) |
Philipp Schrader | 4bd29b1 | 2017-02-22 04:42:27 +0000 | [diff] [blame] | 49 | : frc971::autonomous::BaseAutonomousActor( |
Austin Schuh | 1bf8a21 | 2019-05-26 22:13:14 -0700 | [diff] [blame] | 50 | event_loop, control_loops::drivetrain::GetDrivetrainConfig()), |
| 51 | vision_align_actor_factory_( |
Austin Schuh | 28bde30 | 2019-05-26 22:24:33 -0700 | [diff] [blame] | 52 | actors::VisionAlignActor::MakeFactory(event_loop)), |
| 53 | vision_status_fetcher_( |
| 54 | event_loop->MakeFetcher<::y2016::vision::VisionStatus>( |
Austin Schuh | 4b652c9 | 2019-05-27 13:22:27 -0700 | [diff] [blame] | 55 | ".y2016.vision.vision_status")), |
| 56 | ball_detector_fetcher_( |
| 57 | event_loop->MakeFetcher<::y2016::sensors::BallDetector>( |
| 58 | ".y2016.sensors.ball_detector")) {} |
Comran Morshed | 435f111 | 2016-03-12 14:20:45 +0000 | [diff] [blame] | 59 | |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 60 | constexpr double kDoNotTurnCare = 2.0; |
| 61 | |
Comran Morshed | b134e77 | 2016-03-16 21:05:05 +0000 | [diff] [blame] | 62 | void AutonomousActor::MoveSuperstructure( |
| 63 | double intake, double shoulder, double wrist, |
| 64 | const ProfileParameters intake_params, |
| 65 | const ProfileParameters shoulder_params, |
Austin Schuh | 23b2180 | 2016-04-03 21:18:56 -0700 | [diff] [blame] | 66 | const ProfileParameters wrist_params, bool traverse_up, |
| 67 | double roller_power) { |
Comran Morshed | b134e77 | 2016-03-16 21:05:05 +0000 | [diff] [blame] | 68 | superstructure_goal_ = {intake, shoulder, wrist}; |
| 69 | |
| 70 | auto new_superstructure_goal = |
| 71 | ::y2016::control_loops::superstructure_queue.goal.MakeMessage(); |
| 72 | |
| 73 | new_superstructure_goal->angle_intake = intake; |
| 74 | new_superstructure_goal->angle_shoulder = shoulder; |
| 75 | new_superstructure_goal->angle_wrist = wrist; |
| 76 | |
| 77 | new_superstructure_goal->max_angular_velocity_intake = |
| 78 | intake_params.max_velocity; |
| 79 | new_superstructure_goal->max_angular_velocity_shoulder = |
| 80 | shoulder_params.max_velocity; |
| 81 | new_superstructure_goal->max_angular_velocity_wrist = |
| 82 | wrist_params.max_velocity; |
| 83 | |
| 84 | new_superstructure_goal->max_angular_acceleration_intake = |
| 85 | intake_params.max_acceleration; |
| 86 | new_superstructure_goal->max_angular_acceleration_shoulder = |
| 87 | shoulder_params.max_acceleration; |
| 88 | new_superstructure_goal->max_angular_acceleration_wrist = |
| 89 | wrist_params.max_acceleration; |
| 90 | |
Austin Schuh | 23b2180 | 2016-04-03 21:18:56 -0700 | [diff] [blame] | 91 | new_superstructure_goal->voltage_top_rollers = roller_power; |
| 92 | new_superstructure_goal->voltage_bottom_rollers = roller_power; |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 93 | |
| 94 | new_superstructure_goal->traverse_unlatched = true; |
| 95 | new_superstructure_goal->traverse_down = !traverse_up; |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 96 | new_superstructure_goal->voltage_climber = 0.0; |
| 97 | new_superstructure_goal->unfold_climber = false; |
Comran Morshed | b134e77 | 2016-03-16 21:05:05 +0000 | [diff] [blame] | 98 | |
| 99 | if (!new_superstructure_goal.Send()) { |
| 100 | LOG(ERROR, "Sending superstructure goal failed.\n"); |
| 101 | } |
| 102 | } |
| 103 | |
Austin Schuh | 23b2180 | 2016-04-03 21:18:56 -0700 | [diff] [blame] | 104 | void AutonomousActor::OpenShooter() { |
| 105 | shooter_speed_ = 0.0; |
| 106 | |
| 107 | if (!control_loops::shooter::shooter_queue.goal.MakeWithBuilder() |
| 108 | .angular_velocity(shooter_speed_) |
| 109 | .clamp_open(true) |
| 110 | .push_to_shooter(false) |
| 111 | .force_lights_on(false) |
| 112 | .Send()) { |
| 113 | LOG(ERROR, "Sending shooter goal failed.\n"); |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | void AutonomousActor::CloseShooter() { |
| 118 | shooter_speed_ = 0.0; |
| 119 | |
| 120 | if (!control_loops::shooter::shooter_queue.goal.MakeWithBuilder() |
| 121 | .angular_velocity(shooter_speed_) |
| 122 | .clamp_open(false) |
| 123 | .push_to_shooter(false) |
| 124 | .force_lights_on(false) |
| 125 | .Send()) { |
| 126 | LOG(ERROR, "Sending shooter goal failed.\n"); |
| 127 | } |
| 128 | } |
| 129 | |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 130 | void AutonomousActor::SetShooterSpeed(double speed) { |
| 131 | shooter_speed_ = speed; |
| 132 | |
| 133 | // In auto, we want to have the lights on whenever possible since we have no |
| 134 | // hope of a human aligning the robot. |
| 135 | bool force_lights_on = shooter_speed_ > 1.0; |
| 136 | |
| 137 | if (!control_loops::shooter::shooter_queue.goal.MakeWithBuilder() |
| 138 | .angular_velocity(shooter_speed_) |
| 139 | .clamp_open(false) |
| 140 | .push_to_shooter(false) |
| 141 | .force_lights_on(force_lights_on) |
| 142 | .Send()) { |
| 143 | LOG(ERROR, "Sending shooter goal failed.\n"); |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | void AutonomousActor::Shoot() { |
| 148 | uint32_t initial_shots = 0; |
| 149 | |
| 150 | control_loops::shooter::shooter_queue.status.FetchLatest(); |
| 151 | if (control_loops::shooter::shooter_queue.status.get()) { |
| 152 | initial_shots = control_loops::shooter::shooter_queue.status->shots; |
| 153 | } |
| 154 | |
| 155 | // In auto, we want to have the lights on whenever possible since we have no |
| 156 | // hope of a human aligning the robot. |
| 157 | bool force_lights_on = shooter_speed_ > 1.0; |
| 158 | |
| 159 | if (!control_loops::shooter::shooter_queue.goal.MakeWithBuilder() |
| 160 | .angular_velocity(shooter_speed_) |
| 161 | .clamp_open(false) |
| 162 | .push_to_shooter(true) |
| 163 | .force_lights_on(force_lights_on) |
| 164 | .Send()) { |
| 165 | LOG(ERROR, "Sending shooter goal failed.\n"); |
| 166 | } |
| 167 | |
Austin Schuh | 8aec1ed | 2016-05-01 13:29:20 -0700 | [diff] [blame] | 168 | ::aos::time::PhasedLoop phased_loop(::std::chrono::milliseconds(5), |
Austin Schuh | d32b362 | 2019-06-23 18:49:06 -0700 | [diff] [blame] | 169 | event_loop()->monotonic_now(), |
Austin Schuh | 8aec1ed | 2016-05-01 13:29:20 -0700 | [diff] [blame] | 170 | ::std::chrono::milliseconds(5) / 2); |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 171 | while (true) { |
| 172 | if (ShouldCancel()) return; |
| 173 | |
| 174 | // Wait for the shot count to change so we know when the shot is complete. |
| 175 | control_loops::shooter::shooter_queue.status.FetchLatest(); |
| 176 | if (control_loops::shooter::shooter_queue.status.get()) { |
| 177 | if (initial_shots < control_loops::shooter::shooter_queue.status->shots) { |
| 178 | return; |
| 179 | } |
| 180 | } |
| 181 | phased_loop.SleepUntilNext(); |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | void AutonomousActor::WaitForShooterSpeed() { |
Austin Schuh | 8aec1ed | 2016-05-01 13:29:20 -0700 | [diff] [blame] | 186 | ::aos::time::PhasedLoop phased_loop(::std::chrono::milliseconds(5), |
Austin Schuh | d32b362 | 2019-06-23 18:49:06 -0700 | [diff] [blame] | 187 | event_loop()->monotonic_now(), |
Austin Schuh | 8aec1ed | 2016-05-01 13:29:20 -0700 | [diff] [blame] | 188 | ::std::chrono::milliseconds(5) / 2); |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 189 | while (true) { |
| 190 | if (ShouldCancel()) return; |
| 191 | |
| 192 | control_loops::shooter::shooter_queue.status.FetchLatest(); |
| 193 | if (control_loops::shooter::shooter_queue.status.get()) { |
| 194 | if (control_loops::shooter::shooter_queue.status->left.ready && |
| 195 | control_loops::shooter::shooter_queue.status->right.ready) { |
| 196 | return; |
| 197 | } |
| 198 | } |
| 199 | phased_loop.SleepUntilNext(); |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | void AutonomousActor::AlignWithVisionGoal() { |
| 204 | actors::VisionAlignActionParams params; |
Austin Schuh | 1bf8a21 | 2019-05-26 22:13:14 -0700 | [diff] [blame] | 205 | vision_action_ = vision_align_actor_factory_.Make(params); |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 206 | vision_action_->Start(); |
| 207 | } |
| 208 | |
Austin Schuh | 23b2180 | 2016-04-03 21:18:56 -0700 | [diff] [blame] | 209 | void AutonomousActor::WaitForAlignedWithVision( |
Austin Schuh | f2a50ba | 2016-12-24 16:16:26 -0800 | [diff] [blame] | 210 | chrono::nanoseconds align_duration) { |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 211 | bool vision_valid = false; |
| 212 | double last_angle = 0.0; |
| 213 | int ready_to_fire = 0; |
| 214 | |
Austin Schuh | 8aec1ed | 2016-05-01 13:29:20 -0700 | [diff] [blame] | 215 | ::aos::time::PhasedLoop phased_loop(::std::chrono::milliseconds(5), |
Austin Schuh | d32b362 | 2019-06-23 18:49:06 -0700 | [diff] [blame] | 216 | event_loop()->monotonic_now(), |
Austin Schuh | 8aec1ed | 2016-05-01 13:29:20 -0700 | [diff] [blame] | 217 | ::std::chrono::milliseconds(5) / 2); |
Austin Schuh | f2a50ba | 2016-12-24 16:16:26 -0800 | [diff] [blame] | 218 | monotonic_clock::time_point end_time = |
| 219 | monotonic_clock::now() + align_duration; |
| 220 | while (end_time > monotonic_clock::now()) { |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 221 | if (ShouldCancel()) break; |
| 222 | |
Austin Schuh | 28bde30 | 2019-05-26 22:24:33 -0700 | [diff] [blame] | 223 | vision_status_fetcher_.Fetch(); |
| 224 | if (vision_status_fetcher_.get()) { |
| 225 | vision_valid = (vision_status_fetcher_->left_image_valid && |
| 226 | vision_status_fetcher_->right_image_valid); |
| 227 | last_angle = vision_status_fetcher_->horizontal_angle; |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | drivetrain_queue.status.FetchLatest(); |
| 231 | drivetrain_queue.goal.FetchLatest(); |
| 232 | |
| 233 | if (drivetrain_queue.status.get() && drivetrain_queue.goal.get()) { |
| 234 | const double left_goal = drivetrain_queue.goal->left_goal; |
| 235 | const double right_goal = drivetrain_queue.goal->right_goal; |
| 236 | const double left_current = |
| 237 | drivetrain_queue.status->estimated_left_position; |
| 238 | const double right_current = |
| 239 | drivetrain_queue.status->estimated_right_position; |
| 240 | const double left_velocity = |
| 241 | drivetrain_queue.status->estimated_left_velocity; |
| 242 | const double right_velocity = |
| 243 | drivetrain_queue.status->estimated_right_velocity; |
| 244 | |
| 245 | if (vision_valid && ::std::abs(last_angle) < 0.02 && |
| 246 | ::std::abs((left_goal - right_goal) - |
| 247 | (left_current - right_current)) / |
| 248 | dt_config_.robot_radius / 2.0 < |
| 249 | 0.02 && |
| 250 | ::std::abs(left_velocity - right_velocity) < 0.01) { |
| 251 | ++ready_to_fire; |
| 252 | } else { |
| 253 | ready_to_fire = 0; |
| 254 | } |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 255 | if (ready_to_fire > 15) { |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 256 | break; |
Austin Schuh | 23b2180 | 2016-04-03 21:18:56 -0700 | [diff] [blame] | 257 | LOG(INFO, "Vision align success!\n"); |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 258 | } |
| 259 | } |
| 260 | phased_loop.SleepUntilNext(); |
| 261 | } |
| 262 | |
| 263 | vision_action_->Cancel(); |
| 264 | WaitUntilDoneOrCanceled(::std::move(vision_action_)); |
Austin Schuh | 23b2180 | 2016-04-03 21:18:56 -0700 | [diff] [blame] | 265 | LOG(INFO, "Done waiting for vision\n"); |
| 266 | } |
| 267 | |
| 268 | bool AutonomousActor::IntakeDone() { |
| 269 | control_loops::superstructure_queue.status.FetchAnother(); |
| 270 | |
| 271 | constexpr double kProfileError = 1e-5; |
| 272 | constexpr double kEpsilon = 0.15; |
| 273 | |
| 274 | if (control_loops::superstructure_queue.status->state < 12 || |
| 275 | control_loops::superstructure_queue.status->state == 16) { |
| 276 | LOG(ERROR, "Superstructure no longer running, aborting action\n"); |
| 277 | return true; |
| 278 | } |
| 279 | |
| 280 | if (::std::abs(control_loops::superstructure_queue.status->intake.goal_angle - |
| 281 | superstructure_goal_.intake) < kProfileError && |
| 282 | ::std::abs(control_loops::superstructure_queue.status->intake |
| 283 | .goal_angular_velocity) < kProfileError) { |
| 284 | LOG(DEBUG, "Profile done.\n"); |
| 285 | if (::std::abs(control_loops::superstructure_queue.status->intake.angle - |
| 286 | superstructure_goal_.intake) < kEpsilon && |
| 287 | ::std::abs(control_loops::superstructure_queue.status->intake |
| 288 | .angular_velocity) < kEpsilon) { |
| 289 | LOG(INFO, "Near goal, done.\n"); |
| 290 | return true; |
| 291 | } |
| 292 | } |
| 293 | return false; |
| 294 | } |
| 295 | |
| 296 | bool AutonomousActor::SuperstructureProfileDone() { |
| 297 | constexpr double kProfileError = 1e-5; |
| 298 | return ::std::abs( |
| 299 | control_loops::superstructure_queue.status->intake.goal_angle - |
| 300 | superstructure_goal_.intake) < kProfileError && |
| 301 | ::std::abs( |
| 302 | control_loops::superstructure_queue.status->shoulder.goal_angle - |
| 303 | superstructure_goal_.shoulder) < kProfileError && |
| 304 | ::std::abs( |
| 305 | control_loops::superstructure_queue.status->wrist.goal_angle - |
| 306 | superstructure_goal_.wrist) < kProfileError && |
| 307 | ::std::abs(control_loops::superstructure_queue.status->intake |
| 308 | .goal_angular_velocity) < kProfileError && |
| 309 | ::std::abs(control_loops::superstructure_queue.status->shoulder |
| 310 | .goal_angular_velocity) < kProfileError && |
| 311 | ::std::abs(control_loops::superstructure_queue.status->wrist |
| 312 | .goal_angular_velocity) < kProfileError; |
| 313 | } |
| 314 | |
| 315 | bool AutonomousActor::SuperstructureDone() { |
| 316 | control_loops::superstructure_queue.status.FetchAnother(); |
| 317 | |
| 318 | constexpr double kEpsilon = 0.03; |
| 319 | |
| 320 | if (control_loops::superstructure_queue.status->state < 12 || |
| 321 | control_loops::superstructure_queue.status->state == 16) { |
| 322 | LOG(ERROR, "Superstructure no longer running, aborting action\n"); |
| 323 | return true; |
| 324 | } |
| 325 | |
| 326 | if (SuperstructureProfileDone()) { |
| 327 | LOG(DEBUG, "Profile done.\n"); |
| 328 | if (::std::abs(control_loops::superstructure_queue.status->intake.angle - |
| 329 | superstructure_goal_.intake) < (kEpsilon + 0.1) && |
| 330 | ::std::abs(control_loops::superstructure_queue.status->shoulder.angle - |
| 331 | superstructure_goal_.shoulder) < (kEpsilon + 0.05) && |
| 332 | ::std::abs(control_loops::superstructure_queue.status->wrist.angle - |
| 333 | superstructure_goal_.wrist) < (kEpsilon + 0.01) && |
| 334 | ::std::abs(control_loops::superstructure_queue.status->intake |
| 335 | .angular_velocity) < (kEpsilon + 0.1) && |
| 336 | ::std::abs(control_loops::superstructure_queue.status->shoulder |
| 337 | .angular_velocity) < (kEpsilon + 0.10) && |
| 338 | ::std::abs(control_loops::superstructure_queue.status->wrist |
| 339 | .angular_velocity) < (kEpsilon + 0.05)) { |
| 340 | LOG(INFO, "Near goal, done.\n"); |
| 341 | return true; |
| 342 | } |
| 343 | } |
| 344 | return false; |
| 345 | } |
| 346 | |
| 347 | void AutonomousActor::WaitForIntake() { |
| 348 | while (true) { |
| 349 | if (ShouldCancel()) return; |
| 350 | if (IntakeDone()) return; |
| 351 | } |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 352 | } |
| 353 | |
Comran Morshed | b134e77 | 2016-03-16 21:05:05 +0000 | [diff] [blame] | 354 | void AutonomousActor::WaitForSuperstructure() { |
| 355 | while (true) { |
| 356 | if (ShouldCancel()) return; |
Austin Schuh | 23b2180 | 2016-04-03 21:18:56 -0700 | [diff] [blame] | 357 | if (SuperstructureDone()) return; |
| 358 | } |
| 359 | } |
Comran Morshed | b134e77 | 2016-03-16 21:05:05 +0000 | [diff] [blame] | 360 | |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 361 | void AutonomousActor::WaitForSuperstructureProfile() { |
| 362 | while (true) { |
| 363 | if (ShouldCancel()) return; |
| 364 | control_loops::superstructure_queue.status.FetchAnother(); |
| 365 | |
| 366 | if (control_loops::superstructure_queue.status->state < 12 || |
| 367 | control_loops::superstructure_queue.status->state == 16) { |
| 368 | LOG(ERROR, "Superstructure no longer running, aborting action\n"); |
| 369 | return; |
| 370 | } |
| 371 | |
| 372 | if (SuperstructureProfileDone()) return; |
| 373 | } |
| 374 | } |
| 375 | |
Austin Schuh | 23b2180 | 2016-04-03 21:18:56 -0700 | [diff] [blame] | 376 | void AutonomousActor::WaitForSuperstructureLow() { |
| 377 | while (true) { |
| 378 | if (ShouldCancel()) return; |
| 379 | control_loops::superstructure_queue.status.FetchAnother(); |
Comran Morshed | b134e77 | 2016-03-16 21:05:05 +0000 | [diff] [blame] | 380 | |
| 381 | if (control_loops::superstructure_queue.status->state < 12 || |
| 382 | control_loops::superstructure_queue.status->state == 16) { |
| 383 | LOG(ERROR, "Superstructure no longer running, aborting action\n"); |
| 384 | return; |
| 385 | } |
Austin Schuh | 23b2180 | 2016-04-03 21:18:56 -0700 | [diff] [blame] | 386 | if (SuperstructureProfileDone()) return; |
| 387 | if (control_loops::superstructure_queue.status->shoulder.angle < 0.1) { |
| 388 | return; |
Comran Morshed | b134e77 | 2016-03-16 21:05:05 +0000 | [diff] [blame] | 389 | } |
| 390 | } |
| 391 | } |
Austin Schuh | 23b2180 | 2016-04-03 21:18:56 -0700 | [diff] [blame] | 392 | void AutonomousActor::BackLongShotLowBarTwoBall() { |
| 393 | LOG(INFO, "Expanding for back long shot\n"); |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 394 | MoveSuperstructure(0.00, M_PI / 2.0 - 0.2, -0.55, {7.0, 40.0}, {4.0, 6.0}, |
Austin Schuh | 23b2180 | 2016-04-03 21:18:56 -0700 | [diff] [blame] | 395 | {10.0, 25.0}, false, 0.0); |
| 396 | } |
| 397 | |
| 398 | void AutonomousActor::BackLongShotTwoBall() { |
| 399 | LOG(INFO, "Expanding for back long shot\n"); |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 400 | MoveSuperstructure(0.00, M_PI / 2.0 - 0.2, -0.55, {7.0, 40.0}, {4.0, 6.0}, |
| 401 | {10.0, 25.0}, false, 0.0); |
| 402 | } |
| 403 | |
| 404 | void AutonomousActor::BackLongShotTwoBallFinish() { |
| 405 | LOG(INFO, "Expanding for back long shot\n"); |
Philipp Schrader | 4bd29b1 | 2017-02-22 04:42:27 +0000 | [diff] [blame] | 406 | MoveSuperstructure(0.00, M_PI / 2.0 - 0.2, -0.625 + 0.03, {7.0, 40.0}, |
| 407 | {4.0, 6.0}, {10.0, 25.0}, false, 0.0); |
Austin Schuh | 23b2180 | 2016-04-03 21:18:56 -0700 | [diff] [blame] | 408 | } |
| 409 | |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 410 | void AutonomousActor::BackLongShot() { |
| 411 | LOG(INFO, "Expanding for back long shot\n"); |
Austin Schuh | 23b2180 | 2016-04-03 21:18:56 -0700 | [diff] [blame] | 412 | MoveSuperstructure(0.80, M_PI / 2.0 - 0.2, -0.62, {7.0, 40.0}, {4.0, 6.0}, |
| 413 | {10.0, 25.0}, false, 0.0); |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 414 | } |
| 415 | |
| 416 | void AutonomousActor::BackMiddleShot() { |
| 417 | LOG(INFO, "Expanding for back middle shot\n"); |
| 418 | MoveSuperstructure(-0.05, M_PI / 2.0 - 0.2, -0.665, {7.0, 40.0}, {4.0, 10.0}, |
Austin Schuh | 23b2180 | 2016-04-03 21:18:56 -0700 | [diff] [blame] | 419 | {10.0, 25.0}, false, 0.0); |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 420 | } |
| 421 | |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 422 | void AutonomousActor::FrontLongShot() { |
| 423 | LOG(INFO, "Expanding for front long shot\n"); |
| 424 | MoveSuperstructure(0.80, M_PI / 2.0 + 0.1, M_PI + 0.41 + 0.02, {7.0, 40.0}, |
| 425 | {4.0, 6.0}, {10.0, 25.0}, false, 0.0); |
| 426 | } |
| 427 | |
| 428 | void AutonomousActor::FrontMiddleShot() { |
| 429 | LOG(INFO, "Expanding for front middle shot\n"); |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 430 | MoveSuperstructure(-0.05, M_PI / 2.0 + 0.1, M_PI + 0.44, {7.0, 40.0}, |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 431 | {4.0, 10.0}, {10.0, 25.0}, true, 0.0); |
| 432 | } |
| 433 | |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 434 | void AutonomousActor::TuckArm(bool low_bar, bool traverse_down) { |
| 435 | MoveSuperstructure(low_bar ? -0.05 : 2.0, -0.010, 0.0, {7.0, 40.0}, |
Austin Schuh | 23b2180 | 2016-04-03 21:18:56 -0700 | [diff] [blame] | 436 | {4.0, 10.0}, {10.0, 25.0}, !traverse_down, 0.0); |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 437 | } |
| 438 | |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 439 | void AutonomousActor::DoFullShot() { |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 440 | if (ShouldCancel()) return; |
| 441 | // Make sure that the base is aligned with the base. |
| 442 | LOG(INFO, "Waiting for the superstructure\n"); |
| 443 | WaitForSuperstructure(); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 444 | |
Austin Schuh | f2a50ba | 2016-12-24 16:16:26 -0800 | [diff] [blame] | 445 | this_thread::sleep_for(chrono::milliseconds(500)); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 446 | |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 447 | if (ShouldCancel()) return; |
| 448 | LOG(INFO, "Triggering the vision actor\n"); |
| 449 | AlignWithVisionGoal(); |
| 450 | |
| 451 | // Wait for the drive base to be aligned with the target and make sure that |
| 452 | // the shooter is up to speed. |
| 453 | LOG(INFO, "Waiting for vision to be aligned\n"); |
Austin Schuh | f2a50ba | 2016-12-24 16:16:26 -0800 | [diff] [blame] | 454 | WaitForAlignedWithVision(chrono::milliseconds(2000)); |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 455 | if (ShouldCancel()) return; |
| 456 | LOG(INFO, "Waiting for shooter to be up to speed\n"); |
| 457 | WaitForShooterSpeed(); |
| 458 | if (ShouldCancel()) return; |
| 459 | |
Austin Schuh | f2a50ba | 2016-12-24 16:16:26 -0800 | [diff] [blame] | 460 | this_thread::sleep_for(chrono::milliseconds(300)); |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 461 | LOG(INFO, "Shoot!\n"); |
| 462 | Shoot(); |
| 463 | |
| 464 | // Turn off the shooter and fold up the superstructure. |
| 465 | if (ShouldCancel()) return; |
| 466 | LOG(INFO, "Stopping shooter\n"); |
| 467 | SetShooterSpeed(0.0); |
| 468 | LOG(INFO, "Folding superstructure back down\n"); |
| 469 | TuckArm(false, false); |
| 470 | |
| 471 | // Wait for everything to be folded up. |
| 472 | LOG(INFO, "Waiting for superstructure to be folded back down\n"); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 473 | WaitForSuperstructureLow(); |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 474 | } |
| 475 | |
| 476 | void AutonomousActor::LowBarDrive() { |
| 477 | TuckArm(false, true); |
| 478 | StartDrive(-5.5, 0.0, kLowBarDrive, kSlowTurn); |
| 479 | |
| 480 | if (!WaitForDriveNear(5.3, 0.0)) return; |
| 481 | TuckArm(true, true); |
| 482 | |
| 483 | if (!WaitForDriveNear(5.0, 0.0)) return; |
| 484 | |
| 485 | StartDrive(0.0, 0.0, kLowBarDrive, kSlowTurn); |
| 486 | |
| 487 | if (!WaitForDriveNear(3.0, 0.0)) return; |
| 488 | |
| 489 | StartDrive(0.0, 0.0, kLowBarDrive, kSlowTurn); |
| 490 | |
| 491 | if (!WaitForDriveNear(1.0, 0.0)) return; |
| 492 | |
Austin Schuh | 15b5f6a | 2016-03-26 19:43:56 -0700 | [diff] [blame] | 493 | StartDrive(0, -M_PI / 4.0 - 0.2, kLowBarDrive, kSlowTurn); |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 494 | } |
| 495 | |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 496 | void AutonomousActor::TippyDrive(double goal_distance, double tip_distance, |
| 497 | double below, double above) { |
| 498 | StartDrive(goal_distance, 0.0, kMoatDrive, kSlowTurn); |
| 499 | if (!WaitForBelowAngle(below)) return; |
| 500 | if (!WaitForAboveAngle(above)) return; |
| 501 | // Ok, we are good now. Compensate by moving the goal by the error. |
| 502 | // Should be here at 2.7 |
| 503 | drivetrain_queue.status.FetchLatest(); |
| 504 | if (drivetrain_queue.status.get()) { |
| 505 | const double left_error = |
| 506 | (initial_drivetrain_.left - |
| 507 | drivetrain_queue.status->estimated_left_position); |
| 508 | const double right_error = |
| 509 | (initial_drivetrain_.right - |
| 510 | drivetrain_queue.status->estimated_right_position); |
| 511 | const double distance_to_go = (left_error + right_error) / 2.0; |
| 512 | const double distance_compensation = |
| 513 | goal_distance - tip_distance - distance_to_go; |
| 514 | LOG(INFO, "Going %f further at the bump\n", distance_compensation); |
| 515 | StartDrive(distance_compensation, 0.0, kMoatDrive, kSlowTurn); |
| 516 | } |
| 517 | } |
| 518 | |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 519 | void AutonomousActor::MiddleDrive() { |
| 520 | TuckArm(false, false); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 521 | TippyDrive(3.65, 2.7, -0.2, 0.0); |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 522 | if (!WaitForDriveDone()) return; |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 523 | } |
| 524 | |
| 525 | void AutonomousActor::OneFromMiddleDrive(bool left) { |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 526 | const double kTurnAngle = left ? -0.41 : 0.41; |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 527 | TuckArm(false, false); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 528 | TippyDrive(4.05, 2.7, -0.2, 0.0); |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 529 | |
| 530 | if (!WaitForDriveDone()) return; |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 531 | StartDrive(0.0, kTurnAngle, kRealignDrive, kFastTurn); |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 532 | } |
| 533 | |
| 534 | void AutonomousActor::TwoFromMiddleDrive() { |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 535 | TuckArm(false, false); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 536 | constexpr double kDriveDistance = 5.10; |
| 537 | TippyDrive(kDriveDistance, 2.7, -0.2, 0.0); |
| 538 | |
| 539 | if (!WaitForDriveNear(kDriveDistance - 3.0, 2.0)) return; |
| 540 | StartDrive(0, -M_PI / 2 - 0.10, kMoatDrive, kFastTurn); |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 541 | |
| 542 | if (!WaitForDriveDone()) return; |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 543 | StartDrive(0, M_PI / 3 + 0.35, kMoatDrive, kFastTurn); |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 544 | } |
Comran Morshed | b134e77 | 2016-03-16 21:05:05 +0000 | [diff] [blame] | 545 | |
Austin Schuh | 23b2180 | 2016-04-03 21:18:56 -0700 | [diff] [blame] | 546 | void AutonomousActor::CloseIfBall() { |
Austin Schuh | 4b652c9 | 2019-05-27 13:22:27 -0700 | [diff] [blame] | 547 | ball_detector_fetcher_.Fetch(); |
| 548 | if (ball_detector_fetcher_.get()) { |
| 549 | const bool ball_detected = ball_detector_fetcher_->voltage > 2.5; |
Austin Schuh | 23b2180 | 2016-04-03 21:18:56 -0700 | [diff] [blame] | 550 | if (ball_detected) { |
| 551 | CloseShooter(); |
| 552 | } |
| 553 | } |
| 554 | } |
| 555 | |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 556 | void AutonomousActor::WaitForBallOrDriveDone() { |
Austin Schuh | 8aec1ed | 2016-05-01 13:29:20 -0700 | [diff] [blame] | 557 | ::aos::time::PhasedLoop phased_loop(::std::chrono::milliseconds(5), |
Austin Schuh | d32b362 | 2019-06-23 18:49:06 -0700 | [diff] [blame] | 558 | event_loop()->monotonic_now(), |
Austin Schuh | 8aec1ed | 2016-05-01 13:29:20 -0700 | [diff] [blame] | 559 | ::std::chrono::milliseconds(5) / 2); |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 560 | while (true) { |
| 561 | if (ShouldCancel()) { |
| 562 | return; |
| 563 | } |
| 564 | phased_loop.SleepUntilNext(); |
| 565 | drivetrain_queue.status.FetchLatest(); |
| 566 | if (IsDriveDone()) { |
| 567 | return; |
| 568 | } |
| 569 | |
Austin Schuh | 4b652c9 | 2019-05-27 13:22:27 -0700 | [diff] [blame] | 570 | ball_detector_fetcher_.Fetch(); |
| 571 | if (ball_detector_fetcher_.get()) { |
| 572 | const bool ball_detected = ball_detector_fetcher_->voltage > 2.5; |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 573 | if (ball_detected) { |
| 574 | return; |
| 575 | } |
| 576 | } |
| 577 | } |
| 578 | } |
| 579 | |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 580 | void AutonomousActor::TwoBallAuto() { |
Austin Schuh | f2a50ba | 2016-12-24 16:16:26 -0800 | [diff] [blame] | 581 | monotonic_clock::time_point start_time = monotonic_clock::now(); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 582 | OpenShooter(); |
| 583 | MoveSuperstructure(0.10, -0.010, 0.0, {8.0, 60.0}, {4.0, 10.0}, {10.0, 25.0}, |
| 584 | false, 12.0); |
| 585 | if (ShouldCancel()) return; |
| 586 | LOG(INFO, "Waiting for the intake to come down.\n"); |
| 587 | |
| 588 | WaitForIntake(); |
| 589 | LOG(INFO, "Intake done at %f seconds, starting to drive\n", |
James Kuszmaul | 651fc3f | 2019-05-15 21:14:25 -0700 | [diff] [blame] | 590 | ::aos::time::DurationInSeconds(monotonic_clock::now() - start_time)); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 591 | if (ShouldCancel()) return; |
| 592 | const double kDriveDistance = 5.05; |
| 593 | StartDrive(-kDriveDistance, 0.0, kTwoBallLowDrive, kSlowTurn); |
| 594 | |
| 595 | StartDrive(0.0, 0.4, kTwoBallLowDrive, kSwerveTurn); |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 596 | if (!WaitForDriveNear(kDriveDistance - 0.5, kDoNotTurnCare)) return; |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 597 | |
Austin Schuh | 295c2d9 | 2016-05-01 12:28:04 -0700 | [diff] [blame] | 598 | // Check if the ball is there. |
| 599 | bool first_ball_there = true; |
Austin Schuh | 4b652c9 | 2019-05-27 13:22:27 -0700 | [diff] [blame] | 600 | ball_detector_fetcher_.Fetch(); |
| 601 | if (ball_detector_fetcher_.get()) { |
| 602 | const bool ball_detected = ball_detector_fetcher_->voltage > 2.5; |
Austin Schuh | 295c2d9 | 2016-05-01 12:28:04 -0700 | [diff] [blame] | 603 | first_ball_there = ball_detected; |
| 604 | LOG(INFO, "Saw the ball: %d at %f\n", first_ball_there, |
James Kuszmaul | 651fc3f | 2019-05-15 21:14:25 -0700 | [diff] [blame] | 605 | ::aos::time::DurationInSeconds(monotonic_clock::now() - start_time)); |
Austin Schuh | 295c2d9 | 2016-05-01 12:28:04 -0700 | [diff] [blame] | 606 | } |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 607 | MoveSuperstructure(0.10, -0.010, 0.0, {8.0, 40.0}, {4.0, 10.0}, {10.0, 25.0}, |
| 608 | false, 0.0); |
| 609 | LOG(INFO, "Shutting off rollers at %f seconds, starting to straighten out\n", |
James Kuszmaul | 651fc3f | 2019-05-15 21:14:25 -0700 | [diff] [blame] | 610 | ::aos::time::DurationInSeconds(monotonic_clock::now() - start_time)); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 611 | StartDrive(0.0, -0.4, kTwoBallLowDrive, kSwerveTurn); |
| 612 | MoveSuperstructure(-0.05, -0.010, 0.0, {8.0, 40.0}, {4.0, 10.0}, {10.0, 25.0}, |
| 613 | false, 0.0); |
| 614 | CloseShooter(); |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 615 | if (!WaitForDriveNear(kDriveDistance - 2.4, kDoNotTurnCare)) return; |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 616 | |
| 617 | // We are now under the low bar. Start lifting. |
| 618 | BackLongShotLowBarTwoBall(); |
| 619 | LOG(INFO, "Spinning up the shooter wheels\n"); |
| 620 | SetShooterSpeed(640.0); |
| 621 | StartDrive(0.0, 0.0, kTwoBallFastDrive, kSwerveTurn); |
| 622 | |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 623 | if (!WaitForDriveNear(1.50, kDoNotTurnCare)) return; |
| 624 | constexpr double kShootTurnAngle = -M_PI / 4.0 - 0.05; |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 625 | StartDrive(0, kShootTurnAngle, kTwoBallFastDrive, kFinishTurn); |
| 626 | BackLongShotTwoBall(); |
| 627 | |
| 628 | if (!WaitForDriveDone()) return; |
| 629 | LOG(INFO, "First shot done driving at %f seconds\n", |
James Kuszmaul | 651fc3f | 2019-05-15 21:14:25 -0700 | [diff] [blame] | 630 | ::aos::time::DurationInSeconds(monotonic_clock::now() - start_time)); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 631 | |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 632 | WaitForSuperstructureProfile(); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 633 | |
| 634 | if (ShouldCancel()) return; |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 635 | AlignWithVisionGoal(); |
| 636 | |
| 637 | WaitForShooterSpeed(); |
| 638 | if (ShouldCancel()) return; |
| 639 | |
Austin Schuh | f2a50ba | 2016-12-24 16:16:26 -0800 | [diff] [blame] | 640 | constexpr chrono::milliseconds kVisionExtra{0}; |
| 641 | WaitForAlignedWithVision(chrono::milliseconds(500) + kVisionExtra); |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 642 | BackLongShotTwoBallFinish(); |
| 643 | WaitForSuperstructureProfile(); |
| 644 | if (ShouldCancel()) return; |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 645 | LOG(INFO, "Shoot!\n"); |
Austin Schuh | 295c2d9 | 2016-05-01 12:28:04 -0700 | [diff] [blame] | 646 | if (first_ball_there) { |
| 647 | Shoot(); |
| 648 | } else { |
| 649 | LOG(INFO, "Nah, not shooting\n"); |
| 650 | } |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 651 | |
| 652 | LOG(INFO, "First shot at %f seconds\n", |
James Kuszmaul | 651fc3f | 2019-05-15 21:14:25 -0700 | [diff] [blame] | 653 | ::aos::time::DurationInSeconds(monotonic_clock::now() - start_time)); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 654 | if (ShouldCancel()) return; |
| 655 | |
| 656 | SetShooterSpeed(0.0); |
| 657 | LOG(INFO, "Folding superstructure back down\n"); |
| 658 | TuckArm(true, true); |
| 659 | |
| 660 | // Undo vision move. |
| 661 | StartDrive(0.0, 0.0, kTwoBallFastDrive, kFinishTurn); |
| 662 | if (!WaitForDriveDone()) return; |
| 663 | |
| 664 | constexpr double kBackDrive = 3.09 - 0.4; |
| 665 | StartDrive(kBackDrive, 0.0, kTwoBallReturnDrive, kSlowTurn); |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 666 | if (!WaitForDriveNear(kBackDrive - 0.19, kDoNotTurnCare)) return; |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 667 | StartDrive(0, -kShootTurnAngle, kTwoBallReturnDrive, kSwerveTurn); |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 668 | if (!WaitForDriveNear(1.0, kDoNotTurnCare)) return; |
| 669 | StartDrive(0, 0, kTwoBallReturnSlow, kSwerveTurn); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 670 | |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 671 | if (!WaitForDriveNear(0.06, kDoNotTurnCare)) return; |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 672 | LOG(INFO, "At Low Bar %f\n", |
James Kuszmaul | 651fc3f | 2019-05-15 21:14:25 -0700 | [diff] [blame] | 673 | ::aos::time::DurationInSeconds(monotonic_clock::now() - start_time)); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 674 | |
| 675 | OpenShooter(); |
| 676 | constexpr double kSecondBallAfterBarDrive = 2.10; |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 677 | StartDrive(kSecondBallAfterBarDrive, 0.0, kTwoBallBallPickupAccel, kSlowTurn); |
| 678 | if (!WaitForDriveNear(kSecondBallAfterBarDrive - 0.5, kDoNotTurnCare)) return; |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 679 | constexpr double kBallSmallWallTurn = -0.11; |
| 680 | StartDrive(0, kBallSmallWallTurn, kTwoBallBallPickup, kFinishTurn); |
| 681 | |
| 682 | MoveSuperstructure(0.03, -0.010, 0.0, {8.0, 60.0}, {4.0, 10.0}, {10.0, 25.0}, |
| 683 | false, 12.0); |
| 684 | |
| 685 | if (!WaitForDriveProfileDone()) return; |
| 686 | |
| 687 | MoveSuperstructure(0.10, -0.010, 0.0, {8.0, 60.0}, {4.0, 10.0}, {10.0, 25.0}, |
| 688 | false, 12.0); |
| 689 | |
| 690 | LOG(INFO, "Done backing up %f\n", |
James Kuszmaul | 651fc3f | 2019-05-15 21:14:25 -0700 | [diff] [blame] | 691 | ::aos::time::DurationInSeconds(monotonic_clock::now() - start_time)); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 692 | |
| 693 | constexpr double kDriveBackDistance = 5.15 - 0.4; |
| 694 | StartDrive(-kDriveBackDistance, 0.0, kTwoBallLowDrive, kFinishTurn); |
| 695 | CloseIfBall(); |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 696 | if (!WaitForDriveNear(kDriveBackDistance - 0.75, kDoNotTurnCare)) return; |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 697 | |
| 698 | StartDrive(0.0, -kBallSmallWallTurn, kTwoBallLowDrive, kFinishTurn); |
| 699 | LOG(INFO, "Straightening up at %f\n", |
James Kuszmaul | 651fc3f | 2019-05-15 21:14:25 -0700 | [diff] [blame] | 700 | ::aos::time::DurationInSeconds(monotonic_clock::now() - start_time)); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 701 | |
| 702 | CloseIfBall(); |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 703 | if (!WaitForDriveNear(kDriveBackDistance - 2.3, kDoNotTurnCare)) return; |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 704 | |
Austin Schuh | 4b652c9 | 2019-05-27 13:22:27 -0700 | [diff] [blame] | 705 | ball_detector_fetcher_.Fetch(); |
| 706 | if (ball_detector_fetcher_.get()) { |
| 707 | const bool ball_detected = ball_detector_fetcher_->voltage > 2.5; |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 708 | if (!ball_detected) { |
| 709 | if (!WaitForDriveDone()) return; |
| 710 | LOG(INFO, "Aborting, no ball %f\n", |
James Kuszmaul | 651fc3f | 2019-05-15 21:14:25 -0700 | [diff] [blame] | 711 | ::aos::time::DurationInSeconds(monotonic_clock::now() - start_time)); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 712 | return; |
| 713 | } |
| 714 | } |
| 715 | CloseShooter(); |
| 716 | |
| 717 | BackLongShotLowBarTwoBall(); |
| 718 | LOG(INFO, "Spinning up the shooter wheels\n"); |
| 719 | SetShooterSpeed(640.0); |
| 720 | StartDrive(0.0, 0.0, kTwoBallFastDrive, kSwerveTurn); |
| 721 | |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 722 | if (!WaitForDriveNear(1.80, kDoNotTurnCare)) return; |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 723 | StartDrive(0, kShootTurnAngle, kTwoBallFastDrive, kFinishTurn); |
| 724 | BackLongShotTwoBall(); |
| 725 | |
| 726 | if (!WaitForDriveDone()) return; |
| 727 | LOG(INFO, "Second shot done driving at %f seconds\n", |
James Kuszmaul | 651fc3f | 2019-05-15 21:14:25 -0700 | [diff] [blame] | 728 | ::aos::time::DurationInSeconds(monotonic_clock::now() - start_time)); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 729 | WaitForSuperstructure(); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 730 | AlignWithVisionGoal(); |
| 731 | if (ShouldCancel()) return; |
| 732 | |
| 733 | WaitForShooterSpeed(); |
| 734 | if (ShouldCancel()) return; |
| 735 | |
| 736 | // 2.2 with 0.4 of vision. |
| 737 | // 1.8 without any vision. |
| 738 | LOG(INFO, "Going to vision align at %f\n", |
James Kuszmaul | 651fc3f | 2019-05-15 21:14:25 -0700 | [diff] [blame] | 739 | ::aos::time::DurationInSeconds(monotonic_clock::now() - start_time)); |
Austin Schuh | f2a50ba | 2016-12-24 16:16:26 -0800 | [diff] [blame] | 740 | WaitForAlignedWithVision( |
| 741 | (start_time + chrono::milliseconds(13500) + kVisionExtra * 2) - |
| 742 | monotonic_clock::now()); |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 743 | BackLongShotTwoBallFinish(); |
| 744 | WaitForSuperstructureProfile(); |
| 745 | if (ShouldCancel()) return; |
Austin Schuh | f2a50ba | 2016-12-24 16:16:26 -0800 | [diff] [blame] | 746 | LOG(INFO, "Shoot at %f\n", |
James Kuszmaul | 651fc3f | 2019-05-15 21:14:25 -0700 | [diff] [blame] | 747 | ::aos::time::DurationInSeconds(monotonic_clock::now() - start_time)); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 748 | Shoot(); |
| 749 | |
| 750 | LOG(INFO, "Second shot at %f seconds\n", |
James Kuszmaul | 651fc3f | 2019-05-15 21:14:25 -0700 | [diff] [blame] | 751 | ::aos::time::DurationInSeconds(monotonic_clock::now() - start_time)); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 752 | if (ShouldCancel()) return; |
| 753 | |
| 754 | SetShooterSpeed(0.0); |
| 755 | LOG(INFO, "Folding superstructure back down\n"); |
| 756 | TuckArm(true, false); |
James Kuszmaul | 651fc3f | 2019-05-15 21:14:25 -0700 | [diff] [blame] | 757 | LOG(INFO, "Shot %f\n", |
| 758 | ::aos::time::DurationInSeconds(monotonic_clock::now() - start_time)); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 759 | |
| 760 | WaitForSuperstructureLow(); |
| 761 | |
James Kuszmaul | 651fc3f | 2019-05-15 21:14:25 -0700 | [diff] [blame] | 762 | LOG(INFO, "Done %f\n", |
| 763 | ::aos::time::DurationInSeconds(monotonic_clock::now() - start_time)); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 764 | } |
| 765 | |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 766 | void AutonomousActor::StealAndMoveOverBy(double distance) { |
| 767 | OpenShooter(); |
| 768 | MoveSuperstructure(0.10, -0.010, 0.0, {8.0, 60.0}, {4.0, 10.0}, {10.0, 25.0}, |
| 769 | true, 12.0); |
| 770 | if (ShouldCancel()) return; |
| 771 | LOG(INFO, "Waiting for the intake to come down.\n"); |
| 772 | |
| 773 | WaitForIntake(); |
| 774 | if (ShouldCancel()) return; |
| 775 | StartDrive(-distance, M_PI / 2.0, kFastDrive, kStealTurn); |
| 776 | WaitForBallOrDriveDone(); |
| 777 | if (ShouldCancel()) return; |
| 778 | MoveSuperstructure(1.0, -0.010, 0.0, {8.0, 60.0}, {4.0, 10.0}, {10.0, 25.0}, |
| 779 | true, 12.0); |
| 780 | |
| 781 | if (!WaitForDriveDone()) return; |
| 782 | StartDrive(0.0, M_PI / 2.0, kFastDrive, kStealTurn); |
| 783 | if (!WaitForDriveDone()) return; |
| 784 | } |
| 785 | |
Philipp Schrader | 4bd29b1 | 2017-02-22 04:42:27 +0000 | [diff] [blame] | 786 | bool AutonomousActor::RunAction( |
| 787 | const ::frc971::autonomous::AutonomousActionParams ¶ms) { |
Austin Schuh | f2a50ba | 2016-12-24 16:16:26 -0800 | [diff] [blame] | 788 | monotonic_clock::time_point start_time = monotonic_clock::now(); |
Comran Morshed | e68e373 | 2016-03-12 14:12:11 +0000 | [diff] [blame] | 789 | LOG(INFO, "Starting autonomous action with mode %" PRId32 "\n", params.mode); |
| 790 | |
Comran Morshed | 435f111 | 2016-03-12 14:20:45 +0000 | [diff] [blame] | 791 | InitializeEncoders(); |
| 792 | ResetDrivetrain(); |
| 793 | |
Austin Schuh | 295c2d9 | 2016-05-01 12:28:04 -0700 | [diff] [blame] | 794 | switch (params.mode) { |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 795 | case 0: |
| 796 | LowBarDrive(); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 797 | if (!WaitForDriveDone()) return true; |
| 798 | // Get the superstructure to unfold and get ready for shooting. |
| 799 | LOG(INFO, "Unfolding superstructure\n"); |
| 800 | FrontLongShot(); |
| 801 | |
| 802 | // Spin up the shooter wheels. |
| 803 | LOG(INFO, "Spinning up the shooter wheels\n"); |
| 804 | SetShooterSpeed(640.0); |
| 805 | |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 806 | break; |
| 807 | case 1: |
| 808 | TwoFromMiddleDrive(); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 809 | if (!WaitForDriveDone()) return true; |
| 810 | // Get the superstructure to unfold and get ready for shooting. |
| 811 | LOG(INFO, "Unfolding superstructure\n"); |
| 812 | FrontMiddleShot(); |
| 813 | |
| 814 | // Spin up the shooter wheels. |
| 815 | LOG(INFO, "Spinning up the shooter wheels\n"); |
| 816 | SetShooterSpeed(600.0); |
| 817 | |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 818 | break; |
| 819 | case 2: |
| 820 | OneFromMiddleDrive(true); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 821 | if (!WaitForDriveDone()) return true; |
| 822 | // Get the superstructure to unfold and get ready for shooting. |
| 823 | LOG(INFO, "Unfolding superstructure\n"); |
| 824 | FrontMiddleShot(); |
| 825 | |
| 826 | // Spin up the shooter wheels. |
| 827 | LOG(INFO, "Spinning up the shooter wheels\n"); |
| 828 | SetShooterSpeed(600.0); |
| 829 | |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 830 | break; |
| 831 | case 3: |
| 832 | MiddleDrive(); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 833 | if (!WaitForDriveDone()) return true; |
| 834 | // Get the superstructure to unfold and get ready for shooting. |
| 835 | LOG(INFO, "Unfolding superstructure\n"); |
| 836 | FrontMiddleShot(); |
| 837 | |
| 838 | // Spin up the shooter wheels. |
| 839 | LOG(INFO, "Spinning up the shooter wheels\n"); |
| 840 | SetShooterSpeed(600.0); |
| 841 | |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 842 | break; |
| 843 | case 4: |
| 844 | OneFromMiddleDrive(false); |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 845 | if (!WaitForDriveDone()) return true; |
| 846 | // Get the superstructure to unfold and get ready for shooting. |
| 847 | LOG(INFO, "Unfolding superstructure\n"); |
| 848 | FrontMiddleShot(); |
| 849 | |
| 850 | // Spin up the shooter wheels. |
| 851 | LOG(INFO, "Spinning up the shooter wheels\n"); |
| 852 | SetShooterSpeed(600.0); |
| 853 | |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 854 | break; |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 855 | case 5: |
Campbell Crowley | 9ed61a5 | 2016-11-05 17:13:07 -0700 | [diff] [blame] | 856 | case 15: |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 857 | TwoBallAuto(); |
Austin Schuh | 23b2180 | 2016-04-03 21:18:56 -0700 | [diff] [blame] | 858 | return true; |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 859 | break; |
Austin Schuh | e4ec49c | 2016-04-24 19:07:15 -0700 | [diff] [blame] | 860 | case 6: |
| 861 | StealAndMoveOverBy(3.10 + 2 * 52 * 2.54 / 100.0); |
| 862 | if (ShouldCancel()) return true; |
| 863 | |
| 864 | TwoFromMiddleDrive(); |
| 865 | if (!WaitForDriveDone()) return true; |
| 866 | // Get the superstructure to unfold and get ready for shooting. |
| 867 | LOG(INFO, "Unfolding superstructure\n"); |
| 868 | FrontMiddleShot(); |
| 869 | |
| 870 | // Spin up the shooter wheels. |
| 871 | LOG(INFO, "Spinning up the shooter wheels\n"); |
| 872 | SetShooterSpeed(600.0); |
| 873 | |
| 874 | break; |
| 875 | case 7: |
| 876 | StealAndMoveOverBy(2.95 + 52 * 2.54 / 100.0); |
| 877 | if (ShouldCancel()) return true; |
| 878 | |
| 879 | OneFromMiddleDrive(true); |
| 880 | if (!WaitForDriveDone()) return true; |
| 881 | // Get the superstructure to unfold and get ready for shooting. |
| 882 | LOG(INFO, "Unfolding superstructure\n"); |
| 883 | FrontMiddleShot(); |
| 884 | |
| 885 | // Spin up the shooter wheels. |
| 886 | LOG(INFO, "Spinning up the shooter wheels\n"); |
| 887 | SetShooterSpeed(600.0); |
| 888 | |
| 889 | break; |
| 890 | case 8: { |
| 891 | StealAndMoveOverBy(2.95); |
| 892 | if (ShouldCancel()) return true; |
| 893 | |
| 894 | MiddleDrive(); |
| 895 | if (!WaitForDriveDone()) return true; |
| 896 | // Get the superstructure to unfold and get ready for shooting. |
| 897 | LOG(INFO, "Unfolding superstructure\n"); |
| 898 | FrontMiddleShot(); |
| 899 | |
| 900 | // Spin up the shooter wheels. |
| 901 | LOG(INFO, "Spinning up the shooter wheels\n"); |
| 902 | SetShooterSpeed(600.0); |
| 903 | |
| 904 | } break; |
| 905 | case 9: { |
| 906 | StealAndMoveOverBy(1.70); |
| 907 | if (ShouldCancel()) return true; |
| 908 | |
| 909 | OneFromMiddleDrive(false); |
| 910 | if (!WaitForDriveDone()) return true; |
| 911 | // Get the superstructure to unfold and get ready for shooting. |
| 912 | LOG(INFO, "Unfolding superstructure\n"); |
| 913 | FrontMiddleShot(); |
| 914 | |
| 915 | // Spin up the shooter wheels. |
| 916 | LOG(INFO, "Spinning up the shooter wheels\n"); |
| 917 | SetShooterSpeed(600.0); |
| 918 | |
| 919 | } break; |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 920 | default: |
Austin Schuh | 6c9bc62 | 2016-03-26 19:44:12 -0700 | [diff] [blame] | 921 | LOG(ERROR, "Invalid auto mode %d\n", params.mode); |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 922 | return true; |
| 923 | } |
Comran Morshed | 435f111 | 2016-03-12 14:20:45 +0000 | [diff] [blame] | 924 | |
Austin Schuh | 3e4a527 | 2016-04-20 20:11:00 -0700 | [diff] [blame] | 925 | DoFullShot(); |
| 926 | |
| 927 | StartDrive(0.5, 0.0, kMoatDrive, kFastTurn); |
Comran Morshed | 435f111 | 2016-03-12 14:20:45 +0000 | [diff] [blame] | 928 | if (!WaitForDriveDone()) return true; |
| 929 | |
James Kuszmaul | 651fc3f | 2019-05-15 21:14:25 -0700 | [diff] [blame] | 930 | LOG(INFO, "Done %f\n", |
| 931 | ::aos::time::DurationInSeconds(monotonic_clock::now() - start_time)); |
Comran Morshed | 435f111 | 2016-03-12 14:20:45 +0000 | [diff] [blame] | 932 | |
Austin Schuh | 8aec1ed | 2016-05-01 13:29:20 -0700 | [diff] [blame] | 933 | ::aos::time::PhasedLoop phased_loop(::std::chrono::milliseconds(5), |
Austin Schuh | d32b362 | 2019-06-23 18:49:06 -0700 | [diff] [blame] | 934 | event_loop()->monotonic_now(), |
Austin Schuh | 8aec1ed | 2016-05-01 13:29:20 -0700 | [diff] [blame] | 935 | ::std::chrono::milliseconds(5) / 2); |
Austin Schuh | f59b8ee | 2016-03-19 21:31:36 -0700 | [diff] [blame] | 936 | |
Comran Morshed | 435f111 | 2016-03-12 14:20:45 +0000 | [diff] [blame] | 937 | while (!ShouldCancel()) { |
| 938 | phased_loop.SleepUntilNext(); |
Comran Morshed | e68e373 | 2016-03-12 14:12:11 +0000 | [diff] [blame] | 939 | } |
Comran Morshed | 435f111 | 2016-03-12 14:20:45 +0000 | [diff] [blame] | 940 | LOG(DEBUG, "Done running\n"); |
Comran Morshed | e68e373 | 2016-03-12 14:12:11 +0000 | [diff] [blame] | 941 | |
| 942 | return true; |
| 943 | } |
| 944 | |
Comran Morshed | e68e373 | 2016-03-12 14:12:11 +0000 | [diff] [blame] | 945 | } // namespace actors |
| 946 | } // namespace y2016 |