mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
Flight/ManualControl: Make it so the disarmed signal itself changes when GCS
lost. Warning though: it takes ~5-10 seconds for the flight telemetry status to go from connected so this solution still isn't great. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2070 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
7bdd900409
commit
f950b9f6c0
@ -36,7 +36,6 @@
|
|||||||
//#include "vtolsettings.h"
|
//#include "vtolsettings.h"
|
||||||
#include "systemsettings.h"
|
#include "systemsettings.h"
|
||||||
#include "actuatordesired.h"
|
#include "actuatordesired.h"
|
||||||
#include "flighttelemetrystats.h"
|
|
||||||
#include "actuatorcommand.h"
|
#include "actuatorcommand.h"
|
||||||
#include "manualcontrolcommand.h"
|
#include "manualcontrolcommand.h"
|
||||||
#include "mixersettings.h"
|
#include "mixersettings.h"
|
||||||
@ -180,15 +179,7 @@ static void actuatorTask(void* parameters)
|
|||||||
AlarmsClear(SYSTEMALARMS_ALARM_ACTUATOR);
|
AlarmsClear(SYSTEMALARMS_ALARM_ACTUATOR);
|
||||||
|
|
||||||
bool armed = manualControl.Armed == MANUALCONTROLCOMMAND_ARMED_TRUE;
|
bool armed = manualControl.Armed == MANUALCONTROLCOMMAND_ARMED_TRUE;
|
||||||
if(ManualControlCommandReadOnly(&manualControl)) {
|
armed &= desired.Throttle > 0.00; //zero throttle stops the motors
|
||||||
/* when being controlled by GCS check for connection still intact */
|
|
||||||
/* eventually this lost connection (like lost RX) will trigger */
|
|
||||||
/* a failsafe flight pattern */
|
|
||||||
FlightTelemetryStatsData flightStats;
|
|
||||||
FlightTelemetryStatsGet(&flightStats);
|
|
||||||
armed &= (flightStats.Status == FLIGHTTELEMETRYSTATS_STATUS_CONNECTED);
|
|
||||||
}
|
|
||||||
armed &= desired.Throttle > 0.05; //zero throttle stops the motors
|
|
||||||
|
|
||||||
float curve1 = MixerCurve(desired.Throttle,mixerSettings.ThrottleCurve1);
|
float curve1 = MixerCurve(desired.Throttle,mixerSettings.ThrottleCurve1);
|
||||||
float curve2 = MixerCurve(desired.Throttle,mixerSettings.ThrottleCurve2);
|
float curve2 = MixerCurve(desired.Throttle,mixerSettings.ThrottleCurve2);
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include "actuatordesired.h"
|
#include "actuatordesired.h"
|
||||||
#include "attitudedesired.h"
|
#include "attitudedesired.h"
|
||||||
#include "ahrssettings.h"
|
#include "ahrssettings.h"
|
||||||
|
#include "flighttelemetrystats.h"
|
||||||
|
|
||||||
// Private constants
|
// Private constants
|
||||||
#define STACK_SIZE configMINIMAL_STACK_SIZE
|
#define STACK_SIZE configMINIMAL_STACK_SIZE
|
||||||
@ -110,6 +111,18 @@ static void manualControlTask(void *parameters)
|
|||||||
ManualControlSettingsGet(&settings);
|
ManualControlSettingsGet(&settings);
|
||||||
StabilizationSettingsGet(&stabSettings);
|
StabilizationSettingsGet(&stabSettings);
|
||||||
|
|
||||||
|
if (ManualControlCommandReadOnly(&cmd)) {
|
||||||
|
FlightTelemetryStatsData flightTelemStats;
|
||||||
|
FlightTelemetryStatsGet(&flightTelemStats);
|
||||||
|
if(flightTelemStats.Status != FLIGHTTELEMETRYSTATS_STATUS_CONNECTED) {
|
||||||
|
/* trying to fly via GCS and lost connection. fall back to transmitter */
|
||||||
|
UAVObjMetadata metadata;
|
||||||
|
UAVObjGetMetadata(&cmd, &metadata);
|
||||||
|
metadata.access = ACCESS_READWRITE;
|
||||||
|
UAVObjSetMetadata(&cmd, &metadata);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!ManualControlCommandReadOnly(&cmd)) {
|
if (!ManualControlCommandReadOnly(&cmd)) {
|
||||||
// Check settings, if error raise alarm
|
// Check settings, if error raise alarm
|
||||||
if (settings.Roll >= MANUALCONTROLSETTINGS_ROLL_NONE ||
|
if (settings.Roll >= MANUALCONTROLSETTINGS_ROLL_NONE ||
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
651CF9F1120B700D00EEFD70 /* pios_usb_hid_prop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_usb_hid_prop.h; sourceTree = "<group>"; };
|
651CF9F1120B700D00EEFD70 /* pios_usb_hid_prop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_usb_hid_prop.h; sourceTree = "<group>"; };
|
||||||
651CF9F2120B700D00EEFD70 /* pios_usb_hid_pwr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_usb_hid_pwr.h; sourceTree = "<group>"; };
|
651CF9F2120B700D00EEFD70 /* pios_usb_hid_pwr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_usb_hid_pwr.h; sourceTree = "<group>"; };
|
||||||
651CF9F3120B700D00EEFD70 /* usb_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = usb_conf.h; sourceTree = "<group>"; };
|
651CF9F3120B700D00EEFD70 /* usb_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = usb_conf.h; sourceTree = "<group>"; };
|
||||||
|
651F32ED1281DE7E00D065F8 /* firmwareiap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = firmwareiap.c; sourceTree = "<group>"; };
|
||||||
|
651F32EF1281DE7E00D065F8 /* firmwareiap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = firmwareiap.h; sourceTree = "<group>"; };
|
||||||
65209A1812208B0600453371 /* baroaltitude.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = baroaltitude.xml; sourceTree = "<group>"; };
|
65209A1812208B0600453371 /* baroaltitude.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = baroaltitude.xml; sourceTree = "<group>"; };
|
||||||
65209A1912208B0600453371 /* gpsposition.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = gpsposition.xml; sourceTree = "<group>"; };
|
65209A1912208B0600453371 /* gpsposition.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = gpsposition.xml; sourceTree = "<group>"; };
|
||||||
6526645A122DF972006F9A3C /* pios_i2c_priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_i2c_priv.h; sourceTree = "<group>"; };
|
6526645A122DF972006F9A3C /* pios_i2c_priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pios_i2c_priv.h; sourceTree = "<group>"; };
|
||||||
@ -2920,6 +2922,23 @@
|
|||||||
path = inc;
|
path = inc;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
651F32EC1281DE7E00D065F8 /* FirmwareIAP */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
651F32ED1281DE7E00D065F8 /* firmwareiap.c */,
|
||||||
|
651F32EE1281DE7E00D065F8 /* inc */,
|
||||||
|
);
|
||||||
|
path = FirmwareIAP;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
651F32EE1281DE7E00D065F8 /* inc */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
651F32EF1281DE7E00D065F8 /* firmwareiap.h */,
|
||||||
|
);
|
||||||
|
path = inc;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
65632CBE124E09D900469B77 /* Guidance */ = {
|
65632CBE124E09D900469B77 /* Guidance */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@ -6846,6 +6865,7 @@
|
|||||||
65E8EF2E11EEA61E00BBF654 /* Attitude */,
|
65E8EF2E11EEA61E00BBF654 /* Attitude */,
|
||||||
65E8EF3011EEA61E00BBF654 /* Battery */,
|
65E8EF3011EEA61E00BBF654 /* Battery */,
|
||||||
65E8EF3411EEA61E00BBF654 /* Example */,
|
65E8EF3411EEA61E00BBF654 /* Example */,
|
||||||
|
651F32EC1281DE7E00D065F8 /* FirmwareIAP */,
|
||||||
65E8EF3D11EEA61E00BBF654 /* GPS */,
|
65E8EF3D11EEA61E00BBF654 /* GPS */,
|
||||||
65632CBE124E09D900469B77 /* Guidance */,
|
65632CBE124E09D900469B77 /* Guidance */,
|
||||||
65E8EF4311EEA61E00BBF654 /* ManualControl */,
|
65E8EF4311EEA61E00BBF654 /* ManualControl */,
|
||||||
|
Loading…
Reference in New Issue
Block a user