relative_orientation_euler_angles_fusion_algorithm_using_accelerometer_and_gyroscope.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2018 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. #ifndef SERVICES_DEVICE_GENERIC_SENSOR_RELATIVE_ORIENTATION_EULER_ANGLES_FUSION_ALGORITHM_USING_ACCELEROMETER_AND_GYROSCOPE_H_
  5. #define SERVICES_DEVICE_GENERIC_SENSOR_RELATIVE_ORIENTATION_EULER_ANGLES_FUSION_ALGORITHM_USING_ACCELEROMETER_AND_GYROSCOPE_H_
  6. #include "services/device/generic_sensor/platform_sensor_fusion_algorithm.h"
  7. namespace device {
  8. class
  9. RelativeOrientationEulerAnglesFusionAlgorithmUsingAccelerometerAndGyroscope
  10. final : public PlatformSensorFusionAlgorithm {
  11. public:
  12. RelativeOrientationEulerAnglesFusionAlgorithmUsingAccelerometerAndGyroscope();
  13. RelativeOrientationEulerAnglesFusionAlgorithmUsingAccelerometerAndGyroscope(
  14. const RelativeOrientationEulerAnglesFusionAlgorithmUsingAccelerometerAndGyroscope&) =
  15. delete;
  16. RelativeOrientationEulerAnglesFusionAlgorithmUsingAccelerometerAndGyroscope&
  17. operator=(
  18. const RelativeOrientationEulerAnglesFusionAlgorithmUsingAccelerometerAndGyroscope&) =
  19. delete;
  20. ~RelativeOrientationEulerAnglesFusionAlgorithmUsingAccelerometerAndGyroscope()
  21. override;
  22. void Reset() override;
  23. protected:
  24. bool GetFusedDataInternal(mojom::SensorType which_sensor_changed,
  25. SensorReading* fused_reading) override;
  26. private:
  27. double timestamp_;
  28. double alpha_;
  29. double beta_;
  30. double gamma_;
  31. const double kBias = 0.98;
  32. };
  33. } // namespace device
  34. #endif // SERVICES_DEVICE_GENERIC_SENSOR_RELATIVE_ORIENTATION_EULER_ANGLES_FUSION_ALGORITHM_USING_ACCELEROMETER_AND_GYROSCOPE_H_