mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-06 07:06:10 +00:00
a/vive: Add Vive Pro 2 support
This commit is contained in:
parent
f84353ded3
commit
9b0815bc82
|
@ -40,6 +40,7 @@ extern "C" {
|
||||||
#define VIVE_LIGHTHOUSE_FPGA_RX 0x2000
|
#define VIVE_LIGHTHOUSE_FPGA_RX 0x2000
|
||||||
|
|
||||||
#define VIVE_PRO_MAINBOARD_PID 0x0309
|
#define VIVE_PRO_MAINBOARD_PID 0x0309
|
||||||
|
#define VIVE_PRO2_MAINBOARD_PID 0x0342
|
||||||
#define VIVE_PRO_LHR_PID 0x2300
|
#define VIVE_PRO_LHR_PID 0x2300
|
||||||
|
|
||||||
#define VIVE_WATCHMAN_DONGLE 0x2101
|
#define VIVE_WATCHMAN_DONGLE 0x2101
|
||||||
|
|
|
@ -352,6 +352,12 @@ _calculate_fov(struct vive_config *d)
|
||||||
// eye relief knob adjusts this around [0.0255(near)-0.275(far)]
|
// eye relief knob adjusts this around [0.0255(near)-0.275(far)]
|
||||||
eye_to_screen_distance = 0.0255;
|
eye_to_screen_distance = 0.0255;
|
||||||
}
|
}
|
||||||
|
if (d->variant == VIVE_VARIANT_PRO2) {
|
||||||
|
lens_horizontal_separation = 0.055;
|
||||||
|
h_meters = 0.07;
|
||||||
|
// eye relief knob adjusts this around [0.0255(near)-0.275(far)]
|
||||||
|
eye_to_screen_distance = 0.0255;
|
||||||
|
}
|
||||||
|
|
||||||
double fov = 2 * atan2(w_meters - lens_horizontal_separation / 2.0, eye_to_screen_distance);
|
double fov = 2 * atan2(w_meters - lens_horizontal_separation / 2.0, eye_to_screen_distance);
|
||||||
|
|
||||||
|
@ -432,6 +438,10 @@ vive_config_parse(struct vive_config *d, char *json_string, enum u_logging_level
|
||||||
strcmp(d->firmware.model_number, "VIVE_Pro MV") == 0) {
|
strcmp(d->firmware.model_number, "VIVE_Pro MV") == 0) {
|
||||||
d->variant = VIVE_VARIANT_PRO;
|
d->variant = VIVE_VARIANT_PRO;
|
||||||
VIVE_DEBUG(d, "Found HTC Vive Pro HMD");
|
VIVE_DEBUG(d, "Found HTC Vive Pro HMD");
|
||||||
|
} else if (strcmp(d->firmware.model_number, "Vive_Pro 2 MV") == 0 ||
|
||||||
|
strcmp(d->firmware.model_number, "VIVE_Pro 2 MV") == 0) {
|
||||||
|
d->variant = VIVE_VARIANT_PRO2;
|
||||||
|
VIVE_DEBUG(d, "Found HTC Vive Pro 2 HMD");
|
||||||
} else {
|
} else {
|
||||||
VIVE_ERROR(d, "Failed to parse Vive HMD variant!\n\tfirmware.model_[number|name]: '%s'",
|
VIVE_ERROR(d, "Failed to parse Vive HMD variant!\n\tfirmware.model_[number|name]: '%s'",
|
||||||
d->firmware.model_number);
|
d->firmware.model_number);
|
||||||
|
@ -475,6 +485,26 @@ vive_config_parse(struct vive_config *d, char *json_string, enum u_logging_level
|
||||||
const cJSON *cameras_json = u_json_get(json, "tracked_cameras");
|
const cJSON *cameras_json = u_json_get(json, "tracked_cameras");
|
||||||
_get_cameras(d, cameras_json);
|
_get_cameras(d, cameras_json);
|
||||||
} break;
|
} break;
|
||||||
|
case VIVE_VARIANT_PRO2: {
|
||||||
|
const cJSON *imu = cJSON_GetObjectItemCaseSensitive(json, "imu");
|
||||||
|
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);
|
||||||
|
JSON_VEC3(imu, "gyro_scale", &d->imu.gyro_scale);
|
||||||
|
|
||||||
|
_get_lighthouse(d, json);
|
||||||
|
|
||||||
|
struct xrt_pose trackref_to_head;
|
||||||
|
struct xrt_pose imu_to_head;
|
||||||
|
|
||||||
|
math_pose_invert(&d->display.trackref, &trackref_to_head);
|
||||||
|
math_pose_transform(&trackref_to_head, &d->imu.trackref, &imu_to_head);
|
||||||
|
|
||||||
|
d->display.imuref = imu_to_head;
|
||||||
|
|
||||||
|
const cJSON *cameras_json = u_json_get(json, "tracked_cameras");
|
||||||
|
_get_cameras(d, cameras_json);
|
||||||
|
} break;
|
||||||
default:
|
default:
|
||||||
VIVE_ERROR(d, "Unknown Vive variant.");
|
VIVE_ERROR(d, "Unknown Vive variant.");
|
||||||
vive_config_teardown(d);
|
vive_config_teardown(d);
|
||||||
|
|
|
@ -48,7 +48,8 @@ enum VIVE_VARIANT
|
||||||
VIVE_UNKNOWN = 0,
|
VIVE_UNKNOWN = 0,
|
||||||
VIVE_VARIANT_VIVE,
|
VIVE_VARIANT_VIVE,
|
||||||
VIVE_VARIANT_PRO,
|
VIVE_VARIANT_PRO,
|
||||||
VIVE_VARIANT_INDEX
|
VIVE_VARIANT_INDEX,
|
||||||
|
VIVE_VARIANT_PRO2,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
Loading…
Reference in a new issue