From 95eab1b8938e0033a0aa0d10d6ec53d7d2782907 Mon Sep 17 00:00:00 2001 From: Justin Berger Date: Sun, 11 Mar 2018 15:31:28 -0600 Subject: Added callback for lighthouse found; example in test.c --- src/poser_turveytori.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/poser_turveytori.c') diff --git a/src/poser_turveytori.c b/src/poser_turveytori.c index dae51e6..ddc4ad2 100644 --- a/src/poser_turveytori.c +++ b/src/poser_turveytori.c @@ -1436,17 +1436,17 @@ static Point SolveForLighthouse(FLT posOut[3], FLT quatOut[4], TrackedObject *ob printf("Warning: resetting base station calibration data"); } + SurvivePose lighthousePose; FLT invRot[4]; - quatgetreciprocal(invRot, rotQuat); - - so->ctx->bsd[lh].Pose.Pos[0] = refinedEstimateGd.x; - so->ctx->bsd[lh].Pose.Pos[1] = refinedEstimateGd.y; - so->ctx->bsd[lh].Pose.Pos[2] = refinedEstimateGd.z; - so->ctx->bsd[lh].Pose.Rot[0] = invRot[0]; - so->ctx->bsd[lh].Pose.Rot[1] = invRot[1]; - so->ctx->bsd[lh].Pose.Rot[2] = invRot[2]; - so->ctx->bsd[lh].Pose.Rot[3] = invRot[3]; - so->ctx->bsd[lh].PositionSet = 1; + quatgetreciprocal(invRot, lighthousePose.Rot); + + lighthousePose.Pos[0] = refinedEstimateGd.x; + lighthousePose.Pos[1] = refinedEstimateGd.y; + lighthousePose.Pos[2] = refinedEstimateGd.z; + + if (so->ctx->lighthouseposeproc) { + so->ctx->lighthouseposeproc(so->ctx, lh, &lighthousePose); + } } -- cgit v1.2.3 From ee0fd0be34cd6715b704be534b7e97087905571f Mon Sep 17 00:00:00 2001 From: Justin Berger Date: Sun, 11 Mar 2018 16:24:13 -0600 Subject: Redirected posers to used passed in callbacks --- src/poser_turveytori.c | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to 'src/poser_turveytori.c') diff --git a/src/poser_turveytori.c b/src/poser_turveytori.c index ddc4ad2..db46b09 100644 --- a/src/poser_turveytori.c +++ b/src/poser_turveytori.c @@ -1234,9 +1234,8 @@ void SolveForRotationQuat(FLT rotOut[4], TrackedObject *obj, Point lh) } - -static Point SolveForLighthouse(FLT posOut[3], FLT quatOut[4], TrackedObject *obj, SurviveObject *so, char doLogOutput,const int lh,const int setLhCalibration) -{ +static Point SolveForLighthouse(FLT posOut[3], FLT quatOut[4], TrackedObject *obj, SurviveObject *so, PoserData *pd, + char doLogOutput, const int lh, const int setLhCalibration) { ToriData *toriData = so->PoserData; //printf("Solving for Lighthouse\n"); @@ -1444,9 +1443,7 @@ static Point SolveForLighthouse(FLT posOut[3], FLT quatOut[4], TrackedObject *ob lighthousePose.Pos[1] = refinedEstimateGd.y; lighthousePose.Pos[2] = refinedEstimateGd.z; - if (so->ctx->lighthouseposeproc) { - so->ctx->lighthouseposeproc(so->ctx, lh, &lighthousePose); - } + PoserData_lighthouse_pose_func(pd, so, lh, &lighthousePose); } @@ -1531,16 +1528,7 @@ static Point SolveForLighthouse(FLT posOut[3], FLT quatOut[4], TrackedObject *ob return refinedEstimateGd; } - - - - - - - -static void QuickPose(SurviveObject *so, int lh) -{ - +static void QuickPose(SurviveObject *so, PoserData *pd, int lh) { ToriData * td = so->PoserData; @@ -1634,7 +1622,7 @@ static void QuickPose(SurviveObject *so, int lh) // SolveForLighthouse(pos, quat, to, so, 0, lh, 0); //} - SolveForLighthouse(&pose.Pos[0], &pose.Rot[0], to, so, 0, lh, 0); + SolveForLighthouse(&pose.Pos[0], &pose.Rot[0], to, so, pd, 0, lh, 0); //printf("P&O: [% 08.8f,% 08.8f,% 08.8f] [% 08.8f,% 08.8f,% 08.8f,% 08.8f]\n", pos[0], pos[1], pos[2], quat[0], quat[1], quat[2], quat[3]); if (so->ctx->rawposeproc) @@ -1717,7 +1705,7 @@ int PoserTurveyTori( SurviveObject * so, PoserData * poserData ) // let's just do this occasionally for now... if (counter % 4 == 0) - QuickPose(so, 0); + QuickPose(so, poserData, 0); } if (1 == l->lh && axis) // only once per full cycle... { @@ -1727,7 +1715,7 @@ int PoserTurveyTori( SurviveObject * so, PoserData * poserData ) // let's just do this occasionally for now... if (counter % 4 == 0) - QuickPose(so, 1); + QuickPose(so, poserData, 1); } // axis changed, time to increment the circular buffer index. td->angleIndex[l->lh][axis]++; @@ -1802,7 +1790,7 @@ int PoserTurveyTori( SurviveObject * so, PoserData * poserData ) FLT pos[3], quat[4]; - SolveForLighthouse(pos, quat, to, so, 0, 0, 1); + SolveForLighthouse(pos, quat, to, so, poserData, 0, 0, 1); } { int sensorCount = 0; @@ -1838,7 +1826,7 @@ int PoserTurveyTori( SurviveObject * so, PoserData * poserData ) FLT pos[3], quat[4]; - SolveForLighthouse(pos, quat, to, so, 0, 1, 1); + SolveForLighthouse(pos, quat, to, so, poserData, 0, 1, 1); } -- cgit v1.2.3