Alex Perry | 731b460 | 2019-02-02 22:13:01 -0800 | [diff] [blame] | 1 | #ifndef FRC971_CONTROL_LOOPS_DRIVETRAIN_SPLINEDRIVETRAIN_H_ |
| 2 | #define FRC971_CONTROL_LOOPS_DRIVETRAIN_SPLINEDRIVETRAIN_H_ |
| 3 | |
Alex Perry | a71badb | 2019-02-06 19:40:41 -0800 | [diff] [blame^] | 4 | #include "Eigen/Dense" |
| 5 | |
Alex Perry | 731b460 | 2019-02-02 22:13:01 -0800 | [diff] [blame] | 6 | #include "frc971/control_loops/drivetrain/distance_spline.h" |
| 7 | #include "frc971/control_loops/drivetrain/drivetrain.q.h" |
| 8 | #include "frc971/control_loops/drivetrain/drivetrain_config.h" |
| 9 | #include "frc971/control_loops/drivetrain/spline.h" |
| 10 | #include "frc971/control_loops/drivetrain/trajectory.h" |
| 11 | |
| 12 | namespace frc971 { |
| 13 | namespace control_loops { |
| 14 | namespace drivetrain { |
| 15 | |
| 16 | class SplineDrivetrain { |
| 17 | public: |
| 18 | SplineDrivetrain(const DrivetrainConfig<double> &dt_config); |
| 19 | |
| 20 | void SetGoal(const ::frc971::control_loops::DrivetrainQueue::Goal &goal); |
| 21 | |
Alex Perry | a71badb | 2019-02-06 19:40:41 -0800 | [diff] [blame^] | 22 | void Update(bool enabled); |
| 23 | |
Alex Perry | 731b460 | 2019-02-02 22:13:01 -0800 | [diff] [blame] | 24 | void SetOutput( |
| 25 | ::frc971::control_loops::DrivetrainQueue::Output *output); |
| 26 | // TODO(alex): What status do we need? |
| 27 | void PopulateStatus( |
| 28 | ::frc971::control_loops::DrivetrainQueue::Status *status) const; |
| 29 | private: |
| 30 | const DrivetrainConfig<double> dt_config_; |
| 31 | |
| 32 | uint32_t current_spline_handle_; // Current spline told to excecute. |
| 33 | uint32_t current_spline_idx_; // Current excecuting spline. |
| 34 | ::std::unique_ptr<DistanceSpline> distance_spline_; |
| 35 | ::std::unique_ptr<Trajectory> current_trajectory_; |
Alex Perry | a71badb | 2019-02-06 19:40:41 -0800 | [diff] [blame^] | 36 | ::Eigen::Matrix<double, 3, 1> current_xva_, next_xva_; |
| 37 | ::Eigen::Matrix<double, 2, 1> current_state_; |
Alex Perry | 731b460 | 2019-02-02 22:13:01 -0800 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | } // namespace drivetrain |
| 41 | } // namespace control_loops |
| 42 | } // namespace frc971 |
| 43 | |
| 44 | #endif // FRC971_CONTROL_LOOPS_DRIVETRAIN_SPLINEDRIVETRAIN_H_ |