diff --git a/conf/settings/tuning.xml b/conf/settings/tuning.xml index 8e9538720e..cf1fcb3f4c 100644 --- a/conf/settings/tuning.xml +++ b/conf/settings/tuning.xml @@ -31,6 +31,11 @@ + + + + + diff --git a/conf/settings/tuning_ctl_adaptive.xml b/conf/settings/tuning_ctl_adaptive.xml index 7cd558dae2..6271f6aa9c 100644 --- a/conf/settings/tuning_ctl_adaptive.xml +++ b/conf/settings/tuning_ctl_adaptive.xml @@ -6,6 +6,11 @@ + + + + + diff --git a/conf/settings/tuning_ctl_new.xml b/conf/settings/tuning_ctl_new.xml index d283b907fb..38f5e825fe 100644 --- a/conf/settings/tuning_ctl_new.xml +++ b/conf/settings/tuning_ctl_new.xml @@ -6,6 +6,11 @@ + + + + + diff --git a/conf/settings/tuning_ins.xml b/conf/settings/tuning_ins.xml index 1f092a4a56..0aa57141ef 100644 --- a/conf/settings/tuning_ins.xml +++ b/conf/settings/tuning_ins.xml @@ -31,6 +31,11 @@ + + + + + diff --git a/conf/settings/tuning_ins_dcm.xml b/conf/settings/tuning_ins_dcm.xml index 4ba4f43d96..91b399acbe 100644 --- a/conf/settings/tuning_ins_dcm.xml +++ b/conf/settings/tuning_ins_dcm.xml @@ -31,6 +31,11 @@ + + + + + diff --git a/conf/settings/tuning_loiter.xml b/conf/settings/tuning_loiter.xml index eb6a88c2fe..823fd33523 100644 --- a/conf/settings/tuning_loiter.xml +++ b/conf/settings/tuning_loiter.xml @@ -44,6 +44,10 @@ + + + + diff --git a/sw/airborne/commands.c b/sw/airborne/commands.c index c73b50081f..3dd61cfdd3 100644 --- a/sw/airborne/commands.c +++ b/sw/airborne/commands.c @@ -28,5 +28,16 @@ #include "commands.h" +#ifndef COMMAND_ROLL_TRIM +#define COMMAND_ROLL_TRIM 0 +#endif + +#ifndef COMMAND_PITCH_TRIM +#define COMMAND_PITCH_TRIM 0 +#endif + +pprz_t command_roll_trim = COMMAND_ROLL_TRIM; +pprz_t command_pitch_trim = COMMAND_PITCH_TRIM; + pprz_t commands[COMMANDS_NB]; const pprz_t commands_failsafe[COMMANDS_NB] = COMMANDS_FAILSAFE; diff --git a/sw/airborne/commands.h b/sw/airborne/commands.h index a824de01c9..4716959233 100644 --- a/sw/airborne/commands.h +++ b/sw/airborne/commands.h @@ -32,6 +32,8 @@ #include "paparazzi.h" #include "generated/airframe.h" +extern pprz_t command_roll_trim; +extern pprz_t command_pitch_trim; extern pprz_t commands[COMMANDS_NB]; extern const pprz_t commands_failsafe[COMMANDS_NB]; diff --git a/sw/airborne/firmwares/fixedwing/main_fbw.c b/sw/airborne/firmwares/fixedwing/main_fbw.c index 7989e57433..c8d642caef 100644 --- a/sw/airborne/firmwares/fixedwing/main_fbw.c +++ b/sw/airborne/firmwares/fixedwing/main_fbw.c @@ -145,7 +145,18 @@ void event_task_fbw( void) { #ifdef ACTUATORS if (fbw_new_actuators > 0) { - SetActuatorsFromCommands(commands); + pprz_t trimmed_commands[COMMANDS_NB]; + int i; + for(i = 0; i < COMMANDS_NB; i++) trimmed_commands[i] = commands[i]; + + #ifdef COMMAND_ROLL + trimmed_commands[COMMAND_ROLL] += ChopAbs(command_roll_trim, MAX_PPRZ/10); + #endif + #ifdef COMMAND_PITCH + trimmed_commands[COMMAND_PITCH] += ChopAbs(command_pitch_trim, MAX_PPRZ/10); + #endif + + SetActuatorsFromCommands(trimmed_commands); fbw_new_actuators = 0; } #endif