Brian Silverman | 17f503e | 2015-08-02 18:17:18 -0700 | [diff] [blame] | 1 | #ifndef Y2014_CONTROL_LOOPS_DRIVETRAIN_H_ |
| 2 | #define Y2014_CONTROL_LOOPS_DRIVETRAIN_H_ |
| 3 | |
| 4 | #include "Eigen/Dense" |
| 5 | |
| 6 | #include "aos/common/controls/polytope.h" |
| 7 | #include "aos/common/controls/control_loop.h" |
| 8 | #include "aos/common/controls/polytope.h" |
| 9 | #include "y2014/control_loops/drivetrain/drivetrain.q.h" |
| 10 | #include "aos/common/util/log_interval.h" |
| 11 | |
| 12 | namespace frc971 { |
| 13 | namespace control_loops { |
| 14 | |
| 15 | class DrivetrainLoop |
| 16 | : public aos::controls::ControlLoop<control_loops::DrivetrainQueue> { |
| 17 | public: |
| 18 | // Constructs a control loop which can take a Drivetrain or defaults to the |
| 19 | // drivetrain at frc971::control_loops::drivetrain |
| 20 | explicit DrivetrainLoop(control_loops::DrivetrainQueue *my_drivetrain = |
| 21 | &control_loops::drivetrain_queue) |
| 22 | : aos::controls::ControlLoop<control_loops::DrivetrainQueue>( |
| 23 | my_drivetrain) { |
| 24 | ::aos::controls::HPolytope<0>::Init(); |
| 25 | } |
| 26 | |
| 27 | protected: |
| 28 | // Executes one cycle of the control loop. |
| 29 | virtual void RunIteration( |
| 30 | const control_loops::DrivetrainQueue::Goal *goal, |
| 31 | const control_loops::DrivetrainQueue::Position *position, |
| 32 | control_loops::DrivetrainQueue::Output *output, |
| 33 | control_loops::DrivetrainQueue::Status *status); |
| 34 | |
| 35 | typedef ::aos::util::SimpleLogInterval SimpleLogInterval; |
| 36 | SimpleLogInterval no_position_ = SimpleLogInterval( |
| 37 | ::aos::time::Time::InSeconds(0.25), WARNING, "no position"); |
| 38 | }; |
| 39 | |
| 40 | } // namespace control_loops |
| 41 | } // namespace frc971 |
| 42 | |
| 43 | #endif // Y2014_CONTROL_LOOPS_DRIVETRAIN_H_ |