85 lines
1.7 KiB
C++
85 lines
1.7 KiB
C++
//======================================================================================================
|
|
// Copyright 2023, NaturalPoint Inc.
|
|
//======================================================================================================
|
|
/**
|
|
* This includes common glove data formats referenced in Motive.
|
|
*/
|
|
|
|
|
|
#pragma once
|
|
#include <list>
|
|
#include <mutex>
|
|
#include <vector>
|
|
#include <set>
|
|
|
|
enum class eGloveHandSide : int
|
|
{
|
|
Unknown = 0,
|
|
Left = 1,
|
|
Right = 2
|
|
};
|
|
|
|
|
|
struct sGloveDataTimestamp
|
|
{
|
|
uint8_t hour = 0;
|
|
uint8_t minute = 0;
|
|
uint32_t seconds = 0;
|
|
uint32_t nanoseconds = 0;
|
|
double t = 0;
|
|
sGloveDataTimestamp(uint32_t s, uint32_t n) : seconds(s), nanoseconds(n) { t = double(seconds) + double(nanoseconds) * 0.000000001; }
|
|
sGloveDataTimestamp(double time) { t = time; }
|
|
sGloveDataTimestamp() : t(0.0) {}
|
|
|
|
bool operator >(const sGloveDataTimestamp& x)
|
|
{
|
|
return this->t > x.t;
|
|
}
|
|
bool operator <(const sGloveDataTimestamp& x)
|
|
{
|
|
return this->t < x.t;
|
|
}
|
|
bool operator ==(const sGloveDataTimestamp& x)
|
|
{
|
|
return this->t == x.t;
|
|
}
|
|
|
|
sGloveDataTimestamp operator -(const sGloveDataTimestamp& x)
|
|
{
|
|
return sGloveDataTimestamp(this->t - x.t);
|
|
}
|
|
|
|
operator const double() {
|
|
return t;
|
|
}
|
|
};
|
|
|
|
struct sFingerNode {
|
|
int node_id;
|
|
float quat_x;
|
|
float quat_y;
|
|
float quat_z;
|
|
float quat_w;
|
|
};
|
|
|
|
struct sGloveDeviceData {
|
|
uint64_t gloveId = 0;
|
|
std::vector<sFingerNode> nodes;
|
|
sGloveDataTimestamp timestamp;
|
|
};
|
|
|
|
struct sGloveDeviceBaseInfo
|
|
{
|
|
uint32_t gloveId = 0; // device serial id
|
|
int battery = 0 ;
|
|
int signalStrength= 0;
|
|
eGloveHandSide handSide = eGloveHandSide::Unknown;
|
|
std::string actorName = ""; // Actor 이름 (다중 장비 구분용)
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|