brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 1 | #ifndef FRC971_CONTROL_LOOPS_DRIVETRAIN_H_ |
| 2 | #define FRC971_CONTROL_LOOPS_DRIVETRAIN_H_ |
| 3 | |
Austin Schuh | 2054f5f | 2013-10-27 14:54:10 -0700 | [diff] [blame^] | 4 | #include "Eigen/Dense" |
| 5 | |
| 6 | #include "aos/controls/polytope.h" |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 7 | #include "aos/common/control_loop/ControlLoop.h" |
James Kuszmaul | f254c1a | 2013-03-10 16:31:26 -0700 | [diff] [blame] | 8 | #include "frc971/control_loops/drivetrain/drivetrain.q.h" |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 9 | |
| 10 | namespace frc971 { |
| 11 | namespace control_loops { |
| 12 | |
Austin Schuh | 2054f5f | 2013-10-27 14:54:10 -0700 | [diff] [blame^] | 13 | Eigen::Matrix<double, 2, 1> CoerceGoal(aos::controls::HPolytope<2> ®ion, |
| 14 | const Eigen::Matrix<double, 1, 2> &K, |
| 15 | double w, |
| 16 | const Eigen::Matrix<double, 2, 1> &R); |
| 17 | |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 18 | class DrivetrainLoop |
| 19 | : public aos::control_loops::ControlLoop<control_loops::Drivetrain> { |
| 20 | public: |
| 21 | // Constructs a control loop which can take a Drivetrain or defaults to the |
| 22 | // drivetrain at frc971::control_loops::drivetrain |
| 23 | explicit DrivetrainLoop( |
| 24 | control_loops::Drivetrain *my_drivetrain = &control_loops::drivetrain) |
| 25 | : aos::control_loops::ControlLoop<control_loops::Drivetrain>( |
| 26 | my_drivetrain) {} |
| 27 | |
| 28 | protected: |
| 29 | // Executes one cycle of the control loop. |
| 30 | virtual void RunIteration( |
| 31 | const control_loops::Drivetrain::Goal *goal, |
| 32 | const control_loops::Drivetrain::Position *position, |
| 33 | control_loops::Drivetrain::Output *output, |
| 34 | control_loops::Drivetrain::Status *status); |
| 35 | }; |
| 36 | |
| 37 | } // namespace control_loops |
| 38 | } // namespace frc971 |
| 39 | |
| 40 | #endif // FRC971_CONTROL_LOOPS_DRIVETRAIN_H_ |