From 35e08aaa24bd01e6ace453f89ddb73a6bb0508b0 Mon Sep 17 00:00:00 2001 From: cnlohr Date: Tue, 14 Feb 2017 01:00:33 -0500 Subject: Still not working, but getting closer to dynamic OOTX decoding. --- src/survive_cal.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/survive_cal.h (limited to 'src/survive_cal.h') diff --git a/src/survive_cal.h b/src/survive_cal.h new file mode 100644 index 0000000..a74bf95 --- /dev/null +++ b/src/survive_cal.h @@ -0,0 +1,44 @@ +// (C) 2016, 2017 <>< C. N. Lohr, Under MIT/x11 License. + +// All OOTX code was written by J. Allen. Rest of the code is probably mostly CNLohr. + +#ifndef _SURVIVE_CAL_H +#define _SURVIVE_CAL_H + +//This is a file that is intended for use with capturing vive data during the +//setup phase. This and survive_cal.c/.h should not be included on embedded +//uses of libsurvive. + +//This file handles the following: +// 1: Decoding the OOTX data from the lighthouses. +// 2: Setting OOTX props in the survive context. +// 3: Collect a bunch of data with the vive pointed up and the watchment to either side. +// 4: Running the code to find the lighthouses. +// 5: Setting the information needed to develop the worldspace model in the SurviveContext. + + +#include +#include "ootx_decoder.h" +#include "survive_internal.h" + +void survive_cal_install( struct SurviveContext * ctx ); +int survive_cal_get_status( struct SurviveContext * ctx, char * description, int max_data ); + +//void survive_cal_teardown( struct SurviveContext * ctx ); + +//Called from survive_default_light_process +void survive_cal_light( struct SurviveObject * so, int sensor_id, int acode, int timeinsweep, uint32_t timecode, uint32_t length ); + +struct SurviveCalData +{ + //Stage: + // 0: Idle + // 1: Collecting OOTX data. + int stage; + + //OOTX Data is sync'd off of + ootx_decoder_context ootx_decoders[NUM_LIGHTHOUSES]; +}; + +#endif + -- cgit v1.2.3 From 32fbccbd7d90f1e456d1e477eab2128aaf88df93 Mon Sep 17 00:00:00 2001 From: cnlohr Date: Thu, 16 Feb 2017 17:16:31 -0500 Subject: Move to having an angle callback. --- src/survive_cal.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/survive_cal.h') diff --git a/src/survive_cal.h b/src/survive_cal.h index a74bf95..6653a84 100644 --- a/src/survive_cal.h +++ b/src/survive_cal.h @@ -28,6 +28,7 @@ int survive_cal_get_status( struct SurviveContext * ctx, char * description, int //Called from survive_default_light_process void survive_cal_light( struct SurviveObject * so, int sensor_id, int acode, int timeinsweep, uint32_t timecode, uint32_t length ); +void survive_cal_angle( struct SurviveObject * so, int sensor_id, int acode, uint32_t timecode, FLT length, FLT angle ); struct SurviveCalData { -- cgit v1.2.3 From 9bba1f9e7888f512a587f76179b9dd8f389c7ae8 Mon Sep 17 00:00:00 2001 From: cnlohr Date: Thu, 16 Feb 2017 18:09:19 -0500 Subject: Start collecting data. Getting closer to having a full cal stack. --- src/survive_cal.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/survive_cal.h') diff --git a/src/survive_cal.h b/src/survive_cal.h index 6653a84..b9d4b11 100644 --- a/src/survive_cal.h +++ b/src/survive_cal.h @@ -22,7 +22,7 @@ #include "survive_internal.h" void survive_cal_install( struct SurviveContext * ctx ); -int survive_cal_get_status( struct SurviveContext * ctx, char * description, int max_data ); +int survive_cal_get_status( struct SurviveContext * ctx, char * description, int description_length ); //void survive_cal_teardown( struct SurviveContext * ctx ); @@ -30,6 +30,9 @@ int survive_cal_get_status( struct SurviveContext * ctx, char * description, int void survive_cal_light( struct SurviveObject * so, int sensor_id, int acode, int timeinsweep, uint32_t timecode, uint32_t length ); void survive_cal_angle( struct SurviveObject * so, int sensor_id, int acode, uint32_t timecode, FLT length, FLT angle ); +#define MAX_TO_CAL 96 +#define DRPTS 512 + struct SurviveCalData { //Stage: @@ -37,9 +40,17 @@ struct SurviveCalData // 1: Collecting OOTX data. int stage; - //OOTX Data is sync'd off of + //OOTX Data is sync'd off of the sync pulses coming from the lighthouses. ootx_decoder_context ootx_decoders[NUM_LIGHTHOUSES]; + + //For statistics-gathering phase. + FLT all_lengths[MAX_TO_CAL][NUM_LIGHTHOUSES][2][DRPTS]; + FLT all_angles[MAX_TO_CAL][NUM_LIGHTHOUSES][2][DRPTS]; + int16_t all_counts[MAX_TO_CAL][NUM_LIGHTHOUSES][2]; + int peak_counts; }; + + #endif -- cgit v1.2.3 From bd89d46cb01f7069166e85f017f169e07acc7094 Mon Sep 17 00:00:00 2001 From: cnlohr Date: Thu, 16 Feb 2017 18:28:54 -0500 Subject: closing in on finding common cal points. --- src/survive_cal.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/survive_cal.h') diff --git a/src/survive_cal.h b/src/survive_cal.h index b9d4b11..42ff1ee 100644 --- a/src/survive_cal.h +++ b/src/survive_cal.h @@ -35,11 +35,6 @@ void survive_cal_angle( struct SurviveObject * so, int sensor_id, int acode, uin struct SurviveCalData { - //Stage: - // 0: Idle - // 1: Collecting OOTX data. - int stage; - //OOTX Data is sync'd off of the sync pulses coming from the lighthouses. ootx_decoder_context ootx_decoders[NUM_LIGHTHOUSES]; @@ -47,7 +42,13 @@ struct SurviveCalData FLT all_lengths[MAX_TO_CAL][NUM_LIGHTHOUSES][2][DRPTS]; FLT all_angles[MAX_TO_CAL][NUM_LIGHTHOUSES][2][DRPTS]; int16_t all_counts[MAX_TO_CAL][NUM_LIGHTHOUSES][2]; - int peak_counts; + int16_t peak_counts; + int8_t found_common; + + //Stage: + // 0: Idle + // 1: Collecting OOTX data. + int8_t stage; }; -- cgit v1.2.3