Skip to content

Commit

Permalink
Merge pull request #10 from xuhao1/master
Browse files Browse the repository at this point in the history
Fix translation align
  • Loading branch information
xuhao1 authored Apr 17, 2021
2 parents 24e72a1 + 9a46210 commit c5c7a07
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion FlightAgentX.pro
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ QT += widgets

CONFIG += c++17
DEFINES += QT_DEPRECATED_WARNINGS

QMAKE_CXXFLAGS *= /std:c++17
INCLUDEPATH += ../third_party/opencv-4.4.0-build/include
INCLUDEPATH +=../third_party/eigen-3.3.7
INCLUDEPATH += ../third_party/dlib/include
Expand Down
12 changes: 6 additions & 6 deletions lib/freetrack/ftnoir_protocol_ft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ freetrack::~freetrack()
dummyTrackIR.close();
}

static_assert(sizeof(LONG) == sizeof(std::int32_t));
static_assert(sizeof(LONG) == 4u);
//static_assert(sizeof(LONG) == sizeof(std::int32_t));
//static_assert(sizeof(LONG) == 4u);

#define TX 0
#define TY 1
Expand All @@ -43,16 +43,16 @@ never_inline void store(float volatile& place, const float value)

value_.f32 = value;

static_assert(sizeof(value_) == sizeof(float));
static_assert(offsetof(decltype(value_), f32) == offsetof(decltype(value_), i32));
// static_assert(sizeof(value_) == sizeof(float));
// static_assert(offsetof(decltype(value_), f32) == offsetof(decltype(value_), i32));

(void)InterlockedExchange((LONG volatile*)&place, value_.i32);
}

template<typename t>
static void store(t volatile& place, t value)
{
static_assert(sizeof(t) == 4u);
// static_assert(sizeof(t) == 4u);
(void)InterlockedExchange((LONG volatile*) &place, (LONG)value);
}

Expand Down Expand Up @@ -124,7 +124,7 @@ void freetrack::pose(const double* headpose, const double* raw)
{
// FTHeap pMemData happens to be aligned on a page boundary by virtue of
// memory mapping usage (MS Windows equivalent of mmap(2)).
static_assert((offsetof(FTHeap, table) & (sizeof(LONG)-1)) == 0);
// static_assert((offsetof(FTHeap, table) & (sizeof(LONG)-1)) == 0);

for (unsigned k = 0; k < 2; k++)
store(pMemData->table_ints[k], t.ints[k]);
Expand Down
2 changes: 1 addition & 1 deletion src/HeadPoseDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void HeadPoseDetector::loop() {
}

auto q0_inv = P0.att().inverse();
// q0_inv = Eigen::Quaterniond::Identity();
q0_inv = Eigen::Quaterniond::Identity();
this->on_detect_pose6d_raw(t, make_pair(R2ypr(q0_inv*pose_raw.R()), q0_inv*pose_raw.pos()));

t = QDateTime::currentMSecsSinceEpoch()/1000.0 - t0;
Expand Down
9 changes: 6 additions & 3 deletions src/PoseDataSender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ void PoseDataSender::send_data_udp(double t, Pose6DoF pose) {
//Send packet
//Debug only
double data[6] = {0};
data[0] = pose.second.x()*100;
data[1] = - pose.second.y()*100;
data[2] = pose.second.z()*100;
// data[0] = pose.second.x()*100;
// data[1] = - pose.second.y()*100;
// data[2] = pose.second.z()*100;
data[0] = -pose.second.y()*100;
data[1] = -pose.second.z()*100;
data[2] = -pose.second.x()*100;

data[3] = eul(0);
data[4] = eul(1);
Expand Down
3 changes: 2 additions & 1 deletion src/poseremapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ void PoseRemapper::on_pose_data(double t, Pose_ pose_) {
Pose pose(pose_.second, pose_.first);
if(!is_inited) {
qDebug() << "Reset initial pose";
std::cout << initial_pose.att().toRotationMatrix() << std::endl;
initial_pose = pose;
is_inited = true;
}

auto Q = initial_pose.att().inverse() * pose.att();
Eigen::Vector3d T = pose.pos() - initial_pose.pos();

T = initial_pose.att().inverse() * T;
auto eul = quat2eulers(Q);
this->send_mapped_posedata(t, std::make_pair(eul, T));
}
Expand Down

0 comments on commit c5c7a07

Please sign in to comment.