File palm_pose.hpp
File List > data_format > poses > palm_pose.hpp
Go to the documentation of this file
#pragma once
#ifdef USING_OPENXR
# include "illixr/data_format/poses/pose_base.hpp"
# include "illixr/switchboard.hpp"
# include
namespace ILLIXR::data_format::pose {
struct palm_pose : xrt_space_relation {
[[nodiscard]] bool is_valid() const {
return relation_flags > 0;
}
# ifndef ENABLE_MONADO
void update(XrSpaceLocation& location, XrSpaceVelocity& velocity) {
pose = location.pose;
linear_velocity = velocity.linearVelocity;
angular_velocity = velocity.angularVelocity;
set_flags(location.locationFlags, velocity.velocityFlags);
}
# endif
};
struct palm_poses_pair : public switchboard::event {
std::map<side, palm_pose> hands;
time_point sensor_time;
palm_poses_pair()
: hands{{LEFT, palm_pose{}}, {RIGHT, palm_pose{}}}
, sensor_time{time_point{}} { }
palm_poses_pair(std::map<side, palm_pose> hands_, time_point sensor_time_)
: hands{std::move(hands_)}
, sensor_time{sensor_time_} { }
[[nodiscard]] bool is_valid() const {
return hands.at(LEFT).relation_flags != XRT_SPACE_RELATION_BITMASK_NONE ||
hands.at(RIGHT).relation_flags != XRT_SPACE_RELATION_BITMASK_NONE;
}
palm_pose& operator[](side h) {
return hands[h];
}
};
} // namespace ILLIXR::data_format::pose
#endif