mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
xrt: rename offset → initial_offset on xrt_tracking_origin
Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2286>
This commit is contained in:
parent
eae4472f50
commit
6f8c0d9154
|
@ -113,33 +113,33 @@ u_builder_setup_tracking_origins(struct xrt_device *head,
|
|||
struct xrt_tracking_origin *right_origin = right ? right->tracking_origin : NULL;
|
||||
|
||||
if (left_origin != NULL && left_origin->type == XRT_TRACKING_TYPE_NONE) {
|
||||
left_origin->offset.position.x = -0.2f;
|
||||
left_origin->offset.position.y = 1.3f;
|
||||
left_origin->offset.position.z = -0.5f;
|
||||
left_origin->initial_offset.position.x = -0.2f;
|
||||
left_origin->initial_offset.position.y = 1.3f;
|
||||
left_origin->initial_offset.position.z = -0.5f;
|
||||
}
|
||||
|
||||
if (right_origin != NULL && right_origin->type == XRT_TRACKING_TYPE_NONE) {
|
||||
right_origin->offset.position.x = 0.2f;
|
||||
right_origin->offset.position.y = 1.3f;
|
||||
right_origin->offset.position.z = -0.5f;
|
||||
right_origin->initial_offset.position.x = 0.2f;
|
||||
right_origin->initial_offset.position.y = 1.3f;
|
||||
right_origin->initial_offset.position.z = -0.5f;
|
||||
}
|
||||
|
||||
// Head comes last, because left and right may share tracking origin.
|
||||
if (head_origin != NULL && head_origin->type == XRT_TRACKING_TYPE_NONE) {
|
||||
// "nominal height" 1.6m
|
||||
head_origin->offset.position.x = 0.0f;
|
||||
head_origin->offset.position.y = 1.6f;
|
||||
head_origin->offset.position.z = 0.0f;
|
||||
head_origin->initial_offset.position.x = 0.0f;
|
||||
head_origin->initial_offset.position.y = 1.6f;
|
||||
head_origin->initial_offset.position.z = 0.0f;
|
||||
}
|
||||
|
||||
if (head_origin) {
|
||||
apply_offset(&head_origin->offset.position, global_tracking_origin_offset);
|
||||
apply_offset(&head_origin->initial_offset.position, global_tracking_origin_offset);
|
||||
}
|
||||
if (left_origin && left_origin != head_origin) {
|
||||
apply_offset(&left->tracking_origin->offset.position, global_tracking_origin_offset);
|
||||
apply_offset(&left->tracking_origin->initial_offset.position, global_tracking_origin_offset);
|
||||
}
|
||||
if (right_origin && right_origin != head_origin && right_origin != left_origin) {
|
||||
apply_offset(&right->tracking_origin->offset.position, global_tracking_origin_offset);
|
||||
apply_offset(&right->tracking_origin->initial_offset.position, global_tracking_origin_offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -316,7 +316,7 @@ u_device_allocate(enum u_device_alloc_flags flags, size_t size, size_t input_cou
|
|||
if (alloc_tracking) {
|
||||
xdev->tracking_origin = (struct xrt_tracking_origin *)(ptr + offset_tracking);
|
||||
xdev->tracking_origin->type = XRT_TRACKING_TYPE_NONE;
|
||||
xdev->tracking_origin->offset.orientation.w = 1.0f;
|
||||
xdev->tracking_origin->initial_offset.orientation.w = 1.0f;
|
||||
snprintf(xdev->tracking_origin->name, XRT_TRACKING_NAME_LEN, "%s", "No tracking");
|
||||
}
|
||||
|
||||
|
|
|
@ -914,7 +914,7 @@ u_space_overseer_legacy_setup(struct u_space_overseer *uso,
|
|||
if (ptr != NULL) {
|
||||
xs = (struct xrt_space *)ptr;
|
||||
} else {
|
||||
u_space_overseer_create_offset_space(uso, root, &torig->offset, &xs);
|
||||
u_space_overseer_create_offset_space(uso, root, &torig->initial_offset, &xs);
|
||||
u_hashmap_int_insert(torig_map, key, xs);
|
||||
}
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ euroc_device_create(struct xrt_prober *xp)
|
|||
|
||||
xd->tracking_origin = &ed->tracking_origin;
|
||||
xd->tracking_origin->type = XRT_TRACKING_TYPE_EXTERNAL_SLAM;
|
||||
xd->tracking_origin->offset.orientation.w = 1.0f;
|
||||
xd->tracking_origin->initial_offset.orientation.w = 1.0f;
|
||||
snprintf(xd->tracking_origin->name, XRT_TRACKING_NAME_LEN, "%s %s", dev_name, "SLAM Tracker");
|
||||
|
||||
if (is_hmd) {
|
||||
|
@ -217,7 +217,7 @@ euroc_device_create(struct xrt_prober *xp)
|
|||
u_var_add_root(ed, dev_name, false);
|
||||
u_var_add_pose(ed, &ed->pose, "pose");
|
||||
u_var_add_pose(ed, &ed->offset, "offset");
|
||||
u_var_add_pose(ed, &ed->tracking_origin.offset, "tracking offset");
|
||||
u_var_add_pose(ed, &ed->tracking_origin.initial_offset, "tracking offset");
|
||||
|
||||
bool tracked = xp->tracking->create_tracked_slam(xp->tracking, &ed->slam) >= 0;
|
||||
if (!tracked) {
|
||||
|
|
|
@ -203,10 +203,10 @@ ht_device_create_common(struct t_stereo_camera_calibration *calib,
|
|||
}
|
||||
|
||||
htd->base.tracking_origin->type = XRT_TRACKING_TYPE_RGB;
|
||||
htd->base.tracking_origin->offset.position.x = 0.0f;
|
||||
htd->base.tracking_origin->offset.position.y = 0.0f;
|
||||
htd->base.tracking_origin->offset.position.z = 0.0f;
|
||||
htd->base.tracking_origin->offset.orientation.w = 1.0f;
|
||||
htd->base.tracking_origin->initial_offset.position.x = 0.0f;
|
||||
htd->base.tracking_origin->initial_offset.position.y = 0.0f;
|
||||
htd->base.tracking_origin->initial_offset.position.z = 0.0f;
|
||||
htd->base.tracking_origin->initial_offset.orientation.w = 1.0f;
|
||||
|
||||
htd->base.update_inputs = u_device_noop_update_inputs;
|
||||
htd->base.get_hand_tracking = ht_device_get_hand_tracking;
|
||||
|
|
|
@ -595,9 +595,9 @@ hydra_found(struct xrt_prober *xp,
|
|||
hs->base.type = XRT_TRACKING_TYPE_HYDRA;
|
||||
snprintf(hs->base.name, XRT_TRACKING_NAME_LEN, "%s", "Razer Hydra magnetic tracking");
|
||||
// Arbitrary static transform from local space to base.
|
||||
hs->base.offset.position.y = 1.0f;
|
||||
hs->base.offset.position.z = -0.25f;
|
||||
hs->base.offset.orientation.w = 1.0f;
|
||||
hs->base.initial_offset.position.y = 1.0f;
|
||||
hs->base.initial_offset.position.z = -0.25f;
|
||||
hs->base.initial_offset.orientation.w = 1.0f;
|
||||
|
||||
hs->data_hid = data_hid;
|
||||
hs->command_hid = command_hid;
|
||||
|
|
|
@ -109,8 +109,8 @@ get_tracked_pose(struct xrt_device *xdev,
|
|||
m_space_relation_ident(&in_target_space);
|
||||
in_target_space.relation_flags = tracker_relation.relation_flags;
|
||||
|
||||
struct xrt_pose *target_offset = &d->tracking_override.target->tracking_origin->offset;
|
||||
struct xrt_pose *tracker_offset = &d->tracking_override.tracker->tracking_origin->offset;
|
||||
struct xrt_pose *target_offset = &d->tracking_override.target->tracking_origin->initial_offset;
|
||||
struct xrt_pose *tracker_offset = &d->tracking_override.tracker->tracking_origin->initial_offset;
|
||||
|
||||
attached_override(d, &target_relation, target_offset, &tracker_relation, tracker_offset,
|
||||
&in_target_space, out_relation);
|
||||
|
@ -163,8 +163,8 @@ get_hand_tracking(struct xrt_device *xdev,
|
|||
m_space_relation_ident(&in_target_space);
|
||||
in_target_space.relation_flags = tracker_relation.relation_flags;
|
||||
|
||||
struct xrt_pose *target_offset = &d->tracking_override.target->tracking_origin->offset;
|
||||
struct xrt_pose *tracker_offset = &d->tracking_override.tracker->tracking_origin->offset;
|
||||
struct xrt_pose *target_offset = &d->tracking_override.target->tracking_origin->initial_offset;
|
||||
struct xrt_pose *tracker_offset = &d->tracking_override.tracker->tracking_origin->initial_offset;
|
||||
|
||||
attached_override(d, &out_value->hand_pose, target_offset, &tracker_relation, tracker_offset,
|
||||
&in_target_space, &out_value->hand_pose);
|
||||
|
|
|
@ -1233,7 +1233,7 @@ oh_device_create(ohmd_context *ctx, bool no_hmds, struct xrt_device **out_xdevs)
|
|||
//! @todo: support mix of 3dof and 6dof OpenHMD devices
|
||||
struct oh_system *sys = U_TYPED_CALLOC(struct oh_system);
|
||||
sys->base.type = XRT_TRACKING_TYPE_NONE;
|
||||
sys->base.offset.orientation.w = 1.0f;
|
||||
sys->base.initial_offset.orientation.w = 1.0f;
|
||||
|
||||
u_var_add_root(sys, "OpenHMD Wrapper", false);
|
||||
|
||||
|
|
|
@ -466,7 +466,7 @@ rs_ddev_create(int device_idx)
|
|||
rs->base.destroy = rs_ddev_destroy;
|
||||
rs->base.name = XRT_DEVICE_REALSENSE;
|
||||
rs->base.tracking_origin->type = XRT_TRACKING_TYPE_EXTERNAL_SLAM;
|
||||
rs->base.tracking_origin->offset = (struct xrt_pose)XRT_POSE_IDENTITY;
|
||||
rs->base.tracking_origin->initial_offset = (struct xrt_pose)XRT_POSE_IDENTITY;
|
||||
|
||||
// Print name.
|
||||
snprintf(rs->base.str, XRT_DEVICE_NAME_LEN, "Intel RealSense Device-SLAM");
|
||||
|
|
|
@ -415,7 +415,7 @@ r_create_devices(uint16_t port,
|
|||
r->base.destroy = r_hub_system_devices_destroy;
|
||||
r->base.get_roles = r_hub_system_devices_get_roles;
|
||||
r->origin.type = XRT_TRACKING_TYPE_RGB;
|
||||
r->origin.offset = (struct xrt_pose)XRT_POSE_IDENTITY;
|
||||
r->origin.initial_offset = (struct xrt_pose)XRT_POSE_IDENTITY;
|
||||
r->reset.head.center = (struct xrt_pose)XRT_POSE_IDENTITY;
|
||||
r->reset.head.center.position.y = 1.6f;
|
||||
r->reset.left.active = true;
|
||||
|
@ -487,7 +487,7 @@ r_create_devices(uint16_t port,
|
|||
|
||||
struct xrt_space *root = xso->semantic.root; // Convenience
|
||||
struct xrt_space *offset = NULL;
|
||||
u_space_overseer_create_offset_space(uso, root, &r->origin.offset, &offset);
|
||||
u_space_overseer_create_offset_space(uso, root, &r->origin.initial_offset, &offset);
|
||||
|
||||
for (uint32_t i = 0; i < r->base.xdev_count; i++) {
|
||||
u_space_overseer_link_space_to_device(uso, offset, r->base.xdevs[i]);
|
||||
|
|
|
@ -158,7 +158,7 @@ rift_s_system_create(struct xrt_prober *xp,
|
|||
|
||||
struct rift_s_system *sys = U_TYPED_CALLOC(struct rift_s_system);
|
||||
sys->base.type = XRT_TRACKING_TYPE_NONE;
|
||||
sys->base.offset.orientation.w = 1.0f;
|
||||
sys->base.initial_offset.orientation.w = 1.0f;
|
||||
|
||||
/* Init refcount */
|
||||
sys->ref.count = 1;
|
||||
|
|
|
@ -115,7 +115,7 @@ Context::create(const std::string &steam_install,
|
|||
c->providers = std::move(providers);
|
||||
std::strncpy(c->name, "SteamVR Lighthouse Tracking", XRT_TRACKING_NAME_LEN);
|
||||
c->type = XRT_TRACKING_TYPE_LIGHTHOUSE;
|
||||
c->offset = XRT_POSE_IDENTITY;
|
||||
c->initial_offset = XRT_POSE_IDENTITY;
|
||||
for (vr::IServerTrackedDeviceProvider *const &driver : c->providers) {
|
||||
vr::EVRInitError err = driver->Init(c.get());
|
||||
if (err != vr::VRInitError_None) {
|
||||
|
|
|
@ -1336,10 +1336,10 @@ survive_get_devices(struct xrt_device **out_xdevs, struct vive_config **out_vive
|
|||
ss->ctx = actx;
|
||||
ss->base.type = XRT_TRACKING_TYPE_LIGHTHOUSE;
|
||||
snprintf(ss->base.name, XRT_TRACKING_NAME_LEN, "%s", "Libsurvive Tracking");
|
||||
ss->base.offset.position.x = 0.0f;
|
||||
ss->base.offset.position.y = 0.0f;
|
||||
ss->base.offset.position.z = 0.0f;
|
||||
ss->base.offset.orientation.w = 1.0f;
|
||||
ss->base.initial_offset.position.x = 0.0f;
|
||||
ss->base.initial_offset.position.y = 0.0f;
|
||||
ss->base.initial_offset.position.z = 0.0f;
|
||||
ss->base.initial_offset.orientation.w = 1.0f;
|
||||
ss->timecode_offset_ms = (struct u_var_draggable_f32){
|
||||
.val = debug_get_float_option_survive_timecode_offset_ms(),
|
||||
.min = -20.0,
|
||||
|
|
|
@ -176,7 +176,7 @@ twrap_slam_create_device(struct xrt_frame_context *xfctx,
|
|||
dx->base.destroy = twrap_slam_destroy;
|
||||
dx->base.name = name;
|
||||
dx->base.tracking_origin->type = XRT_TRACKING_TYPE_OTHER;
|
||||
dx->base.tracking_origin->offset = (struct xrt_pose)XRT_POSE_IDENTITY;
|
||||
dx->base.tracking_origin->initial_offset = (struct xrt_pose)XRT_POSE_IDENTITY;
|
||||
dx->base.inputs[0].name = XRT_INPUT_GENERIC_TRACKER_POSE;
|
||||
dx->base.orientation_tracking_supported = true;
|
||||
dx->base.position_tracking_supported = true;
|
||||
|
|
|
@ -387,7 +387,7 @@ ulv2_create_device(struct xrt_device **out_xdev)
|
|||
ulv2d->base.tracking_origin = &ulv2d->tracking_origin;
|
||||
ulv2d->base.tracking_origin->type = XRT_TRACKING_TYPE_OTHER;
|
||||
|
||||
math_pose_identity(&ulv2d->base.tracking_origin->offset);
|
||||
math_pose_identity(&ulv2d->base.tracking_origin->initial_offset);
|
||||
|
||||
ulv2d->log_level = debug_get_log_option_ulv2_log();
|
||||
|
||||
|
|
|
@ -310,7 +310,7 @@ ulv5_create_device(struct xrt_device **out_xdev)
|
|||
ulv5d->base.tracking_origin = &ulv5d->tracking_origin;
|
||||
ulv5d->base.tracking_origin->type = XRT_TRACKING_TYPE_OTHER;
|
||||
|
||||
math_pose_identity(&ulv5d->base.tracking_origin->offset);
|
||||
math_pose_identity(&ulv5d->base.tracking_origin->initial_offset);
|
||||
|
||||
ulv5d->log_level = debug_get_log_option_ulv5_log();
|
||||
|
||||
|
|
|
@ -76,10 +76,10 @@ struct xrt_tracking_origin
|
|||
enum xrt_tracking_type type;
|
||||
|
||||
/*!
|
||||
* Read and written to by the state-tracker using the device(s)
|
||||
* this tracking system is tracking.
|
||||
* Read-only. Set once by the builder, or in some cases, the driver.
|
||||
* With some systems, the offset may be changed at runtime using the space overseer.
|
||||
*/
|
||||
struct xrt_pose offset;
|
||||
struct xrt_pose initial_offset;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
|
|
@ -283,12 +283,12 @@ ipc_instance_create(struct xrt_instance_info *i_info, struct xrt_instance **out_
|
|||
memcpy(xtrack->name, ism->itracks[i].name, sizeof(xtrack->name));
|
||||
|
||||
xtrack->type = ism->itracks[i].type;
|
||||
xtrack->offset = ism->itracks[i].offset;
|
||||
xtrack->initial_offset = ism->itracks[i].offset;
|
||||
ii->xtracks[count++] = xtrack;
|
||||
|
||||
u_var_add_root(xtrack, "Tracking origin", true);
|
||||
u_var_add_ro_text(xtrack, xtrack->name, "name");
|
||||
u_var_add_pose(xtrack, &xtrack->offset, "offset");
|
||||
u_var_add_pose(xtrack, &xtrack->initial_offset, "offset");
|
||||
}
|
||||
|
||||
ii->xtrack_count = count;
|
||||
|
|
|
@ -322,7 +322,7 @@ init_shm(struct ipc_server *s)
|
|||
struct ipc_shared_tracking_origin *itrack = &ism->itracks[count++];
|
||||
memcpy(itrack->name, xtrack->name, sizeof(itrack->name));
|
||||
itrack->type = xtrack->type;
|
||||
itrack->offset = xtrack->offset;
|
||||
itrack->offset = xtrack->initial_offset;
|
||||
}
|
||||
|
||||
ism->itrack_count = count;
|
||||
|
|
|
@ -1789,7 +1789,7 @@ oxr_session_frame_end(struct oxr_logger *log, struct oxr_session *sess, const Xr
|
|||
do_synchronize_state_change(log, sess);
|
||||
|
||||
struct xrt_pose inv_offset = {0};
|
||||
math_pose_invert(&xdev->tracking_origin->offset, &inv_offset);
|
||||
math_pose_invert(&xdev->tracking_origin->initial_offset, &inv_offset);
|
||||
|
||||
struct xrt_layer_frame_data data = {
|
||||
.frame_id = sess->frame_id.begun,
|
||||
|
|
|
@ -421,15 +421,15 @@ p_tracking_init(struct prober *p)
|
|||
fact->base.create_tracked_psvr = p_factory_create_tracked_psvr;
|
||||
fact->base.create_tracked_slam = p_factory_create_tracked_slam;
|
||||
fact->origin.type = XRT_TRACKING_TYPE_RGB;
|
||||
fact->origin.offset.orientation.y = 1.0f;
|
||||
fact->origin.offset.position.z = -2.0f;
|
||||
fact->origin.offset.position.y = 1.0f;
|
||||
fact->origin.initial_offset.orientation.y = 1.0f;
|
||||
fact->origin.initial_offset.position.z = -2.0f;
|
||||
fact->origin.initial_offset.position.y = 1.0f;
|
||||
fact->p = p;
|
||||
|
||||
snprintf(fact->origin.name, sizeof(fact->origin.name), "PSVR & PSMV tracking");
|
||||
|
||||
u_var_add_root(fact, "Tracking Factory", false);
|
||||
u_var_add_pose(fact, &fact->origin.offset, "offset");
|
||||
u_var_add_pose(fact, &fact->origin.initial_offset, "offset");
|
||||
|
||||
// Finally set us as the tracking factory.
|
||||
p->base.tracking = &fact->base;
|
||||
|
|
|
@ -881,7 +881,7 @@ public:
|
|||
struct xrt_space_relation rel;
|
||||
xrt_device_get_tracked_pose(m_xdev, grip_name, now_ns, &rel);
|
||||
|
||||
struct xrt_pose *offset = &m_xdev->tracking_origin->offset;
|
||||
struct xrt_pose *offset = &m_xdev->tracking_origin->initial_offset;
|
||||
|
||||
struct xrt_relation_chain chain = {};
|
||||
m_relation_chain_push_relation(&chain, &rel);
|
||||
|
@ -1268,7 +1268,7 @@ CDeviceDriver_Monado::GetPose()
|
|||
struct xrt_space_relation rel;
|
||||
xrt_device_get_tracked_pose(m_xdev, XRT_INPUT_GENERIC_HEAD_POSE, now_ns, &rel);
|
||||
|
||||
struct xrt_pose *offset = &m_xdev->tracking_origin->offset;
|
||||
struct xrt_pose *offset = &m_xdev->tracking_origin->initial_offset;
|
||||
|
||||
struct xrt_relation_chain chain = {};
|
||||
m_relation_chain_push_relation(&chain, &rel);
|
||||
|
|
|
@ -301,9 +301,9 @@ rgb_open_system_impl(struct xrt_builder *xb,
|
|||
build.xfctx = xfctx;
|
||||
build.origin = origin;
|
||||
build.origin->type = XRT_TRACKING_TYPE_RGB;
|
||||
build.origin->offset.orientation.y = 1.0f;
|
||||
build.origin->offset.position.z = -2.0f;
|
||||
build.origin->offset.position.y = 1.0f;
|
||||
build.origin->initial_offset.orientation.y = 1.0f;
|
||||
build.origin->initial_offset.position.z = -2.0f;
|
||||
build.origin->initial_offset.position.y = 1.0f;
|
||||
|
||||
setup_pipeline(xp, &build);
|
||||
#else
|
||||
|
|
|
@ -120,7 +120,7 @@ sdl_device_init(struct sdl_program *sp)
|
|||
u_distortion_mesh_set_none(xdev);
|
||||
|
||||
// Tracking origin.
|
||||
xdev->tracking_origin->offset = (struct xrt_pose)XRT_POSE_IDENTITY;
|
||||
xdev->tracking_origin->initial_offset = (struct xrt_pose)XRT_POSE_IDENTITY;
|
||||
xdev->tracking_origin->type = XRT_TRACKING_TYPE_OTHER;
|
||||
snprintf(xdev->tracking_origin->name, XRT_TRACKING_NAME_LEN, "SDL Tracking");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue