1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-19 09:54:15 +01:00

GCS/FlightPlan: Create FlighPlan module related objects

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2363 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
vassilis 2011-01-09 22:28:39 +00:00 committed by vassilis
parent f7464557f2
commit 007f7cbea0
19 changed files with 1130 additions and 15 deletions

View File

@ -135,6 +135,22 @@ function [] = OPLogConvert()
FlightBatteryState(1).ConsumedEnergy = 0;
FlightBatteryState(1).EstimatedFlightTime = 0;
flightplancontrolIdx = 1;
FlightPlanControl.timestamp = 0;
FlightPlanControl(1).Test = 0;
flightplansettingsIdx = 1;
FlightPlanSettings.timestamp = 0;
FlightPlanSettings(1).Test = 0;
flightplanstatusIdx = 1;
FlightPlanStatus.timestamp = 0;
FlightPlanStatus(1).Status = 0;
FlightPlanStatus(1).ErrorType = 0;
FlightPlanStatus(1).ErrorFileID = 0;
FlightPlanStatus(1).ErrorLineNum = 0;
FlightPlanStatus(1).Debug = 0;
flighttelemetrystatsIdx = 1;
FlightTelemetryStats.timestamp = 0;
FlightTelemetryStats(1).Status = 0;
@ -376,6 +392,11 @@ function [] = OPLogConvert()
SystemStats(1).HeapRemaining = 0;
SystemStats(1).CPULoad = 0;
taskinfoIdx = 1;
TaskInfo.timestamp = 0;
TaskInfo(1).StackRemaining = zeros(1,13);
TaskInfo(1).Running = zeros(1,13);
telemetrysettingsIdx = 1;
TelemetrySettings.timestamp = 0;
TelemetrySettings(1).Speed = 0;
@ -466,6 +487,15 @@ function [] = OPLogConvert()
case 126985486
FlightBatteryState(flightbatterystateIdx) = ReadFlightBatteryStateObject(fid, timestamp);
flightbatterystateIdx = flightbatterystateIdx + 1;
case 4125349796
FlightPlanControl(flightplancontrolIdx) = ReadFlightPlanControlObject(fid, timestamp);
flightplancontrolIdx = flightplancontrolIdx + 1;
case 2234942498
FlightPlanSettings(flightplansettingsIdx) = ReadFlightPlanSettingsObject(fid, timestamp);
flightplansettingsIdx = flightplansettingsIdx + 1;
case 2726772894
FlightPlanStatus(flightplanstatusIdx) = ReadFlightPlanStatusObject(fid, timestamp);
flightplanstatusIdx = flightplanstatusIdx + 1;
case 1712072286
FlightTelemetryStats(flighttelemetrystatsIdx) = ReadFlightTelemetryStatsObject(fid, timestamp);
flighttelemetrystatsIdx = flighttelemetrystatsIdx + 1;
@ -532,6 +562,9 @@ function [] = OPLogConvert()
case 680908530
SystemStats(systemstatsIdx) = ReadSystemStatsObject(fid, timestamp);
systemstatsIdx = systemstatsIdx + 1;
case 1358273008
TaskInfo(taskinfoIdx) = ReadTaskInfoObject(fid, timestamp);
taskinfoIdx = taskinfoIdx + 1;
case 2785592614
TelemetrySettings(telemetrysettingsIdx) = ReadTelemetrySettingsObject(fid, timestamp);
telemetrysettingsIdx = telemetrysettingsIdx + 1;
@ -554,7 +587,7 @@ function [] = OPLogConvert()
fclose(fid);
matfile = strrep(logfile,'opl','mat');
save(matfile ,'ActuatorCommand','ActuatorDesired','ActuatorSettings','AHRSCalibration','AHRSSettings','AhrsStatus','AttitudeActual','AttitudeDesired','AttitudeRaw','BaroAltitude','BatterySettings','FirmwareIAPObj','FlightBatteryState','FlightTelemetryStats','GCSTelemetryStats','GPSPosition','GPSSatellites','GPSTime','GuidanceSettings','HomeLocation','I2CStats','ManualControlCommand','ManualControlSettings','MixerSettings','MixerStatus','ObjectPersistence','PipXtremeModemSettings','PipXtremeModemStatus','PositionActual','PositionDesired','RateDesired','StabilizationSettings','SystemAlarms','SystemSettings','SystemStats','TelemetrySettings','VelocityActual','VelocityDesired');
save(matfile ,'ActuatorCommand','ActuatorDesired','ActuatorSettings','AHRSCalibration','AHRSSettings','AhrsStatus','AttitudeActual','AttitudeDesired','AttitudeRaw','BaroAltitude','BatterySettings','FirmwareIAPObj','FlightBatteryState','FlightPlanControl','FlightPlanSettings','FlightPlanStatus','FlightTelemetryStats','GCSTelemetryStats','GPSPosition','GPSSatellites','GPSTime','GuidanceSettings','HomeLocation','I2CStats','ManualControlCommand','ManualControlSettings','MixerSettings','MixerStatus','ObjectPersistence','PipXtremeModemSettings','PipXtremeModemStatus','PositionActual','PositionDesired','RateDesired','StabilizationSettings','SystemAlarms','SystemSettings','SystemStats','TaskInfo','TelemetrySettings','VelocityActual','VelocityDesired');
end
@ -824,6 +857,52 @@ function [FlightBatteryState] = ReadFlightBatteryStateObject(fid, timestamp)
fread(fid, 1, 'uint8');
end
function [FlightPlanControl] = ReadFlightPlanControlObject(fid, timestamp)
if 1
headerSize = 8;
else
FlightPlanControl.instanceID = fread(fid, 1, 'uint16');
headerSize = 10;
end
FlightPlanControl.timestamp = timestamp;
FlightPlanControl.Test = double(fread(fid, 1, 'float32'));
% read CRC
fread(fid, 1, 'uint8');
end
function [FlightPlanSettings] = ReadFlightPlanSettingsObject(fid, timestamp)
if 1
headerSize = 8;
else
FlightPlanSettings.instanceID = fread(fid, 1, 'uint16');
headerSize = 10;
end
FlightPlanSettings.timestamp = timestamp;
FlightPlanSettings.Test = double(fread(fid, 1, 'float32'));
% read CRC
fread(fid, 1, 'uint8');
end
function [FlightPlanStatus] = ReadFlightPlanStatusObject(fid, timestamp)
if 1
headerSize = 8;
else
FlightPlanStatus.instanceID = fread(fid, 1, 'uint16');
headerSize = 10;
end
FlightPlanStatus.timestamp = timestamp;
FlightPlanStatus.Status = double(fread(fid, 1, 'uint8'));
FlightPlanStatus.ErrorType = double(fread(fid, 1, 'uint8'));
FlightPlanStatus.ErrorFileID = double(fread(fid, 1, 'uint32'));
FlightPlanStatus.ErrorLineNum = double(fread(fid, 1, 'uint32'));
FlightPlanStatus.Debug = double(fread(fid, 1, 'float32'));
% read CRC
fread(fid, 1, 'uint8');
end
function [FlightTelemetryStats] = ReadFlightTelemetryStatsObject(fid, timestamp)
if 1
headerSize = 8;
@ -1285,6 +1364,21 @@ function [SystemStats] = ReadSystemStatsObject(fid, timestamp)
fread(fid, 1, 'uint8');
end
function [TaskInfo] = ReadTaskInfoObject(fid, timestamp)
if 1
headerSize = 8;
else
TaskInfo.instanceID = fread(fid, 1, 'uint16');
headerSize = 10;
end
TaskInfo.timestamp = timestamp;
TaskInfo.StackRemaining = double(fread(fid, 13, 'uint16'));
TaskInfo.Running = double(fread(fid, 13, 'uint8'));
% read CRC
fread(fid, 1, 'uint8');
end
function [TelemetrySettings] = ReadTelemetrySettingsObject(fid, timestamp)
if 1
headerSize = 8;

