diff --git a/src/xrt/drivers/vive/vive_config.c b/src/xrt/drivers/vive/vive_config.c index 30b4f16ed..4253ed850 100644 --- a/src/xrt/drivers/vive/vive_config.c +++ b/src/xrt/drivers/vive/vive_config.c @@ -365,7 +365,10 @@ vive_config_parse_controller(struct vive_controller_device *d, } else if (strcmp(d->firmware.model_number, "Vive Tracker PVT") == 0) { d->variant = CONTROLLER_TRACKER_GEN1; VIVE_CONTROLLER_DEBUG(d, "Found Gen 1 tracker."); - + } else if (strcmp(d->firmware.model_number, "VIVE Tracker Pro MV") == + 0) { + d->variant = CONTROLLER_TRACKER_GEN2; + VIVE_CONTROLLER_DEBUG(d, "Found Gen 2 tracker."); } else { VIVE_CONTROLLER_ERROR(d, "Failed to parse controller variant"); } @@ -381,13 +384,17 @@ vive_config_parse_controller(struct vive_controller_device *d, d->firmware.mb_serial_number); } break; case CONTROLLER_INDEX_LEFT: - case CONTROLLER_INDEX_RIGHT: { + case CONTROLLER_INDEX_RIGHT: + case CONTROLLER_TRACKER_GEN2: { const cJSON *imu = u_json_get(json, "imu"); _get_pose_from_pos_x_z(imu, &d->imu.trackref); JSON_VEC3(imu, "acc_bias", &d->imu.acc_bias); JSON_VEC3(imu, "acc_scale", &d->imu.acc_scale); JSON_VEC3(imu, "gyro_bias", &d->imu.gyro_bias); + + if (d->variant == CONTROLLER_TRACKER_GEN2) + JSON_VEC3(imu, "gyro_scale", &d->imu.gyro_scale); } break; default: VIVE_CONTROLLER_ERROR(d, "Unknown Vive watchman variant.\n"); diff --git a/src/xrt/drivers/vive/vive_controller.c b/src/xrt/drivers/vive/vive_controller.c index 6ff7e058a..525703631 100644 --- a/src/xrt/drivers/vive/vive_controller.c +++ b/src/xrt/drivers/vive/vive_controller.c @@ -1145,6 +1145,9 @@ vive_controller_create(struct os_hid_device *controller_hid, } else if (d->variant == CONTROLLER_TRACKER_GEN1) { d->base.name = XRT_DEVICE_VIVE_TRACKER_GEN1; d->base.update_inputs = _update_tracker_inputs; + } else if (d->variant == CONTROLLER_TRACKER_GEN2) { + d->base.name = XRT_DEVICE_VIVE_TRACKER_GEN2; + d->base.update_inputs = _update_tracker_inputs; } else { d->base.name = XRT_DEVICE_GENERIC_HMD; VIVE_CONTROLLER_ERROR(d, diff --git a/src/xrt/drivers/vive/vive_controller.h b/src/xrt/drivers/vive/vive_controller.h index 1e7141749..6db837257 100644 --- a/src/xrt/drivers/vive/vive_controller.h +++ b/src/xrt/drivers/vive/vive_controller.h @@ -39,6 +39,7 @@ enum controller_variant CONTROLLER_INDEX_LEFT, CONTROLLER_INDEX_RIGHT, CONTROLLER_TRACKER_GEN1, + CONTROLLER_TRACKER_GEN2, CONTROLLER_UNKNOWN }; diff --git a/src/xrt/include/xrt/xrt_defines.h b/src/xrt/include/xrt/xrt_defines.h index b0d0ee56b..47e284f36 100644 --- a/src/xrt/include/xrt/xrt_defines.h +++ b/src/xrt/include/xrt/xrt_defines.h @@ -387,6 +387,7 @@ enum xrt_device_name XRT_DEVICE_INDEX_CONTROLLER = 5, XRT_DEVICE_VIVE_WAND = 6, XRT_DEVICE_VIVE_TRACKER_GEN1 = 7, + XRT_DEVICE_VIVE_TRACKER_GEN2 = 8, }; /*!