Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plane: combined patches for 4.2 on large quadplanes #21031

Open
wants to merge 61 commits into
base: Plane-4.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
7843eb9
AP_Logger: add loging of servo out 15 to 32
IamPete1 Jan 12, 2021
d1dabf8
AP_PiccoloCAN: update ESC_BM Bitmask
IamPete1 Jan 12, 2021
6e1c8b0
AP_UAVCAN: update ESC_BM and SRV_BM Bitmask
IamPete1 Jan 12, 2021
890f795
AP_Voltz: update MASK Bitmask
IamPete1 Jan 12, 2021
bd0a775
SITL: move to 32 servo outs
IamPete1 Jan 12, 2021
02908d5
AP_HAL: enable 32 servo outs
IamPete1 Jan 12, 2021
47f32ed
AP_HAL_ChibiOS: enable 32 servo outs
IamPete1 Jan 12, 2021
7c4b8d2
AP_HAL_SITL: enable 32 servo outs
IamPete1 Jan 12, 2021
640c58d
AP_SerialLED: enable 32 servo outs
IamPete1 Jan 12, 2021
96b4118
SRV_Channel: add upto 32 servo outs
IamPete1 Jan 12, 2021
2d97ab3
GCS_MAVLink: send servo raw 17-32 using port 1
IamPete1 Jan 12, 2021
ddf9587
AP_Motors: convert to 32 bit motor mask
IamPete1 Dec 10, 2021
8c59366
AR_MotorsUGV: convert to 32 bit motor mask
IamPete1 Dec 10, 2021
014fe12
AP_BLHeli: support upto 32 servo outputs
IamPete1 Dec 10, 2021
020bb1e
SITL: JSON Master: only copy the first 16 servos
IamPete1 Dec 10, 2021
78e323f
SRV_Channel: add invalid mask for GPIO outputs
IamPete1 Jan 2, 2022
71b4474
AP_Logger: RCOUT only log if there is a valid output channel
IamPete1 Jan 2, 2022
4fd4ada
SRV_Channels: set channels above 16 to GPIO by defualt
IamPete1 Jan 2, 2022
70ea9fd
SITL: move to 32 servo outs
IamPete1 Jan 2, 2022
b89b361
Copter: 32 servo conversion
tridge May 15, 2022
25cb30e
Plane: 32 servo conversion
tridge May 15, 2022
5d7f579
AP_Periph: 32 servo conversion
tridge May 15, 2022
14fc9dc
AP_BLHeli: more changes for 32 bit servo mask
tridge May 15, 2022
212ba92
AP_BoardConfig: more changes for 32 bit servo mask
tridge May 15, 2022
07b1f1d
AP_ESC_Telem: more changes for 32 bit servo mask
tridge May 15, 2022
2070b16
AP_HAL_ChibiOS: more changes for 32 bit servo mask
tridge May 15, 2022
6e93761
AP_HAL_ESP32: more changes for 32 bit servo mask
tridge May 15, 2022
28785bb
AP_HAL: more changes for 32 bit servo mask
tridge May 15, 2022
05d04e5
AP_HAL_Linux: more changes for 32 bit servo mask
tridge May 15, 2022
ce28ecb
AP_KDECAN: more changes for 32 bit servo mask
tridge May 15, 2022
5ccdfdd
AP_Motors: more changes for 32 bit servo mask
tridge May 15, 2022
8643229
AP_RobotisServo: more changes for 32 bit servo mask
tridge May 15, 2022
0add4a1
AP_ToshibaCAN: more changes for 32 bit servo mask
tridge May 15, 2022
3670932
SRV_Channel: more changes for 32 bit servo mask
tridge May 15, 2022
0b6c147
SRV_Channel: added a SERVO_32_ENABLE parameter
tridge May 15, 2022
579c7b7
SRV_Channel: only support 32 channels on 2M flash boards
tridge May 19, 2022
868ad48
AP_Periph: allow peripherals to handle servos beyond 16
tridge May 20, 2022
fd641cc
AP_UAVCAN: allow CAN output for function==0 and allow for 32 CAN servos
tridge May 20, 2022
2c95c0f
AP_EFI: allow EFI to be used in AP_Periph
tridge Jun 3, 2022
7edd2e5
AP_UAVCAN: support DroneCAN EFI
tridge Jun 3, 2022
91a423c
AP_EFI: added DroneCAN EFI driver
tridge Jun 3, 2022
9511478
Filter: added EnableOnAllIMUs option to harmonic notch filter
tridge Feb 17, 2022
f2ee4a5
Ap_Inertialsensor: by default only run harmonic notch on the active gyro
tridge Feb 17, 2022
a2e90df
Filter: fixed reset of notch filters
tridge Jun 5, 2022
7dde3df
AP_InertialSensor: count filters to match notch options
tridge Jun 7, 2022
7257fb1
AP_ESC_Telem: support ESC telem for ESCs 13 to 32
tridge Jun 6, 2022
28ebb37
AP_Vehicle: added parameter table for ESC telemetry
tridge Jun 24, 2022
00d4e31
AP_ESC_Telem: added ESC_TLM_MAV_OFS parameter
tridge Jun 6, 2022
6911802
AP_ESC_Telem: disable ESC telem with zero channels
tridge Jun 6, 2022
9ad9c48
AP_HAL: increase max filters
tridge Jun 7, 2022
8bc075c
AP_InertialSensor: allow concurrent logging of both pre- and post-fil…
andyp1per Jun 25, 2022
3bb2bf4
AP_InertialSensor: implement triple notches
tridge Jul 5, 2022
1425629
Filter: add triple harmonic notches
andyp1per Jun 23, 2022
71e093a
Plane: Quadplane: QRTL climb to QRTL alt first if in Q mode
IamPete1 May 31, 2022
06a8bd5
SITL switched to motor_mask for which actuators are motors
tridge Aug 18, 2022
357c054
Filter: allow for expansion of dynamic filters
tridge Aug 18, 2022
2f7e227
AP_Vehicle: removed num_dynamic_notches limit in dynamic harmonic
tridge Aug 18, 2022
3a139b4
AP_InertialSensor: use motor_mask from SITL for which outputs are motors
tridge Aug 18, 2022
864dc25
HAL_SITL: use motor mask for noise checking for motors
tridge Aug 18, 2022
320fde2
AP_ESC_TELEM: allow for non-continguous ESC telem motor sets
tridge Aug 18, 2022
a3fc056
SITL: allow for extra actuators to be marked as motors
tridge Aug 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
AP_InertialSensor: use motor_mask from SITL for which outputs are motors
generate noise based on motor_mask
  • Loading branch information
