Philipp Schrader | e8ad638 | 2017-04-09 21:51:21 +0000 | [diff] [blame] | 1 | #ifndef FRC971_SHOOTER_INTERPOLATION_INTERPOLATION_H_ |
| 2 | #define FRC971_SHOOTER_INTERPOLATION_INTERPOLATION_H_ |
| 3 | |
| 4 | #include <utility> |
| 5 | #include <vector> |
| 6 | |
| 7 | namespace frc971 { |
| 8 | namespace shooter_interpolation { |
| 9 | |
| 10 | // Struct for shot angle and power |
| 11 | struct ShotParams { |
| 12 | double angle; |
| 13 | double power; |
| 14 | }; |
| 15 | |
| 16 | class InterpolationTable { |
| 17 | public: |
Philipp Schrader | 9a83336 | 2017-04-09 22:56:16 +0000 | [diff] [blame] | 18 | InterpolationTable() = default; |
Philipp Schrader | e8ad638 | 2017-04-09 21:51:21 +0000 | [diff] [blame] | 19 | InterpolationTable( |
Philipp Schrader | 9a83336 | 2017-04-09 22:56:16 +0000 | [diff] [blame] | 20 | const ::std::vector<::std::pair<double, ShotParams>> &table); |
Philipp Schrader | e8ad638 | 2017-04-09 21:51:21 +0000 | [diff] [blame] | 21 | |
| 22 | // Uses the interpolation table to calculate the optimal shooter angle and |
| 23 | // power for a shot |
Parker Schuh | 208a58d | 2017-04-12 20:51:38 -0700 | [diff] [blame] | 24 | ShotParams GetShooterData(double distance) const; |
Philipp Schrader | e8ad638 | 2017-04-09 21:51:21 +0000 | [diff] [blame] | 25 | |
| 26 | private: |
| 27 | // Contains the list of angle entries in the interpolation table |
Philipp Schrader | 9a83336 | 2017-04-09 22:56:16 +0000 | [diff] [blame] | 28 | ::std::vector<::std::pair<double, ShotParams>> table_; |
Philipp Schrader | e8ad638 | 2017-04-09 21:51:21 +0000 | [diff] [blame] | 29 | }; |
| 30 | |
| 31 | } // namespace shooter_interpolation |
| 32 | } // namespace frc971 |
| 33 | |
| 34 | #endif // FRC971_SHOOTER_INTERPOLATION_INTERPOLATION_H_ |