blob: daf24be5cc20fbd34ae4e609fe31e7b69db22e61 [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[] = {
Brian Silverman6742a442013-11-03 12:58:42 -080013 {-0.050781, 4.7498},
14 {-0.0375, 4.318},
15 {0.028125, 3.9878},
16 {0.080469, 3.51},
17 {0.126563, 3.1496},
18 {0.131, 2.9972},
19 {0.144, 2.921},
20 {0.196, 3.2258},
21 // Below here is junk because it starts coming off of the tower base.
22 {0.296875, 2.667},
23 {0.351562, 2.3876},
Brian Silverman68a5a012013-03-29 23:37:04 -070024};
25
Austin Schuh86bec782013-04-04 05:50:52 +000026// Must be in reverse order in meters.
Brian Silverman68a5a012013-03-29 23:37:04 -070027static const Interpolation kMetersToShooterSpeeds[] = {
Brian Silverman6742a442013-11-03 12:58:42 -080028 {2.0, 375.0},
29 {3.0, 360.0},
30 {4.5, 375.0},
Brian Silverman68a5a012013-03-29 23:37:04 -070031};
32
33static const Interpolation kMetersToShooterAngles[] = {
Brian Silverman6742a442013-11-03 12:58:42 -080034 {3.0, 0.68},
35 {3.7, 0.635},
36 {4.15, 0.58},
37 {5.0, 0.51},
Brian Silverman68a5a012013-03-29 23:37:04 -070038};
Brian Silverman6ae77dd2013-03-29 22:28:08 -070039
40double interpolate(int num_interp_vals,
41 const Interpolation *interp, double value);
42
Brian Silverman68a5a012013-03-29 23:37:04 -070043} // namespace frc971
Brian Silverman6ae77dd2013-03-29 22:28:08 -070044
Brian Silverman68a5a012013-03-29 23:37:04 -070045#endif // VISION_SENSOR_PROCESSOR_H_