Tyler Chatow | d28951f | 2019-02-16 20:12:28 -0800 | [diff] [blame^] | 1 | #ifndef Y2019_JOYSTICK_ANGLE_H_ |
| 2 | #define Y2019_JOYSTICK_ANGLE_H_ |
| 3 | |
| 4 | #include "aos/input/driver_station_data.h" |
| 5 | |
| 6 | using ::aos::input::driver_station::JoystickAxis; |
| 7 | using ::aos::input::driver_station::Data; |
| 8 | |
| 9 | namespace y2019 { |
| 10 | namespace input { |
| 11 | namespace joysticks { |
| 12 | namespace { |
| 13 | constexpr double kJoystickLeft = -0.5; |
| 14 | constexpr double kJoystickRight = 0.5; |
| 15 | constexpr double kJoystickUp = 0.5; |
| 16 | constexpr double kJoystickDown = -0.5; |
| 17 | } |
| 18 | |
| 19 | enum class JoystickAngle { |
| 20 | kDefault, |
| 21 | kUpperRight, |
| 22 | kMiddleRight, |
| 23 | kLowerRight, |
| 24 | kUpperLeft, |
| 25 | kMiddleLeft, |
| 26 | kLowerLeft |
| 27 | }; |
| 28 | |
| 29 | JoystickAngle GetJoystickPosition(const JoystickAxis &x_axis, |
| 30 | const JoystickAxis &y_axis, const Data &data); |
| 31 | JoystickAngle GetJoystickPosition(float x_axis, float y_axis); |
| 32 | |
| 33 | } // namespace joysticks |
| 34 | } // namespace input |
| 35 | } // namespace y2019 |
| 36 | |
| 37 | #endif // Y2019_JOYSTICK_ANGLE_H_ |