From 7b6687bcac1c3503df61ddc91a6294d36cb31797 Mon Sep 17 00:00:00 2001 From: Joe DiPrima Date: Sun, 22 Feb 2026 12:05:43 -0600 Subject: [PATCH] =?UTF-8?q?Fix=20IMU=20pitch=20correction=20to=20Y-axis=20?= =?UTF-8?q?rotation,=20-8=C2=B0=20default?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-axis was producing roll (sideways tilt). Y-axis is the correct pitch axis in SONIC's quaternion frame. Co-Authored-By: Claude Opus 4.6 --- .../src/g1/g1_deploy_onnx_ref/src/g1_deploy_onnx_ref.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gear_sonic_deploy/src/g1/g1_deploy_onnx_ref/src/g1_deploy_onnx_ref.cpp b/gear_sonic_deploy/src/g1/g1_deploy_onnx_ref/src/g1_deploy_onnx_ref.cpp index 4123dc6..20b14fe 100644 --- a/gear_sonic_deploy/src/g1/g1_deploy_onnx_ref/src/g1_deploy_onnx_ref.cpp +++ b/gear_sonic_deploy/src/g1/g1_deploy_onnx_ref/src/g1_deploy_onnx_ref.cpp @@ -2659,7 +2659,7 @@ class G1Deploy { // Runtime-adjustable via keys 9/0 (±1° steps), default -6°. double pitch_offset_rad = g_imu_pitch_offset_deg.load() * M_PI / 180.0; double half = pitch_offset_rad / 2.0; - std::array pitch_quat = {std::cos(half), std::sin(half), 0.0, 0.0}; // w,x,y,z + std::array pitch_quat = {std::cos(half), 0.0, std::sin(half), 0.0}; // w,x,y,z — Y-axis rotation std::array base_quat = quat_mul_d(pitch_quat, base_quat_raw); std::array base_ang_vel = float_to_double<3>(ls->imu_state().gyroscope()); std::array base_accel = float_to_double<3>(ls->imu_state().accelerometer());