Skip to content
This repository has been archived by the owner on Apr 15, 2023. It is now read-only.

Commit

Permalink
Updated to the v18 AME API
Browse files Browse the repository at this point in the history
  • Loading branch information
KimihikoAkayasaki committed Oct 8, 2022
1 parent 7eaf98a commit cba3ae1
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions external/vendor/Amethyst_API_Devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ inline std::string WStringToString(const std::wstring& w_str)
namespace ktvr
{
// Interface Version
static const char* IAME_API_Devices_Version = "IAME_API_Version_017";
static const char* IAME_API_Devices_Version = "IAME_API_Version_018";

// Return messaging types
enum K2InitErrorType
Expand Down Expand Up @@ -127,7 +127,9 @@ namespace ktvr
jointOrientation{std::move(rot)},
trackingState{state}
{
positionTimestamp = AME_API_GET_TIMESTAMP_NOW;
// Init timestamp creation
previousPoseTimestamp = AME_API_GET_TIMESTAMP_NOW;
poseTimestamp = AME_API_GET_TIMESTAMP_NOW;
}

[[nodiscard]] Eigen::Vector3d getJointPosition() const { return jointPosition; }
Expand All @@ -140,7 +142,9 @@ namespace ktvr
[[nodiscard]] Eigen::Vector3d getJointAngularAcceleration() const { return jointAngularAcceleration; }

[[nodiscard]] ITrackedJointState getTrackingState() const { return trackingState; } // ITrackedJointState
[[nodiscard]] long long getPositionTimestamp() const { return positionTimestamp; }

[[nodiscard]] long long getPoseTimestamp() const { return poseTimestamp; }
[[nodiscard]] long long getPreviousPoseTimestamp() const { return previousPoseTimestamp; }

// For servers!
void update(Eigen::Vector3d position,
Expand All @@ -152,7 +156,8 @@ namespace ktvr
trackingState = state;

// Update pose timestamp
positionTimestamp = AME_API_GET_TIMESTAMP_NOW;
previousPoseTimestamp = poseTimestamp;
poseTimestamp = AME_API_GET_TIMESTAMP_NOW;
}

// For servers!
Expand All @@ -175,7 +180,8 @@ namespace ktvr
trackingState = state;

// Update pose timestamp
positionTimestamp = AME_API_GET_TIMESTAMP_NOW;
previousPoseTimestamp = poseTimestamp;
poseTimestamp = AME_API_GET_TIMESTAMP_NOW;
}

// For servers!
Expand All @@ -184,7 +190,8 @@ namespace ktvr
jointPosition = std::move(position);

// Update pose timestamp
positionTimestamp = AME_API_GET_TIMESTAMP_NOW;
previousPoseTimestamp = poseTimestamp;
poseTimestamp = AME_API_GET_TIMESTAMP_NOW;
}

// For servers!
Expand Down Expand Up @@ -235,7 +242,8 @@ namespace ktvr
Eigen::Vector3d jointAngularAcceleration = Eigen::Vector3d(0., 0., 0.);

ITrackedJointState trackingState = State_NotTracked;
long long positionTimestamp = 0;
long long poseTimestamp = 0;
long long previousPoseTimestamp = 0;
};

// Tracking Device Joint class for client plugins : Extended
Expand Down

0 comments on commit cba3ae1

Please sign in to comment.