View File

@ -0,0 +1,131 @@
/**
******************************************************************************
*
* @file flightplancontrol.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @see The GNU Public License (GPL) Version 3
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup UAVObjectsPlugin UAVObjects Plugin
* @{
*
* @note Object definition file: flightplancontrol.xml.
* This is an automatically generated file.
* DO NOT modify manually.
*
* @brief The UAVUObjects GCS plugin
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "flightplancontrol.h"
#include "uavobjectfield.h"
const QString FlightPlanControl::NAME = QString("FlightPlanControl");
const QString FlightPlanControl::DESCRIPTION = QString("Control the flight plan script");
/**
* Constructor
*/
FlightPlanControl::FlightPlanControl(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME)
{
// Create fields
QList<UAVObjectField*> fields;
QStringList TestElemNames;
TestElemNames.append("0");
fields.append( new UAVObjectField(QString("Test"), QString("%"), UAVObjectField::FLOAT32, TestElemNames, QStringList()) );
// Initialize object
initializeFields(fields, (quint8*)&data, NUMBYTES);
// Set the default field values
setDefaultFieldValues();
// Set the object description
setDescription(DESCRIPTION);
}
/**
* Get the default metadata for this object
*/
UAVObject::Metadata FlightPlanControl::getDefaultMetadata()
{
UAVObject::Metadata metadata;
metadata.flightAccess = ACCESS_READWRITE;
metadata.gcsAccess = ACCESS_READWRITE;
metadata.gcsTelemetryAcked = 1;
metadata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE;
metadata.gcsTelemetryUpdatePeriod = 0;
metadata.flightTelemetryAcked = 1;
metadata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_MANUAL;
metadata.flightTelemetryUpdatePeriod = 0;
metadata.loggingUpdateMode = UAVObject::UPDATEMODE_NEVER;
metadata.loggingUpdatePeriod = 0;
return metadata;
}
/**
* Initialize object fields with the default values.
* If a default value is not specified the object fields
* will be initialized to zero.
*/
void FlightPlanControl::setDefaultFieldValues()
{
}
/**
* Get the object data fields
*/
FlightPlanControl::DataFields FlightPlanControl::getData()
{
QMutexLocker locker(mutex);
return data;
}
/**
* Set the object data fields
*/
void FlightPlanControl::setData(const DataFields& data)
{
QMutexLocker locker(mutex);
// Get metadata
Metadata mdata = getMetadata();
// Update object if the access mode permits
if ( mdata.gcsAccess == ACCESS_READWRITE )
{
this->data = data;
emit objectUpdatedAuto(this); // trigger object updated event
emit objectUpdated(this);
}
}
/**
* Create a clone of this object, a new instance ID must be specified.
* Do not use this function directly to create new instances, the
* UAVObjectManager should be used instead.
*/
UAVDataObject* FlightPlanControl::clone(quint32 instID)
{
FlightPlanControl* obj = new FlightPlanControl();
obj->initialize(instID, this->getMetaObject());
return obj;
}
/**
* Static function to retrieve an instance of the object.
*/
FlightPlanControl* FlightPlanControl::GetInstance(UAVObjectManager* objMngr, quint32 instID)
{
return dynamic_cast<FlightPlanControl*>(objMngr->getObject(FlightPlanControl::OBJID, instID));
}

