Add joystick angle to position mapper
Change-Id: I427b02b656662aad7726ca264d73900f388f9ae3
diff --git a/y2019/joystick_angle.h b/y2019/joystick_angle.h
new file mode 100644
index 0000000..a2c7e36
--- /dev/null
+++ b/y2019/joystick_angle.h
@@ -0,0 +1,37 @@
+#ifndef Y2019_JOYSTICK_ANGLE_H_
+#define Y2019_JOYSTICK_ANGLE_H_
+
+#include "aos/input/driver_station_data.h"
+
+using ::aos::input::driver_station::JoystickAxis;
+using ::aos::input::driver_station::Data;
+
+namespace y2019 {
+namespace input {
+namespace joysticks {
+namespace {
+constexpr double kJoystickLeft = -0.5;
+constexpr double kJoystickRight = 0.5;
+constexpr double kJoystickUp = 0.5;
+constexpr double kJoystickDown = -0.5;
+}
+
+enum class JoystickAngle {
+ kDefault,
+ kUpperRight,
+ kMiddleRight,
+ kLowerRight,
+ kUpperLeft,
+ kMiddleLeft,
+ kLowerLeft
+};
+
+JoystickAngle GetJoystickPosition(const JoystickAxis &x_axis,
+ const JoystickAxis &y_axis, const Data &data);
+JoystickAngle GetJoystickPosition(float x_axis, float y_axis);
+
+} // namespace joysticks
+} // namespace input
+} // namespace y2019
+
+#endif // Y2019_JOYSTICK_ANGLE_H_