mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
d/wmr: fix Original/Odyssey controller orientation
Similar to the HP Reverb G2 controllers apply the rotations provided by their calibration data. Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
This commit is contained in:
parent
57fb867514
commit
c5fa0e02e8
|
@ -8,6 +8,8 @@
|
||||||
* @author Jan Schmidt <jan@centricular.com>
|
* @author Jan Schmidt <jan@centricular.com>
|
||||||
* @ingroup drv_wmr
|
* @ingroup drv_wmr
|
||||||
*/
|
*/
|
||||||
|
#include "math/m_api.h"
|
||||||
|
|
||||||
#include "util/u_device.h"
|
#include "util/u_device.h"
|
||||||
#include "util/u_trace_marker.h"
|
#include "util/u_trace_marker.h"
|
||||||
#include "util/u_var.h"
|
#include "util/u_var.h"
|
||||||
|
@ -224,6 +226,8 @@ wmr_controller_og_packet_parse(struct wmr_controller_og *ctrl, const unsigned ch
|
||||||
acc[1] = read24(&p); // y
|
acc[1] = read24(&p); // y
|
||||||
acc[2] = read24(&p); // z
|
acc[2] = read24(&p); // z
|
||||||
vec3_from_wmr_controller_accel(acc, &last_input->imu.acc);
|
vec3_from_wmr_controller_accel(acc, &last_input->imu.acc);
|
||||||
|
math_quat_rotate_vec3(&wcb->config.sensors.transforms.P_oxr_acc.orientation, &last_input->imu.acc,
|
||||||
|
&last_input->imu.acc);
|
||||||
|
|
||||||
U_LOG_IFL_T(wcb->log_level, "Accel [m/s^2] : %f",
|
U_LOG_IFL_T(wcb->log_level, "Accel [m/s^2] : %f",
|
||||||
sqrtf(last_input->imu.acc.x * last_input->imu.acc.x +
|
sqrtf(last_input->imu.acc.x * last_input->imu.acc.x +
|
||||||
|
@ -238,6 +242,8 @@ wmr_controller_og_packet_parse(struct wmr_controller_og *ctrl, const unsigned ch
|
||||||
gyro[1] = read24(&p);
|
gyro[1] = read24(&p);
|
||||||
gyro[2] = read24(&p);
|
gyro[2] = read24(&p);
|
||||||
vec3_from_wmr_controller_gyro(gyro, &last_input->imu.gyro);
|
vec3_from_wmr_controller_gyro(gyro, &last_input->imu.gyro);
|
||||||
|
math_quat_rotate_vec3(&wcb->config.sensors.transforms.P_oxr_gyr.orientation, &last_input->imu.gyro,
|
||||||
|
&last_input->imu.gyro);
|
||||||
|
|
||||||
|
|
||||||
uint32_t prev_ticks = last_input->imu.timestamp_ticks & UINT32_C(0xFFFFFFFF);
|
uint32_t prev_ticks = last_input->imu.timestamp_ticks & UINT32_C(0xFFFFFFFF);
|
||||||
|
|
Loading…
Reference in a new issue