View File

@ -0,0 +1,79 @@
/**
******************************************************************************
*
* @file flightplancontrol.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @see The GNU Public License (GPL) Version 3
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup UAVObjectsPlugin UAVObjects Plugin
* @{
*
* @note Object definition file: flightplancontrol.xml.
* This is an automatically generated file.
* DO NOT modify manually.
*
* @brief The UAVUObjects GCS plugin
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef FLIGHTPLANCONTROL_H
#define FLIGHTPLANCONTROL_H
#include "uavdataobject.h"
#include "uavobjectmanager.h"
class UAVOBJECTS_EXPORT FlightPlanControl: public UAVDataObject
{
Q_OBJECT
public:
// Field structure
typedef struct {
float Test;
} __attribute__((packed)) DataFields;
// Field information
// Field Test information
// Constants
static const quint32 OBJID = 4125349796U;
static const QString NAME;
static const QString DESCRIPTION;
static const bool ISSINGLEINST = 1;
static const bool ISSETTINGS = 0;
static const quint32 NUMBYTES = sizeof(DataFields);
// Functions
FlightPlanControl();
DataFields getData();
void setData(const DataFields& data);
Metadata getDefaultMetadata();
UAVDataObject* clone(quint32 instID);
static FlightPlanControl* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0);
private:
DataFields data;
void setDefaultFieldValues();
};
#endif // FLIGHTPLANCONTROL_H

View File

@ -0,0 +1,86 @@
##
##############################################################################
#
# @file flightplancontrol.py
# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
# @brief Implementation of the FlightPlanControl object. This file has been
# automatically generated by the UAVObjectGenerator.
#
# @note Object definition file: flightplancontrol.xml.
# This is an automatically generated file.
# DO NOT modify manually.
#
# @see The GNU Public License (GPL) Version 3
#
#############################################################################/
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
import uavobject
import struct
from collections import namedtuple
# This is a list of instances of the data fields contained in this object
_fields = [ \
uavobject.UAVObjectField(
'Test',
'f',
1,
[
'0',
],
{
}
),
]
class FlightPlanControl(uavobject.UAVObject):
## Object constants
OBJID = 4125349796
NAME = "FlightPlanControl"
METANAME = "FlightPlanControlMeta"
ISSINGLEINST = 1
ISSETTINGS = 0
def __init__(self):
uavobject.UAVObject.__init__(self,
self.OBJID,
self.NAME,
self.METANAME,
0,
self.ISSINGLEINST)
for f in _fields:
self.add_field(f)
def __str__(self):
s = ("0x%08X (%10u) %-30s %3u bytes format '%s'\n"
% (self.OBJID, self.OBJID, self.NAME, self.get_struct().size, self.get_struct().format))
for f in self.get_tuple()._fields:
s += ("\t%s\n" % f)
return (s)
def main():
# Instantiate the object and dump out some interesting info
x = FlightPlanControl()
print (x)
if __name__ == "__main__":
#import pdb ; pdb.run('main()')
main()

View File

@ -0,0 +1,132 @@
/**
******************************************************************************
*
* @file flightplansettings.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @see The GNU Public License (GPL) Version 3
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup UAVObjectsPlugin UAVObjects Plugin
* @{
*
* @note Object definition file: flightplansettings.xml.
* This is an automatically generated file.
* DO NOT modify manually.
*
* @brief The UAVUObjects GCS plugin
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "flightplansettings.h"
#include "uavobjectfield.h"
const QString FlightPlanSettings::NAME = QString("FlightPlanSettings");
const QString FlightPlanSettings::DESCRIPTION = QString("Settings for the flight plan module, control the execution of the script");
/**
* Constructor
*/
FlightPlanSettings::FlightPlanSettings(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME)
{
// Create fields
QList<UAVObjectField*> fields;
QStringList TestElemNames;
TestElemNames.append("0");
fields.append( new UAVObjectField(QString("Test"), QString(""), UAVObjectField::FLOAT32, TestElemNames, QStringList()) );
// Initialize object
initializeFields(fields, (quint8*)&data, NUMBYTES);
// Set the default field values
setDefaultFieldValues();
// Set the object description
setDescription(DESCRIPTION);
}
/**
* Get the default metadata for this object
*/
UAVObject::Metadata FlightPlanSettings::getDefaultMetadata()
{
UAVObject::Metadata metadata;
metadata.flightAccess = ACCESS_READWRITE;
metadata.gcsAccess = ACCESS_READWRITE;
metadata.gcsTelemetryAcked = 1;
metadata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE;
metadata.gcsTelemetryUpdatePeriod = 0;
metadata.flightTelemetryAcked = 1;
metadata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE;
metadata.flightTelemetryUpdatePeriod = 0;
metadata.loggingUpdateMode = UAVObject::UPDATEMODE_NEVER;
metadata.loggingUpdatePeriod = 0;
return metadata;
}
/**
* Initialize object fields with the default values.
* If a default value is not specified the object fields
* will be initialized to zero.
*/
void FlightPlanSettings::setDefaultFieldValues()
{
data.Test = 0;
}
/**
* Get the object data fields
*/
FlightPlanSettings::DataFields FlightPlanSettings::getData()
{
QMutexLocker locker(mutex);
return data;
}
/**
* Set the object data fields
*/
void FlightPlanSettings::setData(const DataFields& data)
{
QMutexLocker locker(mutex);
// Get metadata
Metadata mdata = getMetadata();
// Update object if the access mode permits
if ( mdata.gcsAccess == ACCESS_READWRITE )
{
this->data = data;
emit objectUpdatedAuto(this); // trigger object updated event
emit objectUpdated(this);
}
}
/**
* Create a clone of this object, a new instance ID must be specified.
* Do not use this function directly to create new instances, the
* UAVObjectManager should be used instead.
*/
UAVDataObject* FlightPlanSettings::clone(quint32 instID)
{
FlightPlanSettings* obj = new FlightPlanSettings();
obj->initialize(instID, this->getMetaObject());
return obj;
}
/**
* Static function to retrieve an instance of the object.
*/
FlightPlanSettings* FlightPlanSettings::GetInstance(UAVObjectManager* objMngr, quint32 instID)
{
return dynamic_cast<FlightPlanSettings*>(objMngr->getObject(FlightPlanSettings::OBJID, instID));
}

