mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-25 17:23:56 -04:00
AP_InertialSensor: fixed rpm indexing for vtol motors
quadplane vtol motors start at 1
This commit is contained in:
parent
a0bc9d3148
commit
e8f21d3458
@ -100,7 +100,7 @@ void AP_InertialSensor_SITL::generate_accel()
|
||||
if (!is_zero(sitl->vibe_motor) && motors_on) {
|
||||
for (uint8_t i = 0; i < sitl->state.num_motors; i++) {
|
||||
float &phase = accel_motor_phase[i];
|
||||
float motor_freq = calculate_noise(sitl->state.rpm[i] / 60.0f, freq_variation);
|
||||
float motor_freq = calculate_noise(sitl->state.rpm[sitl->state.vtol_motor_start+i] / 60.0f, freq_variation);
|
||||
float phase_incr = motor_freq * 2 * M_PI / (accel_sample_hz * nsamples);
|
||||
phase += phase_incr;
|
||||
if (phase_incr > M_PI) {
|
||||
@ -206,7 +206,7 @@ void AP_InertialSensor_SITL::generate_gyro()
|
||||
// VIB_MOT_MAX is a rpm-scaled vibration applied to each axis
|
||||
if (!is_zero(sitl->vibe_motor) && motors_on) {
|
||||
for (uint8_t i = 0; i < sitl->state.num_motors; i++) {
|
||||
float motor_freq = calculate_noise(sitl->state.rpm[i] / 60.0f, freq_variation);
|
||||
float motor_freq = calculate_noise(sitl->state.rpm[sitl->state.vtol_motor_start+i] / 60.0f, freq_variation);
|
||||
float phase_incr = motor_freq * 2 * M_PI / (gyro_sample_hz * nsamples);
|
||||
float &phase = gyro_motor_phase[i];
|
||||
phase += phase_incr;
|
||||
|
Loading…
Reference in New Issue
Block a user