summaryrefslogtreecommitdiffstats
path: root/src/core/hid/motion_input.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/hid/motion_input.h (renamed from src/input_common/motion_input.h)27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/input_common/motion_input.h b/src/core/hid/motion_input.h
index efe74cf19..5b5b420bb 100644
--- a/src/input_common/motion_input.h
+++ b/src/core/hid/motion_input.h
@@ -7,13 +7,12 @@
#include "common/common_types.h"
#include "common/quaternion.h"
#include "common/vector_math.h"
-#include "core/frontend/input.h"
-namespace InputCommon {
+namespace Core::HID {
class MotionInput {
public:
- explicit MotionInput(f32 new_kp, f32 new_ki, f32 new_kd);
+ explicit MotionInput();
MotionInput(const MotionInput&) = default;
MotionInput& operator=(const MotionInput&) = default;
@@ -21,6 +20,7 @@ public:
MotionInput(MotionInput&&) = default;
MotionInput& operator=(MotionInput&&) = default;
+ void SetPID(f32 new_kp, f32 new_ki, f32 new_kd);
void SetAcceleration(const Common::Vec3f& acceleration);
void SetGyroscope(const Common::Vec3f& gyroscope);
void SetQuaternion(const Common::Quaternion<f32>& quaternion);
@@ -38,9 +38,6 @@ public:
[[nodiscard]] Common::Vec3f GetGyroscope() const;
[[nodiscard]] Common::Vec3f GetRotations() const;
[[nodiscard]] Common::Quaternion<f32> GetQuaternion() const;
- [[nodiscard]] Input::MotionStatus GetMotion() const;
- [[nodiscard]] Input::MotionStatus GetRandomMotion(int accel_magnitude,
- int gyro_magnitude) const;
[[nodiscard]] bool IsMoving(f32 sensitivity) const;
[[nodiscard]] bool IsCalibrated(f32 sensitivity) const;
@@ -59,16 +56,32 @@ private:
Common::Vec3f integral_error;
Common::Vec3f derivative_error;
+ // Quaternion containing the device orientation
Common::Quaternion<f32> quat{{0.0f, 0.0f, -1.0f}, 0.0f};
+
+ // Number of full rotations in each axis
Common::Vec3f rotations;
+
+ // Acceleration vector measurement in G force
Common::Vec3f accel;
+
+ // Gyroscope vector measurement in radians/s.
Common::Vec3f gyro;
+
+ // Vector to be substracted from gyro measurements
Common::Vec3f gyro_drift;
+ // Minimum gyro amplitude to detect if the device is moving
f32 gyro_threshold = 0.0f;
+
+ // Number of invalid sequential data
u32 reset_counter = 0;
+
+ // If the provided data is invalid the device will be autocalibrated
bool reset_enabled = true;
+
+ // Use accelerometer values to calculate position
bool only_accelerometer = true;
};
-} // namespace InputCommon
+} // namespace Core::HID