View File

@ -0,0 +1,79 @@
/**
******************************************************************************
*
* @file flightplansettings.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @see The GNU Public License (GPL) Version 3
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup UAVObjectsPlugin UAVObjects Plugin
* @{
*
* @note Object definition file: flightplansettings.xml.
* This is an automatically generated file.
* DO NOT modify manually.
*
* @brief The UAVUObjects GCS plugin
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef FLIGHTPLANSETTINGS_H
#define FLIGHTPLANSETTINGS_H
#include "uavdataobject.h"
#include "uavobjectmanager.h"
class UAVOBJECTS_EXPORT FlightPlanSettings: public UAVDataObject
{
Q_OBJECT
public:
// Field structure
typedef struct {
float Test;
} __attribute__((packed)) DataFields;
// Field information
// Field Test information
// Constants
static const quint32 OBJID = 2234942498U;
static const QString NAME;
static const QString DESCRIPTION;
static const bool ISSINGLEINST = 1;
static const bool ISSETTINGS = 1;
static const quint32 NUMBYTES = sizeof(DataFields);
// Functions
FlightPlanSettings();
DataFields getData();
void setData(const DataFields& data);
Metadata getDefaultMetadata();
UAVDataObject* clone(quint32 instID);
static FlightPlanSettings* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0);
private:
DataFields data;
void setDefaultFieldValues();
};
#endif // FLIGHTPLANSETTINGS_H

View File

@ -0,0 +1,86 @@
##
##############################################################################
#
# @file flightplansettings.py
# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
# @brief Implementation of the FlightPlanSettings object. This file has been
# automatically generated by the UAVObjectGenerator.
#
# @note Object definition file: flightplansettings.xml.
# This is an automatically generated file.
# DO NOT modify manually.
#
# @see The GNU Public License (GPL) Version 3
#
#############################################################################/
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
import uavobject
import struct
from collections import namedtuple
# This is a list of instances of the data fields contained in this object
_fields = [ \
uavobject.UAVObjectField(
'Test',
'f',
1,
[
'0',
],
{
}
),
]
class FlightPlanSettings(uavobject.UAVObject):
## Object constants
OBJID = 2234942498
NAME = "FlightPlanSettings"
METANAME = "FlightPlanSettingsMeta"
ISSINGLEINST = 1
ISSETTINGS = 1
def __init__(self):
uavobject.UAVObject.__init__(self,
self.OBJID,
self.NAME,
self.METANAME,
0,
self.ISSINGLEINST)
for f in _fields:
self.add_field(f)
def __str__(self):
s = ("0x%08X (%10u) %-30s %3u bytes format '%s'\n"
% (self.OBJID, self.OBJID, self.NAME, self.get_struct().size, self.get_struct().format))
for f in self.get_tuple()._fields:
s += ("\t%s\n" % f)
return (s)
def main():
# Instantiate the object and dump out some interesting info
x = FlightPlanSettings()
print (x)
if __name__ == "__main__":
#import pdb ; pdb.run('main()')
main()

View File

@ -0,0 +1,154 @@
/**
******************************************************************************
*
* @file flightplanstatus.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @see The GNU Public License (GPL) Version 3
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup UAVObjectsPlugin UAVObjects Plugin
* @{
*
* @note Object definition file: flightplanstatus.xml.
* This is an automatically generated file.
* DO NOT modify manually.
*
* @brief The UAVUObjects GCS plugin
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "flightplanstatus.h"
#include "uavobjectfield.h"
const QString FlightPlanStatus::NAME = QString("FlightPlanStatus");
const QString FlightPlanStatus::DESCRIPTION = QString("Status of the flight plan script");
/**
* Constructor
*/
FlightPlanStatus::FlightPlanStatus(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME)
{
// Create fields
QList<UAVObjectField*> fields;
QStringList StatusElemNames;
StatusElemNames.append("0");
QStringList StatusEnumOptions;
StatusEnumOptions.append("None");
StatusEnumOptions.append("Running");
StatusEnumOptions.append("Idle");
StatusEnumOptions.append("VMInitError");
StatusEnumOptions.append("ScriptStartError");
StatusEnumOptions.append("RunTimeError");
fields.append( new UAVObjectField(QString("Status"), QString(""), UAVObjectField::ENUM, StatusElemNames, StatusEnumOptions) );
QStringList ErrorTypeElemNames;
ErrorTypeElemNames.append("0");
QStringList ErrorTypeEnumOptions;
ErrorTypeEnumOptions.append("None");
fields.append( new UAVObjectField(QString("ErrorType"), QString(""), UAVObjectField::ENUM, ErrorTypeElemNames, ErrorTypeEnumOptions) );
QStringList ErrorFileIDElemNames;
ErrorFileIDElemNames.append("0");
fields.append( new UAVObjectField(QString("ErrorFileID"), QString(""), UAVObjectField::UINT32, ErrorFileIDElemNames, QStringList()) );
QStringList ErrorLineNumElemNames;
ErrorLineNumElemNames.append("0");
fields.append( new UAVObjectField(QString("ErrorLineNum"), QString(""), UAVObjectField::UINT32, ErrorLineNumElemNames, QStringList()) );
QStringList DebugElemNames;
DebugElemNames.append("0");
fields.append( new UAVObjectField(QString("Debug"), QString(""), UAVObjectField::FLOAT32, DebugElemNames, QStringList()) );
// Initialize object
initializeFields(fields, (quint8*)&data, NUMBYTES);
// Set the default field values
setDefaultFieldValues();
// Set the object description
setDescription(DESCRIPTION);
}
/**
* Get the default metadata for this object
*/
UAVObject::Metadata FlightPlanStatus::getDefaultMetadata()
{
UAVObject::Metadata metadata;
metadata.flightAccess = ACCESS_READWRITE;
metadata.gcsAccess = ACCESS_READWRITE;
metadata.gcsTelemetryAcked = 0;
metadata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_MANUAL;
metadata.gcsTelemetryUpdatePeriod = 0;
metadata.flightTelemetryAcked = 0;
metadata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC;
metadata.flightTelemetryUpdatePeriod = 2000;
metadata.loggingUpdateMode = UAVObject::UPDATEMODE_NEVER;
metadata.loggingUpdatePeriod = 0;
return metadata;
}
/**
* Initialize object fields with the default values.
* If a default value is not specified the object fields
* will be initialized to zero.
*/
void FlightPlanStatus::setDefaultFieldValues()
{
data.Status = 0;
data.ErrorType = 0;
}
/**
* Get the object data fields
*/
FlightPlanStatus::DataFields FlightPlanStatus::getData()
{
QMutexLocker locker(mutex);
return data;
}
/**
* Set the object data fields
*/
void FlightPlanStatus::setData(const DataFields& data)
{
QMutexLocker locker(mutex);
// Get metadata
Metadata mdata = getMetadata();
// Update object if the access mode permits
if ( mdata.gcsAccess == ACCESS_READWRITE )
{
this->data = data;
emit objectUpdatedAuto(this); // trigger object updated event
emit objectUpdated(this);
}
}
/**
* Create a clone of this object, a new instance ID must be specified.
* Do not use this function directly to create new instances, the
* UAVObjectManager should be used instead.
*/
UAVDataObject* FlightPlanStatus::clone(quint32 instID)
{
FlightPlanStatus* obj = new FlightPlanStatus();
obj->initialize(instID, this->getMetaObject());
return obj;
}
/**
* Static function to retrieve an instance of the object.
*/
FlightPlanStatus* FlightPlanStatus::GetInstance(UAVObjectManager* objMngr, quint32 instID)
{
return dynamic_cast<FlightPlanStatus*>(objMngr->getObject(FlightPlanStatus::OBJID, instID));
}

