@ -2654,12 +2654,11 @@ class G1Deploy {
}
}
std : : array < double , 4 > base_quat_raw = float_to_double < 4 > ( ls - > imu_state ( ) . quaternion ( ) ) ; // qw, qx, qy, qz
std : : array < double , 4 > base_quat_raw = float_to_double < 4 > ( ls - > imu_state ( ) . quaternion ( ) ) ; // qw, qx, qy, qz
// IMU pitch correction: G1's IMU is mounted with ~6° forward pitch offset.
// The NN was trained with a perfect IMU, so we pre-rotate by -6° about Y axis
// to correct the bias before it enters observations (gravity dir, heading, etc.).
constexpr double IMU_PITCH_OFFSET_RAD = 6.0 * M_PI / 180.0 ; // positive = correct backward lean
static const auto imu_pitch_correction = quat_from_angle_axis_d ( IMU_PITCH_OFFSET_RAD , { 0.0 , 1.0 , 0.0 } ) ;
std : : array < double , 4 > base_quat = quat_mul_d ( imu_pitch_correction , base_quat_raw ) ;
// IMU pitch correction: G1's IMU may have a mounting offset.
// Runtime-adjustable via keys 9 (decrease) / 0 (increase) in 1° steps.
double pitch_offset_rad = g_imu_pitch_offset_deg . load ( ) * M_PI / 180.0 ;
auto imu_pitch_correction = quat_from_angle_axis_d ( pitch_offset_rad , { 0.0 , 1.0 , 0.0 } ) ;
std : : array < double , 4 > base_quat = quat_mul_d ( base_quat_raw , imu_pitch_correction ) ;
std : : array < double , 3 > base_ang_vel = float_to_double < 3 > ( ls - > imu_state ( ) . gyroscope ( ) ) ;
std : : array < double , 3 > base_ang_vel = float_to_double < 3 > ( ls - > imu_state ( ) . gyroscope ( ) ) ;
std : : array < double , 3 > base_accel = float_to_double < 3 > ( ls - > imu_state ( ) . accelerometer ( ) ) ;
std : : array < double , 3 > base_accel = float_to_double < 3 > ( ls - > imu_state ( ) . accelerometer ( ) ) ;