Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 1 | #include <stdio.h> |
| 2 | #include <string.h> |
| 3 | #include <unistd.h> |
| 4 | #include <math.h> |
| 5 | |
Austin Schuh | a250b2d | 2019-05-27 16:14:02 -0700 | [diff] [blame] | 6 | #include "aos/actions/actions.h" |
John Park | 398c74a | 2018-10-20 21:17:39 -0700 | [diff] [blame] | 7 | #include "aos/init.h" |
Austin Schuh | a250b2d | 2019-05-27 16:14:02 -0700 | [diff] [blame] | 8 | #include "aos/input/action_joystick_input.h" |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 9 | #include "aos/input/driver_station_data.h" |
| 10 | #include "aos/logging/logging.h" |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 11 | #include "aos/time/time.h" |
Austin Schuh | a250b2d | 2019-05-27 16:14:02 -0700 | [diff] [blame] | 12 | #include "aos/util/log_interval.h" |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 13 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 14 | #include "frc971/autonomous/auto_generated.h" |
| 15 | #include "frc971/control_loops/drivetrain/drivetrain_goal_generated.h" |
| 16 | #include "frc971/control_loops/drivetrain/drivetrain_status_generated.h" |
Austin Schuh | 3028b1d | 2017-03-11 22:12:13 -0800 | [diff] [blame] | 17 | #include "y2016/actors/autonomous_actor.h" |
| 18 | #include "y2016/actors/superstructure_actor.h" |
| 19 | #include "y2016/actors/vision_align_actor.h" |
| 20 | #include "y2016/constants.h" |
| 21 | #include "y2016/control_loops/drivetrain/drivetrain_base.h" |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 22 | #include "y2016/control_loops/shooter/shooter_goal_generated.h" |
Austin Schuh | 45d07f6 | 2016-03-13 15:33:31 -0700 | [diff] [blame] | 23 | #include "y2016/control_loops/superstructure/superstructure.h" |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 24 | #include "y2016/control_loops/superstructure/superstructure_goal_generated.h" |
| 25 | #include "y2016/control_loops/superstructure/superstructure_status_generated.h" |
| 26 | #include "y2016/queues/ball_detector_generated.h" |
| 27 | #include "y2016/vision/vision_generated.h" |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 28 | |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 29 | using ::aos::input::driver_station::ButtonLocation; |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 30 | using ::aos::input::driver_station::ControlBit; |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 31 | using ::aos::input::driver_station::JoystickAxis; |
| 32 | using ::aos::input::driver_station::POVLocation; |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 33 | |
Comran Morshed | 6c6a0a9 | 2016-01-17 12:45:16 +0000 | [diff] [blame] | 34 | namespace y2016 { |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 35 | namespace input { |
| 36 | namespace joysticks { |
| 37 | |
Austin Schuh | 45d07f6 | 2016-03-13 15:33:31 -0700 | [diff] [blame] | 38 | namespace { |
| 39 | |
| 40 | constexpr double kMaxIntakeAngleBeforeArmInterference = control_loops:: |
| 41 | superstructure::CollisionAvoidance::kMaxIntakeAngleBeforeArmInterference; |
| 42 | |
| 43 | } // namespace |
| 44 | |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 45 | const JoystickAxis kSteeringWheel(1, 1), kDriveThrottle(2, 2); |
Campbell Crowley | 5b27f02 | 2016-02-20 16:55:35 -0800 | [diff] [blame] | 46 | const ButtonLocation kShiftHigh(2, 3), kShiftHigh2(2, 2), kShiftLow(2, 1); |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 47 | const ButtonLocation kQuickTurn(1, 5); |
| 48 | |
Austin Schuh | 781cdcc | 2016-03-12 13:03:12 -0800 | [diff] [blame] | 49 | const ButtonLocation kTurn1(1, 7); |
| 50 | const ButtonLocation kTurn2(1, 11); |
| 51 | |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 52 | // Buttons on the lexan driver station to get things running on bring-up day. |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 53 | const ButtonLocation kIntakeDown(3, 11); |
| 54 | const POVLocation kFrontLong(3, 180); |
| 55 | const POVLocation kBackLong(3, 0); |
Austin Schuh | 45d07f6 | 2016-03-13 15:33:31 -0700 | [diff] [blame] | 56 | const POVLocation kBackFender(3, 90); |
| 57 | const POVLocation kFrontFender(3, 270); |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 58 | const ButtonLocation kIntakeIn(3, 12); |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 59 | const ButtonLocation kFire(3, 3); |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 60 | const ButtonLocation kIntakeOut(3, 9); |
Austin Schuh | 843412b | 2016-03-20 16:48:46 -0700 | [diff] [blame] | 61 | const ButtonLocation kPortcullis(3, 7); |
| 62 | const ButtonLocation kChevalDeFrise(3, 8); |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 63 | |
Austin Schuh | add6d79 | 2016-03-19 01:20:01 -0700 | [diff] [blame] | 64 | const ButtonLocation kVisionAlign(3, 4); |
Austin Schuh | 1879911 | 2016-03-16 22:09:54 -0700 | [diff] [blame] | 65 | |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 66 | const ButtonLocation kExpand(3, 6); |
| 67 | const ButtonLocation kWinch(3, 5); |
| 68 | |
Austin Schuh | a250b2d | 2019-05-27 16:14:02 -0700 | [diff] [blame] | 69 | class Reader : public ::aos::input::ActionJoystickInput { |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 70 | public: |
Austin Schuh | 3e45c75 | 2019-02-02 12:19:11 -0800 | [diff] [blame] | 71 | Reader(::aos::EventLoop *event_loop) |
Austin Schuh | a250b2d | 2019-05-27 16:14:02 -0700 | [diff] [blame] | 72 | : ::aos::input::ActionJoystickInput( |
| 73 | event_loop, control_loops::drivetrain::GetDrivetrainConfig(), |
| 74 | ::aos::input::DrivetrainInputReader::InputType::kSteeringWheel, {}), |
Austin Schuh | 1bf8a21 | 2019-05-26 22:13:14 -0700 | [diff] [blame] | 75 | vision_status_fetcher_( |
| 76 | event_loop->MakeFetcher<::y2016::vision::VisionStatus>( |
Tyler Chatow | 15ce3bd | 2020-01-19 21:49:47 -0800 | [diff] [blame] | 77 | "/vision")), |
Austin Schuh | 4b652c9 | 2019-05-27 13:22:27 -0700 | [diff] [blame] | 78 | ball_detector_fetcher_( |
| 79 | event_loop->MakeFetcher<::y2016::sensors::BallDetector>( |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 80 | "/superstructure")), |
Austin Schuh | ae023fb | 2019-06-29 17:11:45 -0700 | [diff] [blame] | 81 | shooter_goal_sender_( |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 82 | event_loop->MakeSender<::y2016::control_loops::shooter::Goal>( |
| 83 | "/shooter")), |
Austin Schuh | 9481d0d | 2019-06-29 21:56:17 -0700 | [diff] [blame] | 84 | superstructure_status_fetcher_( |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 85 | event_loop |
| 86 | ->MakeFetcher<::y2016::control_loops::superstructure::Status>( |
| 87 | "/superstructure")), |
Austin Schuh | 9481d0d | 2019-06-29 21:56:17 -0700 | [diff] [blame] | 88 | superstructure_goal_sender_( |
| 89 | event_loop |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 90 | ->MakeSender<::y2016::control_loops::superstructure::Goal>( |
| 91 | "/superstructure")), |
Austin Schuh | bd0a40f | 2019-06-30 14:56:31 -0700 | [diff] [blame] | 92 | drivetrain_goal_fetcher_( |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 93 | event_loop->MakeFetcher<::frc971::control_loops::drivetrain::Goal>( |
| 94 | "/drivetrain")), |
Austin Schuh | bd0a40f | 2019-06-30 14:56:31 -0700 | [diff] [blame] | 95 | drivetrain_status_fetcher_( |
| 96 | event_loop |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 97 | ->MakeFetcher<::frc971::control_loops::drivetrain::Status>( |
| 98 | "/drivetrain")), |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 99 | intake_goal_(0.0), |
| 100 | shoulder_goal_(M_PI / 2.0), |
Austin Schuh | d52df77 | 2016-03-19 15:38:41 -0700 | [diff] [blame] | 101 | wrist_goal_(0.0), |
Austin Schuh | 1bf8a21 | 2019-05-26 22:13:14 -0700 | [diff] [blame] | 102 | vision_align_action_factory_( |
| 103 | actors::VisionAlignActor::MakeFactory(event_loop)), |
| 104 | superstructure_action_factory_( |
Austin Schuh | a250b2d | 2019-05-27 16:14:02 -0700 | [diff] [blame] | 105 | actors::SuperstructureActor::MakeFactory(event_loop)) { |
| 106 | set_vision_align_fn([this](const ::aos::input::driver_station::Data &data) { |
| 107 | return VisionAlign(data); |
| 108 | }); |
| 109 | } |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 110 | |
Austin Schuh | a250b2d | 2019-05-27 16:14:02 -0700 | [diff] [blame] | 111 | // Returns true when we are vision aligning |
| 112 | bool VisionAlign(const ::aos::input::driver_station::Data &data) { |
Austin Schuh | add6d79 | 2016-03-19 01:20:01 -0700 | [diff] [blame] | 113 | vision_valid_ = false; |
| 114 | |
Austin Schuh | 1bf8a21 | 2019-05-26 22:13:14 -0700 | [diff] [blame] | 115 | vision_status_fetcher_.Fetch(); |
Austin Schuh | add6d79 | 2016-03-19 01:20:01 -0700 | [diff] [blame] | 116 | |
Austin Schuh | 1bf8a21 | 2019-05-26 22:13:14 -0700 | [diff] [blame] | 117 | if (vision_status_fetcher_.get()) { |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 118 | vision_valid_ = (vision_status_fetcher_->left_image_valid() && |
| 119 | vision_status_fetcher_->right_image_valid()); |
| 120 | last_angle_ = vision_status_fetcher_->horizontal_angle(); |
Austin Schuh | add6d79 | 2016-03-19 01:20:01 -0700 | [diff] [blame] | 121 | } |
| 122 | |
Austin Schuh | 974cf65 | 2016-04-20 20:18:13 -0700 | [diff] [blame] | 123 | if (data.IsPressed(kVisionAlign)) { |
| 124 | if (vision_valid_ && !vision_action_running_) { |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 125 | actors::vision_align_action::VisionAlignActionParamsT params; |
Austin Schuh | a250b2d | 2019-05-27 16:14:02 -0700 | [diff] [blame] | 126 | EnqueueAction(vision_align_action_factory_.Make(params)); |
Austin Schuh | 974cf65 | 2016-04-20 20:18:13 -0700 | [diff] [blame] | 127 | vision_action_running_ = true; |
Austin Schuh | f257f3c | 2019-10-27 21:00:43 -0700 | [diff] [blame] | 128 | AOS_LOG(INFO, "Starting vision align\n"); |
Austin Schuh | 974cf65 | 2016-04-20 20:18:13 -0700 | [diff] [blame] | 129 | } else { |
| 130 | if (!vision_valid_) { |
Austin Schuh | f257f3c | 2019-10-27 21:00:43 -0700 | [diff] [blame] | 131 | AOS_LOG(INFO, "Vision align but not valid\n"); |
Austin Schuh | 974cf65 | 2016-04-20 20:18:13 -0700 | [diff] [blame] | 132 | } |
| 133 | } |
Austin Schuh | 1879911 | 2016-03-16 22:09:54 -0700 | [diff] [blame] | 134 | } |
| 135 | |
| 136 | if (data.NegEdge(kVisionAlign)) { |
Austin Schuh | a250b2d | 2019-05-27 16:14:02 -0700 | [diff] [blame] | 137 | CancelAllActions(); |
Austin Schuh | 1879911 | 2016-03-16 22:09:54 -0700 | [diff] [blame] | 138 | } |
Austin Schuh | add6d79 | 2016-03-19 01:20:01 -0700 | [diff] [blame] | 139 | if (!data.IsPressed(kVisionAlign)) { |
| 140 | vision_action_running_ = false; |
| 141 | } |
Austin Schuh | 1879911 | 2016-03-16 22:09:54 -0700 | [diff] [blame] | 142 | |
Austin Schuh | a250b2d | 2019-05-27 16:14:02 -0700 | [diff] [blame] | 143 | return vision_action_running_; |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 144 | } |
| 145 | |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 146 | void HandleTeleop(const ::aos::input::driver_station::Data &data) { |
Austin Schuh | a250b2d | 2019-05-27 16:14:02 -0700 | [diff] [blame] | 147 | if (!data.GetControlBit(ControlBit::kEnabled)) { |
| 148 | // If we are not enabled, reset the waiting for zero bit. |
Austin Schuh | f257f3c | 2019-10-27 21:00:43 -0700 | [diff] [blame] | 149 | AOS_LOG(DEBUG, "Waiting for zero.\n"); |
Austin Schuh | a250b2d | 2019-05-27 16:14:02 -0700 | [diff] [blame] | 150 | waiting_for_zero_ = true; |
| 151 | } |
| 152 | |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 153 | float voltage_climber = 0.0; |
Austin Schuh | 45d07f6 | 2016-03-13 15:33:31 -0700 | [diff] [blame] | 154 | // Default the intake to up. |
| 155 | intake_goal_ = constants::Values::kIntakeRange.upper - 0.04; |
| 156 | |
| 157 | bool force_lights_on = false; |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 158 | if (!data.GetControlBit(ControlBit::kEnabled)) { |
Austin Schuh | a250b2d | 2019-05-27 16:14:02 -0700 | [diff] [blame] | 159 | CancelAllActions(); |
Austin Schuh | f257f3c | 2019-10-27 21:00:43 -0700 | [diff] [blame] | 160 | AOS_LOG(DEBUG, "Canceling\n"); |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 161 | } |
| 162 | |
Austin Schuh | 9481d0d | 2019-06-29 21:56:17 -0700 | [diff] [blame] | 163 | superstructure_status_fetcher_.Fetch(); |
| 164 | if (!superstructure_status_fetcher_.get()) { |
Austin Schuh | f257f3c | 2019-10-27 21:00:43 -0700 | [diff] [blame] | 165 | AOS_LOG(ERROR, "Got no superstructure status packet.\n"); |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 166 | } |
| 167 | |
Austin Schuh | 9481d0d | 2019-06-29 21:56:17 -0700 | [diff] [blame] | 168 | if (superstructure_status_fetcher_.get() && |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 169 | superstructure_status_fetcher_->zeroed()) { |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 170 | if (waiting_for_zero_) { |
Austin Schuh | f257f3c | 2019-10-27 21:00:43 -0700 | [diff] [blame] | 171 | AOS_LOG(DEBUG, "Zeroed! Starting teleop mode.\n"); |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 172 | waiting_for_zero_ = false; |
| 173 | } |
| 174 | } else { |
| 175 | waiting_for_zero_ = true; |
| 176 | } |
| 177 | |
Austin Schuh | add6d79 | 2016-03-19 01:20:01 -0700 | [diff] [blame] | 178 | double intake_when_shooting = kMaxIntakeAngleBeforeArmInterference; |
| 179 | bool use_slow_profile = false; |
| 180 | if (vision_action_running_) { |
| 181 | use_slow_profile = true; |
| 182 | if (vision_valid_) { |
| 183 | intake_when_shooting -= 0.5; |
| 184 | } |
| 185 | } |
| 186 | |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 187 | if (data.IsPressed(kFrontLong)) { |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 188 | // Forwards shot |
Austin Schuh | 3d79cc0 | 2016-03-20 21:08:53 -0700 | [diff] [blame] | 189 | shoulder_goal_ = M_PI / 2.0 + 0.1; |
Austin Schuh | 6a871ff | 2016-05-01 12:31:23 -0700 | [diff] [blame] | 190 | wrist_goal_ = M_PI + 0.41 + 0.02 - 0.005; |
Austin Schuh | bd0a40f | 2019-06-30 14:56:31 -0700 | [diff] [blame] | 191 | drivetrain_status_fetcher_.Fetch(); |
| 192 | if (drivetrain_status_fetcher_.get()) { |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 193 | wrist_goal_ += drivetrain_status_fetcher_->ground_angle(); |
Austin Schuh | b009964 | 2016-04-03 21:37:27 -0700 | [diff] [blame] | 194 | } |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 195 | shooter_velocity_ = 640.0; |
Austin Schuh | add6d79 | 2016-03-19 01:20:01 -0700 | [diff] [blame] | 196 | intake_goal_ = intake_when_shooting; |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 197 | } else if (data.IsPressed(kBackLong)) { |
| 198 | // Backwards shot |
Austin Schuh | 3d79cc0 | 2016-03-20 21:08:53 -0700 | [diff] [blame] | 199 | shoulder_goal_ = M_PI / 2.0 - 0.4; |
Austin Schuh | e153c5a | 2016-04-20 20:18:42 -0700 | [diff] [blame] | 200 | wrist_goal_ = -0.62 - 0.02; |
Austin Schuh | bd0a40f | 2019-06-30 14:56:31 -0700 | [diff] [blame] | 201 | drivetrain_status_fetcher_.Fetch(); |
| 202 | if (drivetrain_status_fetcher_.get()) { |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 203 | wrist_goal_ += drivetrain_status_fetcher_->ground_angle(); |
Austin Schuh | b009964 | 2016-04-03 21:37:27 -0700 | [diff] [blame] | 204 | } |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 205 | shooter_velocity_ = 640.0; |
Austin Schuh | add6d79 | 2016-03-19 01:20:01 -0700 | [diff] [blame] | 206 | intake_goal_ = intake_when_shooting; |
Austin Schuh | 45d07f6 | 2016-03-13 15:33:31 -0700 | [diff] [blame] | 207 | } else if (data.IsPressed(kBackFender)) { |
Adam Snaider | a3271fe | 2016-10-26 21:03:38 -0700 | [diff] [blame] | 208 | // Backwards shot no IMU |
| 209 | shoulder_goal_ = M_PI / 2.0 - 0.4; |
| 210 | wrist_goal_ = -0.62 - 0.02; |
| 211 | shooter_velocity_ = 640.0; |
Austin Schuh | add6d79 | 2016-03-19 01:20:01 -0700 | [diff] [blame] | 212 | intake_goal_ = intake_when_shooting; |
Austin Schuh | 45d07f6 | 2016-03-13 15:33:31 -0700 | [diff] [blame] | 213 | } else if (data.IsPressed(kFrontFender)) { |
Adam Snaider | a3271fe | 2016-10-26 21:03:38 -0700 | [diff] [blame] | 214 | // Forwards shot no IMU |
Austin Schuh | 6a871ff | 2016-05-01 12:31:23 -0700 | [diff] [blame] | 215 | shoulder_goal_ = M_PI / 2.0 + 0.1; |
Adam Snaider | a3271fe | 2016-10-26 21:03:38 -0700 | [diff] [blame] | 216 | wrist_goal_ = M_PI + 0.41 + 0.02 - 0.005; |
Austin Schuh | 6a871ff | 2016-05-01 12:31:23 -0700 | [diff] [blame] | 217 | shooter_velocity_ = 640.0; |
Austin Schuh | add6d79 | 2016-03-19 01:20:01 -0700 | [diff] [blame] | 218 | intake_goal_ = intake_when_shooting; |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 219 | } else if (data.IsPressed(kExpand) || data.IsPressed(kWinch)) { |
| 220 | // Set the goals to the hanging position so when the actor finishes, we |
| 221 | // will still be at the right spot. |
| 222 | shoulder_goal_ = 1.2; |
Austin Schuh | fef64ac | 2016-04-24 19:08:01 -0700 | [diff] [blame] | 223 | wrist_goal_ = 1.0; |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 224 | intake_goal_ = 0.0; |
| 225 | if (data.PosEdge(kExpand)) { |
| 226 | is_expanding_ = true; |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 227 | actors::superstructure_action::SuperstructureActionParamsT params; |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 228 | params.partial_angle = 0.3; |
| 229 | params.delay_time = 0.7; |
| 230 | params.full_angle = shoulder_goal_; |
Austin Schuh | fef64ac | 2016-04-24 19:08:01 -0700 | [diff] [blame] | 231 | params.shooter_angle = wrist_goal_; |
Austin Schuh | a250b2d | 2019-05-27 16:14:02 -0700 | [diff] [blame] | 232 | EnqueueAction(superstructure_action_factory_.Make(params)); |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 233 | } |
| 234 | if (data.IsPressed(kWinch)) { |
| 235 | voltage_climber = 12.0; |
| 236 | } |
Austin Schuh | de802e9 | 2016-02-27 14:49:03 -0800 | [diff] [blame] | 237 | } else { |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 238 | wrist_goal_ = 0.0; |
Austin Schuh | 3f0b119 | 2016-03-12 13:03:56 -0800 | [diff] [blame] | 239 | shoulder_goal_ = -0.010; |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 240 | shooter_velocity_ = 0.0; |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 241 | } |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 242 | if (data.NegEdge(kExpand) || voltage_climber > 1.0) { |
| 243 | is_expanding_ = false; |
Austin Schuh | a250b2d | 2019-05-27 16:14:02 -0700 | [diff] [blame] | 244 | CancelAllActions(); |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 245 | } |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 246 | |
Comran Morshed | aa0573c | 2016-03-05 19:05:54 +0000 | [diff] [blame] | 247 | bool ball_detected = false; |
Austin Schuh | 4b652c9 | 2019-05-27 13:22:27 -0700 | [diff] [blame] | 248 | ball_detector_fetcher_.Fetch(); |
| 249 | if (ball_detector_fetcher_.get()) { |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 250 | ball_detected = ball_detector_fetcher_->voltage() > 2.5; |
Comran Morshed | aa0573c | 2016-03-05 19:05:54 +0000 | [diff] [blame] | 251 | } |
| 252 | if (data.PosEdge(kIntakeIn)) { |
| 253 | saw_ball_when_started_intaking_ = ball_detected; |
| 254 | } |
| 255 | |
Austin Schuh | 45d07f6 | 2016-03-13 15:33:31 -0700 | [diff] [blame] | 256 | if (data.IsPressed(kIntakeIn)) { |
| 257 | is_intaking_ = (!ball_detected || saw_ball_when_started_intaking_); |
| 258 | if (ball_detected) { |
| 259 | force_lights_on = true; |
| 260 | } |
| 261 | } else { |
| 262 | is_intaking_ = false; |
| 263 | } |
| 264 | |
Austin Schuh | d52df77 | 2016-03-19 15:38:41 -0700 | [diff] [blame] | 265 | fire_ = false; |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 266 | if (data.IsPressed(kFire) && shooter_velocity_ != 0.0) { |
Austin Schuh | d52df77 | 2016-03-19 15:38:41 -0700 | [diff] [blame] | 267 | if (data.IsPressed(kVisionAlign)) { |
| 268 | // Make sure that we are lined up. |
Austin Schuh | bd0a40f | 2019-06-30 14:56:31 -0700 | [diff] [blame] | 269 | drivetrain_status_fetcher_.Fetch(); |
| 270 | drivetrain_goal_fetcher_.Fetch(); |
| 271 | if (drivetrain_status_fetcher_.get() && |
| 272 | drivetrain_goal_fetcher_.get()) { |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 273 | const double left_goal = drivetrain_goal_fetcher_->left_goal(); |
| 274 | const double right_goal = drivetrain_goal_fetcher_->right_goal(); |
Austin Schuh | d52df77 | 2016-03-19 15:38:41 -0700 | [diff] [blame] | 275 | const double left_current = |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 276 | drivetrain_status_fetcher_->estimated_left_position(); |
Austin Schuh | d52df77 | 2016-03-19 15:38:41 -0700 | [diff] [blame] | 277 | const double right_current = |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 278 | drivetrain_status_fetcher_->estimated_right_position(); |
Austin Schuh | d52df77 | 2016-03-19 15:38:41 -0700 | [diff] [blame] | 279 | const double left_velocity = |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 280 | drivetrain_status_fetcher_->estimated_left_velocity(); |
Austin Schuh | d52df77 | 2016-03-19 15:38:41 -0700 | [diff] [blame] | 281 | const double right_velocity = |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 282 | drivetrain_status_fetcher_->estimated_right_velocity(); |
Austin Schuh | d52df77 | 2016-03-19 15:38:41 -0700 | [diff] [blame] | 283 | if (vision_action_running_ && ::std::abs(last_angle_) < 0.02 && |
| 284 | ::std::abs((left_goal - right_goal) - |
| 285 | (left_current - right_current)) / |
Austin Schuh | a250b2d | 2019-05-27 16:14:02 -0700 | [diff] [blame] | 286 | dt_config().robot_radius / 2.0 < |
Austin Schuh | d52df77 | 2016-03-19 15:38:41 -0700 | [diff] [blame] | 287 | 0.02 && |
| 288 | ::std::abs(left_velocity - right_velocity) < 0.01) { |
| 289 | ++ready_to_fire_; |
| 290 | } else { |
| 291 | ready_to_fire_ = 0; |
| 292 | } |
Austin Schuh | 3d79cc0 | 2016-03-20 21:08:53 -0700 | [diff] [blame] | 293 | if (ready_to_fire_ > 9) { |
Austin Schuh | d52df77 | 2016-03-19 15:38:41 -0700 | [diff] [blame] | 294 | fire_ = true; |
| 295 | } |
| 296 | } |
| 297 | } else { |
| 298 | fire_ = true; |
| 299 | } |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 300 | } |
| 301 | |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 302 | is_outtaking_ = data.IsPressed(kIntakeOut); |
Austin Schuh | 5a6db4d | 2016-02-28 22:02:42 -0800 | [diff] [blame] | 303 | |
Austin Schuh | d52df77 | 2016-03-19 15:38:41 -0700 | [diff] [blame] | 304 | if (is_intaking_ || is_outtaking_) { |
| 305 | recently_intaking_accumulator_ = 20; |
| 306 | } |
| 307 | |
| 308 | if (data.IsPressed(kIntakeDown)) { |
| 309 | if (recently_intaking_accumulator_) { |
| 310 | intake_goal_ = 0.1; |
| 311 | } else { |
| 312 | intake_goal_ = -0.05; |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | if (recently_intaking_accumulator_ > 0) { |
| 317 | --recently_intaking_accumulator_; |
| 318 | } |
| 319 | |
Austin Schuh | 843412b | 2016-03-20 16:48:46 -0700 | [diff] [blame] | 320 | if (data.IsPressed(kPortcullis)) { |
| 321 | traverse_unlatched_ = true; |
| 322 | traverse_down_ = true; |
| 323 | } else if (data.IsPressed(kChevalDeFrise)) { |
| 324 | traverse_unlatched_ = false; |
| 325 | traverse_down_ = true; |
| 326 | } else { |
| 327 | traverse_unlatched_ = true; |
| 328 | traverse_down_ = false; |
| 329 | } |
| 330 | |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 331 | if (!waiting_for_zero_) { |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 332 | if (!is_expanding_) { |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 333 | auto builder = superstructure_goal_sender_.MakeBuilder(); |
Austin Schuh | 3f0b119 | 2016-03-12 13:03:56 -0800 | [diff] [blame] | 334 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 335 | ::y2016::control_loops::superstructure::Goal::Builder |
| 336 | superstructure_builder = builder.MakeBuilder< |
| 337 | ::y2016::control_loops::superstructure::Goal>(); |
| 338 | superstructure_builder.add_angle_intake(intake_goal_); |
| 339 | superstructure_builder.add_angle_shoulder(shoulder_goal_); |
| 340 | superstructure_builder.add_angle_wrist(wrist_goal_); |
| 341 | |
| 342 | superstructure_builder.add_max_angular_velocity_intake(7.0); |
| 343 | superstructure_builder.add_max_angular_velocity_shoulder(4.0); |
| 344 | superstructure_builder.add_max_angular_velocity_wrist(10.0); |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 345 | if (use_slow_profile) { |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 346 | superstructure_builder.add_max_angular_acceleration_intake(10.0); |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 347 | } else { |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 348 | superstructure_builder.add_max_angular_acceleration_intake(40.0); |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 349 | } |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 350 | superstructure_builder.add_max_angular_acceleration_shoulder(10.0); |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 351 | if (shoulder_goal_ > 1.0) { |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 352 | superstructure_builder.add_max_angular_acceleration_wrist(45.0); |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 353 | } else { |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 354 | superstructure_builder.add_max_angular_acceleration_wrist(25.0); |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 355 | } |
Austin Schuh | 3f0b119 | 2016-03-12 13:03:56 -0800 | [diff] [blame] | 356 | |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 357 | // Granny mode |
| 358 | /* |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 359 | superstructure_builder.add_max_angular_velocity_intake(0.2); |
| 360 | superstructure_builder.add_max_angular_velocity_shoulder(0.2); |
| 361 | superstructure_builder.add_max_angular_velocity_wrist(0.2); |
| 362 | superstructure_builder.add_max_angular_acceleration_intake(1.0); |
| 363 | superstructure_builder.add_max_angular_acceleration_shoulder(1.0); |
| 364 | superstructure_builder.add_max_angular_acceleration_wrist(1.0); |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 365 | */ |
| 366 | if (is_intaking_) { |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 367 | superstructure_builder.add_voltage_top_rollers(12.0); |
| 368 | superstructure_builder.add_voltage_bottom_rollers(12.0); |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 369 | } else if (is_outtaking_) { |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 370 | superstructure_builder.add_voltage_top_rollers(-12.0); |
| 371 | superstructure_builder.add_voltage_bottom_rollers(-7.0); |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 372 | } else { |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 373 | superstructure_builder.add_voltage_top_rollers(0.0); |
| 374 | superstructure_builder.add_voltage_bottom_rollers(0.0); |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 375 | } |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 376 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 377 | superstructure_builder.add_traverse_unlatched(traverse_unlatched_); |
| 378 | superstructure_builder.add_unfold_climber(false); |
| 379 | superstructure_builder.add_voltage_climber(voltage_climber); |
| 380 | superstructure_builder.add_traverse_down(traverse_down_); |
| 381 | superstructure_builder.add_force_intake(true); |
Austin Schuh | 843412b | 2016-03-20 16:48:46 -0700 | [diff] [blame] | 382 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 383 | if (!builder.Send(superstructure_builder.Finish())) { |
Austin Schuh | f257f3c | 2019-10-27 21:00:43 -0700 | [diff] [blame] | 384 | AOS_LOG(ERROR, "Sending superstructure goal failed.\n"); |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 385 | } else { |
Austin Schuh | f257f3c | 2019-10-27 21:00:43 -0700 | [diff] [blame] | 386 | AOS_LOG(DEBUG, "sending goals: intake: %f, shoulder: %f, wrist: %f\n", |
| 387 | intake_goal_, shoulder_goal_, wrist_goal_); |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 388 | } |
Austin Schuh | add6d79 | 2016-03-19 01:20:01 -0700 | [diff] [blame] | 389 | } |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 390 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 391 | { |
| 392 | auto builder = shooter_goal_sender_.MakeBuilder(); |
| 393 | y2016::control_loops::shooter::Goal::Builder shooter_builder = |
| 394 | builder.MakeBuilder<y2016::control_loops::shooter::Goal>(); |
| 395 | shooter_builder.add_angular_velocity(shooter_velocity_); |
| 396 | shooter_builder.add_clamp_open(is_intaking_ || is_outtaking_); |
| 397 | shooter_builder.add_push_to_shooter(fire_); |
| 398 | shooter_builder.add_force_lights_on(force_lights_on); |
| 399 | shooter_builder.add_shooting_forwards(wrist_goal_ > 0); |
Austin Schuh | ae023fb | 2019-06-29 17:11:45 -0700 | [diff] [blame] | 400 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 401 | if (!builder.Send(shooter_builder.Finish())) { |
| 402 | AOS_LOG(ERROR, "Sending shooter goal failed.\n"); |
| 403 | } |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 404 | } |
| 405 | } |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 406 | } |
| 407 | |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 408 | private: |
Austin Schuh | 1bf8a21 | 2019-05-26 22:13:14 -0700 | [diff] [blame] | 409 | ::aos::Fetcher<::y2016::vision::VisionStatus> vision_status_fetcher_; |
Austin Schuh | 4b652c9 | 2019-05-27 13:22:27 -0700 | [diff] [blame] | 410 | ::aos::Fetcher<::y2016::sensors::BallDetector> ball_detector_fetcher_; |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 411 | ::aos::Sender<::y2016::control_loops::shooter::Goal> |
Austin Schuh | ae023fb | 2019-06-29 17:11:45 -0700 | [diff] [blame] | 412 | shooter_goal_sender_; |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 413 | ::aos::Fetcher<::y2016::control_loops::superstructure::Status> |
Austin Schuh | 9481d0d | 2019-06-29 21:56:17 -0700 | [diff] [blame] | 414 | superstructure_status_fetcher_; |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 415 | ::aos::Sender<::y2016::control_loops::superstructure::Goal> |
Austin Schuh | 9481d0d | 2019-06-29 21:56:17 -0700 | [diff] [blame] | 416 | superstructure_goal_sender_; |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 417 | ::aos::Fetcher<::frc971::control_loops::drivetrain::Goal> |
Austin Schuh | bd0a40f | 2019-06-30 14:56:31 -0700 | [diff] [blame] | 418 | drivetrain_goal_fetcher_; |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 419 | ::aos::Fetcher<::frc971::control_loops::drivetrain::Status> |
Austin Schuh | bd0a40f | 2019-06-30 14:56:31 -0700 | [diff] [blame] | 420 | drivetrain_status_fetcher_; |
Austin Schuh | 1bf8a21 | 2019-05-26 22:13:14 -0700 | [diff] [blame] | 421 | |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 422 | // Whatever these are set to are our default goals to send out after zeroing. |
| 423 | double intake_goal_; |
| 424 | double shoulder_goal_; |
| 425 | double wrist_goal_; |
Austin Schuh | de802e9 | 2016-02-27 14:49:03 -0800 | [diff] [blame] | 426 | double shooter_velocity_ = 0.0; |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 427 | |
Austin Schuh | 843412b | 2016-03-20 16:48:46 -0700 | [diff] [blame] | 428 | bool traverse_unlatched_ = false; |
| 429 | bool traverse_down_ = false; |
| 430 | |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 431 | // If we're waiting for the subsystems to zero. |
| 432 | bool waiting_for_zero_ = true; |
| 433 | |
Comran Morshed | aa0573c | 2016-03-05 19:05:54 +0000 | [diff] [blame] | 434 | // If true, the ball was present when the intaking button was pressed. |
| 435 | bool saw_ball_when_started_intaking_ = false; |
| 436 | |
Austin Schuh | de802e9 | 2016-02-27 14:49:03 -0800 | [diff] [blame] | 437 | bool is_intaking_ = false; |
Austin Schuh | 5a6db4d | 2016-02-28 22:02:42 -0800 | [diff] [blame] | 438 | bool is_outtaking_ = false; |
Austin Schuh | de802e9 | 2016-02-27 14:49:03 -0800 | [diff] [blame] | 439 | bool fire_ = false; |
| 440 | |
Austin Schuh | add6d79 | 2016-03-19 01:20:01 -0700 | [diff] [blame] | 441 | bool vision_action_running_ = false; |
| 442 | bool vision_valid_ = false; |
| 443 | |
Austin Schuh | d52df77 | 2016-03-19 15:38:41 -0700 | [diff] [blame] | 444 | int recently_intaking_accumulator_ = 0; |
| 445 | double last_angle_ = 100; |
| 446 | |
| 447 | int ready_to_fire_ = 0; |
| 448 | |
Diana Vandenberg | 9cc9ab6 | 2016-04-20 21:27:47 -0700 | [diff] [blame] | 449 | bool is_expanding_ = false; |
| 450 | |
Austin Schuh | 1bf8a21 | 2019-05-26 22:13:14 -0700 | [diff] [blame] | 451 | actors::VisionAlignActor::Factory vision_align_action_factory_; |
| 452 | actors::SuperstructureActor::Factory superstructure_action_factory_; |
| 453 | |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 454 | ::aos::util::SimpleLogInterval no_drivetrain_status_ = |
Austin Schuh | 61bdc60 | 2016-12-04 19:10:10 -0800 | [diff] [blame] | 455 | ::aos::util::SimpleLogInterval(::std::chrono::milliseconds(200), WARNING, |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 456 | "no drivetrain status"); |
| 457 | }; |
| 458 | |
| 459 | } // namespace joysticks |
| 460 | } // namespace input |
Comran Morshed | 6c6a0a9 | 2016-01-17 12:45:16 +0000 | [diff] [blame] | 461 | } // namespace y2016 |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 462 | |
| 463 | int main() { |
James Kuszmaul | ad8a808 | 2020-02-14 21:21:58 -0800 | [diff] [blame] | 464 | ::aos::InitNRT(); |
Austin Schuh | 9fe68f7 | 2019-08-10 19:32:03 -0700 | [diff] [blame] | 465 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 466 | aos::FlatbufferDetachedBuffer<aos::Configuration> config = |
| 467 | aos::configuration::ReadConfig("config.json"); |
| 468 | |
| 469 | ::aos::ShmEventLoop event_loop(&config.message()); |
Austin Schuh | 3e45c75 | 2019-02-02 12:19:11 -0800 | [diff] [blame] | 470 | ::y2016::input::joysticks::Reader reader(&event_loop); |
Austin Schuh | 9fe68f7 | 2019-08-10 19:32:03 -0700 | [diff] [blame] | 471 | |
| 472 | event_loop.Run(); |
| 473 | |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 474 | ::aos::Cleanup(); |
| 475 | } |