View File

@ -0,0 +1,91 @@
/**
******************************************************************************
*
* @file flightplanstatus.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @see The GNU Public License (GPL) Version 3
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup UAVObjectsPlugin UAVObjects Plugin
* @{
*
* @note Object definition file: flightplanstatus.xml.
* This is an automatically generated file.
* DO NOT modify manually.
*
* @brief The UAVUObjects GCS plugin
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef FLIGHTPLANSTATUS_H
#define FLIGHTPLANSTATUS_H
#include "uavdataobject.h"
#include "uavobjectmanager.h"
class UAVOBJECTS_EXPORT FlightPlanStatus: public UAVDataObject
{
Q_OBJECT
public:
// Field structure
typedef struct {
quint8 Status;
quint8 ErrorType;
quint32 ErrorFileID;
quint32 ErrorLineNum;
float Debug;
} __attribute__((packed)) DataFields;
// Field information
// Field Status information
/* Enumeration options for field Status */
typedef enum { STATUS_NONE=0, STATUS_RUNNING=1, STATUS_IDLE=2, STATUS_VMINITERROR=3, STATUS_SCRIPTSTARTERROR=4, STATUS_RUNTIMEERROR=5 } StatusOptions;
// Field ErrorType information
/* Enumeration options for field ErrorType */
typedef enum { ERRORTYPE_NONE=0 } ErrorTypeOptions;
// Field ErrorFileID information
// Field ErrorLineNum information
// Field Debug information
// Constants
static const quint32 OBJID = 2726772894U;
static const QString NAME;
static const QString DESCRIPTION;
static const bool ISSINGLEINST = 1;
static const bool ISSETTINGS = 0;
static const quint32 NUMBYTES = sizeof(DataFields);
// Functions
FlightPlanStatus();
DataFields getData();
void setData(const DataFields& data);
Metadata getDefaultMetadata();
UAVDataObject* clone(quint32 instID);
static FlightPlanStatus* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0);
private:
DataFields data;
void setDefaultFieldValues();
};
#endif // FLIGHTPLANSTATUS_H

