Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef DEVICE_GENERIC_SENSOR_RELATIVE_ORIENTATION_FUSION_ALGORITHM_H_ | |
| 6 #define DEVICE_GENERIC_SENSOR_RELATIVE_ORIENTATION_FUSION_ALGORITHM_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 | |
| 10 namespace device { | |
| 11 | |
| 12 // Base class for relative orientation fusion algorithm. | |
| 13 // Subclasses can use Accelerometer or Accelerometer + Gyroscope to create | |
| 14 // a fusion algorithm. | |
| 15 class RelativeOrientationFusionAlgorithm { | |
|
Mikhail
2017/06/20 13:50:00
cool, strategy class :)
| |
| 16 public: | |
| 17 RelativeOrientationFusionAlgorithm(); | |
| 18 virtual ~RelativeOrientationFusionAlgorithm(); | |
| 19 | |
| 20 void set_acceleration(double acceleration_x, | |
| 21 double acceleration_y, | |
| 22 double acceleration_z) { | |
| 23 acceleration_x_ = acceleration_x; | |
| 24 acceleration_y_ = acceleration_y; | |
| 25 acceleration_z_ = acceleration_z; | |
| 26 } | |
| 27 | |
| 28 void set_angular_speed(double angular_speed_x, | |
| 29 double angular_speed_y, | |
| 30 double angular_speed_z) { | |
| 31 angular_speed_x_ = angular_speed_x; | |
| 32 angular_speed_y_ = angular_speed_y; | |
| 33 angular_speed_z_ = angular_speed_z; | |
| 34 } | |
| 35 | |
| 36 virtual void GetRelativeOrientationData(double* x, | |
| 37 double* y, | |
| 38 double* z, | |
| 39 double* w) = 0; | |
| 40 | |
| 41 protected: | |
| 42 double acceleration_x_; | |
| 43 double acceleration_y_; | |
| 44 double acceleration_z_; | |
| 45 double angular_speed_x_; | |
| 46 double angular_speed_y_; | |
| 47 double angular_speed_z_; | |
| 48 | |
| 49 private: | |
| 50 DISALLOW_COPY_AND_ASSIGN(RelativeOrientationFusionAlgorithm); | |
| 51 }; | |
| 52 | |
| 53 } // namespace device | |
| 54 | |
| 55 #endif // DEVICE_GENERIC_SENSOR_RELATIVE_ORIENTATION_FUSION_ALGORITHM_H_ | |
| OLD | NEW |