blob: 4bb7ac98c4c0d172c2bfb760b6e0416085134aee [file] [log] [blame]
Alex Perry731b4602019-02-02 22:13:01 -08001#ifndef FRC971_CONTROL_LOOPS_DRIVETRAIN_SPLINEDRIVETRAIN_H_
2#define FRC971_CONTROL_LOOPS_DRIVETRAIN_SPLINEDRIVETRAIN_H_
3
Alex Perrya71badb2019-02-06 19:40:41 -08004#include "Eigen/Dense"
5
Alex Perry731b4602019-02-02 22:13:01 -08006#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
12namespace frc971 {
13namespace control_loops {
14namespace drivetrain {
15
16class SplineDrivetrain {
17 public:
18 SplineDrivetrain(const DrivetrainConfig<double> &dt_config);
19
20 void SetGoal(const ::frc971::control_loops::DrivetrainQueue::Goal &goal);
21
Alex Perrya71badb2019-02-06 19:40:41 -080022 void Update(bool enabled);
23
Alex Perry731b4602019-02-02 22:13:01 -080024 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 Perrya71badb2019-02-06 19:40:41 -080036 ::Eigen::Matrix<double, 3, 1> current_xva_, next_xva_;
37 ::Eigen::Matrix<double, 2, 1> current_state_;
Alex Perry731b4602019-02-02 22:13:01 -080038};
39
40} // namespace drivetrain
41} // namespace control_loops
42} // namespace frc971
43
44#endif // FRC971_CONTROL_LOOPS_DRIVETRAIN_SPLINEDRIVETRAIN_H_