View File

@ -0,0 +1,133 @@
##
##############################################################################
#
# @file flightplanstatus.py
# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
# @brief Implementation of the FlightPlanStatus object. This file has been
# automatically generated by the UAVObjectGenerator.
#
# @note Object definition file: flightplanstatus.xml.
# This is an automatically generated file.
# DO NOT modify manually.
#
# @see The GNU Public License (GPL) Version 3
#
#############################################################################/
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
import uavobject
import struct
from collections import namedtuple
# This is a list of instances of the data fields contained in this object
_fields = [ \
uavobject.UAVObjectField(
'Status',
'b',
1,
[
'0',
],
{
'0' : 'None',
'1' : 'Running',
'2' : 'Idle',
'3' : 'VMInitError',
'4' : 'ScriptStartError',
'5' : 'RunTimeError',
}
),
uavobject.UAVObjectField(
'ErrorType',
'b',
1,
[
'0',
],
{
'0' : 'None',
}
),
uavobject.UAVObjectField(
'ErrorFileID',
'I',
1,
[
'0',
],
{
}
),
uavobject.UAVObjectField(
'ErrorLineNum',
'I',
1,
[
'0',
],
{
}
),
uavobject.UAVObjectField(
'Debug',
'f',
1,
[
'0',
],
{
}
),
]
class FlightPlanStatus(uavobject.UAVObject):
## Object constants
OBJID = 2726772894
NAME = "FlightPlanStatus"
METANAME = "FlightPlanStatusMeta"
ISSINGLEINST = 1
ISSETTINGS = 0
def __init__(self):
uavobject.UAVObject.__init__(self,
self.OBJID,
self.NAME,
self.METANAME,
0,
self.ISSINGLEINST)
for f in _fields:
self.add_field(f)
def __str__(self):
s = ("0x%08X (%10u) %-30s %3u bytes format '%s'\n"
% (self.OBJID, self.OBJID, self.NAME, self.get_struct().size, self.get_struct().format))
for f in self.get_tuple()._fields:
s += ("\t%s\n" % f)
return (s)
def main():
# Instantiate the object and dump out some interesting info
x = FlightPlanStatus()
print (x)
if __name__ == "__main__":
#import pdb ; pdb.run('main()')
main()

View File

