From 76623e6a945cb8be50f8081f610b397e480dcf58 Mon Sep 17 00:00:00 2001 From: cnlohr Date: Fri, 3 Mar 2017 01:32:49 -0500 Subject: First thoughts on a resolver? --- include/survive.h | 20 ++++++++++++++++++-- src/survive_internal.h | 3 +-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/include/survive.h b/include/survive.h index 51910a6..0d43465 100644 --- a/include/survive.h +++ b/include/survive.h @@ -20,6 +20,11 @@ struct SurviveContext; //It will also require a recompile. TODO: revisit this and correct the comment once fixed. #define NUM_LIGHTHOUSES 2 +struct SurviveObject; + +//XXX TODO -> Probably should be one function to take multiple types of input? +typedef int (*ResolverCB)( struct SurviveObject * so ); + struct SurviveObject { struct SurviveContext * ctx; @@ -36,9 +41,16 @@ struct SurviveObject int8_t ison:1; int8_t additional_flags:6; + //Pose Information, also "resolver" field. + FLT PoseConfidence; //0..1 + FLT Position[3]; + FLT Rotation[4]; + void * Resolver; + ResolverCB * PreferredResolverFn; //XXX TODO + + int8_t nr_locations; FLT * sensor_locations; FLT * sensor_normals; - int8_t nr_locations; //Timing sensitive data (mostly for disambiguation) int32_t timebase_hz; //48,000,000 for normal vive hardware. (checked) @@ -51,7 +63,7 @@ struct SurviveObject int32_t pulse_synctime_slack; //5,000 for normal vive hardware. (guessed) //Flood info, for calculating which laser is currently sweeping. - int8_t oldcode; + int8_t oldcode; int8_t sync_set_number; //0 = master, 1 = slave, -1 = fault. int8_t did_handle_ootx; //If unset, will send lightcap data for sync pulses next time a sensor is hit. uint32_t last_time[NUM_LIGHTHOUSES]; @@ -60,10 +72,14 @@ struct SurviveObject uint32_t last_lighttime; //May be a 24- or 32- bit number depending on what device. + //Debug int tsl; }; + + + typedef void (*text_feedback_func)( struct SurviveContext * ctx, const char * fault ); typedef void (*light_process_func)( struct SurviveObject * so, int sensor_id, int acode, int timeinsweep, uint32_t timecode, uint32_t length ); typedef void (*imu_process_func)( struct SurviveObject * so, int16_t * accelgyro, uint32_t timecode, int id ); diff --git a/src/survive_internal.h b/src/survive_internal.h index 5962623..1fdef41 100644 --- a/src/survive_internal.h +++ b/src/survive_internal.h @@ -1,4 +1,4 @@ -//<>< (C) 2016 C. N. Lohr, MOSTLY Under MIT/x11 License. +//<>< (C) 2016-2017 C. N. Lohr, MOSTLY Under MIT/x11 License. // //Based off of https://github.com/collabora/OSVR-Vive-Libre // Originally Copyright 2016 Philipp Zabel @@ -36,7 +36,6 @@ struct SurviveUSBInterface; typedef int (*DeviceDriverCb)( struct SurviveContext * ctx, void * driver ); typedef int (*DeviceDriverMagicCb)( struct SurviveContext * ctx, void * driver, int magic_code, void * data, int datalen ); - //This is defined in survive.h struct SurviveObject; struct SurviveCalData; -- cgit v1.2.3