Austin Schuh | 6979266 | 2015-02-22 21:39:52 -0800 | [diff] [blame] | 1 | #include <math.h> |
| 2 | |
| 3 | #include "aos/common/time.h" |
| 4 | #include "frc971/actors/lift_actor.h" |
Austin Schuh | 6979266 | 2015-02-22 21:39:52 -0800 | [diff] [blame] | 5 | #include "frc971/constants.h" |
Austin Schuh | 6e242ac | 2015-03-07 17:08:21 -0800 | [diff] [blame^] | 6 | #include "frc971/actors/fridge_profile_lib.h" |
Austin Schuh | 6979266 | 2015-02-22 21:39:52 -0800 | [diff] [blame] | 7 | |
| 8 | namespace frc971 { |
| 9 | namespace actors { |
| 10 | namespace { |
Austin Schuh | 6e242ac | 2015-03-07 17:08:21 -0800 | [diff] [blame^] | 11 | constexpr ProfileParams kArmMove{0.6, 2.0}; |
| 12 | constexpr ProfileParams kElevatorMove{0.9, 3.0}; |
Austin Schuh | 6979266 | 2015-02-22 21:39:52 -0800 | [diff] [blame] | 13 | } // namespace |
| 14 | |
| 15 | LiftActor::LiftActor(LiftActionQueueGroup *queues) |
Austin Schuh | 6e242ac | 2015-03-07 17:08:21 -0800 | [diff] [blame^] | 16 | : FridgeActorBase<LiftActionQueueGroup>(queues) {} |
Austin Schuh | 6979266 | 2015-02-22 21:39:52 -0800 | [diff] [blame] | 17 | |
| 18 | bool LiftActor::RunAction(const LiftParams ¶ms) { |
| 19 | // Lift the box straight up. |
Austin Schuh | 6e242ac | 2015-03-07 17:08:21 -0800 | [diff] [blame^] | 20 | DoFridgeProfile(params.lift_height, 0.0, kElevatorMove, kArmMove, true); |
Austin Schuh | 6979266 | 2015-02-22 21:39:52 -0800 | [diff] [blame] | 21 | // Move it back to the storage location. |
Austin Schuh | 6e242ac | 2015-03-07 17:08:21 -0800 | [diff] [blame^] | 22 | DoFridgeProfile(params.lift_height, params.lift_arm, kElevatorMove, kArmMove, |
| 23 | true); |
Austin Schuh | 6979266 | 2015-02-22 21:39:52 -0800 | [diff] [blame] | 24 | |
| 25 | return true; |
| 26 | } |
| 27 | |
| 28 | ::std::unique_ptr<LiftAction> MakeLiftAction(const LiftParams ¶ms) { |
| 29 | return ::std::unique_ptr<LiftAction>( |
| 30 | new LiftAction(&::frc971::actors::lift_action, params)); |
| 31 | } |
| 32 | |
| 33 | } // namespace actors |
| 34 | } // namespace frc971 |