aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/libsurvive/survive.h2
-rw-r--r--include/libsurvive/survive_imu.h36
-rw-r--r--include/libsurvive/survive_types.h3
3 files changed, 39 insertions, 2 deletions
diff --git a/include/libsurvive/survive.h b/include/libsurvive/survive.h
index 0558dc8..65343b7 100644
--- a/include/libsurvive/survive.h
+++ b/include/libsurvive/survive.h
@@ -115,7 +115,7 @@ struct SurviveObject {
haptic_func haptic;
SurviveSensorActivations activations;
- void* user_ptr;
+ void *user_ptr;
// Debug
int tsl;
};
diff --git a/include/libsurvive/survive_imu.h b/include/libsurvive/survive_imu.h
new file mode 100644
index 0000000..124ad7e
--- /dev/null
+++ b/include/libsurvive/survive_imu.h
@@ -0,0 +1,36 @@
+#ifndef _SURVIVE_IMU_H
+#define _SURVIVE_IMU_H
+
+#include "poser.h"
+#include "survive_types.h"
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct SurviveIMUTracker_p;
+
+typedef struct {
+ FLT updir[3];
+ FLT accel_scale_bias;
+
+ LinmathVec3d current_velocity; // Velocity in world frame
+ PoserDataIMU last_data;
+ SurvivePose pose;
+
+ SurvivePose lastGT;
+ uint32_t lastGTTime;
+
+ float integralFBx, integralFBy, integralFBz; // integral error terms scaled by Ki
+
+} SurviveIMUTracker;
+
+void survive_imu_tracker_set_pose(SurviveIMUTracker *tracker, uint32_t timecode, SurvivePose *pose);
+void survive_imu_tracker_integrate(SurviveObject *so, SurviveIMUTracker *tracker, PoserDataIMU *data);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
diff --git a/include/libsurvive/survive_types.h b/include/libsurvive/survive_types.h
index edce3e9..367c391 100644
--- a/include/libsurvive/survive_types.h
+++ b/include/libsurvive/survive_types.h
@@ -50,7 +50,8 @@ typedef void (*imu_process_func)( SurviveObject * so, int mask, FLT * accelgyro,
typedef void (*angle_process_func)( SurviveObject * so, int sensor_id, int acode, uint32_t timecode, FLT length, FLT angle, uint32_t lh);
typedef void(*button_process_func)(SurviveObject * so, uint8_t eventType, uint8_t buttonId, uint8_t axis1Id, uint16_t axis1Val, uint8_t axis2Id, uint16_t axis2Val);
typedef void (*pose_func)(SurviveObject *so, uint32_t timecode, SurvivePose *pose);
-typedef void (*lighthouse_pose_func)(SurviveContext *ctx, uint8_t lighthouse, SurvivePose *lighthouse_pose, SurvivePose *object_pose);
+typedef void (*lighthouse_pose_func)(SurviveContext *ctx, uint8_t lighthouse, SurvivePose *lighthouse_pose,
+ SurvivePose *object_pose);
// For lightcap, etc. Don't change this structure at all. Regular vive is dependent on it being exactly as-is.
// When you write drivers, you can use this to send survive lightcap data.