Sensor Scol plugin
Multi platform sensors for handled devices
orientationTracker.h
1#ifndef _ORIENTATION_TRACKER_H_
2#define _ORIENTATION_TRACKER_H_
3
4#include "tools/OrientationEKF.h"
5#include "tools/Quaternion.h"
6#include "tools/Matrix4.h"
7#include "tools/Vector3d.h"
8#include "tools/gyroscopeBiasEstimator.h"
9
10enum DeviceOrientation
11{
12 ROTATION_0 = 0,
13 ROTATION_90 = 1,
14 ROTATION_180 = 2,
15 ROTATION_270 = 3
16};
17
19{
20 public:
22 virtual ~OrientationTracker();
23
24 void processGyro(Vector3d gyro, int64_t sensorTimeStamp);
25 void processAcceleration(Vector3d acc, int64_t sensorTimeStamp);
26 void processMag(Vector3d mag, int64_t sensorTimeStamp);
27
28 void startTracking(DeviceOrientation orientation);
29 void stopTracking();
30 Quaternion lastHeadView(double timeOffsetInSeconds);
31
32 void updateDeviceOrientation(DeviceOrientation orientation);
33
34 bool neckModelEnabled();
35 void setNeckModelEnabled(bool enabled);
36
37 bool isReady();
38
39 private:
40 GyroscopeBiasEstimator mBiasEstimator;
41 OrientationEKF mTracker;
42 Quaternion mDisplayFromDevice;
43 Quaternion mInertialReferenceFrameFromWorld;
44 int64_t mLastGyroEventTimestamp;
45 bool mNeckModelEnabled;
46 Matrix4 mNeckModelTranslation;
47 float mOrientationCorrectionAngle;
48 Vector3d mGyroBias;
49};
50
51#endif