From 5d1ebf76ea427ddf6e6844bbf2ba0215b80d0d79 Mon Sep 17 00:00:00 2001 From: peabody124 Date: Sun, 12 Sep 2010 02:54:44 +0000 Subject: [PATCH] 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 --- flight/OpenPilot/Modules/Actuator/actuator.c | 12 ++++++------ .../OpenPilot/Modules/ManualControl/manualcontrol.c | 2 +- ground/src/experimental/SerialLogger/analyzeINSGPS.m | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/flight/OpenPilot/Modules/Actuator/actuator.c b/flight/OpenPilot/Modules/Actuator/actuator.c index a6e5a5144..157dad46a 100644 --- a/flight/OpenPilot/Modules/Actuator/actuator.c +++ b/flight/OpenPilot/Modules/Actuator/actuator.c @@ -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], diff --git a/flight/OpenPilot/Modules/ManualControl/manualcontrol.c b/flight/OpenPilot/Modules/ManualControl/manualcontrol.c index 97bb25636..1a815aed6 100644 --- a/flight/OpenPilot/Modules/ManualControl/manualcontrol.c +++ b/flight/OpenPilot/Modules/ManualControl/manualcontrol.c @@ -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; diff --git a/ground/src/experimental/SerialLogger/analyzeINSGPS.m b/ground/src/experimental/SerialLogger/analyzeINSGPS.m index 943157f9b..8561d228f 100644 --- a/ground/src/experimental/SerialLogger/analyzeINSGPS.m +++ b/ground/src/experimental/SerialLogger/analyzeINSGPS.m @@ -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);