Comran Morshed | 0d6cf9b | 2015-06-17 19:29:57 +0000 | [diff] [blame^] | 1 | #include <stdio.h> |
| 2 | |
| 3 | #include <memory> |
| 4 | |
| 5 | #include "aos/common/util/phased_loop.h" |
| 6 | #include "aos/common/time.h" |
| 7 | #include "aos/common/util/trapezoid_profile.h" |
| 8 | #include "aos/common/logging/logging.h" |
| 9 | #include "aos/common/logging/queue_logging.h" |
| 10 | |
| 11 | #include "bot3/autonomous/auto.q.h" |
| 12 | #include "bot3/control_loops/drivetrain/drivetrain.q.h" |
| 13 | #include "frc971/actors/drivetrain_actor.h" |
| 14 | |
| 15 | using ::aos::time::Time; |
| 16 | using ::bot3::control_loops::drivetrain_queue; |
| 17 | |
| 18 | namespace bot3 { |
| 19 | namespace autonomous { |
| 20 | |
| 21 | struct ProfileParams { |
| 22 | double velocity; |
| 23 | double acceleration; |
| 24 | }; |
| 25 | |
| 26 | namespace time = ::aos::time; |
| 27 | |
| 28 | bool ShouldExitAuto() { |
| 29 | ::bot3::autonomous::autonomous.FetchLatest(); |
| 30 | bool ans = !::bot3::autonomous::autonomous->run_auto; |
| 31 | if (ans) { |
| 32 | LOG(INFO, "Time to exit auto mode\n"); |
| 33 | } |
| 34 | return ans; |
| 35 | } |
| 36 | |
| 37 | void HandleAuto() { |
| 38 | ::aos::time::Time start_time = ::aos::time::Time::Now(); |
| 39 | LOG(INFO, "Starting auto mode at %f\n", start_time.ToSeconds()); |
| 40 | ::std::unique_ptr<::frc971::actors::DrivetrainAction> drive; |
| 41 | LOG(INFO, "Doing nothing in auto.\n"); |
| 42 | |
| 43 | if (ShouldExitAuto()) return; |
| 44 | } |
| 45 | |
| 46 | } // namespace autonomous |
| 47 | } // namespace bot3 |