HID: use MotionDevice for Accelerometer and Gyroscope

This commit is contained in:
wwylele 2017-08-06 22:54:19 +03:00
parent 53ef90d1bd
commit 867eabd6b7
3 changed files with 48 additions and 5 deletions

View file

@ -11,6 +11,7 @@
#include <utility>
#include "common/logging/log.h"
#include "common/param_package.h"
#include "common/vector_math.h"
namespace Input {
@ -107,4 +108,23 @@ using ButtonDevice = InputDevice<bool>;
*/
using AnalogDevice = InputDevice<std::tuple<float, float>>;
/**
* A motion device is an input device that returns a tuple of accelerometer state vector and
* gyroscope state vector.
*
* For accelerometer state vector:
* x+ is the same direction as LEFT on D-pad.
* y+ is normal to the touch screen, pointing outward.
* z+ is the same direction as UP on D-pad.
* Units: measured in unit of gravitational acceleration
*
* For gyroscope state vector:
* x+ is the same direction as LEFT on D-pad.
* y+ is normal to the touch screen, pointing outward.
* z+ is the same direction as UP on D-pad.
* Orientation is determined by right-hand rule.
* Units: deg/sec
*/
using MotionDevice = InputDevice<std::tuple<Math::Vec3<float>, Math::Vec3<float>>>;
} // namespace Input