mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +01:00
OP-192 Flight/ManualControl: Add an ArmedTimeout field to the
ManualControlSettings so that planes can disable the timeout feature for gliding (holding roll on a plane not so good). Note: This will require you to reconfigure your ManualControlSettings git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2185 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
477657ea6e
commit
a04e33ccc6
@ -49,7 +49,6 @@
|
|||||||
#define UPDATE_PERIOD_MS 20
|
#define UPDATE_PERIOD_MS 20
|
||||||
#define THROTTLE_FAILSAFE -0.1
|
#define THROTTLE_FAILSAFE -0.1
|
||||||
#define FLIGHT_MODE_LIMIT 1.0/3.0
|
#define FLIGHT_MODE_LIMIT 1.0/3.0
|
||||||
#define ARMED_TIMEOUT_MS 30000
|
|
||||||
#define ARMED_TIME_MS 1000
|
#define ARMED_TIME_MS 1000
|
||||||
//safe band to allow a bit of calibration error or trim offset (in microseconds)
|
//safe band to allow a bit of calibration error or trim offset (in microseconds)
|
||||||
#define CONNECTION_OFFSET 150
|
#define CONNECTION_OFFSET 150
|
||||||
@ -288,7 +287,7 @@ static void manualControlTask(void *parameters)
|
|||||||
lowThrottleStart = lastSysTime;
|
lowThrottleStart = lastSysTime;
|
||||||
} else if (cmd.Throttle >= 0)
|
} else if (cmd.Throttle >= 0)
|
||||||
lowThrottleDetected = 0;
|
lowThrottleDetected = 0;
|
||||||
else if((cmd.Throttle < 0) && (timeDifferenceMs(lowThrottleStart, lastSysTime) > ARMED_TIMEOUT_MS)) {
|
else if((cmd.Throttle < 0) && (timeDifferenceMs(lowThrottleStart, lastSysTime) > settings.ArmedTimeout)) {
|
||||||
cmd.Armed = MANUALCONTROLCOMMAND_ARMED_FALSE;
|
cmd.Armed = MANUALCONTROLCOMMAND_ARMED_FALSE;
|
||||||
ManualControlCommandSet(&cmd);
|
ManualControlCommandSet(&cmd);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
#define MANUALCONTROLSETTINGS_H
|
#define MANUALCONTROLSETTINGS_H
|
||||||
|
|
||||||
// Object constants
|
// Object constants
|
||||||
#define MANUALCONTROLSETTINGS_OBJID 3505967188U
|
#define MANUALCONTROLSETTINGS_OBJID 157988682U
|
||||||
#define MANUALCONTROLSETTINGS_NAME "ManualControlSettings"
|
#define MANUALCONTROLSETTINGS_NAME "ManualControlSettings"
|
||||||
#define MANUALCONTROLSETTINGS_METANAME "ManualControlSettingsMeta"
|
#define MANUALCONTROLSETTINGS_METANAME "ManualControlSettingsMeta"
|
||||||
#define MANUALCONTROLSETTINGS_ISSINGLEINST 1
|
#define MANUALCONTROLSETTINGS_ISSINGLEINST 1
|
||||||
@ -89,6 +89,7 @@ typedef struct {
|
|||||||
int16_t ChannelMax[8];
|
int16_t ChannelMax[8];
|
||||||
int16_t ChannelNeutral[8];
|
int16_t ChannelNeutral[8];
|
||||||
int16_t ChannelMin[8];
|
int16_t ChannelMin[8];
|
||||||
|
uint16_t ArmedTimeout;
|
||||||
|
|
||||||
} __attribute__((packed)) ManualControlSettingsData;
|
} __attribute__((packed)) ManualControlSettingsData;
|
||||||
|
|
||||||
@ -159,6 +160,7 @@ typedef enum { MANUALCONTROLSETTINGS_POS3FLIGHTMODE_MANUAL=0, MANUALCONTROLSETTI
|
|||||||
// Field ChannelMin information
|
// Field ChannelMin information
|
||||||
/* Number of elements for field ChannelMin */
|
/* Number of elements for field ChannelMin */
|
||||||
#define MANUALCONTROLSETTINGS_CHANNELMIN_NUMELEM 8
|
#define MANUALCONTROLSETTINGS_CHANNELMIN_NUMELEM 8
|
||||||
|
// Field ArmedTimeout information
|
||||||
|
|
||||||
|
|
||||||
// Generic interface functions
|
// Generic interface functions
|
||||||
|
@ -125,6 +125,7 @@ static void setDefaults(UAVObjHandle obj, uint16_t instId)
|
|||||||
data.ChannelMin[5] = 1000;
|
data.ChannelMin[5] = 1000;
|
||||||
data.ChannelMin[6] = 1000;
|
data.ChannelMin[6] = 1000;
|
||||||
data.ChannelMin[7] = 1000;
|
data.ChannelMin[7] = 1000;
|
||||||
|
data.ArmedTimeout = 30000;
|
||||||
|
|
||||||
UAVObjSetInstanceData(obj, instId, &data);
|
UAVObjSetInstanceData(obj, instId, &data);
|
||||||
|
|
||||||
|
@ -231,6 +231,9 @@ ManualControlSettings::ManualControlSettings(): UAVDataObject(OBJID, ISSINGLEINS
|
|||||||
ChannelMinElemNames.append("6");
|
ChannelMinElemNames.append("6");
|
||||||
ChannelMinElemNames.append("7");
|
ChannelMinElemNames.append("7");
|
||||||
fields.append( new UAVObjectField(QString("ChannelMin"), QString("us"), UAVObjectField::INT16, ChannelMinElemNames, QStringList()) );
|
fields.append( new UAVObjectField(QString("ChannelMin"), QString("us"), UAVObjectField::INT16, ChannelMinElemNames, QStringList()) );
|
||||||
|
QStringList ArmedTimeoutElemNames;
|
||||||
|
ArmedTimeoutElemNames.append("0");
|
||||||
|
fields.append( new UAVObjectField(QString("ArmedTimeout"), QString("ms"), UAVObjectField::UINT16, ArmedTimeoutElemNames, QStringList()) );
|
||||||
|
|
||||||
// Initialize object
|
// Initialize object
|
||||||
initializeFields(fields, (quint8*)&data, NUMBYTES);
|
initializeFields(fields, (quint8*)&data, NUMBYTES);
|
||||||
@ -309,6 +312,7 @@ void ManualControlSettings::setDefaultFieldValues()
|
|||||||
data.ChannelMin[5] = 1000;
|
data.ChannelMin[5] = 1000;
|
||||||
data.ChannelMin[6] = 1000;
|
data.ChannelMin[6] = 1000;
|
||||||
data.ChannelMin[7] = 1000;
|
data.ChannelMin[7] = 1000;
|
||||||
|
data.ArmedTimeout = 30000;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@ public:
|
|||||||
qint16 ChannelMax[8];
|
qint16 ChannelMax[8];
|
||||||
qint16 ChannelNeutral[8];
|
qint16 ChannelNeutral[8];
|
||||||
qint16 ChannelMin[8];
|
qint16 ChannelMin[8];
|
||||||
|
quint16 ArmedTimeout;
|
||||||
|
|
||||||
} __attribute__((packed)) DataFields;
|
} __attribute__((packed)) DataFields;
|
||||||
|
|
||||||
@ -131,10 +132,11 @@ public:
|
|||||||
// Field ChannelMin information
|
// Field ChannelMin information
|
||||||
/* Number of elements for field ChannelMin */
|
/* Number of elements for field ChannelMin */
|
||||||
static const quint32 CHANNELMIN_NUMELEM = 8;
|
static const quint32 CHANNELMIN_NUMELEM = 8;
|
||||||
|
// Field ArmedTimeout information
|
||||||
|
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
static const quint32 OBJID = 3505967188U;
|
static const quint32 OBJID = 157988682U;
|
||||||
static const QString NAME;
|
static const QString NAME;
|
||||||
static const bool ISSINGLEINST = 1;
|
static const bool ISSINGLEINST = 1;
|
||||||
static const bool ISSETTINGS = 1;
|
static const bool ISSETTINGS = 1;
|
||||||
|
@ -337,12 +337,22 @@ _fields = [ \
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
uavobject.UAVObjectField(
|
||||||
|
'ArmedTimeout',
|
||||||
|
'H',
|
||||||
|
1,
|
||||||
|
[
|
||||||
|
'0',
|
||||||
|
],
|
||||||
|
{
|
||||||
|
}
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class ManualControlSettings(uavobject.UAVObject):
|
class ManualControlSettings(uavobject.UAVObject):
|
||||||
## Object constants
|
## Object constants
|
||||||
OBJID = 3505967188
|
OBJID = 157988682
|
||||||
NAME = "ManualControlSettings"
|
NAME = "ManualControlSettings"
|
||||||
METANAME = "ManualControlSettingsMeta"
|
METANAME = "ManualControlSettingsMeta"
|
||||||
ISSINGLEINST = 1
|
ISSINGLEINST = 1
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
<field name="ChannelMax" units="us" type="int16" elements="8" defaultvalue="2000"/>
|
<field name="ChannelMax" units="us" type="int16" elements="8" defaultvalue="2000"/>
|
||||||
<field name="ChannelNeutral" units="us" type="int16" elements="8" defaultvalue="1500"/>
|
<field name="ChannelNeutral" units="us" type="int16" elements="8" defaultvalue="1500"/>
|
||||||
<field name="ChannelMin" units="us" type="int16" elements="8" defaultvalue="1000"/>
|
<field name="ChannelMin" units="us" type="int16" elements="8" defaultvalue="1000"/>
|
||||||
|
<field name="ArmedTimeout" units="ms" type="uint16" elements="1" defaultvalue="30000"/>
|
||||||
<access gcs="readwrite" flight="readwrite"/>
|
<access gcs="readwrite" flight="readwrite"/>
|
||||||
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
|
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
|
||||||
<telemetryflight acked="true" updatemode="onchange" period="0"/>
|
<telemetryflight acked="true" updatemode="onchange" period="0"/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user