blob: c219245d8dc0594e0bfabc68f17071bd60904278 [file] [log] [blame]
Brian Silverman68a5a012013-03-29 23:37:04 -07001#ifndef VISION_SENSOR_PROCESSOR_H_
2#define VISION_SENSOR_PROCESSOR_H_
Brian Silverman6ae77dd2013-03-29 22:28:08 -07003
Brian Silverman68a5a012013-03-29 23:37:04 -07004namespace frc971 {
Brian Silverman6ae77dd2013-03-29 22:28:08 -07005
6// struct maps a single point x to to a value f of x
7typedef struct {
8 double x;
9 double fx;
10} Interpolation;
11
Brian Silverman68a5a012013-03-29 23:37:04 -070012static const Interpolation kPixelsToMeters[] = {
13 {43.0 / 320.0, 12.573},
14 {98.0 / 320.0, 6.604},
15 {145.75 / 320.0, 4.420},
16 {216.75 / 320.0, 2.794},
17};
18
Austin Schuh86bec782013-04-04 05:50:52 +000019// Must be in reverse order in meters.
Brian Silverman68a5a012013-03-29 23:37:04 -070020static const Interpolation kMetersToShooterSpeeds[] = {
Austin Schuh86bec782013-04-04 05:50:52 +000021 {12.5, 375.0},
22 {21.0, 360.0},
23 {25.0, 375.0},
Brian Silverman68a5a012013-03-29 23:37:04 -070024};
25
26static const Interpolation kMetersToShooterAngles[] = {
Austin Schuh86bec782013-04-04 05:50:52 +000027 {0.0, 0.7267},
28 {12.5, 0.7267},
29 {16.5, 0.604},
30 {18.0, 0.587},
31 {20.0, 0.576},
32 {21.0, 0.550},
33 {23.0, 0.540},
Brian Silverman68a5a012013-03-29 23:37:04 -070034};
Brian Silverman6ae77dd2013-03-29 22:28:08 -070035
36double interpolate(int num_interp_vals,
37 const Interpolation *interp, double value);
38
Brian Silverman68a5a012013-03-29 23:37:04 -070039} // namespace frc971
Brian Silverman6ae77dd2013-03-29 22:28:08 -070040
Brian Silverman68a5a012013-03-29 23:37:04 -070041#endif // VISION_SENSOR_PROCESSOR_H_