From 1472b342c14f4eb4263ea8aab30b1938b09b82ec Mon Sep 17 00:00:00 2001 From: corvus Date: Thu, 23 Sep 2010 22:05:03 +0000 Subject: [PATCH] 1.0 Featur Freeze - Removing some Experimental and Incomplete Modules and their UAVObjects not suited for 1.0 - they will be moved into an experimental branch: Navigation : experimental code only FlightSituation: experimental code only Guidance : preliminary draft - possibly to be replaced by peabody124 position hold code if finished in time. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1729 ebee16cc-31ac-478f-84a7-5cbb03baadba --- flight/OpenPilot/Makefile | 5 - flight/OpenPilot/Makefile.posix | 7 +- .../Modules/FlightSituation/flightsituation.c | 160 ------ .../FlightSituation/inc/flightsituation.h | 42 -- flight/OpenPilot/Modules/Guidance/guidance.c | 280 --------- .../OpenPilot/Modules/Guidance/inc/guidance.h | 43 -- .../Modules/Navigation/inc/navigation.h | 44 -- .../OpenPilot/Modules/Navigation/navigation.c | 530 ------------------ .../UAVObjects/flightsituationactual.c | 111 ---- .../OpenPilot/UAVObjects/guidancesettings.c | 132 ----- .../UAVObjects/inc/flightsituationactual.h | 107 ---- .../UAVObjects/inc/guidancesettings.h | 131 ----- .../UAVObjects/inc/navigationdesired.h | 97 ---- .../UAVObjects/inc/navigationsettings.h | 105 ---- .../UAVObjects/inc/positiondesired.h | 97 ---- .../OpenPilot/UAVObjects/navigationdesired.c | 111 ---- .../OpenPilot/UAVObjects/navigationsettings.c | 119 ---- flight/OpenPilot/UAVObjects/positiondesired.c | 111 ---- flight/OpenPilot/UAVObjects/uavobjectsinit.c | 10 - .../uavobjects/flightsituationactual.cpp | 152 ----- .../uavobjects/flightsituationactual.h | 94 ---- .../uavobjects/flightsituationactual.py | 166 ------ .../plugins/uavobjects/guidancesettings.cpp | 209 ------- .../src/plugins/uavobjects/guidancesettings.h | 118 ---- .../plugins/uavobjects/guidancesettings.py | 286 ---------- .../plugins/uavobjects/navigationdesired.cpp | 137 ----- .../plugins/uavobjects/navigationdesired.h | 84 --- .../plugins/uavobjects/navigationdesired.py | 116 ---- .../plugins/uavobjects/navigationsettings.cpp | 157 ------ .../plugins/uavobjects/navigationsettings.h | 92 --- .../plugins/uavobjects/navigationsettings.py | 156 ------ .../plugins/uavobjects/positiondesired.cpp | 136 ----- .../src/plugins/uavobjects/positiondesired.h | 84 --- .../src/plugins/uavobjects/positiondesired.py | 108 ---- ground/src/plugins/uavobjects/uavobjects.pro | 10 - .../src/plugins/uavobjects/uavobjectsinit.cpp | 10 - .../flightsituationactual.xml | 18 - .../uavobjectdefinition/guidancesettings.xml | 30 - .../uavobjectdefinition/navigationdesired.xml | 13 - .../navigationsettings.xml | 17 - .../uavobjectdefinition/positiondesired.xml | 12 - 41 files changed, 1 insertion(+), 4446 deletions(-) delete mode 100644 flight/OpenPilot/Modules/FlightSituation/flightsituation.c delete mode 100644 flight/OpenPilot/Modules/FlightSituation/inc/flightsituation.h delete mode 100644 flight/OpenPilot/Modules/Guidance/guidance.c delete mode 100644 flight/OpenPilot/Modules/Guidance/inc/guidance.h delete mode 100644 flight/OpenPilot/Modules/Navigation/inc/navigation.h delete mode 100644 flight/OpenPilot/Modules/Navigation/navigation.c delete mode 100644 flight/OpenPilot/UAVObjects/flightsituationactual.c delete mode 100644 flight/OpenPilot/UAVObjects/guidancesettings.c delete mode 100644 flight/OpenPilot/UAVObjects/inc/flightsituationactual.h delete mode 100644 flight/OpenPilot/UAVObjects/inc/guidancesettings.h delete mode 100644 flight/OpenPilot/UAVObjects/inc/navigationdesired.h delete mode 100644 flight/OpenPilot/UAVObjects/inc/navigationsettings.h delete mode 100644 flight/OpenPilot/UAVObjects/inc/positiondesired.h delete mode 100644 flight/OpenPilot/UAVObjects/navigationdesired.c delete mode 100644 flight/OpenPilot/UAVObjects/navigationsettings.c delete mode 100644 flight/OpenPilot/UAVObjects/positiondesired.c delete mode 100644 ground/src/plugins/uavobjects/flightsituationactual.cpp delete mode 100644 ground/src/plugins/uavobjects/flightsituationactual.h delete mode 100644 ground/src/plugins/uavobjects/flightsituationactual.py delete mode 100644 ground/src/plugins/uavobjects/guidancesettings.cpp delete mode 100644 ground/src/plugins/uavobjects/guidancesettings.h delete mode 100644 ground/src/plugins/uavobjects/guidancesettings.py delete mode 100644 ground/src/plugins/uavobjects/navigationdesired.cpp delete mode 100644 ground/src/plugins/uavobjects/navigationdesired.h delete mode 100644 ground/src/plugins/uavobjects/navigationdesired.py delete mode 100644 ground/src/plugins/uavobjects/navigationsettings.cpp delete mode 100644 ground/src/plugins/uavobjects/navigationsettings.h delete mode 100644 ground/src/plugins/uavobjects/navigationsettings.py delete mode 100644 ground/src/plugins/uavobjects/positiondesired.cpp delete mode 100644 ground/src/plugins/uavobjects/positiondesired.h delete mode 100644 ground/src/plugins/uavobjects/positiondesired.py delete mode 100644 ground/src/shared/uavobjectdefinition/flightsituationactual.xml delete mode 100644 ground/src/shared/uavobjectdefinition/guidancesettings.xml delete mode 100644 ground/src/shared/uavobjectdefinition/navigationdesired.xml delete mode 100644 ground/src/shared/uavobjectdefinition/navigationsettings.xml delete mode 100644 ground/src/shared/uavobjectdefinition/positiondesired.xml diff --git a/flight/OpenPilot/Makefile b/flight/OpenPilot/Makefile index 7eeca005f..01791694b 100644 --- a/flight/OpenPilot/Makefile +++ b/flight/OpenPilot/Makefile @@ -177,9 +177,6 @@ SRC += $(OPUAVOBJ)/baroaltitude.c SRC += $(OPUAVOBJ)/ahrscalibration.c SRC += $(OPUAVOBJ)/attitudeactual.c SRC += $(OPUAVOBJ)/ahrssettings.c -SRC += $(OPUAVOBJ)/flightsituationactual.c -SRC += $(OPUAVOBJ)/navigationsettings.c -SRC += $(OPUAVOBJ)/navigationdesired.c SRC += $(OPUAVOBJ)/flightbatterystate.c SRC += $(OPUAVOBJ)/attituderaw.c SRC += $(OPUAVOBJ)/homelocation.c @@ -188,8 +185,6 @@ SRC += $(OPUAVOBJ)/vtolsettings.c SRC += $(OPUAVOBJ)/vtolstatus.c SRC += $(OPUAVOBJ)/mixersettings.c SRC += $(OPUAVOBJ)/mixerstatus.c -SRC += $(OPUAVOBJ)/guidancesettings.c -SRC += $(OPUAVOBJ)/positiondesired.c #SRC += $(OPUAVOBJ)/lesstabilizationsettings.c endif diff --git a/flight/OpenPilot/Makefile.posix b/flight/OpenPilot/Makefile.posix index 16cea3414..7fff08d09 100644 --- a/flight/OpenPilot/Makefile.posix +++ b/flight/OpenPilot/Makefile.posix @@ -53,7 +53,7 @@ FLASH_TOOL = OPENOCD USE_THUMB_MODE = YES # List of modules to include -MODULES = Telemetry Stabilization/experimental/Stabilization ManualControl Guidance +MODULES = Telemetry Stabilization/experimental/Stabilization ManualControl #MODULES = Telemetry GPS ManualControl Actuator Altitude Attitude Stabilization #MODULES = Telemetry Example #MODULES = Telemetry MK/MKSerial @@ -149,9 +149,6 @@ SRC += $(OPUAVOBJ)/stabilizationsettings.c SRC += $(OPUAVOBJ)/ahrsstatus.c SRC += $(OPUAVOBJ)/baroaltitude.c SRC += $(OPUAVOBJ)/attitudeactual.c -SRC += $(OPUAVOBJ)/flightsituationactual.c -SRC += $(OPUAVOBJ)/navigationsettings.c -SRC += $(OPUAVOBJ)/navigationdesired.c SRC += $(OPUAVOBJ)/flightbatterystate.c SRC += $(OPUAVOBJ)/attituderaw.c SRC += $(OPUAVOBJ)/homelocation.c @@ -164,8 +161,6 @@ SRC += $(OPUAVOBJ)/vtolsettings.c SRC += $(OPUAVOBJ)/vtolstatus.c SRC += $(OPUAVOBJ)/mixersettings.c SRC += $(OPUAVOBJ)/mixerstatus.c -SRC += $(OPUAVOBJ)/guidancesettings.c -SRC += $(OPUAVOBJ)/positiondesired.c endif ## PIOS Hardware (posix) diff --git a/flight/OpenPilot/Modules/FlightSituation/flightsituation.c b/flight/OpenPilot/Modules/FlightSituation/flightsituation.c deleted file mode 100644 index c78d34c0e..000000000 --- a/flight/OpenPilot/Modules/FlightSituation/flightsituation.c +++ /dev/null @@ -1,160 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotModules OpenPilot Modules - * @{ - * @addtogroup FlightSituationModule FlightSituation Module - * @brief Sensor Merge of all Flight data into most likely situation - * @note This object updates the @ref FlightSituationActual UAVObject - * @{ - * - * @file flightsituation.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Attitude stabilization module. - * - * @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 - */ - -#include "openpilot.h" -#include "flightsituation.h" -#include "flightsituationactual.h" -#include "attitudeactual.h" -#include "altitudeactual.h" -#include "headingactual.h" -#include "positionactual.h" -#include "systemsettings.h" - - -// Private constants -#define STACK_SIZE configMINIMAL_STACK_SIZE -#define TASK_PRIORITY (tskIDLE_PRIORITY+4) - -// Private types - -// Private variables -static xTaskHandle taskHandle; - -// Private functions -static void flightSituationTask(void* parameters); - -/** - * Module initialization - */ -int32_t FlightSituationInitialize() -{ - // Initialize variables - - // Start main task - xTaskCreate(flightSituationTask, (signed char*)"FlightSituation", STACK_SIZE, NULL, TASK_PRIORITY, &taskHandle); - - return 0; -} - -/** - * Module task - */ -static void flightSituationTask(void* parameters) -{ - AttitudeActualData attitudeActual; - AltitudeActualData altitudeActual; - HeadingActualData headingActual; - PositionActualData positionActual; - SystemSettingsData systemSettings; - FlightSituationActualData flightSituationActual; - portTickType lastSysTime; - - // private variables - float altitudeLast=0.0; - // Main task loop - lastSysTime = xTaskGetTickCount(); - while (1) - { - // Read settings and other objects - SystemSettingsGet(&systemSettings); - AttitudeActualGet(&attitudeActual); - AltitudeActualGet(&altitudeActual); - HeadingActualGet(&headingActual); - PositionActualGet(&positionActual); - FlightSituationActualGet(&flightSituationActual); - - // TODO: plausibility check of GPS data, - // innertial navigation with kalman feed-in of GPS data - // sensor fusion - // STUB code: - flightSituationActual.Latitude = positionActual.Latitude; - flightSituationActual.Longitude = positionActual.Longitude; - - - // TODO: fuse altitude information with GPS data plus - // plausibility check - // STUB Code: - flightSituationActual.Altitude = altitudeActual.Altitude; - - // TODO: get altitude over ground from somewhere: - // method 1: reflection sensor - // method 2: crude database with ground hight information - // method 3: manual setting of ground hight at start pos - // STUB code: - flightSituationActual.ATG = altitudeActual.Altitude; - - // TODO: use some more sophisticated Kalman filtering - // and several sources (including speed and pitch!) - // to get this one right - flightSituationActual.Climbrate = 0.9*flightSituationActual.Climbrate + 0.1*((flightSituationActual.Altitude-altitudeLast)*10); - // the times 10 is because timescale is 1/10th - // of a second right now - altitudeLast = flightSituationActual.Altitude; - - // TODO: heading: sensor fusion from AttitudeActual.yaw - // and HeadingActual - with plausibility checks - // BUT ??? what to do with heli- / multicopters - // that can fly sideways? - // Maybe the AHRS can give us a movement vector too? - flightSituationActual.Heading = positionActual.Heading; - - // TODO: airspeed - is THE critical measure to prevent stall - // and judge which maneuvers are safe. - // However AFAIK we have no sensor for it yet, do we? - // Even with moderate winds, a glider or other UAV - // can easily fly (seemingly) backwards, so airspeed - // and groundspeed can significantly differ! - flightSituationActual.Airspeed = positionActual.Groundspeed; - - // TODO: this can possibly be taken from GPS - // with just a bit of plausibility checking - // and replacing by above if missing - flightSituationActual.Course = positionActual.Heading; - flightSituationActual.Groundspeed = positionActual.Groundspeed; - - - FlightSituationActualSet(&flightSituationActual); - - // Clear alarms - // TODO create a new alarm - //AlarmsClear(SYSTEMALARMS_ALARM_STABILIZATION); - - // Wait until next update - // TODO non-hardcoded update rate - vTaskDelayUntil(&lastSysTime, 100 / portTICK_RATE_MS ); - } -} - -/** - * @} - * @} - */ diff --git a/flight/OpenPilot/Modules/FlightSituation/inc/flightsituation.h b/flight/OpenPilot/Modules/FlightSituation/inc/flightsituation.h deleted file mode 100644 index ca1d7516b..000000000 --- a/flight/OpenPilot/Modules/FlightSituation/inc/flightsituation.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotModules OpenPilot Modules - * @{ - * @addtogroup FlightSituationModule FlightSituation Module - * @brief Sensor Merge of all Flight data into most likely situation - * @note This object updates the @ref FlightSituationActual UAVObject - * @{ - * - * @file flightsituation.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Attitude stabilization module. - * - * @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 - */ -#ifndef FLIGHTSITUATION_H -#define FLIGHTSITUATION_H - -int32_t FlightSituationInitialize(); - -#endif // FLIGHTSITUATION_H - -/** - * @} - * @} - */ diff --git a/flight/OpenPilot/Modules/Guidance/guidance.c b/flight/OpenPilot/Modules/Guidance/guidance.c deleted file mode 100644 index da71c6a24..000000000 --- a/flight/OpenPilot/Modules/Guidance/guidance.c +++ /dev/null @@ -1,280 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotModules OpenPilot Modules - * @{ - * @addtogroup GuidanceModule Guidance Module - * @brief Guidance PID loops in an airframe type independent manner - * @note This object updates the @ref AttitudeDesired "Attitude Desired" based on the - * PID loops on the craft position, speed and course - * @{ - * - * @file guidance.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Attitude guidance module. - * - * @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 - */ - -#include "openpilot.h" -#include "guidance.h" -#include "guidancesettings.h" -#include "attitudedesired.h" -#include "positiondesired.h" -#include "positionactual.h" -#include "attitudeactual.h" -#include "manualcontrolcommand.h" -#include "systemsettings.h" - - -// Private constants -#define STACK_SIZE configMINIMAL_STACK_SIZE -#define TASK_PRIORITY (tskIDLE_PRIORITY+4) -#define LATERAL_INTEGRAL_LIMIT 0.5 -#define COURSE_INTEGRAL_LIMIT 0.5 -#define ENERGY_INTEGRAL_LIMIT 0.5 -#define SPEED_INTEGRAL_LIMIT 0.5 -#define DEG2RAD ( M_PI / 180.0 ) -#define GEE 9.81 - -// Private types - -// Private variables -static xTaskHandle taskHandle; - -// Private functions -static void guidanceTask(void* parameters); -static float bound(float val, float min, float max); -static float angleDifference(float val); - -/** - * Module initialization - */ -int32_t GuidanceInitialize() -{ - // Initialize variables - - // Start main task - xTaskCreate(guidanceTask, (signed char*)"Guidance", STACK_SIZE, NULL, TASK_PRIORITY, &taskHandle); - - return 0; -} - -/** - * Module task - */ -static void guidanceTask(void* parameters) -{ - GuidanceSettingsData guidanceSettings; - AttitudeDesiredData attitudeDesired; - AttitudeActualData attitudeActual; - PositionActualData positionActual; - PositionDesiredData positionDesired; - - ManualControlCommandData manualControl; - SystemSettingsData systemSettings; - portTickType lastSysTime; - // declarations... - float lateralError, lateralErrorLast, lateralDerivative, lateralIntegralLimit, lateralIntegral; - float courseError, courseErrorLast, courseDerivative, courseIntegralLimit, courseIntegral; - float speedError, speedErrorLast, speedDerivative, speedIntegralLimit, speedIntegral; - float energyError, energyErrorLast, energyDerivative, energyIntegralLimit, energyIntegral; - float sinAlpha, cosAlpha; - - // Initialize - lateralIntegral = 0.0; - courseIntegral = 0.0; - speedIntegral = 0.0; - energyIntegral = 0.0; - - lateralErrorLast = 0.0; - courseErrorLast = 0.0; - speedErrorLast = 0.0; - energyErrorLast = 0.0; - - // Main task loop - lastSysTime = xTaskGetTickCount(); - while (1) - { - // Read settings and other objects - GuidanceSettingsGet(&guidanceSettings); - SystemSettingsGet(&systemSettings); - ManualControlCommandGet(&manualControl); - PositionDesiredGet(&positionDesired); - PositionActualGet(&positionActual); - AttitudeActualGet(&attitudeActual); - - // lateral PID Loop - // error is the distance between the current position and the imaginary line going through PositionDesired.NED - // at PositionDesired.Heading degrees course - - sinAlpha = sin(positionDesired.Heading); - cosAlpha = cos(positionDesired.Heading); - lateralError = ( - - sinAlpha * ( positionDesired.NED[0] - positionActual.NED[0] ) - + cosAlpha * ( positionDesired.NED[1] - positionActual.NED[1] ) - ) / ( sinAlpha*sinAlpha + cosAlpha*cosAlpha ); - lateralDerivative = lateralError - lateralErrorLast; - lateralErrorLast = lateralError; - lateralIntegralLimit = LATERAL_INTEGRAL_LIMIT / guidanceSettings.LateralKi; - lateralIntegral = bound(lateralIntegral+lateralError*guidanceSettings.UpdatePeriod, - -lateralIntegralLimit,lateralIntegralLimit); - attitudeDesired.Yaw = angleDifference( bound( ( guidanceSettings.LateralKp*lateralError + - guidanceSettings.LateralKi*lateralIntegral + - guidanceSettings.LateralKd*lateralDerivative - ),-90,90 - ) + positionDesired.Heading - ); - - if (attitudeDesired.Yaw<0) attitudeDesired.Yaw+=360; - - - - // course PID Loop - // very straighforward - courseError = angleDifference( attitudeDesired.Yaw - positionActual.Heading ); - courseDerivative = courseError - courseErrorLast; - courseErrorLast = courseError; - courseIntegralLimit = COURSE_INTEGRAL_LIMIT / guidanceSettings.CourseKi; - courseIntegral = bound(courseIntegral+courseError*guidanceSettings.UpdatePeriod, - -courseIntegralLimit,courseIntegralLimit); - attitudeDesired.Roll = bound( ( guidanceSettings.CourseKp*courseError + - guidanceSettings.CourseKi*courseIntegral + - guidanceSettings.CourseKd*courseDerivative - ),-guidanceSettings.RollMax,guidanceSettings.RollMax - ); - - - // speed PID loop - // since desired value is given as groundspeed, but our limits affect airspeed, translation is necessary - // we assume a constant (wind) offset between the two - // (this is not completely correct since there might be an air pressure dependent linear relationship, too - // but this puts only a linear multiplication factor on our error) - speedError = bound( - positionDesired.Groundspeed + - (positionActual.Airspeed-positionActual.Groundspeed) - ,guidanceSettings.SpeedMin,guidanceSettings.SpeedMax - ) - positionActual.Airspeed; - speedDerivative = speedError - speedErrorLast; - speedErrorLast = speedError; - speedIntegralLimit = SPEED_INTEGRAL_LIMIT / guidanceSettings.SpeedKi; - speedIntegral = bound(speedIntegral+speedError*guidanceSettings.UpdatePeriod, - -speedIntegralLimit,speedIntegralLimit); - attitudeDesired.Pitch = bound( -( guidanceSettings.SpeedKp*speedError + - guidanceSettings.SpeedKi*speedIntegral + - guidanceSettings.SpeedKd*speedDerivative - ),guidanceSettings.PitchMin,guidanceSettings.PitchMax - ); - - // energy PID loop - flight energy = mass_factor*(speed^2+g*altitude) - using mass_factor=1 - // the desired energy is calculated from the desired airspeed (which has been calculated above) - // and the desired altitude - energyError = ( - ( speedError + positionActual.Airspeed ) * ( speedError + positionActual.Airspeed ) - + GEE * -positionDesired.NED[3] - ) - ( - positionActual.Airspeed * positionActual.Airspeed + positionActual.Climbrate * positionActual.Climbrate - + GEE * -positionActual.NED[3] - ); - energyDerivative = energyError - energyErrorLast; - energyErrorLast = energyError; - energyIntegralLimit = SPEED_INTEGRAL_LIMIT / guidanceSettings.EnergyKi; - energyIntegral = bound(energyIntegral+energyError*guidanceSettings.UpdatePeriod, - -energyIntegralLimit,energyIntegralLimit); - attitudeDesired.Throttle = bound( ( guidanceSettings.EnergyKp*energyError + - guidanceSettings.EnergyKi*energyIntegral + - guidanceSettings.EnergyKd*energyDerivative - ),guidanceSettings.ThrottleMin,guidanceSettings.ThrottleMax - ); - - - // adapt roll in case of negative pitch demand - if (attitudeDesired.Pitch < attitudeActual.Pitch) { - if (attitudeDesired.Pitch <= attitudeActual.Pitch - guidanceSettings.PitchRollEpsilon) { - // in case of heavy push, reverse roll - attitudeDesired.Roll = -attitudeDesired.Roll; - } else { - // otherwise linear interpolation between Roll and -Roll - attitudeDesired.Roll -= 2.0 * attitudeDesired.Roll * - ( attitudeActual.Pitch - attitudeDesired.Pitch ) - / guidanceSettings.PitchRollEpsilon; - } - } - - // Write actuator desired (if not in manual mode) - if ( manualControl.FlightMode == MANUALCONTROLCOMMAND_FLIGHTMODE_AUTO ) - { - AttitudeDesiredSet(&attitudeDesired); - } - else - { - lateralIntegral = 0.0; - courseIntegral = 0.0; - speedIntegral = 0.0; - energyIntegral = 0.0; - - lateralErrorLast = 0.0; - courseErrorLast = 0.0; - speedErrorLast = 0.0; - energyErrorLast = 0.0; - } - - // Clear alarms - AlarmsClear(SYSTEMALARMS_ALARM_GUIDANCE); - - // Wait until next update - vTaskDelayUntil(&lastSysTime, guidanceSettings.UpdatePeriod / portTICK_RATE_MS ); - } -} - -/** - * Bound input value between limits - */ -static float bound(float val, float min, float max) -{ - if ( val < min ) - { - val = min; - } - else if ( val > max ) - { - val = max; - } - return val; -} - -/** - * Fix result of angular differences - */ -static float angleDifference(float val) -{ - while ( val < -180.0 ) - { - val += 360.0; - } - while ( val > 180.0 ) - { - val -= 360.0; - } - return val; -} - -/** - * @} - * @} - */ diff --git a/flight/OpenPilot/Modules/Guidance/inc/guidance.h b/flight/OpenPilot/Modules/Guidance/inc/guidance.h deleted file mode 100644 index 8c9969628..000000000 --- a/flight/OpenPilot/Modules/Guidance/inc/guidance.h +++ /dev/null @@ -1,43 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotModules OpenPilot Modules - * @{ - * @addtogroup GuidanceModule Guidance Module - * @brief Guidance PID loops in an airframe type independent manner - * @note This object updates the @ref AttitudeDesired "Attitude Desired" based on the - * PID loops on the craft position, speed and course - * @{ - * - * @file guidance.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief guidance module. - * - * @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 - */ -#ifndef GUIDANCE_H -#define GUIDANCE_H - -int32_t GuidanceInitialize(); - -#endif // GUIDANCE_H - -/** - * @} - * @} - */ diff --git a/flight/OpenPilot/Modules/Navigation/inc/navigation.h b/flight/OpenPilot/Modules/Navigation/inc/navigation.h deleted file mode 100644 index aae4ff096..000000000 --- a/flight/OpenPilot/Modules/Navigation/inc/navigation.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotModules OpenPilot Modules - * @{ - * @addtogroup NavigationModule Navigation Module - * @brief Feeds Stabilization with input to fly to a given coordinate in space - * @note This object updates the @ref AttitudeDesired "Attitude Desired" based on the - * comparison on the @ref NavigationDesired "Navigation Desired", @ref AttitudeActual - * "Attitude Actual" and @ref FlightSituationActual "FlightSituation Actual" - * @{ - * - * @file navigation.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Position stabilization module. - * - * @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 - */ -#ifndef NAVIGATION_H -#define NAVIGATION_H - -int32_t NavigationInitialize(); - -#endif // NAVIGATION_H - -/** - * @} - * @} - */ diff --git a/flight/OpenPilot/Modules/Navigation/navigation.c b/flight/OpenPilot/Modules/Navigation/navigation.c deleted file mode 100644 index 47ee6f4a4..000000000 --- a/flight/OpenPilot/Modules/Navigation/navigation.c +++ /dev/null @@ -1,530 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup OpenPilotModules OpenPilot Modules - * @{ - * @addtogroup NavigationModule Navigation Module - * @brief Feeds Stabilization with input to fly to a given coordinate in space - * @note This object updates the @ref AttitudeDesired "Attitude Desired" based on the - * comparison on the @ref NavigationDesired "Navigation Desired", @ref AttitudeActual - * "Attitude Actual" and @ref FlightSituationActual "FlightSituation Actual" - * @{ - * - * @file navigation.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Position stabilization module. - * - * @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 - */ - -#include "openpilot.h" -#include "navigation.h" -#include "navigationsettings.h" -#include "navigationdesired.h" -#include "attitudeactual.h" -#include "attitudedesired.h" -#include "flightsituationactual.h" -#include "manualcontrolcommand.h" -#include "systemsettings.h" - - -// Private constants -#define STACK_SIZE configMINIMAL_STACK_SIZE -#define TASK_PRIORITY (tskIDLE_PRIORITY+3) -#define DEG2RAD ( M_PI / 180.0 ) -#define RAD2DEG ( 180.0 / M_PI ) -#define MIN(a,b) ((ab)?a:b) -#define SSQRT(x) ((x)>=0?sqrt(x):-sqrt(-x)) // signed square root -#define EARTHRAD 6378137 -#define GRAVITY 9.81 - -// Private types - -// Private variables -static xTaskHandle taskHandle; - -// Private functions -static void navigationTask(void* parameters); -static float bound(float val, float min, float max); -static float angleDifference(float val); -static float fixAngle(float val,float min, float max); -static float sphereDistance(float lat1,float long1,float lat2,float long2); -static float sphereCourse(float lat1,float long1,float lat2,float long2); - -/** - * Module initialization - */ -int32_t NavigationInitialize() -{ - // Initialize variables - - // Start main task - xTaskCreate(navigationTask, (signed char*)"Navigation", STACK_SIZE, NULL, TASK_PRIORITY, &taskHandle); - - return 0; -} - -/** - * Module task - */ -static void navigationTask(void* parameters) -{ - NavigationSettingsData navSettings; - NavigationDesiredData navigationDesired; - AttitudeActualData attitudeActual; - AttitudeDesiredData attitudeDesired; - FlightSituationActualData situationActual; - ManualControlCommandData manualControl; - SystemSettingsData systemSettings; - portTickType lastSysTime; - - // flight safety values - float maxPitch; - float minPitch; - float maxAccel; - - // helper variables - float safeAccel; - float safeDistance; - float aoa,saoa; - - // intended flight direction - float targetDistance; - float targetVspeed; - float targetTruePitch; - float targetHeading; - float targetPitch; - float targetYaw; - - // turn direction - float turnDirection; - float turnSpeed; - float turnAccel; - - - // Main task loop - lastSysTime = xTaskGetTickCount(); - while (1) - { - // Read settings and other objects - NavigationSettingsGet(&navSettings); - SystemSettingsGet(&systemSettings); - ManualControlCommandGet(&manualControl); - FlightSituationActualGet(&situationActual); - NavigationDesiredGet(&navigationDesired); - AttitudeActualGet(&attitudeActual); - - // horizontal distance to waypoint - // (not 100% exact since the earth is not a perfect sphere, but - // close enough for our purpose...) - targetDistance = DEG2RAD * EARTHRAD * sphereDistance( - situationActual.Latitude,situationActual.Longitude, - navigationDesired.Latitude,navigationDesired.Longitude - ); - - // pitch to climb/sink to target altitude (attempts to reach - // target altitude withing SettleTime seconds - targetVspeed= (navigationDesired.Altitude - situationActual.Altitude)/navSettings.SettleTime; - if ( targetVspeed >= situationActual.Airspeed ) - { - targetTruePitch = 90.0; - } - else if ( targetVspeed <= -situationActual.Airspeed ) - { - targetTruePitch = -90.0; - } - else - { - targetTruePitch = RAD2DEG * asin( targetVspeed / situationActual.Airspeed ); - } - - // course to target coordinate - targetHeading = sphereCourse( - situationActual.Latitude,situationActual.Longitude, - navigationDesired.Latitude,navigationDesired.Longitude - ); - -//printf("\n\n\nTarget: Heading: %2f Distance: %2f climbing %2f°\n",targetHeading,targetDistance,targetTruePitch); -//printf("distance: %f\n",sphereDistance(situationActual.Latitude,situationActual.Longitude,navigationDesired.Latitude,navigationDesired.Longitude)); - /** - * navigation for fixed wing planes - */ - if (systemSettings.AirframeType != SYSTEMSETTINGS_AIRFRAMETYPE_VTOL) - { - - /** - * Fixed wing planes create lift through their airspeed - * therefore most maneuver limits depend on the current - * speed and situation. - */ - - // acceleration: - maxAccel=navSettings.AccelerationMax; - /** - * Idea: at minSpeed, the plane can JUST compensate 1g - * safely. The StallSpeed at any load factor is - * Vstall=Vs(0) / sqrt(load) so the maximum load for - * the current speed is maxLoad = (Vs(0)/V)² - */ - maxAccel = MIN( maxAccel , - GRAVITY * (situationActual.Airspeed*situationActual.Airspeed) - / (navSettings.SpeedMin * navSettings.SpeedMin) - ); - - // maximum pitch: - maxPitch=85.0; - - /** - * Idea: any climb decreases speed. Aside from drag - * speed decrease is vertical speed times g (9.81m/s²) - * make sure speed stays above min speed within - * SettleTime - */ - safeAccel = ( navSettings.SpeedSafe-situationActual.Airspeed ) / navSettings.SettleTime; - if (safeAccel>=0) - { - // speed is below minimum speed. Do not allow any climbs! - maxPitch = MIN(maxPitch,0); - } - else if (safeAccel>-GRAVITY) - { - // speed is getting low. Limit maximum climb! - maxPitch = MIN(maxPitch,RAD2DEG*asin(-safeAccel/GRAVITY)); - } - - // minimum pitch: - minPitch=-85.0; - - /** - * Idea: any dive increases speed. Aside from drag - * speed increase is vertical speed times g (9.81m/s²) - * make sure speed stays below max speed within - * SettleTime - */ - safeAccel = ( navSettings.SpeedMax-situationActual.Airspeed ) / navSettings.SettleTime; - if (safeAccel<=0) - { - // speed is above maximum speed. Do not allow any dives! - minPitch = MAX(minPitch,0); - } - else if (safeAccel= situationActual.Altitude - navigationDesired.Altitude) - { - // altitude is close to target altitude, limit negative pitch - minPitch = MAX(minPitch,-1 * RAD2DEG * asin( (situationActual.Altitude - navigationDesired.Altitude) / safeDistance )); - } - -//printf("Safety: Pitch: %2f %2f Accel: %2fm/s²\n",minPitch,maxPitch,maxAccel); - - /** - * Base anted yaw and pitch on calculated angle of - * attack and side slip effects - * - * Note: This can lead to an oszillation between a - * flight with positive and negative angle of attack. - * Without this correction however, the plane will - * always "lag behind" it's desired altitude. - */ - - // angle of attack in X and Y - aoa = attitudeActual.Pitch - (RAD2DEG * atan2( situationActual.Climbrate, situationActual.Groundspeed)); - saoa = attitudeActual.Yaw-situationActual.Course; - - targetPitch = bound(targetTruePitch+aoa,minPitch,maxPitch); - targetYaw = fixAngle(targetHeading+saoa,0.,360.); -//printf("Target Pitch: %2f Yaw: %2f \n",targetPitch,targetYaw); -//printf("Current Roll: %2f Pitch: %2f Yaw: %2f \n",attitudeActual.Roll,attitudeActual.Pitch,attitudeActual.Yaw); - - /** - * Now we have the current Pitch Yaw and Roll in - * AttitudeActual and the wanted course in targetPitch - * and targetYaw. We also have the safety limits. Now - * make a smooth and save transition. - * including all safety limits! Make a nice transition. - */ - - // turn vector (Euler) - /** - * The naive approach wants to fly along an Orthodrome - the quickest way to get from one angle to another - */ - turnDirection = sphereCourse(attitudeActual.Pitch,attitudeActual.Yaw,targetPitch,targetYaw); - - /** - * However if the target yaw is more than 90° away, this orthodrome would lead through a minimum or maximum point that - * could be beyond safe min/max pitch values! - */ - if (fabs(angleDifference(attitudeActual.Yaw-targetYaw))>90) - { - if (fabs(turnDirection)<90) - { - /** - * Positive turns (upward) can conflict with maxPitch - */ - if (RAD2DEG*acos(sin(fabs(DEG2RAD*turnDirection))*cos(DEG2RAD*attitudeActual.Pitch))>maxPitch) - { - /** - * In this case the turn has to be adjusted to a circle that won't conflict with maxPitch - */ -//printf("maximum is %2f which is higher than %2f\n",RAD2DEG*acos(sin(DEG2RAD*turnDirection)*cos(DEG2RAD*attitudeActual.Pitch)),maxPitch); - if (cos(DEG2RAD*attitudeActual.Pitch)>cos(DEG2RAD*maxPitch)) - { - if (turnDirection>0) - { - turnDirection = RAD2DEG * asin( cos(DEG2RAD*maxPitch)/cos(DEG2RAD*attitudeActual.Pitch)); - } - else - { - turnDirection = -RAD2DEG * asin( cos(DEG2RAD*maxPitch)/cos(DEG2RAD*attitudeActual.Pitch)); - } - } - else - { - /** - * something went wrong (attitude outside safe bounds?)- compensate safely - */ - turnDirection=(turnDirection>0?110:-110); - } -//printf("limiting because of max!\n"); - } - } - else - { - /** - * Downward turns can conflict with minPitch - */ - if (RAD2DEG*acos(sin(fabs(DEG2RAD*turnDirection))*cos(DEG2RAD*attitudeActual.Pitch))>-minPitch) - { -//printf("minimum is %2f which is less than %2f\n",-1*RAD2DEG*acos(sin(fabs(DEG2RAD*turnDirection))*cos(DEG2RAD*attitudeActual.Pitch)),minPitch); - /** - * In this case the turn has to be adjusted to a circle that won't conflict with minPitch - */ - if (cos(DEG2RAD*attitudeActual.Pitch)>cos(DEG2RAD*minPitch)) - { - if (turnDirection>0) { - turnDirection = 180 - RAD2DEG * asin( cos(DEG2RAD*minPitch)/cos(DEG2RAD*attitudeActual.Pitch)); - } - else - { - turnDirection = -180 + RAD2DEG * asin( cos(DEG2RAD*minPitch)/cos(DEG2RAD*attitudeActual.Pitch)); - } - } - else - { - /** - * something went wrong (attitude outside safe bounds?)- compensate safely - */ - turnDirection=(turnDirection>0?45:-45); - } -//printf("limiting because of min!\n"); - } - } - } - - /** - * Turn speed in °/s is the minimum of - * TurnSpeedFactor * degrees to turn - * and - * the maximum angular velocity achievable with - * less than maxAccel centripetal acceleration - * (taking gravity effect into account) - * but not less than 0 - * Formula: acceleration = (DEG2RAD*turnSpeed) - * * airspeed - */ - turnSpeed = MAX(0,MIN( - navSettings.TurnSpeedFactor * sphereDistance( - attitudeActual.Pitch,attitudeActual.Yaw, - targetPitch,targetYaw) - , - RAD2DEG * (maxAccel-( MIN(0,cos(DEG2RAD*turnDirection))*GRAVITY )) / situationActual.Airspeed - )); -//printf("turn distance is %2f °\n", sphereDistance(attitudeActual.Pitch,attitudeActual.Yaw,targetPitch,targetYaw)); -//printf("safe speed is %2f °/s\n",RAD2DEG * (maxAccel-( MIN(0,cos(DEG2RAD*turnDirection))*GRAVITY )) / situationActual.Airspeed); -//printf("turn speed is %2f °/s\n",turnSpeed); -//printf("Airspeed is %2f °/s\n",situationActual.Airspeed); - - /** - * Compute wanted centripetal acceleration - */ - turnAccel = DEG2RAD* turnSpeed * situationActual.Airspeed; -//printf("Turn with: %2f at %2fm/s²\n",turnDirection,turnAccel); - - - // Desired Attitude - /** - * Now that we know which way the plane is supposed to - * go and at what acceleration, calculate the required - * roll angle to also compensate gravity during the - * turn - */ - attitudeDesired.Roll = RAD2DEG*atan2( - turnAccel * sin(DEG2RAD*turnDirection), - turnAccel * cos(DEG2RAD*turnDirection) + cos(DEG2RAD*attitudeActual.Pitch)*GRAVITY - ); - /** - * However this can also result in an upright flight - * with a load of less than 1g - * In this case, the effect on yaw is reversed. - * (Imagine rolling 45° right, then push the stick - * slightly. You will go left and down!) - * In this case we reverse the roll to descent into the - * right direction! - */ - if (fabs(angleDifference(attitudeDesired.Roll-turnDirection))>90) { - attitudeDesired.Roll=-attitudeDesired.Roll; - } -//printf("FINALS: roll %2f ",attitudeDesired.Roll); - - /** - * The desired Yaw and Pitch values are tricky. - * The current Stabilization module doesn't allow us to - * specify an angular speed or even centripetal - * acceleration instead we have to specify an - * orientation. - * According to tests, a formula of - * sqrt(turnAccel) * StabilizationForceFactor - * degrees lookahead gives reasonable results. - */ - attitudeDesired.Pitch = bound( - attitudeActual.Pitch + navSettings.StabilizationForceFactor * SSQRT(turnAccel * cos(DEG2RAD*turnDirection)), - minPitch, - maxPitch); - attitudeDesired.Yaw = attitudeActual.Yaw + navSettings.StabilizationForceFactor * SSQRT(turnAccel * sin(DEG2RAD*turnDirection)) ; -//printf("pitch %2f yaw %2f\n",attitudeDesired.Pitch-attitudeActual.Pitch,attitudeDesired.Yaw-attitudeActual.Yaw); - - - /** - * TODO: Make a real PID loop for the throttle. - */ - attitudeDesired.Throttle=0.8; - - - } - - // Write actuator desired (if not in manual mode) - if ( manualControl.FlightMode == MANUALCONTROLCOMMAND_FLIGHTMODE_AUTO ) - { - AttitudeDesiredSet(&attitudeDesired); - } - - // Wait until next update - vTaskDelayUntil(&lastSysTime, navSettings.UpdatePeriod / portTICK_RATE_MS ); - } -} - -/** - * Bound input value between limits - */ -static float bound(float val, float min, float max) -{ - if ( val < min ) - { - val = min; - } - else if ( val > max ) - { - val = max; - } - return val; -} - -/** - * Fix result of angular differences - */ -static float angleDifference(float val) -{ - while ( val < -180.0 ) - { - val += 360.0; - } - while ( val > 180.0 ) - { - val -= 360.0; - } - return val; -} - -/** - * Make sure an angular value stays between correct bounds - */ -static float fixAngle(float val,float min, float max) -{ - while ( val < min ) - { - val += 360.0; - } - while ( val >= max ) - { - val -= 360.0; - } - return val; -} - -/** - * calculate spherical distance and course between two coordinate pairs - * see http://de.wikipedia.org/wiki/Orthodrome for details - */ -static float sphereDistance(float lat1, float long1, float lat2, float long2) -{ - float zeta=(RAD2DEG * acos ( - sin(DEG2RAD*lat1) * sin(DEG2RAD*lat2) - + cos(DEG2RAD*lat1) * cos(DEG2RAD*lat2) * cos(DEG2RAD*(long2-long1)) - )); - if (isnan(zeta)) { - zeta=0; - } - return zeta; - -} -static float sphereCourse(float lat1, float long1, float lat2, float long2) -{ - float zeta = sphereDistance(lat1,long1,lat2,long2); - float angle = RAD2DEG * acos( - ( sin(DEG2RAD*lat2) - sin(DEG2RAD*lat1) * cos(DEG2RAD*zeta) ) - / ( cos(DEG2RAD*lat1) * sin(DEG2RAD*zeta) ) - ); - if (isnan(angle)) angle=0; - if (angleDifference(long2-long1)>=0) { - return angle; - } else { - return -angle; - } -} - -/** - * @} - * @} - */ diff --git a/flight/OpenPilot/UAVObjects/flightsituationactual.c b/flight/OpenPilot/UAVObjects/flightsituationactual.c deleted file mode 100644 index b2592dd77..000000000 --- a/flight/OpenPilot/UAVObjects/flightsituationactual.c +++ /dev/null @@ -1,111 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup UAVObjects OpenPilot UAVObjects - * @{ - * @addtogroup FlightSituationActual FlightSituationActual - * @brief Currently unused - * - * Autogenerated files and functions for FlightSituationActual Object - * @{ - * - * @file flightsituationactual.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Implementation of the FlightSituationActual object. This file has been - * automatically generated by the UAVObjectGenerator. - * - * @note Object definition file: flightsituationactual.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 - */ - -#include "openpilot.h" -#include "flightsituationactual.h" - -// Private variables -static UAVObjHandle handle; - -// Private functions -static void setDefaults(UAVObjHandle obj, uint16_t instId); - -/** - * Initialize object. - * \return 0 Success - * \return -1 Failure - */ -int32_t FlightSituationActualInitialize() -{ - // Register object with the object manager - handle = UAVObjRegister(FLIGHTSITUATIONACTUAL_OBJID, FLIGHTSITUATIONACTUAL_NAME, FLIGHTSITUATIONACTUAL_METANAME, 0, - FLIGHTSITUATIONACTUAL_ISSINGLEINST, FLIGHTSITUATIONACTUAL_ISSETTINGS, FLIGHTSITUATIONACTUAL_NUMBYTES, &setDefaults); - - // Done - if (handle != 0) - { - return 0; - } - else - { - return -1; - } -} - -/** - * Initialize object fields and metadata with the default values. - * If a default value is not specified the object fields - * will be initialized to zero. - */ -static void setDefaults(UAVObjHandle obj, uint16_t instId) -{ - FlightSituationActualData data; - UAVObjMetadata metadata; - - // Initialize object fields to their default values - UAVObjGetInstanceData(obj, instId, &data); - memset(&data, 0, sizeof(FlightSituationActualData)); - - UAVObjSetInstanceData(obj, instId, &data); - - // Initialize object metadata to their default values - metadata.access = ACCESS_READWRITE; - metadata.gcsAccess = ACCESS_READWRITE; - metadata.telemetryAcked = 0; - metadata.telemetryUpdateMode = UPDATEMODE_PERIODIC; - metadata.telemetryUpdatePeriod = 1000; - metadata.gcsTelemetryAcked = 0; - metadata.gcsTelemetryUpdateMode = UPDATEMODE_MANUAL; - metadata.gcsTelemetryUpdatePeriod = 0; - metadata.loggingUpdateMode = UPDATEMODE_PERIODIC; - metadata.loggingUpdatePeriod = 1000; - UAVObjSetMetadata(obj, &metadata); -} - -/** - * Get object handle - */ -UAVObjHandle FlightSituationActualHandle() -{ - return handle; -} - -/** - * @} - */ - diff --git a/flight/OpenPilot/UAVObjects/guidancesettings.c b/flight/OpenPilot/UAVObjects/guidancesettings.c deleted file mode 100644 index 32a2a51d1..000000000 --- a/flight/OpenPilot/UAVObjects/guidancesettings.c +++ /dev/null @@ -1,132 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup UAVObjects OpenPilot UAVObjects - * @{ - * @addtogroup GuidanceSettings GuidanceSettings - * @brief PID settings used by the Guidance module to combine the @ref PositionActual and @ref PositionDesired to compute @ref AttitudeDesired - * - * Autogenerated files and functions for GuidanceSettings Object - * @{ - * - * @file guidancesettings.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Implementation of the GuidanceSettings object. This file has been - * automatically generated by the UAVObjectGenerator. - * - * @note Object definition file: guidancesettings.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 - */ - -#include "openpilot.h" -#include "guidancesettings.h" - -// Private variables -static UAVObjHandle handle; - -// Private functions -static void setDefaults(UAVObjHandle obj, uint16_t instId); - -/** - * Initialize object. - * \return 0 Success - * \return -1 Failure - */ -int32_t GuidanceSettingsInitialize() -{ - // Register object with the object manager - handle = UAVObjRegister(GUIDANCESETTINGS_OBJID, GUIDANCESETTINGS_NAME, GUIDANCESETTINGS_METANAME, 0, - GUIDANCESETTINGS_ISSINGLEINST, GUIDANCESETTINGS_ISSETTINGS, GUIDANCESETTINGS_NUMBYTES, &setDefaults); - - // Done - if (handle != 0) - { - return 0; - } - else - { - return -1; - } -} - -/** - * Initialize object fields and metadata with the default values. - * If a default value is not specified the object fields - * will be initialized to zero. - */ -static void setDefaults(UAVObjHandle obj, uint16_t instId) -{ - GuidanceSettingsData data; - UAVObjMetadata metadata; - - // Initialize object fields to their default values - UAVObjGetInstanceData(obj, instId, &data); - memset(&data, 0, sizeof(GuidanceSettingsData)); - data.UpdatePeriod = 10; - data.RollMax = 35; - data.PitchMax = 35; - data.PitchMin = -35; - data.PitchRollEpsilon = 10; - data.ThrottleMax = 1; - data.ThrottleMin = 0; - data.SpeedMax = 100; - data.SpeedMin = 10; - data.SpeedKp = 0.04; - data.SpeedKi = 4e-06; - data.SpeedKd = 0.01; - data.EnergyKp = 0.04; - data.EnergyKi = 4e-06; - data.EnergyKd = 0.01; - data.LateralKp = 0.04; - data.LateralKi = 4e-06; - data.LateralKd = 0.01; - data.CourseKp = 0.04; - data.CourseKi = 4e-06; - data.CourseKd = 0.01; - - UAVObjSetInstanceData(obj, instId, &data); - - // Initialize object metadata to their default values - metadata.access = ACCESS_READWRITE; - metadata.gcsAccess = ACCESS_READWRITE; - metadata.telemetryAcked = 1; - metadata.telemetryUpdateMode = UPDATEMODE_ONCHANGE; - metadata.telemetryUpdatePeriod = 0; - metadata.gcsTelemetryAcked = 1; - metadata.gcsTelemetryUpdateMode = UPDATEMODE_ONCHANGE; - metadata.gcsTelemetryUpdatePeriod = 0; - metadata.loggingUpdateMode = UPDATEMODE_NEVER; - metadata.loggingUpdatePeriod = 0; - UAVObjSetMetadata(obj, &metadata); -} - -/** - * Get object handle - */ -UAVObjHandle GuidanceSettingsHandle() -{ - return handle; -} - -/** - * @} - */ - diff --git a/flight/OpenPilot/UAVObjects/inc/flightsituationactual.h b/flight/OpenPilot/UAVObjects/inc/flightsituationactual.h deleted file mode 100644 index 70f49661a..000000000 --- a/flight/OpenPilot/UAVObjects/inc/flightsituationactual.h +++ /dev/null @@ -1,107 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup UAVObjects OpenPilot UAVObjects - * @{ - * @addtogroup FlightSituationActual FlightSituationActual - * @brief Currently unused - * - * Autogenerated files and functions for FlightSituationActual Object - - * @{ - * - * @file flightsituationactual.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Implementation of the FlightSituationActual object. This file has been - * automatically generated by the UAVObjectGenerator. - * - * @note Object definition file: flightsituationactual.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 - */ - -#ifndef FLIGHTSITUATIONACTUAL_H -#define FLIGHTSITUATIONACTUAL_H - -// Object constants -#define FLIGHTSITUATIONACTUAL_OBJID 499301246U -#define FLIGHTSITUATIONACTUAL_NAME "FlightSituationActual" -#define FLIGHTSITUATIONACTUAL_METANAME "FlightSituationActualMeta" -#define FLIGHTSITUATIONACTUAL_ISSINGLEINST 1 -#define FLIGHTSITUATIONACTUAL_ISSETTINGS 0 -#define FLIGHTSITUATIONACTUAL_NUMBYTES sizeof(FlightSituationActualData) - -// Object access macros -/** - * @function FlightSituationActualGet(dataOut) - * @brief Populate a FlightSituationActualData object - * @param[out] dataOut - */ -#define FlightSituationActualGet(dataOut) UAVObjGetData(FlightSituationActualHandle(), dataOut) -#define FlightSituationActualSet(dataIn) UAVObjSetData(FlightSituationActualHandle(), dataIn) -#define FlightSituationActualInstGet(instId, dataOut) UAVObjGetInstanceData(FlightSituationActualHandle(), instId, dataOut) -#define FlightSituationActualInstSet(instId, dataIn) UAVObjSetInstanceData(FlightSituationActualHandle(), instId, dataIn) -#define FlightSituationActualConnectQueue(queue) UAVObjConnectQueue(FlightSituationActualHandle(), queue, EV_MASK_ALL_UPDATES) -#define FlightSituationActualConnectCallback(cb) UAVObjConnectCallback(FlightSituationActualHandle(), cb, EV_MASK_ALL_UPDATES) -#define FlightSituationActualCreateInstance() UAVObjCreateInstance(FlightSituationActualHandle()) -#define FlightSituationActualRequestUpdate() UAVObjRequestUpdate(FlightSituationActualHandle()) -#define FlightSituationActualRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(FlightSituationActualHandle(), instId) -#define FlightSituationActualUpdated() UAVObjUpdated(FlightSituationActualHandle()) -#define FlightSituationActualInstUpdated(instId) UAVObjUpdated(FlightSituationActualHandle(), instId) -#define FlightSituationActualGetMetadata(dataOut) UAVObjGetMetadata(FlightSituationActualHandle(), dataOut) -#define FlightSituationActualSetMetadata(dataIn) UAVObjSetMetadata(FlightSituationActualHandle(), dataIn) -#define FlightSituationActualReadOnly(dataIn) UAVObjReadOnly(FlightSituationActualHandle()) - -// Object data -typedef struct { - float Latitude; - float Longitude; - float Altitude; - float ATG; - float Climbrate; - float Heading; - float Airspeed; - float Course; - float Groundspeed; - -} __attribute__((packed)) FlightSituationActualData; - -// Field information -// Field Latitude information -// Field Longitude information -// Field Altitude information -// Field ATG information -// Field Climbrate information -// Field Heading information -// Field Airspeed information -// Field Course information -// Field Groundspeed information - - -// Generic interface functions -int32_t FlightSituationActualInitialize(); -UAVObjHandle FlightSituationActualHandle(); - -#endif // FLIGHTSITUATIONACTUAL_H - -/** - * @} - * @} - */ diff --git a/flight/OpenPilot/UAVObjects/inc/guidancesettings.h b/flight/OpenPilot/UAVObjects/inc/guidancesettings.h deleted file mode 100644 index 3e55a849b..000000000 --- a/flight/OpenPilot/UAVObjects/inc/guidancesettings.h +++ /dev/null @@ -1,131 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup UAVObjects OpenPilot UAVObjects - * @{ - * @addtogroup GuidanceSettings GuidanceSettings - * @brief PID settings used by the Guidance module to combine the @ref PositionActual and @ref PositionDesired to compute @ref AttitudeDesired - * - * Autogenerated files and functions for GuidanceSettings Object - - * @{ - * - * @file guidancesettings.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Implementation of the GuidanceSettings object. This file has been - * automatically generated by the UAVObjectGenerator. - * - * @note Object definition file: guidancesettings.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 - */ - -#ifndef GUIDANCESETTINGS_H -#define GUIDANCESETTINGS_H - -// Object constants -#define GUIDANCESETTINGS_OBJID 2093064904U -#define GUIDANCESETTINGS_NAME "GuidanceSettings" -#define GUIDANCESETTINGS_METANAME "GuidanceSettingsMeta" -#define GUIDANCESETTINGS_ISSINGLEINST 1 -#define GUIDANCESETTINGS_ISSETTINGS 1 -#define GUIDANCESETTINGS_NUMBYTES sizeof(GuidanceSettingsData) - -// Object access macros -/** - * @function GuidanceSettingsGet(dataOut) - * @brief Populate a GuidanceSettingsData object - * @param[out] dataOut - */ -#define GuidanceSettingsGet(dataOut) UAVObjGetData(GuidanceSettingsHandle(), dataOut) -#define GuidanceSettingsSet(dataIn) UAVObjSetData(GuidanceSettingsHandle(), dataIn) -#define GuidanceSettingsInstGet(instId, dataOut) UAVObjGetInstanceData(GuidanceSettingsHandle(), instId, dataOut) -#define GuidanceSettingsInstSet(instId, dataIn) UAVObjSetInstanceData(GuidanceSettingsHandle(), instId, dataIn) -#define GuidanceSettingsConnectQueue(queue) UAVObjConnectQueue(GuidanceSettingsHandle(), queue, EV_MASK_ALL_UPDATES) -#define GuidanceSettingsConnectCallback(cb) UAVObjConnectCallback(GuidanceSettingsHandle(), cb, EV_MASK_ALL_UPDATES) -#define GuidanceSettingsCreateInstance() UAVObjCreateInstance(GuidanceSettingsHandle()) -#define GuidanceSettingsRequestUpdate() UAVObjRequestUpdate(GuidanceSettingsHandle()) -#define GuidanceSettingsRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(GuidanceSettingsHandle(), instId) -#define GuidanceSettingsUpdated() UAVObjUpdated(GuidanceSettingsHandle()) -#define GuidanceSettingsInstUpdated(instId) UAVObjUpdated(GuidanceSettingsHandle(), instId) -#define GuidanceSettingsGetMetadata(dataOut) UAVObjGetMetadata(GuidanceSettingsHandle(), dataOut) -#define GuidanceSettingsSetMetadata(dataIn) UAVObjSetMetadata(GuidanceSettingsHandle(), dataIn) -#define GuidanceSettingsReadOnly(dataIn) UAVObjReadOnly(GuidanceSettingsHandle()) - -// Object data -typedef struct { - uint16_t UpdatePeriod; - float RollMax; - float PitchMax; - float PitchMin; - float PitchRollEpsilon; - float ThrottleMax; - float ThrottleMin; - float SpeedMax; - float SpeedMin; - float SpeedKp; - float SpeedKi; - float SpeedKd; - float EnergyKp; - float EnergyKi; - float EnergyKd; - float LateralKp; - float LateralKi; - float LateralKd; - float CourseKp; - float CourseKi; - float CourseKd; - -} __attribute__((packed)) GuidanceSettingsData; - -// Field information -// Field UpdatePeriod information -// Field RollMax information -// Field PitchMax information -// Field PitchMin information -// Field PitchRollEpsilon information -// Field ThrottleMax information -// Field ThrottleMin information -// Field SpeedMax information -// Field SpeedMin information -// Field SpeedKp information -// Field SpeedKi information -// Field SpeedKd information -// Field EnergyKp information -// Field EnergyKi information -// Field EnergyKd information -// Field LateralKp information -// Field LateralKi information -// Field LateralKd information -// Field CourseKp information -// Field CourseKi information -// Field CourseKd information - - -// Generic interface functions -int32_t GuidanceSettingsInitialize(); -UAVObjHandle GuidanceSettingsHandle(); - -#endif // GUIDANCESETTINGS_H - -/** - * @} - * @} - */ diff --git a/flight/OpenPilot/UAVObjects/inc/navigationdesired.h b/flight/OpenPilot/UAVObjects/inc/navigationdesired.h deleted file mode 100644 index 552736428..000000000 --- a/flight/OpenPilot/UAVObjects/inc/navigationdesired.h +++ /dev/null @@ -1,97 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup UAVObjects OpenPilot UAVObjects - * @{ - * @addtogroup NavigationDesired NavigationDesired - * @brief Currently unused - * - * Autogenerated files and functions for NavigationDesired Object - - * @{ - * - * @file navigationdesired.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Implementation of the NavigationDesired object. This file has been - * automatically generated by the UAVObjectGenerator. - * - * @note Object definition file: navigationdesired.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 - */ - -#ifndef NAVIGATIONDESIRED_H -#define NAVIGATIONDESIRED_H - -// Object constants -#define NAVIGATIONDESIRED_OBJID 2357718118U -#define NAVIGATIONDESIRED_NAME "NavigationDesired" -#define NAVIGATIONDESIRED_METANAME "NavigationDesiredMeta" -#define NAVIGATIONDESIRED_ISSINGLEINST 1 -#define NAVIGATIONDESIRED_ISSETTINGS 0 -#define NAVIGATIONDESIRED_NUMBYTES sizeof(NavigationDesiredData) - -// Object access macros -/** - * @function NavigationDesiredGet(dataOut) - * @brief Populate a NavigationDesiredData object - * @param[out] dataOut - */ -#define NavigationDesiredGet(dataOut) UAVObjGetData(NavigationDesiredHandle(), dataOut) -#define NavigationDesiredSet(dataIn) UAVObjSetData(NavigationDesiredHandle(), dataIn) -#define NavigationDesiredInstGet(instId, dataOut) UAVObjGetInstanceData(NavigationDesiredHandle(), instId, dataOut) -#define NavigationDesiredInstSet(instId, dataIn) UAVObjSetInstanceData(NavigationDesiredHandle(), instId, dataIn) -#define NavigationDesiredConnectQueue(queue) UAVObjConnectQueue(NavigationDesiredHandle(), queue, EV_MASK_ALL_UPDATES) -#define NavigationDesiredConnectCallback(cb) UAVObjConnectCallback(NavigationDesiredHandle(), cb, EV_MASK_ALL_UPDATES) -#define NavigationDesiredCreateInstance() UAVObjCreateInstance(NavigationDesiredHandle()) -#define NavigationDesiredRequestUpdate() UAVObjRequestUpdate(NavigationDesiredHandle()) -#define NavigationDesiredRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(NavigationDesiredHandle(), instId) -#define NavigationDesiredUpdated() UAVObjUpdated(NavigationDesiredHandle()) -#define NavigationDesiredInstUpdated(instId) UAVObjUpdated(NavigationDesiredHandle(), instId) -#define NavigationDesiredGetMetadata(dataOut) UAVObjGetMetadata(NavigationDesiredHandle(), dataOut) -#define NavigationDesiredSetMetadata(dataIn) UAVObjSetMetadata(NavigationDesiredHandle(), dataIn) -#define NavigationDesiredReadOnly(dataIn) UAVObjReadOnly(NavigationDesiredHandle()) - -// Object data -typedef struct { - float Latitude; - float Longitude; - float Altitude; - float Speed; - -} __attribute__((packed)) NavigationDesiredData; - -// Field information -// Field Latitude information -// Field Longitude information -// Field Altitude information -// Field Speed information - - -// Generic interface functions -int32_t NavigationDesiredInitialize(); -UAVObjHandle NavigationDesiredHandle(); - -#endif // NAVIGATIONDESIRED_H - -/** - * @} - * @} - */ diff --git a/flight/OpenPilot/UAVObjects/inc/navigationsettings.h b/flight/OpenPilot/UAVObjects/inc/navigationsettings.h deleted file mode 100644 index 4d0dcf911..000000000 --- a/flight/OpenPilot/UAVObjects/inc/navigationsettings.h +++ /dev/null @@ -1,105 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup UAVObjects OpenPilot UAVObjects - * @{ - * @addtogroup NavigationSettings NavigationSettings - * @brief Settings for Navigation. Currently unused. - * - * Autogenerated files and functions for NavigationSettings Object - - * @{ - * - * @file navigationsettings.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Implementation of the NavigationSettings object. This file has been - * automatically generated by the UAVObjectGenerator. - * - * @note Object definition file: navigationsettings.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 - */ - -#ifndef NAVIGATIONSETTINGS_H -#define NAVIGATIONSETTINGS_H - -// Object constants -#define NAVIGATIONSETTINGS_OBJID 1350892244U -#define NAVIGATIONSETTINGS_NAME "NavigationSettings" -#define NAVIGATIONSETTINGS_METANAME "NavigationSettingsMeta" -#define NAVIGATIONSETTINGS_ISSINGLEINST 1 -#define NAVIGATIONSETTINGS_ISSETTINGS 1 -#define NAVIGATIONSETTINGS_NUMBYTES sizeof(NavigationSettingsData) - -// Object access macros -/** - * @function NavigationSettingsGet(dataOut) - * @brief Populate a NavigationSettingsData object - * @param[out] dataOut - */ -#define NavigationSettingsGet(dataOut) UAVObjGetData(NavigationSettingsHandle(), dataOut) -#define NavigationSettingsSet(dataIn) UAVObjSetData(NavigationSettingsHandle(), dataIn) -#define NavigationSettingsInstGet(instId, dataOut) UAVObjGetInstanceData(NavigationSettingsHandle(), instId, dataOut) -#define NavigationSettingsInstSet(instId, dataIn) UAVObjSetInstanceData(NavigationSettingsHandle(), instId, dataIn) -#define NavigationSettingsConnectQueue(queue) UAVObjConnectQueue(NavigationSettingsHandle(), queue, EV_MASK_ALL_UPDATES) -#define NavigationSettingsConnectCallback(cb) UAVObjConnectCallback(NavigationSettingsHandle(), cb, EV_MASK_ALL_UPDATES) -#define NavigationSettingsCreateInstance() UAVObjCreateInstance(NavigationSettingsHandle()) -#define NavigationSettingsRequestUpdate() UAVObjRequestUpdate(NavigationSettingsHandle()) -#define NavigationSettingsRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(NavigationSettingsHandle(), instId) -#define NavigationSettingsUpdated() UAVObjUpdated(NavigationSettingsHandle()) -#define NavigationSettingsInstUpdated(instId) UAVObjUpdated(NavigationSettingsHandle(), instId) -#define NavigationSettingsGetMetadata(dataOut) UAVObjGetMetadata(NavigationSettingsHandle(), dataOut) -#define NavigationSettingsSetMetadata(dataIn) UAVObjSetMetadata(NavigationSettingsHandle(), dataIn) -#define NavigationSettingsReadOnly(dataIn) UAVObjReadOnly(NavigationSettingsHandle()) - -// Object data -typedef struct { - uint16_t UpdatePeriod; - float AccelerationMax; - float SpeedMax; - float SpeedSafe; - float SpeedMin; - float SettleTime; - float TurnSpeedFactor; - float StabilizationForceFactor; - -} __attribute__((packed)) NavigationSettingsData; - -// Field information -// Field UpdatePeriod information -// Field AccelerationMax information -// Field SpeedMax information -// Field SpeedSafe information -// Field SpeedMin information -// Field SettleTime information -// Field TurnSpeedFactor information -// Field StabilizationForceFactor information - - -// Generic interface functions -int32_t NavigationSettingsInitialize(); -UAVObjHandle NavigationSettingsHandle(); - -#endif // NAVIGATIONSETTINGS_H - -/** - * @} - * @} - */ diff --git a/flight/OpenPilot/UAVObjects/inc/positiondesired.h b/flight/OpenPilot/UAVObjects/inc/positiondesired.h deleted file mode 100644 index a8259bf6a..000000000 --- a/flight/OpenPilot/UAVObjects/inc/positiondesired.h +++ /dev/null @@ -1,97 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup UAVObjects OpenPilot UAVObjects - * @{ - * @addtogroup PositionDesired PositionDesired - * @brief The desired position that @ref GuidanceModule will try and achieve if FlightMode is Auto. Comes from @ref PathPlannerModule. - * - * Autogenerated files and functions for PositionDesired Object - - * @{ - * - * @file positiondesired.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Implementation of the PositionDesired object. This file has been - * automatically generated by the UAVObjectGenerator. - * - * @note Object definition file: positiondesired.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 - */ - -#ifndef POSITIONDESIRED_H -#define POSITIONDESIRED_H - -// Object constants -#define POSITIONDESIRED_OBJID 2182398544U -#define POSITIONDESIRED_NAME "PositionDesired" -#define POSITIONDESIRED_METANAME "PositionDesiredMeta" -#define POSITIONDESIRED_ISSINGLEINST 1 -#define POSITIONDESIRED_ISSETTINGS 0 -#define POSITIONDESIRED_NUMBYTES sizeof(PositionDesiredData) - -// Object access macros -/** - * @function PositionDesiredGet(dataOut) - * @brief Populate a PositionDesiredData object - * @param[out] dataOut - */ -#define PositionDesiredGet(dataOut) UAVObjGetData(PositionDesiredHandle(), dataOut) -#define PositionDesiredSet(dataIn) UAVObjSetData(PositionDesiredHandle(), dataIn) -#define PositionDesiredInstGet(instId, dataOut) UAVObjGetInstanceData(PositionDesiredHandle(), instId, dataOut) -#define PositionDesiredInstSet(instId, dataIn) UAVObjSetInstanceData(PositionDesiredHandle(), instId, dataIn) -#define PositionDesiredConnectQueue(queue) UAVObjConnectQueue(PositionDesiredHandle(), queue, EV_MASK_ALL_UPDATES) -#define PositionDesiredConnectCallback(cb) UAVObjConnectCallback(PositionDesiredHandle(), cb, EV_MASK_ALL_UPDATES) -#define PositionDesiredCreateInstance() UAVObjCreateInstance(PositionDesiredHandle()) -#define PositionDesiredRequestUpdate() UAVObjRequestUpdate(PositionDesiredHandle()) -#define PositionDesiredRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(PositionDesiredHandle(), instId) -#define PositionDesiredUpdated() UAVObjUpdated(PositionDesiredHandle()) -#define PositionDesiredInstUpdated(instId) UAVObjUpdated(PositionDesiredHandle(), instId) -#define PositionDesiredGetMetadata(dataOut) UAVObjGetMetadata(PositionDesiredHandle(), dataOut) -#define PositionDesiredSetMetadata(dataIn) UAVObjSetMetadata(PositionDesiredHandle(), dataIn) -#define PositionDesiredReadOnly(dataIn) UAVObjReadOnly(PositionDesiredHandle()) - -// Object data -typedef struct { - float NED[3]; - float Heading; - float Groundspeed; - -} __attribute__((packed)) PositionDesiredData; - -// Field information -// Field NED information -/* Number of elements for field NED */ -#define POSITIONDESIRED_NED_NUMELEM 3 -// Field Heading information -// Field Groundspeed information - - -// Generic interface functions -int32_t PositionDesiredInitialize(); -UAVObjHandle PositionDesiredHandle(); - -#endif // POSITIONDESIRED_H - -/** - * @} - * @} - */ diff --git a/flight/OpenPilot/UAVObjects/navigationdesired.c b/flight/OpenPilot/UAVObjects/navigationdesired.c deleted file mode 100644 index 445237db1..000000000 --- a/flight/OpenPilot/UAVObjects/navigationdesired.c +++ /dev/null @@ -1,111 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup UAVObjects OpenPilot UAVObjects - * @{ - * @addtogroup NavigationDesired NavigationDesired - * @brief Currently unused - * - * Autogenerated files and functions for NavigationDesired Object - * @{ - * - * @file navigationdesired.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Implementation of the NavigationDesired object. This file has been - * automatically generated by the UAVObjectGenerator. - * - * @note Object definition file: navigationdesired.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 - */ - -#include "openpilot.h" -#include "navigationdesired.h" - -// Private variables -static UAVObjHandle handle; - -// Private functions -static void setDefaults(UAVObjHandle obj, uint16_t instId); - -/** - * Initialize object. - * \return 0 Success - * \return -1 Failure - */ -int32_t NavigationDesiredInitialize() -{ - // Register object with the object manager - handle = UAVObjRegister(NAVIGATIONDESIRED_OBJID, NAVIGATIONDESIRED_NAME, NAVIGATIONDESIRED_METANAME, 0, - NAVIGATIONDESIRED_ISSINGLEINST, NAVIGATIONDESIRED_ISSETTINGS, NAVIGATIONDESIRED_NUMBYTES, &setDefaults); - - // Done - if (handle != 0) - { - return 0; - } - else - { - return -1; - } -} - -/** - * Initialize object fields and metadata with the default values. - * If a default value is not specified the object fields - * will be initialized to zero. - */ -static void setDefaults(UAVObjHandle obj, uint16_t instId) -{ - NavigationDesiredData data; - UAVObjMetadata metadata; - - // Initialize object fields to their default values - UAVObjGetInstanceData(obj, instId, &data); - memset(&data, 0, sizeof(NavigationDesiredData)); - - UAVObjSetInstanceData(obj, instId, &data); - - // Initialize object metadata to their default values - metadata.access = ACCESS_READWRITE; - metadata.gcsAccess = ACCESS_READWRITE; - metadata.telemetryAcked = 0; - metadata.telemetryUpdateMode = UPDATEMODE_PERIODIC; - metadata.telemetryUpdatePeriod = 1000; - metadata.gcsTelemetryAcked = 0; - metadata.gcsTelemetryUpdateMode = UPDATEMODE_MANUAL; - metadata.gcsTelemetryUpdatePeriod = 0; - metadata.loggingUpdateMode = UPDATEMODE_NEVER; - metadata.loggingUpdatePeriod = 0; - UAVObjSetMetadata(obj, &metadata); -} - -/** - * Get object handle - */ -UAVObjHandle NavigationDesiredHandle() -{ - return handle; -} - -/** - * @} - */ - diff --git a/flight/OpenPilot/UAVObjects/navigationsettings.c b/flight/OpenPilot/UAVObjects/navigationsettings.c deleted file mode 100644 index 0f8ad9c75..000000000 --- a/flight/OpenPilot/UAVObjects/navigationsettings.c +++ /dev/null @@ -1,119 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup UAVObjects OpenPilot UAVObjects - * @{ - * @addtogroup NavigationSettings NavigationSettings - * @brief Settings for Navigation. Currently unused. - * - * Autogenerated files and functions for NavigationSettings Object - * @{ - * - * @file navigationsettings.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Implementation of the NavigationSettings object. This file has been - * automatically generated by the UAVObjectGenerator. - * - * @note Object definition file: navigationsettings.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 - */ - -#include "openpilot.h" -#include "navigationsettings.h" - -// Private variables -static UAVObjHandle handle; - -// Private functions -static void setDefaults(UAVObjHandle obj, uint16_t instId); - -/** - * Initialize object. - * \return 0 Success - * \return -1 Failure - */ -int32_t NavigationSettingsInitialize() -{ - // Register object with the object manager - handle = UAVObjRegister(NAVIGATIONSETTINGS_OBJID, NAVIGATIONSETTINGS_NAME, NAVIGATIONSETTINGS_METANAME, 0, - NAVIGATIONSETTINGS_ISSINGLEINST, NAVIGATIONSETTINGS_ISSETTINGS, NAVIGATIONSETTINGS_NUMBYTES, &setDefaults); - - // Done - if (handle != 0) - { - return 0; - } - else - { - return -1; - } -} - -/** - * Initialize object fields and metadata with the default values. - * If a default value is not specified the object fields - * will be initialized to zero. - */ -static void setDefaults(UAVObjHandle obj, uint16_t instId) -{ - NavigationSettingsData data; - UAVObjMetadata metadata; - - // Initialize object fields to their default values - UAVObjGetInstanceData(obj, instId, &data); - memset(&data, 0, sizeof(NavigationSettingsData)); - data.UpdatePeriod = 100; - data.AccelerationMax = 35; - data.SpeedMax = 300; - data.SpeedSafe = 100; - data.SpeedMin = 70; - data.SettleTime = 12; - data.TurnSpeedFactor = 0.1; - data.StabilizationForceFactor = 4; - - UAVObjSetInstanceData(obj, instId, &data); - - // Initialize object metadata to their default values - metadata.access = ACCESS_READWRITE; - metadata.gcsAccess = ACCESS_READWRITE; - metadata.telemetryAcked = 1; - metadata.telemetryUpdateMode = UPDATEMODE_ONCHANGE; - metadata.telemetryUpdatePeriod = 0; - metadata.gcsTelemetryAcked = 1; - metadata.gcsTelemetryUpdateMode = UPDATEMODE_ONCHANGE; - metadata.gcsTelemetryUpdatePeriod = 0; - metadata.loggingUpdateMode = UPDATEMODE_NEVER; - metadata.loggingUpdatePeriod = 0; - UAVObjSetMetadata(obj, &metadata); -} - -/** - * Get object handle - */ -UAVObjHandle NavigationSettingsHandle() -{ - return handle; -} - -/** - * @} - */ - diff --git a/flight/OpenPilot/UAVObjects/positiondesired.c b/flight/OpenPilot/UAVObjects/positiondesired.c deleted file mode 100644 index 64533698d..000000000 --- a/flight/OpenPilot/UAVObjects/positiondesired.c +++ /dev/null @@ -1,111 +0,0 @@ -/** - ****************************************************************************** - * @addtogroup UAVObjects OpenPilot UAVObjects - * @{ - * @addtogroup PositionDesired PositionDesired - * @brief The desired position that @ref GuidanceModule will try and achieve if FlightMode is Auto. Comes from @ref PathPlannerModule. - * - * Autogenerated files and functions for PositionDesired Object - * @{ - * - * @file positiondesired.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @brief Implementation of the PositionDesired object. This file has been - * automatically generated by the UAVObjectGenerator. - * - * @note Object definition file: positiondesired.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 - */ - -#include "openpilot.h" -#include "positiondesired.h" - -// Private variables -static UAVObjHandle handle; - -// Private functions -static void setDefaults(UAVObjHandle obj, uint16_t instId); - -/** - * Initialize object. - * \return 0 Success - * \return -1 Failure - */ -int32_t PositionDesiredInitialize() -{ - // Register object with the object manager - handle = UAVObjRegister(POSITIONDESIRED_OBJID, POSITIONDESIRED_NAME, POSITIONDESIRED_METANAME, 0, - POSITIONDESIRED_ISSINGLEINST, POSITIONDESIRED_ISSETTINGS, POSITIONDESIRED_NUMBYTES, &setDefaults); - - // Done - if (handle != 0) - { - return 0; - } - else - { - return -1; - } -} - -/** - * Initialize object fields and metadata with the default values. - * If a default value is not specified the object fields - * will be initialized to zero. - */ -static void setDefaults(UAVObjHandle obj, uint16_t instId) -{ - PositionDesiredData data; - UAVObjMetadata metadata; - - // Initialize object fields to their default values - UAVObjGetInstanceData(obj, instId, &data); - memset(&data, 0, sizeof(PositionDesiredData)); - - UAVObjSetInstanceData(obj, instId, &data); - - // Initialize object metadata to their default values - metadata.access = ACCESS_READWRITE; - metadata.gcsAccess = ACCESS_READWRITE; - metadata.telemetryAcked = 0; - metadata.telemetryUpdateMode = UPDATEMODE_PERIODIC; - metadata.telemetryUpdatePeriod = 1000; - metadata.gcsTelemetryAcked = 0; - metadata.gcsTelemetryUpdateMode = UPDATEMODE_MANUAL; - metadata.gcsTelemetryUpdatePeriod = 0; - metadata.loggingUpdateMode = UPDATEMODE_NEVER; - metadata.loggingUpdatePeriod = 0; - UAVObjSetMetadata(obj, &metadata); -} - -/** - * Get object handle - */ -UAVObjHandle PositionDesiredHandle() -{ - return handle; -} - -/** - * @} - */ - diff --git a/flight/OpenPilot/UAVObjects/uavobjectsinit.c b/flight/OpenPilot/UAVObjects/uavobjectsinit.c index 7a8f47204..6e86f68ad 100644 --- a/flight/OpenPilot/UAVObjects/uavobjectsinit.c +++ b/flight/OpenPilot/UAVObjects/uavobjectsinit.c @@ -43,23 +43,18 @@ #include "exampleobject2.h" #include "examplesettings.h" #include "flightbatterystate.h" -#include "flightsituationactual.h" #include "flighttelemetrystats.h" #include "gcstelemetrystats.h" #include "gpsposition.h" #include "gpssatellites.h" #include "gpstime.h" -#include "guidancesettings.h" #include "homelocation.h" #include "manualcontrolcommand.h" #include "manualcontrolsettings.h" #include "mixersettings.h" #include "mixerstatus.h" -#include "navigationdesired.h" -#include "navigationsettings.h" #include "objectpersistence.h" #include "positionactual.h" -#include "positiondesired.h" #include "stabilizationsettings.h" #include "systemalarms.h" #include "systemsettings.h" @@ -90,23 +85,18 @@ void UAVObjectsInitializeAll() ExampleObject2Initialize(); ExampleSettingsInitialize(); FlightBatteryStateInitialize(); - FlightSituationActualInitialize(); FlightTelemetryStatsInitialize(); GCSTelemetryStatsInitialize(); GPSPositionInitialize(); GPSSatellitesInitialize(); GPSTimeInitialize(); - GuidanceSettingsInitialize(); HomeLocationInitialize(); ManualControlCommandInitialize(); ManualControlSettingsInitialize(); MixerSettingsInitialize(); MixerStatusInitialize(); - NavigationDesiredInitialize(); - NavigationSettingsInitialize(); ObjectPersistenceInitialize(); PositionActualInitialize(); - PositionDesiredInitialize(); StabilizationSettingsInitialize(); SystemAlarmsInitialize(); SystemSettingsInitialize(); diff --git a/ground/src/plugins/uavobjects/flightsituationactual.cpp b/ground/src/plugins/uavobjects/flightsituationactual.cpp deleted file mode 100644 index 61a5510b0..000000000 --- a/ground/src/plugins/uavobjects/flightsituationactual.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/** - ****************************************************************************** - * - * @file flightsituationactual.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: flightsituationactual.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 "flightsituationactual.h" -#include "uavobjectfield.h" - -const QString FlightSituationActual::NAME = QString("FlightSituationActual"); - -/** - * Constructor - */ -FlightSituationActual::FlightSituationActual(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME) -{ - // Create fields - QList fields; - QStringList LatitudeElemNames; - LatitudeElemNames.append("0"); - fields.append( new UAVObjectField(QString("Latitude"), QString("degrees"), UAVObjectField::FLOAT32, LatitudeElemNames, QStringList()) ); - QStringList LongitudeElemNames; - LongitudeElemNames.append("0"); - fields.append( new UAVObjectField(QString("Longitude"), QString("degrees"), UAVObjectField::FLOAT32, LongitudeElemNames, QStringList()) ); - QStringList AltitudeElemNames; - AltitudeElemNames.append("0"); - fields.append( new UAVObjectField(QString("Altitude"), QString("meters"), UAVObjectField::FLOAT32, AltitudeElemNames, QStringList()) ); - QStringList ATGElemNames; - ATGElemNames.append("0"); - fields.append( new UAVObjectField(QString("ATG"), QString("meters"), UAVObjectField::FLOAT32, ATGElemNames, QStringList()) ); - QStringList ClimbrateElemNames; - ClimbrateElemNames.append("0"); - fields.append( new UAVObjectField(QString("Climbrate"), QString("m/s"), UAVObjectField::FLOAT32, ClimbrateElemNames, QStringList()) ); - QStringList HeadingElemNames; - HeadingElemNames.append("0"); - fields.append( new UAVObjectField(QString("Heading"), QString("degrees"), UAVObjectField::FLOAT32, HeadingElemNames, QStringList()) ); - QStringList AirspeedElemNames; - AirspeedElemNames.append("0"); - fields.append( new UAVObjectField(QString("Airspeed"), QString("m/s"), UAVObjectField::FLOAT32, AirspeedElemNames, QStringList()) ); - QStringList CourseElemNames; - CourseElemNames.append("0"); - fields.append( new UAVObjectField(QString("Course"), QString("degrees"), UAVObjectField::FLOAT32, CourseElemNames, QStringList()) ); - QStringList GroundspeedElemNames; - GroundspeedElemNames.append("0"); - fields.append( new UAVObjectField(QString("Groundspeed"), QString("m/s"), UAVObjectField::FLOAT32, GroundspeedElemNames, QStringList()) ); - - // Initialize object - initializeFields(fields, (quint8*)&data, NUMBYTES); - // Set the default field values - setDefaultFieldValues(); -} - -/** - * Get the default metadata for this object - */ -UAVObject::Metadata FlightSituationActual::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 = 1000; - metadata.loggingUpdateMode = UAVObject::UPDATEMODE_PERIODIC; - metadata.loggingUpdatePeriod = 1000; - 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 FlightSituationActual::setDefaultFieldValues() -{ - -} - -/** - * Get the object data fields - */ -FlightSituationActual::DataFields FlightSituationActual::getData() -{ - QMutexLocker locker(mutex); - return data; -} - -/** - * Set the object data fields - */ -void FlightSituationActual::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* FlightSituationActual::clone(quint32 instID) -{ - FlightSituationActual* obj = new FlightSituationActual(); - obj->initialize(instID, this->getMetaObject()); - return obj; -} - -/** - * Static function to retrieve an instance of the object. - */ -FlightSituationActual* FlightSituationActual::GetInstance(UAVObjectManager* objMngr, quint32 instID) -{ - return dynamic_cast(objMngr->getObject(FlightSituationActual::OBJID, instID)); -} diff --git a/ground/src/plugins/uavobjects/flightsituationactual.h b/ground/src/plugins/uavobjects/flightsituationactual.h deleted file mode 100644 index dc5ede755..000000000 --- a/ground/src/plugins/uavobjects/flightsituationactual.h +++ /dev/null @@ -1,94 +0,0 @@ -/** - ****************************************************************************** - * - * @file flightsituationactual.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: flightsituationactual.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 FLIGHTSITUATIONACTUAL_H -#define FLIGHTSITUATIONACTUAL_H - -#include "uavdataobject.h" -#include "uavobjectmanager.h" - -class UAVOBJECTS_EXPORT FlightSituationActual: public UAVDataObject -{ - Q_OBJECT - -public: - // Field structure - typedef struct { - float Latitude; - float Longitude; - float Altitude; - float ATG; - float Climbrate; - float Heading; - float Airspeed; - float Course; - float Groundspeed; - - } __attribute__((packed)) DataFields; - - // Field information - // Field Latitude information - // Field Longitude information - // Field Altitude information - // Field ATG information - // Field Climbrate information - // Field Heading information - // Field Airspeed information - // Field Course information - // Field Groundspeed information - - - // Constants - static const quint32 OBJID = 499301246U; - static const QString NAME; - static const bool ISSINGLEINST = 1; - static const bool ISSETTINGS = 0; - static const quint32 NUMBYTES = sizeof(DataFields); - - // Functions - FlightSituationActual(); - - DataFields getData(); - void setData(const DataFields& data); - Metadata getDefaultMetadata(); - UAVDataObject* clone(quint32 instID); - - static FlightSituationActual* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0); - -private: - DataFields data; - - void setDefaultFieldValues(); - -}; - -#endif // FLIGHTSITUATIONACTUAL_H diff --git a/ground/src/plugins/uavobjects/flightsituationactual.py b/ground/src/plugins/uavobjects/flightsituationactual.py deleted file mode 100644 index fe1d9f4ce..000000000 --- a/ground/src/plugins/uavobjects/flightsituationactual.py +++ /dev/null @@ -1,166 +0,0 @@ -## -############################################################################## -# -# @file flightsituationactual.py -# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -# @brief Implementation of the FlightSituationActual object. This file has been -# automatically generated by the UAVObjectGenerator. -# -# @note Object definition file: flightsituationactual.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( - 'Latitude', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'Longitude', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'Altitude', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'ATG', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'Climbrate', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'Heading', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'Airspeed', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'Course', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'Groundspeed', - 'f', - 1, - [ - '0', - ], - { - } - ), -] - - -class FlightSituationActual(uavobject.UAVObject): - ## Object constants - OBJID = 499301246 - NAME = "FlightSituationActual" - METANAME = "FlightSituationActualMeta" - 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 = FlightSituationActual() - print (x) - -if __name__ == "__main__": - #import pdb ; pdb.run('main()') - main() diff --git a/ground/src/plugins/uavobjects/guidancesettings.cpp b/ground/src/plugins/uavobjects/guidancesettings.cpp deleted file mode 100644 index 4d7494ff1..000000000 --- a/ground/src/plugins/uavobjects/guidancesettings.cpp +++ /dev/null @@ -1,209 +0,0 @@ -/** - ****************************************************************************** - * - * @file guidancesettings.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: guidancesettings.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 "guidancesettings.h" -#include "uavobjectfield.h" - -const QString GuidanceSettings::NAME = QString("GuidanceSettings"); - -/** - * Constructor - */ -GuidanceSettings::GuidanceSettings(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME) -{ - // Create fields - QList fields; - QStringList UpdatePeriodElemNames; - UpdatePeriodElemNames.append("0"); - fields.append( new UAVObjectField(QString("UpdatePeriod"), QString("ms"), UAVObjectField::UINT16, UpdatePeriodElemNames, QStringList()) ); - QStringList RollMaxElemNames; - RollMaxElemNames.append("0"); - fields.append( new UAVObjectField(QString("RollMax"), QString("degrees"), UAVObjectField::FLOAT32, RollMaxElemNames, QStringList()) ); - QStringList PitchMaxElemNames; - PitchMaxElemNames.append("0"); - fields.append( new UAVObjectField(QString("PitchMax"), QString("degrees"), UAVObjectField::FLOAT32, PitchMaxElemNames, QStringList()) ); - QStringList PitchMinElemNames; - PitchMinElemNames.append("0"); - fields.append( new UAVObjectField(QString("PitchMin"), QString("degrees"), UAVObjectField::FLOAT32, PitchMinElemNames, QStringList()) ); - QStringList PitchRollEpsilonElemNames; - PitchRollEpsilonElemNames.append("0"); - fields.append( new UAVObjectField(QString("PitchRollEpsilon"), QString("degrees"), UAVObjectField::FLOAT32, PitchRollEpsilonElemNames, QStringList()) ); - QStringList ThrottleMaxElemNames; - ThrottleMaxElemNames.append("0"); - fields.append( new UAVObjectField(QString("ThrottleMax"), QString("%"), UAVObjectField::FLOAT32, ThrottleMaxElemNames, QStringList()) ); - QStringList ThrottleMinElemNames; - ThrottleMinElemNames.append("0"); - fields.append( new UAVObjectField(QString("ThrottleMin"), QString("%"), UAVObjectField::FLOAT32, ThrottleMinElemNames, QStringList()) ); - QStringList SpeedMaxElemNames; - SpeedMaxElemNames.append("0"); - fields.append( new UAVObjectField(QString("SpeedMax"), QString("m/s"), UAVObjectField::FLOAT32, SpeedMaxElemNames, QStringList()) ); - QStringList SpeedMinElemNames; - SpeedMinElemNames.append("0"); - fields.append( new UAVObjectField(QString("SpeedMin"), QString("m/s"), UAVObjectField::FLOAT32, SpeedMinElemNames, QStringList()) ); - QStringList SpeedKpElemNames; - SpeedKpElemNames.append("0"); - fields.append( new UAVObjectField(QString("SpeedKp"), QString(""), UAVObjectField::FLOAT32, SpeedKpElemNames, QStringList()) ); - QStringList SpeedKiElemNames; - SpeedKiElemNames.append("0"); - fields.append( new UAVObjectField(QString("SpeedKi"), QString(""), UAVObjectField::FLOAT32, SpeedKiElemNames, QStringList()) ); - QStringList SpeedKdElemNames; - SpeedKdElemNames.append("0"); - fields.append( new UAVObjectField(QString("SpeedKd"), QString(""), UAVObjectField::FLOAT32, SpeedKdElemNames, QStringList()) ); - QStringList EnergyKpElemNames; - EnergyKpElemNames.append("0"); - fields.append( new UAVObjectField(QString("EnergyKp"), QString(""), UAVObjectField::FLOAT32, EnergyKpElemNames, QStringList()) ); - QStringList EnergyKiElemNames; - EnergyKiElemNames.append("0"); - fields.append( new UAVObjectField(QString("EnergyKi"), QString(""), UAVObjectField::FLOAT32, EnergyKiElemNames, QStringList()) ); - QStringList EnergyKdElemNames; - EnergyKdElemNames.append("0"); - fields.append( new UAVObjectField(QString("EnergyKd"), QString(""), UAVObjectField::FLOAT32, EnergyKdElemNames, QStringList()) ); - QStringList LateralKpElemNames; - LateralKpElemNames.append("0"); - fields.append( new UAVObjectField(QString("LateralKp"), QString(""), UAVObjectField::FLOAT32, LateralKpElemNames, QStringList()) ); - QStringList LateralKiElemNames; - LateralKiElemNames.append("0"); - fields.append( new UAVObjectField(QString("LateralKi"), QString(""), UAVObjectField::FLOAT32, LateralKiElemNames, QStringList()) ); - QStringList LateralKdElemNames; - LateralKdElemNames.append("0"); - fields.append( new UAVObjectField(QString("LateralKd"), QString(""), UAVObjectField::FLOAT32, LateralKdElemNames, QStringList()) ); - QStringList CourseKpElemNames; - CourseKpElemNames.append("0"); - fields.append( new UAVObjectField(QString("CourseKp"), QString(""), UAVObjectField::FLOAT32, CourseKpElemNames, QStringList()) ); - QStringList CourseKiElemNames; - CourseKiElemNames.append("0"); - fields.append( new UAVObjectField(QString("CourseKi"), QString(""), UAVObjectField::FLOAT32, CourseKiElemNames, QStringList()) ); - QStringList CourseKdElemNames; - CourseKdElemNames.append("0"); - fields.append( new UAVObjectField(QString("CourseKd"), QString(""), UAVObjectField::FLOAT32, CourseKdElemNames, QStringList()) ); - - // Initialize object - initializeFields(fields, (quint8*)&data, NUMBYTES); - // Set the default field values - setDefaultFieldValues(); -} - -/** - * Get the default metadata for this object - */ -UAVObject::Metadata GuidanceSettings::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 GuidanceSettings::setDefaultFieldValues() -{ - data.UpdatePeriod = 10; - data.RollMax = 35; - data.PitchMax = 35; - data.PitchMin = -35; - data.PitchRollEpsilon = 10; - data.ThrottleMax = 1; - data.ThrottleMin = 0; - data.SpeedMax = 100; - data.SpeedMin = 10; - data.SpeedKp = 0.04; - data.SpeedKi = 4e-06; - data.SpeedKd = 0.01; - data.EnergyKp = 0.04; - data.EnergyKi = 4e-06; - data.EnergyKd = 0.01; - data.LateralKp = 0.04; - data.LateralKi = 4e-06; - data.LateralKd = 0.01; - data.CourseKp = 0.04; - data.CourseKi = 4e-06; - data.CourseKd = 0.01; - -} - -/** - * Get the object data fields - */ -GuidanceSettings::DataFields GuidanceSettings::getData() -{ - QMutexLocker locker(mutex); - return data; -} - -/** - * Set the object data fields - */ -void GuidanceSettings::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* GuidanceSettings::clone(quint32 instID) -{ - GuidanceSettings* obj = new GuidanceSettings(); - obj->initialize(instID, this->getMetaObject()); - return obj; -} - -/** - * Static function to retrieve an instance of the object. - */ -GuidanceSettings* GuidanceSettings::GetInstance(UAVObjectManager* objMngr, quint32 instID) -{ - return dynamic_cast(objMngr->getObject(GuidanceSettings::OBJID, instID)); -} diff --git a/ground/src/plugins/uavobjects/guidancesettings.h b/ground/src/plugins/uavobjects/guidancesettings.h deleted file mode 100644 index 50ceeda31..000000000 --- a/ground/src/plugins/uavobjects/guidancesettings.h +++ /dev/null @@ -1,118 +0,0 @@ -/** - ****************************************************************************** - * - * @file guidancesettings.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: guidancesettings.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 GUIDANCESETTINGS_H -#define GUIDANCESETTINGS_H - -#include "uavdataobject.h" -#include "uavobjectmanager.h" - -class UAVOBJECTS_EXPORT GuidanceSettings: public UAVDataObject -{ - Q_OBJECT - -public: - // Field structure - typedef struct { - quint16 UpdatePeriod; - float RollMax; - float PitchMax; - float PitchMin; - float PitchRollEpsilon; - float ThrottleMax; - float ThrottleMin; - float SpeedMax; - float SpeedMin; - float SpeedKp; - float SpeedKi; - float SpeedKd; - float EnergyKp; - float EnergyKi; - float EnergyKd; - float LateralKp; - float LateralKi; - float LateralKd; - float CourseKp; - float CourseKi; - float CourseKd; - - } __attribute__((packed)) DataFields; - - // Field information - // Field UpdatePeriod information - // Field RollMax information - // Field PitchMax information - // Field PitchMin information - // Field PitchRollEpsilon information - // Field ThrottleMax information - // Field ThrottleMin information - // Field SpeedMax information - // Field SpeedMin information - // Field SpeedKp information - // Field SpeedKi information - // Field SpeedKd information - // Field EnergyKp information - // Field EnergyKi information - // Field EnergyKd information - // Field LateralKp information - // Field LateralKi information - // Field LateralKd information - // Field CourseKp information - // Field CourseKi information - // Field CourseKd information - - - // Constants - static const quint32 OBJID = 2093064904U; - static const QString NAME; - static const bool ISSINGLEINST = 1; - static const bool ISSETTINGS = 1; - static const quint32 NUMBYTES = sizeof(DataFields); - - // Functions - GuidanceSettings(); - - DataFields getData(); - void setData(const DataFields& data); - Metadata getDefaultMetadata(); - UAVDataObject* clone(quint32 instID); - - static GuidanceSettings* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0); - -private: - DataFields data; - - void setDefaultFieldValues(); - -}; - -#endif // GUIDANCESETTINGS_H diff --git a/ground/src/plugins/uavobjects/guidancesettings.py b/ground/src/plugins/uavobjects/guidancesettings.py deleted file mode 100644 index 01b9e7364..000000000 --- a/ground/src/plugins/uavobjects/guidancesettings.py +++ /dev/null @@ -1,286 +0,0 @@ -## -############################################################################## -# -# @file guidancesettings.py -# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -# @brief Implementation of the GuidanceSettings object. This file has been -# automatically generated by the UAVObjectGenerator. -# -# @note Object definition file: guidancesettings.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( - 'UpdatePeriod', - 'H', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'RollMax', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'PitchMax', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'PitchMin', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'PitchRollEpsilon', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'ThrottleMax', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'ThrottleMin', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'SpeedMax', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'SpeedMin', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'SpeedKp', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'SpeedKi', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'SpeedKd', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'EnergyKp', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'EnergyKi', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'EnergyKd', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'LateralKp', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'LateralKi', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'LateralKd', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'CourseKp', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'CourseKi', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'CourseKd', - 'f', - 1, - [ - '0', - ], - { - } - ), -] - - -class GuidanceSettings(uavobject.UAVObject): - ## Object constants - OBJID = 2093064904 - NAME = "GuidanceSettings" - METANAME = "GuidanceSettingsMeta" - 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 = GuidanceSettings() - print (x) - -if __name__ == "__main__": - #import pdb ; pdb.run('main()') - main() diff --git a/ground/src/plugins/uavobjects/navigationdesired.cpp b/ground/src/plugins/uavobjects/navigationdesired.cpp deleted file mode 100644 index 688ba2355..000000000 --- a/ground/src/plugins/uavobjects/navigationdesired.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/** - ****************************************************************************** - * - * @file navigationdesired.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: navigationdesired.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 "navigationdesired.h" -#include "uavobjectfield.h" - -const QString NavigationDesired::NAME = QString("NavigationDesired"); - -/** - * Constructor - */ -NavigationDesired::NavigationDesired(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME) -{ - // Create fields - QList fields; - QStringList LatitudeElemNames; - LatitudeElemNames.append("0"); - fields.append( new UAVObjectField(QString("Latitude"), QString("degrees"), UAVObjectField::FLOAT32, LatitudeElemNames, QStringList()) ); - QStringList LongitudeElemNames; - LongitudeElemNames.append("0"); - fields.append( new UAVObjectField(QString("Longitude"), QString("degrees"), UAVObjectField::FLOAT32, LongitudeElemNames, QStringList()) ); - QStringList AltitudeElemNames; - AltitudeElemNames.append("0"); - fields.append( new UAVObjectField(QString("Altitude"), QString("meters"), UAVObjectField::FLOAT32, AltitudeElemNames, QStringList()) ); - QStringList SpeedElemNames; - SpeedElemNames.append("0"); - fields.append( new UAVObjectField(QString("Speed"), QString("m/s"), UAVObjectField::FLOAT32, SpeedElemNames, QStringList()) ); - - // Initialize object - initializeFields(fields, (quint8*)&data, NUMBYTES); - // Set the default field values - setDefaultFieldValues(); -} - -/** - * Get the default metadata for this object - */ -UAVObject::Metadata NavigationDesired::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 = 1000; - 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 NavigationDesired::setDefaultFieldValues() -{ - -} - -/** - * Get the object data fields - */ -NavigationDesired::DataFields NavigationDesired::getData() -{ - QMutexLocker locker(mutex); - return data; -} - -/** - * Set the object data fields - */ -void NavigationDesired::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* NavigationDesired::clone(quint32 instID) -{ - NavigationDesired* obj = new NavigationDesired(); - obj->initialize(instID, this->getMetaObject()); - return obj; -} - -/** - * Static function to retrieve an instance of the object. - */ -NavigationDesired* NavigationDesired::GetInstance(UAVObjectManager* objMngr, quint32 instID) -{ - return dynamic_cast(objMngr->getObject(NavigationDesired::OBJID, instID)); -} diff --git a/ground/src/plugins/uavobjects/navigationdesired.h b/ground/src/plugins/uavobjects/navigationdesired.h deleted file mode 100644 index f9663f2e8..000000000 --- a/ground/src/plugins/uavobjects/navigationdesired.h +++ /dev/null @@ -1,84 +0,0 @@ -/** - ****************************************************************************** - * - * @file navigationdesired.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: navigationdesired.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 NAVIGATIONDESIRED_H -#define NAVIGATIONDESIRED_H - -#include "uavdataobject.h" -#include "uavobjectmanager.h" - -class UAVOBJECTS_EXPORT NavigationDesired: public UAVDataObject -{ - Q_OBJECT - -public: - // Field structure - typedef struct { - float Latitude; - float Longitude; - float Altitude; - float Speed; - - } __attribute__((packed)) DataFields; - - // Field information - // Field Latitude information - // Field Longitude information - // Field Altitude information - // Field Speed information - - - // Constants - static const quint32 OBJID = 2357718118U; - static const QString NAME; - static const bool ISSINGLEINST = 1; - static const bool ISSETTINGS = 0; - static const quint32 NUMBYTES = sizeof(DataFields); - - // Functions - NavigationDesired(); - - DataFields getData(); - void setData(const DataFields& data); - Metadata getDefaultMetadata(); - UAVDataObject* clone(quint32 instID); - - static NavigationDesired* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0); - -private: - DataFields data; - - void setDefaultFieldValues(); - -}; - -#endif // NAVIGATIONDESIRED_H diff --git a/ground/src/plugins/uavobjects/navigationdesired.py b/ground/src/plugins/uavobjects/navigationdesired.py deleted file mode 100644 index 260ccc868..000000000 --- a/ground/src/plugins/uavobjects/navigationdesired.py +++ /dev/null @@ -1,116 +0,0 @@ -## -############################################################################## -# -# @file navigationdesired.py -# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -# @brief Implementation of the NavigationDesired object. This file has been -# automatically generated by the UAVObjectGenerator. -# -# @note Object definition file: navigationdesired.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( - 'Latitude', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'Longitude', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'Altitude', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'Speed', - 'f', - 1, - [ - '0', - ], - { - } - ), -] - - -class NavigationDesired(uavobject.UAVObject): - ## Object constants - OBJID = 2357718118 - NAME = "NavigationDesired" - METANAME = "NavigationDesiredMeta" - 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 = NavigationDesired() - print (x) - -if __name__ == "__main__": - #import pdb ; pdb.run('main()') - main() diff --git a/ground/src/plugins/uavobjects/navigationsettings.cpp b/ground/src/plugins/uavobjects/navigationsettings.cpp deleted file mode 100644 index 62271dc8a..000000000 --- a/ground/src/plugins/uavobjects/navigationsettings.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/** - ****************************************************************************** - * - * @file navigationsettings.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: navigationsettings.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 "navigationsettings.h" -#include "uavobjectfield.h" - -const QString NavigationSettings::NAME = QString("NavigationSettings"); - -/** - * Constructor - */ -NavigationSettings::NavigationSettings(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME) -{ - // Create fields - QList fields; - QStringList UpdatePeriodElemNames; - UpdatePeriodElemNames.append("0"); - fields.append( new UAVObjectField(QString("UpdatePeriod"), QString("ms"), UAVObjectField::UINT16, UpdatePeriodElemNames, QStringList()) ); - QStringList AccelerationMaxElemNames; - AccelerationMaxElemNames.append("0"); - fields.append( new UAVObjectField(QString("AccelerationMax"), QString("m/s"), UAVObjectField::FLOAT32, AccelerationMaxElemNames, QStringList()) ); - QStringList SpeedMaxElemNames; - SpeedMaxElemNames.append("0"); - fields.append( new UAVObjectField(QString("SpeedMax"), QString("m/s"), UAVObjectField::FLOAT32, SpeedMaxElemNames, QStringList()) ); - QStringList SpeedSafeElemNames; - SpeedSafeElemNames.append("0"); - fields.append( new UAVObjectField(QString("SpeedSafe"), QString("m/s"), UAVObjectField::FLOAT32, SpeedSafeElemNames, QStringList()) ); - QStringList SpeedMinElemNames; - SpeedMinElemNames.append("0"); - fields.append( new UAVObjectField(QString("SpeedMin"), QString("m/s"), UAVObjectField::FLOAT32, SpeedMinElemNames, QStringList()) ); - QStringList SettleTimeElemNames; - SettleTimeElemNames.append("0"); - fields.append( new UAVObjectField(QString("SettleTime"), QString("seconds"), UAVObjectField::FLOAT32, SettleTimeElemNames, QStringList()) ); - QStringList TurnSpeedFactorElemNames; - TurnSpeedFactorElemNames.append("0"); - fields.append( new UAVObjectField(QString("TurnSpeedFactor"), QString(""), UAVObjectField::FLOAT32, TurnSpeedFactorElemNames, QStringList()) ); - QStringList StabilizationForceFactorElemNames; - StabilizationForceFactorElemNames.append("0"); - fields.append( new UAVObjectField(QString("StabilizationForceFactor"), QString(""), UAVObjectField::FLOAT32, StabilizationForceFactorElemNames, QStringList()) ); - - // Initialize object - initializeFields(fields, (quint8*)&data, NUMBYTES); - // Set the default field values - setDefaultFieldValues(); -} - -/** - * Get the default metadata for this object - */ -UAVObject::Metadata NavigationSettings::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 NavigationSettings::setDefaultFieldValues() -{ - data.UpdatePeriod = 100; - data.AccelerationMax = 35; - data.SpeedMax = 300; - data.SpeedSafe = 100; - data.SpeedMin = 70; - data.SettleTime = 12; - data.TurnSpeedFactor = 0.1; - data.StabilizationForceFactor = 4; - -} - -/** - * Get the object data fields - */ -NavigationSettings::DataFields NavigationSettings::getData() -{ - QMutexLocker locker(mutex); - return data; -} - -/** - * Set the object data fields - */ -void NavigationSettings::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* NavigationSettings::clone(quint32 instID) -{ - NavigationSettings* obj = new NavigationSettings(); - obj->initialize(instID, this->getMetaObject()); - return obj; -} - -/** - * Static function to retrieve an instance of the object. - */ -NavigationSettings* NavigationSettings::GetInstance(UAVObjectManager* objMngr, quint32 instID) -{ - return dynamic_cast(objMngr->getObject(NavigationSettings::OBJID, instID)); -} diff --git a/ground/src/plugins/uavobjects/navigationsettings.h b/ground/src/plugins/uavobjects/navigationsettings.h deleted file mode 100644 index 53724b748..000000000 --- a/ground/src/plugins/uavobjects/navigationsettings.h +++ /dev/null @@ -1,92 +0,0 @@ -/** - ****************************************************************************** - * - * @file navigationsettings.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: navigationsettings.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 NAVIGATIONSETTINGS_H -#define NAVIGATIONSETTINGS_H - -#include "uavdataobject.h" -#include "uavobjectmanager.h" - -class UAVOBJECTS_EXPORT NavigationSettings: public UAVDataObject -{ - Q_OBJECT - -public: - // Field structure - typedef struct { - quint16 UpdatePeriod; - float AccelerationMax; - float SpeedMax; - float SpeedSafe; - float SpeedMin; - float SettleTime; - float TurnSpeedFactor; - float StabilizationForceFactor; - - } __attribute__((packed)) DataFields; - - // Field information - // Field UpdatePeriod information - // Field AccelerationMax information - // Field SpeedMax information - // Field SpeedSafe information - // Field SpeedMin information - // Field SettleTime information - // Field TurnSpeedFactor information - // Field StabilizationForceFactor information - - - // Constants - static const quint32 OBJID = 1350892244U; - static const QString NAME; - static const bool ISSINGLEINST = 1; - static const bool ISSETTINGS = 1; - static const quint32 NUMBYTES = sizeof(DataFields); - - // Functions - NavigationSettings(); - - DataFields getData(); - void setData(const DataFields& data); - Metadata getDefaultMetadata(); - UAVDataObject* clone(quint32 instID); - - static NavigationSettings* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0); - -private: - DataFields data; - - void setDefaultFieldValues(); - -}; - -#endif // NAVIGATIONSETTINGS_H diff --git a/ground/src/plugins/uavobjects/navigationsettings.py b/ground/src/plugins/uavobjects/navigationsettings.py deleted file mode 100644 index 13a2edcd0..000000000 --- a/ground/src/plugins/uavobjects/navigationsettings.py +++ /dev/null @@ -1,156 +0,0 @@ -## -############################################################################## -# -# @file navigationsettings.py -# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -# @brief Implementation of the NavigationSettings object. This file has been -# automatically generated by the UAVObjectGenerator. -# -# @note Object definition file: navigationsettings.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( - 'UpdatePeriod', - 'H', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'AccelerationMax', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'SpeedMax', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'SpeedSafe', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'SpeedMin', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'SettleTime', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'TurnSpeedFactor', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'StabilizationForceFactor', - 'f', - 1, - [ - '0', - ], - { - } - ), -] - - -class NavigationSettings(uavobject.UAVObject): - ## Object constants - OBJID = 1350892244 - NAME = "NavigationSettings" - METANAME = "NavigationSettingsMeta" - 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 = NavigationSettings() - print (x) - -if __name__ == "__main__": - #import pdb ; pdb.run('main()') - main() diff --git a/ground/src/plugins/uavobjects/positiondesired.cpp b/ground/src/plugins/uavobjects/positiondesired.cpp deleted file mode 100644 index e45bafdec..000000000 --- a/ground/src/plugins/uavobjects/positiondesired.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/** - ****************************************************************************** - * - * @file positiondesired.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: positiondesired.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 "positiondesired.h" -#include "uavobjectfield.h" - -const QString PositionDesired::NAME = QString("PositionDesired"); - -/** - * Constructor - */ -PositionDesired::PositionDesired(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME) -{ - // Create fields - QList fields; - QStringList NEDElemNames; - NEDElemNames.append("0"); - NEDElemNames.append("1"); - NEDElemNames.append("2"); - fields.append( new UAVObjectField(QString("NED"), QString("m"), UAVObjectField::FLOAT32, NEDElemNames, QStringList()) ); - QStringList HeadingElemNames; - HeadingElemNames.append("0"); - fields.append( new UAVObjectField(QString("Heading"), QString("degrees"), UAVObjectField::FLOAT32, HeadingElemNames, QStringList()) ); - QStringList GroundspeedElemNames; - GroundspeedElemNames.append("0"); - fields.append( new UAVObjectField(QString("Groundspeed"), QString("m/s"), UAVObjectField::FLOAT32, GroundspeedElemNames, QStringList()) ); - - // Initialize object - initializeFields(fields, (quint8*)&data, NUMBYTES); - // Set the default field values - setDefaultFieldValues(); -} - -/** - * Get the default metadata for this object - */ -UAVObject::Metadata PositionDesired::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 = 1000; - 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 PositionDesired::setDefaultFieldValues() -{ - -} - -/** - * Get the object data fields - */ -PositionDesired::DataFields PositionDesired::getData() -{ - QMutexLocker locker(mutex); - return data; -} - -/** - * Set the object data fields - */ -void PositionDesired::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* PositionDesired::clone(quint32 instID) -{ - PositionDesired* obj = new PositionDesired(); - obj->initialize(instID, this->getMetaObject()); - return obj; -} - -/** - * Static function to retrieve an instance of the object. - */ -PositionDesired* PositionDesired::GetInstance(UAVObjectManager* objMngr, quint32 instID) -{ - return dynamic_cast(objMngr->getObject(PositionDesired::OBJID, instID)); -} diff --git a/ground/src/plugins/uavobjects/positiondesired.h b/ground/src/plugins/uavobjects/positiondesired.h deleted file mode 100644 index 62ec1683c..000000000 --- a/ground/src/plugins/uavobjects/positiondesired.h +++ /dev/null @@ -1,84 +0,0 @@ -/** - ****************************************************************************** - * - * @file positiondesired.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: positiondesired.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 POSITIONDESIRED_H -#define POSITIONDESIRED_H - -#include "uavdataobject.h" -#include "uavobjectmanager.h" - -class UAVOBJECTS_EXPORT PositionDesired: public UAVDataObject -{ - Q_OBJECT - -public: - // Field structure - typedef struct { - float NED[3]; - float Heading; - float Groundspeed; - - } __attribute__((packed)) DataFields; - - // Field information - // Field NED information - /* Number of elements for field NED */ - static const quint32 NED_NUMELEM = 3; - // Field Heading information - // Field Groundspeed information - - - // Constants - static const quint32 OBJID = 2182398544U; - static const QString NAME; - static const bool ISSINGLEINST = 1; - static const bool ISSETTINGS = 0; - static const quint32 NUMBYTES = sizeof(DataFields); - - // Functions - PositionDesired(); - - DataFields getData(); - void setData(const DataFields& data); - Metadata getDefaultMetadata(); - UAVDataObject* clone(quint32 instID); - - static PositionDesired* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0); - -private: - DataFields data; - - void setDefaultFieldValues(); - -}; - -#endif // POSITIONDESIRED_H diff --git a/ground/src/plugins/uavobjects/positiondesired.py b/ground/src/plugins/uavobjects/positiondesired.py deleted file mode 100644 index d49ed374e..000000000 --- a/ground/src/plugins/uavobjects/positiondesired.py +++ /dev/null @@ -1,108 +0,0 @@ -## -############################################################################## -# -# @file positiondesired.py -# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -# @brief Implementation of the PositionDesired object. This file has been -# automatically generated by the UAVObjectGenerator. -# -# @note Object definition file: positiondesired.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( - 'NED', - 'f', - 3, - [ - '0', - '1', - '2', - ], - { - } - ), - uavobject.UAVObjectField( - 'Heading', - 'f', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'Groundspeed', - 'f', - 1, - [ - '0', - ], - { - } - ), -] - - -class PositionDesired(uavobject.UAVObject): - ## Object constants - OBJID = 2182398544 - NAME = "PositionDesired" - METANAME = "PositionDesiredMeta" - 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 = PositionDesired() - print (x) - -if __name__ == "__main__": - #import pdb ; pdb.run('main()') - main() diff --git a/ground/src/plugins/uavobjects/uavobjects.pro b/ground/src/plugins/uavobjects/uavobjects.pro index 21a950489..2f6cd777a 100644 --- a/ground/src/plugins/uavobjects/uavobjects.pro +++ b/ground/src/plugins/uavobjects/uavobjects.pro @@ -28,20 +28,15 @@ HEADERS += uavobjects_global.h \ telemetrysettings.h \ systemsettings.h \ stabilizationsettings.h \ - flightsituationactual.h \ manualcontrolsettings.h \ manualcontrolcommand.h \ attitudedesired.h \ actuatorsettings.h \ actuatordesired.h \ actuatorcommand.h \ - navigationsettings.h \ - navigationdesired.h \ gpsposition.h \ gpstime.h \ gpssatellites.h \ - guidancesettings.h \ - positiondesired.h \ positionactual.h \ flightbatterystate.h \ homelocation.h \ @@ -74,20 +69,15 @@ SOURCES += uavobject.cpp \ telemetrysettings.cpp \ systemsettings.cpp \ stabilizationsettings.cpp \ - flightsituationactual.cpp \ manualcontrolsettings.cpp \ manualcontrolcommand.cpp \ attitudedesired.cpp \ actuatorsettings.cpp \ actuatordesired.cpp \ actuatorcommand.cpp \ - navigationsettings.cpp \ - navigationdesired.cpp \ gpsposition.cpp \ gpstime.cpp \ gpssatellites.cpp \ - guidancesettings.cpp \ - positiondesired.cpp \ positionactual.cpp \ flightbatterystate.cpp \ homelocation.cpp \ diff --git a/ground/src/plugins/uavobjects/uavobjectsinit.cpp b/ground/src/plugins/uavobjects/uavobjectsinit.cpp index d41397879..bea0049db 100644 --- a/ground/src/plugins/uavobjects/uavobjectsinit.cpp +++ b/ground/src/plugins/uavobjects/uavobjectsinit.cpp @@ -45,23 +45,18 @@ #include "exampleobject2.h" #include "examplesettings.h" #include "flightbatterystate.h" -#include "flightsituationactual.h" #include "flighttelemetrystats.h" #include "gcstelemetrystats.h" #include "gpsposition.h" #include "gpssatellites.h" #include "gpstime.h" -#include "guidancesettings.h" #include "homelocation.h" #include "manualcontrolcommand.h" #include "manualcontrolsettings.h" #include "mixersettings.h" #include "mixerstatus.h" -#include "navigationdesired.h" -#include "navigationsettings.h" #include "objectpersistence.h" #include "positionactual.h" -#include "positiondesired.h" #include "stabilizationsettings.h" #include "systemalarms.h" #include "systemsettings.h" @@ -92,23 +87,18 @@ void UAVObjectsInitialize(UAVObjectManager* objMngr) objMngr->registerObject( new ExampleObject2() ); objMngr->registerObject( new ExampleSettings() ); objMngr->registerObject( new FlightBatteryState() ); - objMngr->registerObject( new FlightSituationActual() ); objMngr->registerObject( new FlightTelemetryStats() ); objMngr->registerObject( new GCSTelemetryStats() ); objMngr->registerObject( new GPSPosition() ); objMngr->registerObject( new GPSSatellites() ); objMngr->registerObject( new GPSTime() ); - objMngr->registerObject( new GuidanceSettings() ); objMngr->registerObject( new HomeLocation() ); objMngr->registerObject( new ManualControlCommand() ); objMngr->registerObject( new ManualControlSettings() ); objMngr->registerObject( new MixerSettings() ); objMngr->registerObject( new MixerStatus() ); - objMngr->registerObject( new NavigationDesired() ); - objMngr->registerObject( new NavigationSettings() ); objMngr->registerObject( new ObjectPersistence() ); objMngr->registerObject( new PositionActual() ); - objMngr->registerObject( new PositionDesired() ); objMngr->registerObject( new StabilizationSettings() ); objMngr->registerObject( new SystemAlarms() ); objMngr->registerObject( new SystemSettings() ); diff --git a/ground/src/shared/uavobjectdefinition/flightsituationactual.xml b/ground/src/shared/uavobjectdefinition/flightsituationactual.xml deleted file mode 100644 index f1a59919e..000000000 --- a/ground/src/shared/uavobjectdefinition/flightsituationactual.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - Currently unused - - - - - - - - - - - - - - - diff --git a/ground/src/shared/uavobjectdefinition/guidancesettings.xml b/ground/src/shared/uavobjectdefinition/guidancesettings.xml deleted file mode 100644 index 45b8419a9..000000000 --- a/ground/src/shared/uavobjectdefinition/guidancesettings.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - PID settings used by the Guidance module to combine the @ref PositionActual and @ref PositionDesired to compute @ref AttitudeDesired - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ground/src/shared/uavobjectdefinition/navigationdesired.xml b/ground/src/shared/uavobjectdefinition/navigationdesired.xml deleted file mode 100644 index d5eb17b12..000000000 --- a/ground/src/shared/uavobjectdefinition/navigationdesired.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - Currently unused - - - - - - - - - - diff --git a/ground/src/shared/uavobjectdefinition/navigationsettings.xml b/ground/src/shared/uavobjectdefinition/navigationsettings.xml deleted file mode 100644 index 48f7ed6b5..000000000 --- a/ground/src/shared/uavobjectdefinition/navigationsettings.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - Settings for Navigation. Currently unused. - - - - - - - - - - - - - - diff --git a/ground/src/shared/uavobjectdefinition/positiondesired.xml b/ground/src/shared/uavobjectdefinition/positiondesired.xml deleted file mode 100644 index e609989be..000000000 --- a/ground/src/shared/uavobjectdefinition/positiondesired.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - The desired position that @ref GuidanceModule will try and achieve if FlightMode is Auto. Comes from @ref PathPlannerModule. - - - - - - - - -