@ -56,6 +56,7 @@ TaskInfo::TaskInfo(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME)
StackRemainingElemNames.append("Stabilization");
StackRemainingElemNames.append("Guidance");
StackRemainingElemNames.append("Watchdog");
StackRemainingElemNames.append("FlightPlan");
fields.append( new UAVObjectField(QString("StackRemaining"), QString("bytes"), UAVObjectField::UINT16, StackRemainingElemNames, QStringList()) );
QStringList RunningElemNames;
RunningElemNames.append("System");
@ -70,6 +71,7 @@ TaskInfo::TaskInfo(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME)
RunningElemNames.append("Stabilization");
RunningElemNames.append("Guidance");
RunningElemNames.append("Watchdog");
RunningElemNames.append("FlightPlan");
QStringList RunningEnumOptions;
RunningEnumOptions.append("False");
RunningEnumOptions.append("True");

View File

@ -43,28 +43,28 @@ class UAVOBJECTS_EXPORT TaskInfo: public UAVDataObject
public:
// Field structure
typedef struct {
quint16 StackRemaining[12];
quint8 Running[12];
quint16 StackRemaining[13];
quint8 Running[13];
} __attribute__((packed)) DataFields;
// Field information
// Field StackRemaining information
/* Array element names for field StackRemaining */
typedef enum { STACKREMAINING_SYSTEM=0, STACKREMAINING_ACTUATOR=1, STACKREMAINING_TELEMETRYTX=2, STACKREMAINING_TELEMETRYTXPRI=3, STACKREMAINING_TELEMETRYRX=4, STACKREMAINING_GPS=5, STACKREMAINING_MANUALCONTROL=6, STACKREMAINING_ALTITUDE=7, STACKREMAINING_AHRSCOMMS=8, STACKREMAINING_STABILIZATION=9, STACKREMAINING_GUIDANCE=10, STACKREMAINING_WATCHDOG=11 } StackRemainingElem;
typedef enum { STACKREMAINING_SYSTEM=0, STACKREMAINING_ACTUATOR=1, STACKREMAINING_TELEMETRYTX=2, STACKREMAINING_TELEMETRYTXPRI=3, STACKREMAINING_TELEMETRYRX=4, STACKREMAINING_GPS=5, STACKREMAINING_MANUALCONTROL=6, STACKREMAINING_ALTITUDE=7, STACKREMAINING_AHRSCOMMS=8, STACKREMAINING_STABILIZATION=9, STACKREMAINING_GUIDANCE=10, STACKREMAINING_WATCHDOG=11, STACKREMAINING_FLIGHTPLAN=12 } StackRemainingElem;
/* Number of elements for field StackRemaining */
static const quint32 STACKREMAINING_NUMELEM = 12;
static const quint32 STACKREMAINING_NUMELEM = 13;
// Field Running information
/* Enumeration options for field Running */
typedef enum { RUNNING_FALSE=0, RUNNING_TRUE=1 } RunningOptions;
/* Array element names for field Running */
typedef enum { RUNNING_SYSTEM=0, RUNNING_ACTUATOR=1, RUNNING_TELEMETRYTX=2, RUNNING_TELEMETRYTXPRI=3, RUNNING_TELEMETRYRX=4, RUNNING_GPS=5, RUNNING_MANUALCONTROL=6, RUNNING_ALTITUDE=7, RUNNING_AHRSCOMMS=8, RUNNING_STABILIZATION=9, RUNNING_GUIDANCE=10, RUNNING_WATCHDOG=11 } RunningElem;
typedef enum { RUNNING_SYSTEM=0, RUNNING_ACTUATOR=1, RUNNING_TELEMETRYTX=2, RUNNING_TELEMETRYTXPRI=3, RUNNING_TELEMETRYRX=4, RUNNING_GPS=5, RUNNING_MANUALCONTROL=6, RUNNING_ALTITUDE=7, RUNNING_AHRSCOMMS=8, RUNNING_STABILIZATION=9, RUNNING_GUIDANCE=10, RUNNING_WATCHDOG=11, RUNNING_FLIGHTPLAN=12 } RunningElem;
/* Number of elements for field Running */
static const quint32 RUNNING_NUMELEM = 12;
static const quint32 RUNNING_NUMELEM = 13;
// Constants
static const quint32 OBJID = 3297598544U;
static const quint32 OBJID = 1358273008U;
static const QString NAME;
static const QString DESCRIPTION;
static const bool ISSINGLEINST = 1;

View File

