From 8253e3c3adbb54ebc3d3c8e02c017e900a83edb0 Mon Sep 17 00:00:00 2001 From: cnlohr Date: Mon, 20 Mar 2017 01:42:32 -0400 Subject: log synctimes. --- include/libsurvive/poser.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/libsurvive/poser.h b/include/libsurvive/poser.h index 98c926e..cf11e0c 100644 --- a/include/libsurvive/poser.h +++ b/include/libsurvive/poser.h @@ -45,6 +45,7 @@ typedef struct //If "lengths[...]" < 0, means not a valid piece of sweep information. FLT lengths[SENSORS_PER_OBJECT][NUM_LIGHTHOUSES][2]; FLT angles [SENSORS_PER_OBJECT][NUM_LIGHTHOUSES][2]; //2 Axes (Angles in LH space) + FLT synctimes[SENSORS_PER_OBJECT][NUM_LIGHTHOUSES]; PoserDataIMU lastimu; } PoserDataFullScene; -- cgit v1.2.3 From 472d05c2a356ec6d71669d67fb599e401a6f4a76 Mon Sep 17 00:00:00 2001 From: Mike Turvey Date: Thu, 23 Mar 2017 00:25:25 -0700 Subject: Updated disambiguator. Solid OOTX --- include/libsurvive/survive.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/libsurvive/survive.h b/include/libsurvive/survive.h index e04586c..c3b6a03 100644 --- a/include/libsurvive/survive.h +++ b/include/libsurvive/survive.h @@ -47,6 +47,7 @@ struct SurviveObject int32_t pulse_synctime_slack; //5,000 for normal vive hardware. (guessed) //Flood info, for calculating which laser is currently sweeping. + void * disambiguator_data; 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. @@ -129,7 +130,7 @@ void survive_cal_install( SurviveContext * ctx ); //XXX This will be removed if //Call these from your callback if overridden. //Accept higher-level data. -void survive_default_light_process( SurviveObject * so, int sensor_id, int acode, int timeinsweep, uint32_t timecode, uint32_t length ); +void survive_default_light_process( SurviveObject * so, int sensor_id, int acode, int timeinsweep, uint32_t timecode, uint32_t length , int lh); void survive_default_imu_process( SurviveObject * so, int mode, FLT * accelgyro, uint32_t timecode, int id ); void survive_default_angle_process( SurviveObject * so, int sensor_id, int acode, uint32_t timecode, FLT length, FLT angle ); -- cgit v1.2.3 From 280a6599fea76a7d2c16cfe0fcc5c8f37fde66de Mon Sep 17 00:00:00 2001 From: mwturvey Date: Thu, 23 Mar 2017 09:47:38 -0700 Subject: More cleanup --- include/libsurvive/survive.h | 2 +- include/libsurvive/survive_types.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/libsurvive/survive.h b/include/libsurvive/survive.h index c3b6a03..1165e9d 100644 --- a/include/libsurvive/survive.h +++ b/include/libsurvive/survive.h @@ -130,7 +130,7 @@ void survive_cal_install( SurviveContext * ctx ); //XXX This will be removed if //Call these from your callback if overridden. //Accept higher-level data. -void survive_default_light_process( SurviveObject * so, int sensor_id, int acode, int timeinsweep, uint32_t timecode, uint32_t length , int lh); +void survive_default_light_process( SurviveObject * so, int sensor_id, int acode, int timeinsweep, uint32_t timecode, uint32_t length , uint32_t lh); void survive_default_imu_process( SurviveObject * so, int mode, FLT * accelgyro, uint32_t timecode, int id ); void survive_default_angle_process( SurviveObject * so, int sensor_id, int acode, uint32_t timecode, FLT length, FLT angle ); diff --git a/include/libsurvive/survive_types.h b/include/libsurvive/survive_types.h index 1600e11..def30b8 100644 --- a/include/libsurvive/survive_types.h +++ b/include/libsurvive/survive_types.h @@ -28,7 +28,7 @@ typedef struct BaseStationData BaseStationData; typedef struct SurviveCalData SurviveCalData; //XXX Warning: This may be removed. Check at a later time for its defunctness. typedef void (*text_feedback_func)( SurviveContext * ctx, const char * fault ); -typedef void (*light_process_func)( SurviveObject * so, int sensor_id, int acode, int timeinsweep, uint32_t timecode, uint32_t length ); +typedef void (*light_process_func)( SurviveObject * so, int sensor_id, int acode, int timeinsweep, uint32_t timecode, uint32_t length, uint32_t lighthouse); typedef void (*imu_process_func)( SurviveObject * so, int mask, FLT * accelgyro, uint32_t timecode, int id ); typedef void (*angle_process_func)( SurviveObject * so, int sensor_id, int acode, uint32_t timecode, FLT length, FLT angle ); -- cgit v1.2.3 From 4dc1d72785c660c206f8def9d8c8aa32289c2709 Mon Sep 17 00:00:00 2001 From: mwturvey Date: Fri, 24 Mar 2017 15:19:59 -0700 Subject: More cleanup & finishing genericization of calibrator --- include/libsurvive/survive.h | 2 +- include/libsurvive/survive_types.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/libsurvive/survive.h b/include/libsurvive/survive.h index 1165e9d..e13312d 100644 --- a/include/libsurvive/survive.h +++ b/include/libsurvive/survive.h @@ -132,7 +132,7 @@ void survive_cal_install( SurviveContext * ctx ); //XXX This will be removed if //Accept higher-level data. void survive_default_light_process( SurviveObject * so, int sensor_id, int acode, int timeinsweep, uint32_t timecode, uint32_t length , uint32_t lh); void survive_default_imu_process( SurviveObject * so, int mode, FLT * accelgyro, uint32_t timecode, int id ); -void survive_default_angle_process( SurviveObject * so, int sensor_id, int acode, uint32_t timecode, FLT length, FLT angle ); +void survive_default_angle_process( SurviveObject * so, int sensor_id, int acode, uint32_t timecode, FLT length, FLT angle, uint32_t lh ); ////////////////////// Survive Drivers //////////////////////////// diff --git a/include/libsurvive/survive_types.h b/include/libsurvive/survive_types.h index def30b8..bfd0b1d 100644 --- a/include/libsurvive/survive_types.h +++ b/include/libsurvive/survive_types.h @@ -30,7 +30,7 @@ typedef struct SurviveCalData SurviveCalData; //XXX Warning: This may be remov typedef void (*text_feedback_func)( SurviveContext * ctx, const char * fault ); typedef void (*light_process_func)( SurviveObject * so, int sensor_id, int acode, int timeinsweep, uint32_t timecode, uint32_t length, uint32_t lighthouse); typedef void (*imu_process_func)( SurviveObject * so, int mask, FLT * accelgyro, uint32_t timecode, int id ); -typedef void (*angle_process_func)( SurviveObject * so, int sensor_id, int acode, uint32_t timecode, FLT length, FLT angle ); +typedef void (*angle_process_func)( SurviveObject * so, int sensor_id, int acode, uint32_t timecode, FLT length, FLT angle, uint32_t lh); //Device drivers (prefix your drivers with "DriverReg") i.e. -- cgit v1.2.3 From ce7fa5b134b1394f7bb9f4bddb1da9e83d792827 Mon Sep 17 00:00:00 2001 From: Mike Turvey Date: Sat, 25 Mar 2017 21:58:51 -0700 Subject: Adding Tori Poser --- include/libsurvive/survive.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/libsurvive/survive.h b/include/libsurvive/survive.h index e13312d..278bbca 100644 --- a/include/libsurvive/survive.h +++ b/include/libsurvive/survive.h @@ -32,9 +32,9 @@ struct SurviveObject PoserCB PoserFn; //Device-specific information about the location of the sensors. This data will be used by the poser. - int8_t nr_locations; - FLT * sensor_locations; - FLT * sensor_normals; + int8_t nr_locations; // sensor count + FLT * sensor_locations; // size is nr_locations*3. Contains x,y,z values for each sensor + FLT * sensor_normals;// size is nrlocations*3. cointains normal vector for each sensor //Timing sensitive data (mostly for disambiguation) int32_t timebase_hz; //48,000,000 for normal vive hardware. (checked) -- cgit v1.2.3 From fba18d9de738fd07a0b6db944369127a6a66f0d8 Mon Sep 17 00:00:00 2001 From: mwturvey Date: Tue, 28 Mar 2017 11:19:39 -0700 Subject: Add lh to poser light data --- include/libsurvive/poser.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/libsurvive/poser.h b/include/libsurvive/poser.h index cf11e0c..497b009 100644 --- a/include/libsurvive/poser.h +++ b/include/libsurvive/poser.h @@ -32,7 +32,8 @@ typedef struct { PoserType pt; int sensor_id; - int acode; //OOTX Code associated with this sweep. base_station = acode >> 2; axis = acode & 1; + int acode; //OOTX Code associated with this sweep. bit 1 indicates vertical(1) or horizontal(0) sweep + int lh; //Lighthouse making this sweep uint32_t timecode; //In object-local ticks. FLT length; //In seconds FLT angle; //In radians from center of lighthouse. -- cgit v1.2.3 From 06f580d722136051c55653f6767f185b396f3371 Mon Sep 17 00:00:00 2001 From: "Dr. Orion Lawlor" Date: Mon, 17 Apr 2017 21:38:46 -0800 Subject: Support calling the library from C++, by adding extern "C" decorations, and including correct prototypes. --- include/libsurvive/poser.h | 9 +++++++++ include/libsurvive/survive.h | 13 ++++++++++++- include/libsurvive/survive_types.h | 8 ++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/libsurvive/poser.h b/include/libsurvive/poser.h index 497b009..582590e 100644 --- a/include/libsurvive/poser.h +++ b/include/libsurvive/poser.h @@ -3,6 +3,11 @@ #include "survive_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + typedef enum PoserType_t { POSERDATA_NONE = 0, @@ -55,4 +60,8 @@ typedef struct typedef int (*PoserCB)( SurviveObject * so, PoserData * pd ); +#ifdef __cplusplus +}; +#endif + #endif diff --git a/include/libsurvive/survive.h b/include/libsurvive/survive.h index 278bbca..3c35bd2 100644 --- a/include/libsurvive/survive.h +++ b/include/libsurvive/survive.h @@ -5,6 +5,10 @@ #include "survive_types.h" #include "poser.h" +#ifdef __cplusplus +extern "C" { +#endif + //DANGER: This structure may be redefined. Note that it is logically split into 64-bit chunks //for optimization on 32- and 64-bit systems. @@ -116,7 +120,7 @@ void survive_install_imu_fn( SurviveContext * ctx, imu_process_func fbp ); void survive_install_angle_fn( SurviveContext * ctx, angle_process_func fbp ); void survive_close( SurviveContext * ctx ); -int survive_poll(); +int survive_poll( SurviveContext * ctx ); SurviveObject * survive_get_so_by_name( SurviveContext * ctx, const char * name ); @@ -128,6 +132,9 @@ int survive_send_magic( SurviveContext * ctx, int magic_code, void * data, int d //Install the calibrator. void survive_cal_install( SurviveContext * ctx ); //XXX This will be removed if not already done so. +// Read back a human-readable string description of the calibration status +int survive_cal_get_status( struct SurviveContext * ctx, char * description, int description_length ); + //Call these from your callback if overridden. //Accept higher-level data. void survive_default_light_process( SurviveObject * so, int sensor_id, int acode, int timeinsweep, uint32_t timecode, uint32_t length , uint32_t lh); @@ -174,5 +181,9 @@ void handle_lightcap( SurviveObject * so, LightcapElement * le ); #define SV_ERROR( ... ) { char stbuff[1024]; sprintf( stbuff, __VA_ARGS__ ); ctx->faultfunction( ctx, stbuff ); } #define SV_KILL() exit(0) //XXX This should likely be re-defined. +#ifdef __cplusplus +}; +#endif + #endif diff --git a/include/libsurvive/survive_types.h b/include/libsurvive/survive_types.h index bfd0b1d..224719e 100644 --- a/include/libsurvive/survive_types.h +++ b/include/libsurvive/survive_types.h @@ -1,6 +1,11 @@ #ifndef _SURVIVE_TYPES_H #define _SURVIVE_TYPES_H +#ifdef __cplusplus +extern "C" { +#endif + + #ifndef FLT #ifdef USE_DOUBLE #define FLT double @@ -39,6 +44,9 @@ typedef int (*DeviceDriver)( SurviveContext * ctx ); typedef int (*DeviceDriverCb)( struct SurviveContext * ctx, void * driver ); typedef int (*DeviceDriverMagicCb)( struct SurviveContext * ctx, void * driver, int magic_code, void * data, int datalen ); +#ifdef __cplusplus +}; +#endif #endif -- cgit v1.2.3 From f177f87e98637de8f07488d820390f322c45413c Mon Sep 17 00:00:00 2001 From: cnlohr Date: Sun, 30 Apr 2017 00:13:42 -0400 Subject: Update the charles disambiguator --- include/libsurvive/survive.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/libsurvive/survive.h b/include/libsurvive/survive.h index 3c35bd2..e85fe48 100644 --- a/include/libsurvive/survive.h +++ b/include/libsurvive/survive.h @@ -42,7 +42,7 @@ struct SurviveObject //Timing sensitive data (mostly for disambiguation) int32_t timebase_hz; //48,000,000 for normal vive hardware. (checked) - int32_t timecenter_ticks; //200,000 for normal vive hardware. (checked) + int32_t timecenter_ticks; //200,000 for normal vive hardware. (checked) (This doubles-up as 2x this = full sweep length) int32_t pulsedist_max_ticks; //500,000 for normal vive hardware. (guessed) int32_t pulselength_min_sync; //2,200 for normal vive hardware. (guessed) int32_t pulse_in_clear_time; //35,000 for normal vive hardware. (guessed) -- cgit v1.2.3 From 6c748afc397f29cd461e54c09d8a3cb45272f4ad Mon Sep 17 00:00:00 2001 From: Joshua Allen Date: Sat, 6 May 2017 22:16:12 -0400 Subject: use calibration numbers from device json files --- include/libsurvive/survive.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/libsurvive/survive.h b/include/libsurvive/survive.h index e85fe48..1532d62 100644 --- a/include/libsurvive/survive.h +++ b/include/libsurvive/survive.h @@ -62,6 +62,12 @@ struct SurviveObject uint32_t last_lighttime; //May be a 24- or 32- bit number depending on what device. + FLT* acc_bias; // size is FLT*3. contains x,y,z + FLT* acc_scale; // size is FLT*3. contains x,y,z + FLT* gyro_bias; // size is FLT*3. contains x,y,z + FLT* gyro_scale; // size is FLT*3. contains x,y,z + + //Debug int tsl; }; -- cgit v1.2.3