tridge committed Aug 21, 2022
commit 3a139b401ce8d90c1c05a4276c87292ac11675cd
4 changes: 2 additions & 2 deletions libraries/AP_InertialSensor/AP_InertialSensor_NONE.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class AP_InertialSensor_NONE : public AP_InertialSensor_Backend
uint64_t next_accel_sample;
float gyro_time;
float accel_time;
float gyro_motor_phase[12];
float accel_motor_phase[12];
float gyro_motor_phase[32];
float accel_motor_phase[32];

static uint8_t bus_id;
};
Expand Down
58 changes: 32 additions & 26 deletions libraries/AP_InertialSensor/AP_InertialSensor_SITL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,20 +136,23 @@ void AP_InertialSensor_SITL::generate_accel()

// 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 &phase = accel_motor_phase[i];
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) {
phase -= 2 * M_PI;
uint32_t mask = sitl->state.motor_mask;
uint8_t mbit;
while ((mbit = __builtin_ffs(mask)) != 0) {
const uint8_t motor = mbit-1;
mask &= ~(1U<<motor);
uint32_t harmonics = uint32_t(sitl->vibe_motor_harmonics);
const float base_freq = calculate_noise(sitl->state.rpm[motor] / 60.0f, freq_variation);
while (harmonics != 0) {
const uint8_t bit = __builtin_ffs(harmonics);
harmonics &= ~(1U<<(bit-1U));
const float phase = accel_motor_phase[motor] * float(bit);
accel.x += sinf(phase) * calculate_noise(accel_noise * sitl->vibe_motor_scale, noise_variation);
accel.y += sinf(phase) * calculate_noise(accel_noise * sitl->vibe_motor_scale, noise_variation);
accel.z += sinf(phase) * calculate_noise(accel_noise * sitl->vibe_motor_scale, noise_variation);
}
else if (phase_incr < -M_PI) {
phase += 2 * M_PI;
}
accel.x += sinf(phase) * calculate_noise(accel_noise * sitl->vibe_motor_scale, noise_variation);
accel.y += sinf(phase) * calculate_noise(accel_noise * sitl->vibe_motor_scale, noise_variation);
accel.z += sinf(phase) * calculate_noise(accel_noise * sitl->vibe_motor_scale, noise_variation);
const float phase_incr = base_freq * 2 * M_PI / (accel_sample_hz * nsamples);
accel_motor_phase[motor] = wrap_PI(accel_motor_phase[motor] + phase_incr);
}
}

Expand Down Expand Up @@ -242,20 +245,23 @@ 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[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;
if (phase_incr > M_PI) {
phase -= 2 * M_PI;
}
else if (phase_incr < -M_PI) {
phase += 2 * M_PI;
uint32_t mask = sitl->state.motor_mask;
uint8_t mbit;
while ((mbit = __builtin_ffs(mask)) != 0) {
const uint8_t motor = mbit-1;
mask &= ~(1U<<motor);
uint32_t harmonics = uint32_t(sitl->vibe_motor_harmonics);
const float base_freq = calculate_noise(sitl->state.rpm[motor] / 60.0f, freq_variation);
while (harmonics != 0) {
const uint8_t bit = __builtin_ffs(harmonics);
harmonics &= ~(1U<<(bit-1U));
const float phase = gyro_motor_phase[motor] * float(bit);
p += sinf(phase) * calculate_noise(gyro_noise * sitl->vibe_motor_scale, noise_variation);
q += sinf(phase) * calculate_noise(gyro_noise * sitl->vibe_motor_scale, noise_variation);
r += sinf(phase) * calculate_noise(gyro_noise * sitl->vibe_motor_scale, noise_variation);
}
p += sinf(phase) * calculate_noise(gyro_noise * sitl->vibe_motor_scale, noise_variation);
q += sinf(phase) * calculate_noise(gyro_noise * sitl->vibe_motor_scale, noise_variation);
r += sinf(phase) * calculate_noise(gyro_noise * sitl->vibe_motor_scale, noise_variation);
const float phase_incr = base_freq * 2 * M_PI / (gyro_sample_hz * nsamples);
gyro_motor_phase[motor] = wrap_PI(gyro_motor_phase[motor] + phase_incr);
}
}

Expand Down
4 changes: 2 additions & 2 deletions libraries/AP_InertialSensor/AP_InertialSensor_SITL.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class AP_InertialSensor_SITL : public AP_InertialSensor_Backend
uint64_t next_accel_sample;
float gyro_time;
float accel_time;
float gyro_motor_phase[12];
float accel_motor_phase[12];
float gyro_motor_phase[32];
float accel_motor_phase[32];
uint32_t temp_start_ms;

static uint8_t bus_id;
Expand Down