Daniel Petti | aece37f | 2014-10-25 17:13:44 -0700 | [diff] [blame] | 1 | #ifndef BOT3_CONTROL_LOOPS_DRIVETRAIN_H_ |
| 2 | #define BOT3_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 "aos/common/util/log_interval.h" |
| 10 | #include "bot3/control_loops/drivetrain/drivetrain.q.h" |
| 11 | |
| 12 | namespace bot3 { |
| 13 | namespace control_loops { |
| 14 | |
| 15 | class DrivetrainLoop |
| 16 | : public aos::controls::ControlLoop<control_loops::Drivetrain, true, false> { |
| 17 | public: |
| 18 | // Constructs a control loop which can take a Drivetrain or defaults to the |
| 19 | // drivetrain at bot3::control_loops::drivetrain |
| 20 | explicit DrivetrainLoop( |
| 21 | control_loops::Drivetrain *my_drivetrain = &control_loops::drivetrain) |
| 22 | : aos::controls::ControlLoop<control_loops::Drivetrain, true, false>( |
| 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::Drivetrain::Goal *goal, |
| 31 | const control_loops::Drivetrain::Position *position, |
| 32 | control_loops::Drivetrain::Output *output, |
| 33 | control_loops::Drivetrain::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 bot3 |
| 42 | |
| 43 | #endif // BOT3_CONTROL_LOOPS_DRIVETRAIN_H_ |