mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
Flight/VTOLmixer: Fix bug in mixer that messed up roll mixing. Also changed minimum to -1 so that neutral can be position motors come on and -1 the off position. Also made failsafe throttle value -1 to be consistent.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1591 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
c376711405
commit
5d1ebf76ea
@ -291,7 +291,7 @@ static int32_t mixerVTOL(const ActuatorSettingsData* settings, const ActuatorDes
|
||||
VTOLSettingsGet(&vtolSettings);
|
||||
VTOLStatusGet(&vtolStatus);
|
||||
|
||||
const int vtolMin = 0;
|
||||
const int vtolMin = -1;
|
||||
|
||||
if(((settings->VTOLMotorN != ACTUATORSETTINGS_VTOLMOTORN_NONE) +
|
||||
(settings->VTOLMotorNE != ACTUATORSETTINGS_VTOLMOTORS_NONE) +
|
||||
@ -327,7 +327,7 @@ static int32_t mixerVTOL(const ActuatorSettingsData* settings, const ActuatorDes
|
||||
if(settings->VTOLMotorE != ACTUATORSETTINGS_VTOLMOTORE_NONE) {
|
||||
vtolStatus.MotorE = bound(desired->Throttle * vtolSettings.MotorE[VTOLSETTINGS_MOTORE_THROTTLE] +
|
||||
desired->Pitch * vtolSettings.MotorE[VTOLSETTINGS_MOTORE_PITCH] +
|
||||
desired->Roll * vtolSettings.MotorN[VTOLSETTINGS_MOTORE_ROLL] +
|
||||
desired->Roll * vtolSettings.MotorE[VTOLSETTINGS_MOTORE_ROLL] +
|
||||
desired->Yaw * vtolSettings.MotorE[VTOLSETTINGS_MOTORE_YAW],vtolMin,1);
|
||||
cmd->Channel[settings->VTOLMotorE] = scaleChannel(vtolStatus.MotorE,
|
||||
settings->ChannelMax[settings->VTOLMotorE],
|
||||
@ -337,7 +337,7 @@ static int32_t mixerVTOL(const ActuatorSettingsData* settings, const ActuatorDes
|
||||
if(settings->VTOLMotorSE != ACTUATORSETTINGS_VTOLMOTORSE_NONE) {
|
||||
vtolStatus.MotorSE = bound(desired->Throttle * vtolSettings.MotorSE[VTOLSETTINGS_MOTORSE_THROTTLE] +
|
||||
desired->Pitch * vtolSettings.MotorSE[VTOLSETTINGS_MOTORSE_PITCH] +
|
||||
desired->Roll * vtolSettings.MotorN[VTOLSETTINGS_MOTORSE_ROLL] +
|
||||
desired->Roll * vtolSettings.MotorSE[VTOLSETTINGS_MOTORSE_ROLL] +
|
||||
desired->Yaw * vtolSettings.MotorSE[VTOLSETTINGS_MOTORSE_YAW],vtolMin,1);
|
||||
cmd->Channel[settings->VTOLMotorSE] = scaleChannel(vtolStatus.MotorSE,
|
||||
settings->ChannelMax[settings->VTOLMotorSE],
|
||||
@ -347,7 +347,7 @@ static int32_t mixerVTOL(const ActuatorSettingsData* settings, const ActuatorDes
|
||||
if(settings->VTOLMotorS != ACTUATORSETTINGS_VTOLMOTORS_NONE) {
|
||||
vtolStatus.MotorS = bound(desired->Throttle * vtolSettings.MotorS[VTOLSETTINGS_MOTORS_THROTTLE] +
|
||||
desired->Pitch * vtolSettings.MotorS[VTOLSETTINGS_MOTORS_PITCH] +
|
||||
desired->Roll * vtolSettings.MotorN[VTOLSETTINGS_MOTORS_ROLL] +
|
||||
desired->Roll * vtolSettings.MotorS[VTOLSETTINGS_MOTORS_ROLL] +
|
||||
desired->Yaw * vtolSettings.MotorS[VTOLSETTINGS_MOTORS_YAW],vtolMin,1);
|
||||
cmd->Channel[settings->VTOLMotorS] = scaleChannel(vtolStatus.MotorS,
|
||||
settings->ChannelMax[settings->VTOLMotorS],
|
||||
@ -357,7 +357,7 @@ static int32_t mixerVTOL(const ActuatorSettingsData* settings, const ActuatorDes
|
||||
if(settings->VTOLMotorSW != ACTUATORSETTINGS_VTOLMOTORSW_NONE) {
|
||||
vtolStatus.MotorSW = bound(desired->Throttle * vtolSettings.MotorSW[VTOLSETTINGS_MOTORSW_THROTTLE] +
|
||||
desired->Pitch * vtolSettings.MotorSW[VTOLSETTINGS_MOTORSW_PITCH] +
|
||||
desired->Roll * vtolSettings.MotorN[VTOLSETTINGS_MOTORSW_ROLL] +
|
||||
desired->Roll * vtolSettings.MotorSW[VTOLSETTINGS_MOTORSW_ROLL] +
|
||||
desired->Yaw * vtolSettings.MotorSW[VTOLSETTINGS_MOTORSW_YAW],vtolMin,1);
|
||||
cmd->Channel[settings->VTOLMotorSW] = scaleChannel(vtolStatus.MotorSW,
|
||||
settings->ChannelMax[settings->VTOLMotorSW],
|
||||
@ -367,7 +367,7 @@ static int32_t mixerVTOL(const ActuatorSettingsData* settings, const ActuatorDes
|
||||
if(settings->VTOLMotorW != ACTUATORSETTINGS_VTOLMOTORW_NONE) {
|
||||
vtolStatus.MotorW = bound(desired->Throttle * vtolSettings.MotorW[VTOLSETTINGS_MOTORW_THROTTLE] +
|
||||
desired->Pitch * vtolSettings.MotorW[VTOLSETTINGS_MOTORW_PITCH] +
|
||||
desired->Roll * vtolSettings.MotorN[VTOLSETTINGS_MOTORW_ROLL] +
|
||||
desired->Roll * vtolSettings.MotorW[VTOLSETTINGS_MOTORW_ROLL] +
|
||||
desired->Yaw * vtolSettings.MotorW[VTOLSETTINGS_MOTORW_YAW],vtolMin,1);
|
||||
cmd->Channel[settings->VTOLMotorW] = scaleChannel(vtolStatus.MotorW,
|
||||
settings->ChannelMax[settings->VTOLMotorW],
|
||||
|
@ -214,7 +214,7 @@ static void manualControlTask(void* parameters)
|
||||
|
||||
if (connection_state == DISCONNECTED) {
|
||||
cmd.Connected = MANUALCONTROLCOMMAND_CONNECTED_FALSE;
|
||||
cmd.Throttle = 0; // Shut down engine with no control
|
||||
cmd.Throttle = -1; // Shut down engine with no control
|
||||
cmd.Roll = 0;
|
||||
cmd.Yaw = 0;
|
||||
cmd.Pitch = 0;
|
||||
|
@ -36,6 +36,7 @@ fclose(fid);
|
||||
b = [data.block]; % get block counts
|
||||
gaps = find(diff(b) ~= 1);
|
||||
if(gaps) % get biggest contiguous chunk
|
||||
gaps = [1 gaps length(b)];
|
||||
lengths = diff(gaps);
|
||||
[foo idx] = max(lengths);
|
||||
idx = gaps(idx):gaps(idx+1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user