a/vive: Make imu config return be a out variable [NFC]

This commit is contained in:
Jakob Bornecrantz 2023-04-22 22:20:06 +01:00
parent b93ed31cce
commit d984950be1
3 changed files with 15 additions and 12 deletions

View file

@ -228,8 +228,8 @@ vive_get_slam_cams_calib(const struct vive_config *d,
*out_calib1 = calib1; *out_calib1 = calib1;
} }
struct t_imu_calibration void
vive_get_imu_calibration(const struct vive_config *d) vive_get_imu_calibration(const struct vive_config *d, struct t_imu_calibration *out_calib)
{ {
struct xrt_vec3 ab = d->imu.acc_bias; struct xrt_vec3 ab = d->imu.acc_bias;
@ -253,15 +253,18 @@ vive_get_imu_calibration(const struct vive_config *d)
.noise_std = {0.000282, 0.000282, 0.000282}, .noise_std = {0.000282, 0.000282, 0.000282},
}, },
}; };
return calib;
*out_calib = calib;
} }
struct t_slam_imu_calibration void
vive_get_slam_imu_calibration(const struct vive_config *d) vive_get_slam_imu_calibration(const struct vive_config *d, struct t_slam_imu_calibration *out_calib)
{ {
struct t_slam_imu_calibration calib; struct t_slam_imu_calibration calib;
const int IMU_FREQUENCY = 1000; const int IMU_FREQUENCY = 1000;
calib.base = vive_get_imu_calibration(d);
vive_get_imu_calibration(d, &calib.base);
calib.frequency = IMU_FREQUENCY; calib.frequency = IMU_FREQUENCY;
return calib;
*out_calib = calib;
} }

View file

@ -46,16 +46,16 @@ vive_get_slam_cams_calib(const struct vive_config *d,
* *
* @ingroup drv_vive * @ingroup drv_vive
*/ */
struct t_imu_calibration void
vive_get_imu_calibration(const struct vive_config *d); vive_get_imu_calibration(const struct vive_config *d, struct t_imu_calibration *out_calib);
/*! /*!
* Get a @ref t_slam_imu_calibration for the IMU. * Get a @ref t_slam_imu_calibration for the IMU.
* *
* @ingroup drv_vive * @ingroup drv_vive
*/ */
struct t_slam_imu_calibration void
vive_get_slam_imu_calibration(const struct vive_config *d); vive_get_slam_imu_calibration(const struct vive_config *d, struct t_slam_imu_calibration *out_calib);
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -385,7 +385,7 @@ valve_index_setup_visual_trackers(struct lighthouse_system *lhs,
// SLAM calibration // SLAM calibration
lhs->slam_calib.cam_count = 2; lhs->slam_calib.cam_count = 2;
vive_get_slam_cams_calib(lhs->hmd_config, &lhs->slam_calib.cams[0], &lhs->slam_calib.cams[1]); vive_get_slam_cams_calib(lhs->hmd_config, &lhs->slam_calib.cams[0], &lhs->slam_calib.cams[1]);
lhs->slam_calib.imu = vive_get_slam_imu_calibration(lhs->hmd_config); vive_get_slam_imu_calibration(lhs->hmd_config, &lhs->slam_calib.imu);
// Initialize SLAM tracker // Initialize SLAM tracker
struct xrt_slam_sinks *slam_sinks = NULL; struct xrt_slam_sinks *slam_sinks = NULL;