Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalize quats in predicted poses #14

Open
wants to merge 1 commit into
base: AprilTagTrackers
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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