Chromium Code Reviews| Index: device/generic_sensor/relative_orientation_fusion_algorithm.h |
| diff --git a/device/generic_sensor/relative_orientation_fusion_algorithm.h b/device/generic_sensor/relative_orientation_fusion_algorithm.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..330cbe9c35d174f2127bde650e20166046c9d9d1 |
| --- /dev/null |
| +++ b/device/generic_sensor/relative_orientation_fusion_algorithm.h |
| @@ -0,0 +1,55 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef DEVICE_GENERIC_SENSOR_RELATIVE_ORIENTATION_FUSION_ALGORITHM_H_ |
| +#define DEVICE_GENERIC_SENSOR_RELATIVE_ORIENTATION_FUSION_ALGORITHM_H_ |
| + |
| +#include "base/macros.h" |
| + |
| +namespace device { |
| + |
| +// Base class for relative orientation fusion algorithm. |
| +// Subclasses can use Accelerometer or Accelerometer + Gyroscope to create |
| +// a fusion algorithm. |
| +class RelativeOrientationFusionAlgorithm { |
|
Mikhail
2017/06/20 13:50:00
cool, strategy class :)
|
| + public: |
| + RelativeOrientationFusionAlgorithm(); |
| + virtual ~RelativeOrientationFusionAlgorithm(); |
| + |
| + void set_acceleration(double acceleration_x, |
| + double acceleration_y, |
| + double acceleration_z) { |
| + acceleration_x_ = acceleration_x; |
| + acceleration_y_ = acceleration_y; |
| + acceleration_z_ = acceleration_z; |
| + } |
| + |
| + void set_angular_speed(double angular_speed_x, |
| + double angular_speed_y, |
| + double angular_speed_z) { |
| + angular_speed_x_ = angular_speed_x; |
| + angular_speed_y_ = angular_speed_y; |
| + angular_speed_z_ = angular_speed_z; |
| + } |
| + |
| + virtual void GetRelativeOrientationData(double* x, |
| + double* y, |
| + double* z, |
| + double* w) = 0; |
| + |
| + protected: |
| + double acceleration_x_; |
| + double acceleration_y_; |
| + double acceleration_z_; |
| + double angular_speed_x_; |
| + double angular_speed_y_; |
| + double angular_speed_z_; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(RelativeOrientationFusionAlgorithm); |
| +}; |
| + |
| +} // namespace device |
| + |
| +#endif // DEVICE_GENERIC_SENSOR_RELATIVE_ORIENTATION_FUSION_ALGORITHM_H_ |