Skip to content

Commit

Permalink
Added pose (std & prev) timestamp handling, copying and (sample) usage
Browse files Browse the repository at this point in the history
  • Loading branch information
KimihikoAkayasaki committed Oct 7, 2022
1 parent 5071c3d commit fb9adf5
Show file tree
Hide file tree
Showing 7 changed files with 272 additions and 91 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ x86/
*.sln.docstates

Amethyst/Amethyst.aps

external/protobuf/out/
21 changes: 18 additions & 3 deletions Amethyst/K2AppTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,13 @@ namespace k2app
tracker_base.mutable_data()->set_role(data_role);
tracker_base.mutable_data()->set_isactive(data_isActive);

// Add ID and return
// Add ID
tracker_base.set_tracker(base_tracker);

// Add timestamps and return
tracker_base.mutable_pose()->set_posetimestamp(pose_poseTimestamp);
tracker_base.mutable_pose()->set_previousposetimestamp(pose_previousPoseTimestamp);

return tracker_base;
}

Expand Down Expand Up @@ -565,9 +570,13 @@ namespace k2app
tracker_base.mutable_data()->set_role(data_role);
tracker_base.mutable_data()->set_isactive(data_isActive);


// Add ID and return
// Add ID
tracker_base.set_tracker(base_tracker);

// Add timestamps and return
tracker_base.mutable_pose()->set_posetimestamp(pose_poseTimestamp);
tracker_base.mutable_pose()->set_previousposetimestamp(pose_previousPoseTimestamp);

return tracker_base;
}

Expand Down Expand Up @@ -619,6 +628,9 @@ namespace k2app
Eigen::Vector3d pose_angularVelocity{0, 0, 0};
Eigen::Vector3d pose_angularAcceleration{0, 0, 0};

long long pose_poseTimestamp = 0;
long long pose_previousPoseTimestamp = 0;

template <class Archive>
void serialize(Archive& archive)
{
Expand All @@ -636,6 +648,9 @@ namespace k2app
CEREAL_NVP(pose_angularVelocity),
CEREAL_NVP(pose_angularAcceleration),

CEREAL_NVP(pose_poseTimestamp),
CEREAL_NVP(pose_previousPoseTimestamp),

CEREAL_NVP(data_serial),
CEREAL_NVP(data_role),
CEREAL_NVP(data_isActive),
Expand Down
12 changes: 12 additions & 0 deletions Amethyst/K2Main.h
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,9 @@ namespace k2app::main
overrides::getFlippedJointType(
ITrackerType_Joint[tracker.base_tracker], base_flip)];

tracker.pose_poseTimestamp = _joint.getPoseTimestamp();
tracker.pose_previousPoseTimestamp = _joint.getPreviousPoseTimestamp();

tracker.pose_position = _joint.getJointPosition();
tracker.m_use_own_physics = _kinect->isPhysicsOverrideEnabled();
tracker.m_no_position_filtering_requested =
Expand All @@ -815,6 +818,9 @@ namespace k2app::main
const auto& _joint = _joints->getTrackedJoints().at(
tracker.selectedTrackedJointID);

tracker.pose_poseTimestamp = _joint.getPoseTimestamp();
tracker.pose_previousPoseTimestamp = _joint.getPreviousPoseTimestamp();

tracker.pose_position = _joint.getJointPosition();
tracker.m_use_own_physics = _joints->isPhysicsOverrideEnabled();
tracker.m_no_position_filtering_requested =
Expand Down Expand Up @@ -1053,6 +1059,9 @@ namespace k2app::main
TrackingDevices::devices_override_joint_id(
_override_id, tracker.overrideJointID)), override_flip)];

tracker.pose_poseTimestamp = _joint.getPoseTimestamp();
tracker.pose_previousPoseTimestamp = _joint.getPreviousPoseTimestamp();

tracker.pose_position = _joint.getJointPosition();
tracker.m_use_own_physics = _kinect->isPhysicsOverrideEnabled();
tracker.m_no_position_filtering_requested =
Expand Down Expand Up @@ -1080,6 +1089,9 @@ namespace k2app::main
const auto& _joint = _joints->getTrackedJoints().at(
tracker.overrideJointID);

tracker.pose_poseTimestamp = _joint.getPoseTimestamp();
tracker.pose_previousPoseTimestamp = _joint.getPreviousPoseTimestamp();

tracker.pose_position = _joint.getJointPosition();
tracker.m_use_own_physics = _joints->isPhysicsOverrideEnabled();
tracker.m_no_position_filtering_requested =
Expand Down
Loading

0 comments on commit fb9adf5

Please sign in to comment.