diff options
author | ultramn <dchapm2@umbc.edu> | 2017-02-19 11:02:20 -0800 |
---|---|---|
committer | ultramn <dchapm2@umbc.edu> | 2017-02-19 11:02:20 -0800 |
commit | 771ca61466c7b510d42bade3a8b607fabac49c32 (patch) | |
tree | f45cab2bb491a206cebb6c6c75fd86d478a9ad53 /src/survive_process.c | |
parent | e593db4c3a3575f826682d5eb9e402372aa1ba98 (diff) | |
parent | bd89d46cb01f7069166e85f017f169e07acc7094 (diff) | |
download | libsurvive-771ca61466c7b510d42bade3a8b607fabac49c32.tar.gz libsurvive-771ca61466c7b510d42bade3a8b607fabac49c32.tar.bz2 |
plot_lighthouse/Makefile
Diffstat (limited to 'src/survive_process.c')
-rw-r--r-- | src/survive_process.c | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/src/survive_process.c b/src/survive_process.c index d3a8c4a..75453da 100644 --- a/src/survive_process.c +++ b/src/survive_process.c @@ -1,21 +1,58 @@ //<>< (C) 2016 C. N. Lohr, FULLY Under MIT/x11 License. //All MIT/x11 Licensed Code in this file may be relicensed freely under the GPL or LGPL licenses. -#include "survive_internal.h" +#include "survive_cal.h" - -int bufferpts[32*2]; -char buffermts[32*128]; -int buffertimeto[32]; +//XXX TODO: Once data is avialble in the context, use the stuff here to handle converting from time codes to +//proper angles, then from there perform the rest of the solution. void survive_default_light_process( struct SurviveObject * so, int sensor_id, int acode, int timeinsweep, uint32_t timecode, uint32_t length ) { - //TODO: Writeme! + struct SurviveContext * ctx = so->ctx; + int base_station = acode >> 2; + int axis = acode & 1; + + if( ctx->calptr ) + { + survive_cal_light( so, sensor_id, acode, timeinsweep, timecode, length ); + } + + if( base_station > NUM_LIGHTHOUSES ) return; + + //No loner need sync information past this point. + if( sensor_id < 0 ) return; + FLT angle = (timeinsweep - so->timecenter_ticks) * (1./so->timecenter_ticks * 3.14159265359/2.0); + + //Need to now do angle correction. +#if 1 + struct BaseStationData * bsd = &ctx->bsd[base_station]; + + //XXX TODO: This seriously needs to be worked on. See: https://github.com/cnlohr/libsurvive/issues/18 + angle += bsd->fcalphase[axis]; +// angle += bsd->fcaltilt[axis] * predicted_angle(axis1); + + //TODO!!! +#endif + + FLT length_sec = length / (FLT)so->timebase_hz; + ctx->angleproc( so, sensor_id, acode, timecode, length_sec, angle ); } + +void survive_default_angle_process( struct SurviveObject * so, int sensor_id, int acode, uint32_t timecode, FLT length, FLT angle ) +{ + struct SurviveContext * ctx = so->ctx; + if( ctx->calptr ) + { + survive_cal_angle( so, sensor_id, acode, timecode, length, angle ); + } + + //TODO: Writeme! +} + + void survive_default_imu_process( struct SurviveObject * so, int16_t * accelgyro, uint32_t timecode, int id ) { //TODO: Writeme! } - |