@ -40,7 +40,7 @@ _fields = [ \
uavobject.UAVObjectField(
'StackRemaining',
'H',
12,
13,
[
'System',
'Actuator',
@ -54,6 +54,7 @@ _fields = [ \
'Stabilization',
'Guidance',
'Watchdog',
'FlightPlan',
],
{
}
@ -61,7 +62,7 @@ _fields = [ \
uavobject.UAVObjectField(
'Running',
'b',
12,
13,
[
'System',
'Actuator',
@ -75,6 +76,7 @@ _fields = [ \
'Stabilization',
'Guidance',
'Watchdog',
'FlightPlan',
],
{
'0' : 'False',
@ -86,7 +88,7 @@ _fields = [ \
class TaskInfo(uavobject.UAVObject):
## Object constants
OBJID = 3297598544
OBJID = 1358273008
NAME = "TaskInfo"
METANAME = "TaskInfoMeta"
ISSINGLEINST = 1

View File

@ -49,7 +49,10 @@ HEADERS += uavobjects_global.h \
pipxtrememodemstatus.h \
i2cstats.h \
batterysettings.h \
taskinfo.h
taskinfo.h \
flightplanstatus.h \
flightplansettings.h \
flightplancontrol.h
SOURCES += uavobject.cpp \
uavmetaobject.cpp \
@ -96,5 +99,8 @@ SOURCES += uavobject.cpp \
pipxtrememodemstatus.cpp \
i2cstats.cpp \
batterysettings.cpp \
taskinfo.cpp
taskinfo.cpp \
flightplanstatus.cpp \
flightplansettings.cpp \
flightplancontrol.cpp
OTHER_FILES += UAVObjects.pluginspec

View File

@ -43,6 +43,9 @@
#include "batterysettings.h"
#include "firmwareiapobj.h"
#include "flightbatterystate.h"
#include "flightplancontrol.h"
#include "flightplansettings.h"
#include "flightplanstatus.h"
#include "flighttelemetrystats.h"
#include "gcstelemetrystats.h"
#include "gpsposition.h"
@ -90,6 +93,9 @@ void UAVObjectsInitialize(UAVObjectManager* objMngr)
objMngr->registerObject( new BatterySettings() );
objMngr->registerObject( new FirmwareIAPObj() );
objMngr->registerObject( new FlightBatteryState() );
objMngr->registerObject( new FlightPlanControl() );
objMngr->registerObject( new FlightPlanSettings() );
objMngr->registerObject( new FlightPlanStatus() );
objMngr->registerObject( new FlightTelemetryStats() );
objMngr->registerObject( new GCSTelemetryStats() );
objMngr->registerObject( new GPSPosition() );

View File

@ -0,0 +1,10 @@
<xml>
<object name="FlightPlanControl" singleinstance="true" settings="false">
<description>Control the flight plan script</description>
<field name="Test" units="%" type="float" elements="1"/>
<access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
<telemetryflight acked="true" updatemode="manual" period="0"/>
<logging updatemode="never" period="0"/>
</object>
</xml>

View File

@ -0,0 +1,10 @@
<xml>
<object name="FlightPlanSettings" singleinstance="true" settings="true">
<description>Settings for the flight plan module, control the execution of the script</description>
<field name="Test" units="" type="float" elements="1" defaultvalue="0.0"/>
<access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
<telemetryflight acked="true" updatemode="onchange" period="0"/>
<logging updatemode="never" period="0"/>
</object>
</xml>

View File

@ -0,0 +1,14 @@
<xml>
<object name="FlightPlanStatus" singleinstance="true" settings="false">
<description>Status of the flight plan script</description>
<field name="Status" units="" type="enum" elements="1" options="None,Running,Idle,VMInitError,ScriptStartError,RunTimeError" defaultvalue="None"/>
<field name="ErrorType" units="" type="enum" elements="1" options="None" defaultvalue="None"/>
<field name="ErrorFileID" units="" type="uint32" elements="1"/>
<field name="ErrorLineNum" units="" type="uint32" elements="1"/>
<field name="Debug" units="" type="float" elements="1"/>
<access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="false" updatemode="manual" period="0"/>
<telemetryflight acked="false" updatemode="periodic" period="2000"/>
<logging updatemode="never" period="0"/>
</object>
</xml>

View File

@ -1,8 +1,8 @@
<xml>
<object name="TaskInfo" singleinstance="true" settings="false">
<description>Task information</description>
<field name="StackRemaining" units="bytes" type="uint16" elementnames="System,Actuator,TelemetryTx,TelemetryTxPri,TelemetryRx,GPS,ManualControl,Altitude,AHRSComms,Stabilization,Guidance,Watchdog"/>
<field name="Running" units="bool" type="enum" options="False,True" elementnames="System,Actuator,TelemetryTx,TelemetryTxPri,TelemetryRx,GPS,ManualControl,Altitude,AHRSComms,Stabilization,Guidance,Watchdog"/>
<field name="StackRemaining" units="bytes" type="uint16" elementnames="System,Actuator,TelemetryTx,TelemetryTxPri,TelemetryRx,GPS,ManualControl,Altitude,AHRSComms,Stabilization,Guidance,Watchdog,FlightPlan"/>
<field name="Running" units="bool" type="enum" options="False,True" elementnames="System,Actuator,TelemetryTx,TelemetryTxPri,TelemetryRx,GPS,ManualControl,Altitude,AHRSComms,Stabilization,Guidance,Watchdog,FlightPlan"/>
<access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
<telemetryflight acked="true" updatemode="periodic" period="10000"/>