Skip to content

Commit

Permalink
Normalize quats in predicted poses
Browse files Browse the repository at this point in the history
The predicted poses obtained from the linear regression model will not
necessarily return normalized quaternions
  • Loading branch information
yoyobuae committed Feb 26, 2023
1 parent c440e11 commit 5fad3d8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions driver_files/src/Driver/TrackerDevice.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "TrackerDevice.hpp"

#define EPSILON 1.e-6

void normalizeQuat(double pose[])
{

Expand All @@ -9,10 +11,13 @@ void normalizeQuat(double pose[])
pose[5] * pose[5] +
pose[6] * pose[6]);

pose[3] /= mag;
pose[4] /= mag;
pose[5] /= mag;
pose[6] /= mag;
if (mag > EPSILON)
{
pose[3] /= mag;
pose[4] /= mag;
pose[5] /= mag;
pose[6] /= mag;
}
}

ExampleDriver::TrackerDevice::TrackerDevice(std::string serial, std::string role):
Expand Down Expand Up @@ -267,6 +272,7 @@ int ExampleDriver::TrackerDevice::get_next_pose(double time_offset, double pred[


}
normalizeQuat(pred);
//printf("::: %f\n", pred[0]);
return statuscode;
//return pred[0], pred[1], pred[2], pred[3], pred[4], pred[5], pred[6];
Expand Down

0 comments on commit 5fad3d8

Please sign in to comment.