The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

d/psmv: Tidy code and add some comments

+66 -64
+66 -64
src/xrt/drivers/psmv/psmv_driver.c
··· 243 243 }; 244 244 245 245 /*! 246 + * Parsed calibration data from a ZCM1 device. 247 + */ 248 + struct psmv_parsed_calibration_zcm1 249 + { 250 + struct xrt_vec3_i32 accel_min_x; 251 + struct xrt_vec3_i32 accel_max_x; 252 + struct xrt_vec3_i32 accel_min_y; 253 + struct xrt_vec3_i32 accel_max_y; 254 + struct xrt_vec3_i32 accel_min_z; 255 + struct xrt_vec3_i32 accel_max_z; 256 + 257 + /*! 258 + * From: https://github.com/nitsch/moveonpc/wiki/Calibration-data 259 + * 260 + * Coded as the one before. The values are very near to 1.0. 261 + * 262 + * I observed, that when I multiply this vector with the gyro bias 263 + * vector before subtracting from the gyro 80rpm measures, I get a 264 + * better calibration. 265 + * 266 + * So in order to get the accurate 80rpm measures: 267 + * GyroMeasure80rpm-(GyroBias1*UnknownVector2) or 268 + * GyroMeasure80rpm-(GyroBias2*UnknownVector2) 269 + */ 270 + struct xrt_vec3 gyro_fact; 271 + struct xrt_vec3_i32 gyro_bias_0; 272 + struct xrt_vec3_i32 gyro_bias_1; 273 + struct xrt_vec3_i32 gyro_rot_x; 274 + struct xrt_vec3_i32 gyro_rot_y; 275 + struct xrt_vec3_i32 gyro_rot_z; 276 + 277 + struct xrt_vec3 unknown_vec3; 278 + float unknown_float_0, unknown_float_1; 279 + }; 280 + 281 + /*! 246 282 * Calibration data, multiple packets goes into this. 247 283 */ 248 284 struct psmv_calibration_zcm2 ··· 267 303 uint8_t _pad1[12]; 268 304 }; 269 305 306 + 270 307 /*! 271 - * Input package. 308 + * Parsed calibration data from a ZCM2 device. 309 + */ 310 + struct psmv_parsed_calibration_zcm2 311 + { 312 + struct xrt_vec3_i32 accel_min_x; 313 + struct xrt_vec3_i32 accel_max_x; 314 + struct xrt_vec3_i32 accel_min_y; 315 + struct xrt_vec3_i32 accel_max_y; 316 + struct xrt_vec3_i32 accel_min_z; 317 + struct xrt_vec3_i32 accel_max_z; 318 + 319 + struct xrt_vec3_i32 gyro_neg_x; 320 + struct xrt_vec3_i32 gyro_pos_x; 321 + struct xrt_vec3_i32 gyro_neg_y; 322 + struct xrt_vec3_i32 gyro_pos_y; 323 + struct xrt_vec3_i32 gyro_neg_z; 324 + struct xrt_vec3_i32 gyro_pos_z; 325 + 326 + //! Pretty sure this is gryo bias. 327 + struct xrt_vec3_i32 gyro_bias; 328 + }; 329 + 330 + /*! 331 + * Input package for ZCM1. 272 332 */ 273 333 struct psmv_input_zcm1 274 334 { ··· 289 349 }; 290 350 291 351 /*! 292 - * Input package. 352 + * Input package for ZCM2. 293 353 */ 294 354 struct psmv_input_zcm2 295 355 { ··· 310 370 }; 311 371 312 372 /*! 313 - * A parsed sample. 373 + * A parsed sample of accel and gyro. 314 374 */ 315 375 struct psmv_parsed_sample 316 376 { ··· 359 419 }; 360 420 361 421 /*! 362 - * Parsed calibration data from a ZCM1 device. 363 - */ 364 - struct psmv_parsed_calibration_zcm1 365 - { 366 - struct xrt_vec3_i32 accel_min_x; 367 - struct xrt_vec3_i32 accel_max_x; 368 - struct xrt_vec3_i32 accel_min_y; 369 - struct xrt_vec3_i32 accel_max_y; 370 - struct xrt_vec3_i32 accel_min_z; 371 - struct xrt_vec3_i32 accel_max_z; 372 - 373 - /*! 374 - * From: https://github.com/nitsch/moveonpc/wiki/Calibration-data 375 - * 376 - * Coded as the one before. The values are very near to 1.0. 377 - * 378 - * I observed, that when I multiply this vector with the gyro bias 379 - * vector before subtracting from the gyro 80rpm measures, I get a 380 - * better calibration. 381 - * 382 - * So in order to get the accurate 80rpm measures: 383 - * GyroMeasure80rpm-(GyroBias1*UnknownVector2) or 384 - * GyroMeasure80rpm-(GyroBias2*UnknownVector2) 385 - */ 386 - struct xrt_vec3 gyro_fact; 387 - struct xrt_vec3_i32 gyro_bias_0; 388 - struct xrt_vec3_i32 gyro_bias_1; 389 - struct xrt_vec3_i32 gyro_rot_x; 390 - struct xrt_vec3_i32 gyro_rot_y; 391 - struct xrt_vec3_i32 gyro_rot_z; 392 - 393 - struct xrt_vec3 unknown_vec3; 394 - float unknown_float_0, unknown_float_1; 395 - }; 396 - 397 - /*! 398 - * Parsed calibration data from a ZCM2 device. 399 - */ 400 - struct psmv_parsed_calibration_zcm2 401 - { 402 - struct xrt_vec3_i32 accel_min_x; 403 - struct xrt_vec3_i32 accel_max_x; 404 - struct xrt_vec3_i32 accel_min_y; 405 - struct xrt_vec3_i32 accel_max_y; 406 - struct xrt_vec3_i32 accel_min_z; 407 - struct xrt_vec3_i32 accel_max_z; 408 - 409 - struct xrt_vec3_i32 gyro_neg_x; 410 - struct xrt_vec3_i32 gyro_pos_x; 411 - struct xrt_vec3_i32 gyro_neg_y; 412 - struct xrt_vec3_i32 gyro_pos_y; 413 - struct xrt_vec3_i32 gyro_neg_z; 414 - struct xrt_vec3_i32 gyro_pos_z; 415 - 416 - //! Pretty sure this is gryo bias. 417 - struct xrt_vec3_i32 gyro_bias; 418 - }; 419 - 420 - /*! 421 422 * A single PlayStation Move Controller. 422 423 * 423 424 * A note about coordinate system. If you stand the controller in front of you ··· 442 443 int64_t resend_time; 443 444 struct xrt_colour_rgb_u8 led; 444 445 uint8_t rumble; 445 - } wants; 446 + } wants; //!< What should be set. 446 447 447 448 struct 448 449 { 449 450 struct xrt_colour_rgb_u8 led; 450 451 uint8_t rumble; 451 - } state; 452 + } state; //!< What is currently set on the device. 452 453 453 454 struct 454 455 { ··· 1566 1567 default: return 0; 1567 1568 } 1568 1569 } 1570 + 1569 1571 1570 1572 /*! 1571 1573 * @}