mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
[OP-119] Flight/AHRS: Created a HomeLocation object which is updated when the GPS gets an initial 3D fix and populated with the information to convert from LLA from the GPS to NED reference frame. Also added a message for passing the MagneticNorth vector to the AHRS and removed that computation from AHRS.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1337 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
fd986f3437
commit
ef0b307353
@ -70,6 +70,8 @@ AHRS = ./
|
||||
AHRSINC = $(AHRS)/inc
|
||||
PIOS = ../PiOS
|
||||
PIOSINC = $(PIOS)/inc
|
||||
FLIGHTLIB = ../Libraries
|
||||
FLIGHTLIBINC = ../Libraries/inc
|
||||
PIOSSTM32F10X = $(PIOS)/STM32F10x
|
||||
PIOSCOMMON = $(PIOS)/Common
|
||||
APPLIBDIR = $(PIOSSTM32F10X)/Libraries
|
||||
@ -89,8 +91,7 @@ SRC = ahrs.c
|
||||
SRC += pios_board.c
|
||||
SRC += ahrs_fsm.c
|
||||
SRC += insgps.c
|
||||
SRC += CoordinateConversions.c
|
||||
SRC += WorldMagModel.c
|
||||
SRC += $(FLIGHTLIB)/CoordinateConversions.c
|
||||
|
||||
## PIOS Hardware (STM32F10x)
|
||||
SRC += $(PIOSSTM32F10X)/pios_sys.c
|
||||
@ -160,6 +161,7 @@ ASRCARM =
|
||||
# Each directory must be seperated by a space.
|
||||
EXTRAINCDIRS += $(PIOS)
|
||||
EXTRAINCDIRS += $(PIOSINC)
|
||||
EXTRAINCDIRS += $(FLIGHTLIBINC)
|
||||
EXTRAINCDIRS += $(PIOSSTM32F10X)
|
||||
EXTRAINCDIRS += $(PIOSCOMMON)
|
||||
EXTRAINCDIRS += $(STMSPDINCDIR)
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include "ahrs_fsm.h" /* lfsm_state */
|
||||
#include "insgps.h"
|
||||
#include "CoordinateConversions.h"
|
||||
#include "WorldMagModel.h"
|
||||
|
||||
/**
|
||||
* State of AHRS EKF
|
||||
@ -314,18 +313,6 @@ int main()
|
||||
INSSetGyroVar(gyro_var);
|
||||
}
|
||||
|
||||
/******************* World magnetic model *********************/
|
||||
float MagNorth[3];
|
||||
WMM_Initialize(); // Set default values and constants
|
||||
WMM_GetMagVector(29, -95, 18, 8, 17, 2010, MagNorth);
|
||||
// TODO: Get this from first GPS coordinate or whenever we initialize NED frame
|
||||
if(ahrs_algorithm == INSGPS_Algo)
|
||||
{
|
||||
float MagNorthLen = sqrt(MagNorth[0] * MagNorth[0] + MagNorth[1] * MagNorth[1] + MagNorth[2] * MagNorth[2]);
|
||||
float MagNorthScaled[3] = {MagNorth[0] / MagNorthLen, MagNorth[1] / MagNorthLen, MagNorth[2] / MagNorthLen};
|
||||
INSSetMagNorth(MagNorthScaled);
|
||||
}
|
||||
|
||||
/******************* Main EKF loop ****************************/
|
||||
while (1) {
|
||||
// Alive signal
|
||||
@ -377,15 +364,6 @@ int main()
|
||||
|
||||
INSPrediction(gyro, accel, 1 / (float) EKF_RATE);
|
||||
|
||||
if ( ((loop_ctr % 10000) == 0) && (gps_data.status > 0) )
|
||||
{
|
||||
// cheap logic instead of detecting the first update of gps data
|
||||
WMM_GetMagVector(gps_data.latitude, gps_data.longitude, gps_data.altitude, 8, 17, 2010, MagNorth);
|
||||
float MagNorthLen = sqrt(MagNorth[0] * MagNorth[0] + MagNorth[1] * MagNorth[1] + MagNorth[2] * MagNorth[2]);
|
||||
float MagNorthScaled[3] = {MagNorth[0] / MagNorthLen, MagNorth[1] / MagNorthLen, MagNorth[2] / MagNorthLen};
|
||||
INSSetMagNorth(MagNorthScaled);
|
||||
}
|
||||
|
||||
if ( gps_updated )
|
||||
{
|
||||
if(BaseECEF[0] == 0 && BaseECEF[1] == 0 && BaseECEF[2] == 0)
|
||||
@ -677,6 +655,12 @@ void process_spi_request(void)
|
||||
dump_spi_message(PIOS_COM_AUX, "V", (uint8_t *)&user_rx_v1, sizeof(user_rx_v1));
|
||||
lfsm_user_set_tx_v1 (&user_tx_v1);
|
||||
break;
|
||||
case OPAHRS_MSG_V1_REQ_NORTH:
|
||||
opahrs_msg_v1_init_user_tx (&user_tx_v1, OPAHRS_MSG_V1_RSP_ALTITUDE);
|
||||
INSSetMagNorth(user_rx_v1.payload.user.v.req.north.Be);
|
||||
dump_spi_message(PIOS_COM_AUX, "N", (uint8_t *)&user_rx_v1, sizeof(user_rx_v1));
|
||||
lfsm_user_set_tx_v1 (&user_tx_v1);
|
||||
break;
|
||||
case OPAHRS_MSG_V1_REQ_GPS:
|
||||
opahrs_msg_v1_init_user_tx (&user_tx_v1, OPAHRS_MSG_V1_RSP_GPS);
|
||||
gps_updated = TRUE;
|
||||
@ -686,7 +670,7 @@ void process_spi_request(void)
|
||||
gps_data.heading = user_rx_v1.payload.user.v.req.gps.heading;
|
||||
gps_data.groundspeed = user_rx_v1.payload.user.v.req.gps.groundspeed;
|
||||
gps_data.status = user_rx_v1.payload.user.v.req.gps.status;
|
||||
dump_spi_message(PIOS_COM_AUX, "V", (uint8_t *)&user_rx_v1, sizeof(user_rx_v1));
|
||||
dump_spi_message(PIOS_COM_AUX, "G", (uint8_t *)&user_rx_v1, sizeof(user_rx_v1));
|
||||
lfsm_user_set_tx_v1 (&user_tx_v1);
|
||||
break;
|
||||
case OPAHRS_MSG_V1_REQ_ATTITUDERAW:
|
||||
|
@ -93,6 +93,8 @@ OPUAVOBJ = ./UAVObjects
|
||||
OPUAVOBJINC = $(OPUAVOBJ)/inc
|
||||
OPTESTS = ./Tests
|
||||
OPMODULEDIR = ./Modules
|
||||
FLIGHTLIB = ../Libraries
|
||||
FLIGHTLIBINC = ../Libraries/inc
|
||||
PIOS = ../PiOS
|
||||
PIOSINC = $(PIOS)/inc
|
||||
PIOSSTM32F10X = $(PIOS)/STM32F10x
|
||||
@ -168,6 +170,7 @@ SRC += $(OPUAVOBJ)/navigationsettings.c
|
||||
SRC += $(OPUAVOBJ)/navigationdesired.c
|
||||
SRC += $(OPUAVOBJ)/flightbatterystate.c
|
||||
SRC += $(OPUAVOBJ)/attituderaw.c
|
||||
SRC += $(OPUAVOBJ)/homelocation.c
|
||||
endif
|
||||
|
||||
## PIOS Hardware (STM32F10x)
|
||||
@ -196,8 +199,6 @@ SRC += $(PIOSSTM32F10X)/pios_usb_hid_istr.c
|
||||
SRC += $(PIOSSTM32F10X)/pios_usb_hid_prop.c
|
||||
SRC += $(PIOSSTM32F10X)/pios_usb_hid_pwr.c
|
||||
|
||||
|
||||
|
||||
## PIOS Hardware (Common)
|
||||
SRC += $(PIOSCOMMON)/pios_sdcard.c
|
||||
SRC += $(PIOSCOMMON)/pios_com.c
|
||||
@ -206,6 +207,10 @@ SRC += $(PIOSCOMMON)/pios_opahrs.c
|
||||
SRC += $(PIOSCOMMON)/pios_opahrs_proto.c
|
||||
SRC += $(PIOSCOMMON)/printf-stdarg.c
|
||||
|
||||
## Libraries for flight calculations
|
||||
SRC += $(FLIGHTLIB)/WorldMagModel.c
|
||||
SRC += $(FLIGHTLIB)/CoordinateConversions.c
|
||||
|
||||
## CMSIS for STM32
|
||||
SRC += $(CMSISDIR)/core_cm3.c
|
||||
SRC += $(CMSISDIR)/system_stm32f10x.c
|
||||
@ -294,6 +299,7 @@ EXTRAINCDIRS += $(OPUAVOBJ)
|
||||
EXTRAINCDIRS += $(OPUAVOBJINC)
|
||||
EXTRAINCDIRS += $(PIOS)
|
||||
EXTRAINCDIRS += $(PIOSINC)
|
||||
EXTRAINCDIRS += $(FLIGHTLIBINC)
|
||||
EXTRAINCDIRS += $(PIOSSTM32F10X)
|
||||
EXTRAINCDIRS += $(PIOSCOMMON)
|
||||
EXTRAINCDIRS += $(STMSPDINCDIR)
|
||||
|
@ -59,6 +59,7 @@
|
||||
#include "altitudeactual.h"
|
||||
#include "stdbool.h"
|
||||
#include "positionactual.h"
|
||||
#include "homelocation.h"
|
||||
|
||||
#include "pios_opahrs.h" // library for OpenPilot AHRS access functions
|
||||
#include "pios_opahrs_proto.h"
|
||||
@ -75,6 +76,7 @@ static xTaskHandle taskHandle;
|
||||
// Private functions
|
||||
static void ahrscommsTask(void* parameters);
|
||||
static void load_altitude_actual(struct opahrs_msg_v1_req_altitude * altitude);
|
||||
static void load_magnetic_north(struct opahrs_msg_v1_req_north * north);
|
||||
static void load_position_actual(struct opahrs_msg_v1_req_gps * gps);
|
||||
static void update_attitude_actual(struct opahrs_msg_v1_rsp_attitude * attitude);
|
||||
static void update_attitude_raw(struct opahrs_msg_v1_rsp_attituderaw * attituderaw);
|
||||
@ -92,6 +94,12 @@ static void PositionActualUpdatedCb(UAVObjEvent * ev)
|
||||
PositionActualIsUpdatedFlag = true;
|
||||
}
|
||||
|
||||
static bool HomeLocationIsUpdatedFlag = false;
|
||||
static void HomeLocationUpdatedCb(UAVObjEvent * ev)
|
||||
{
|
||||
HomeLocationIsUpdatedFlag = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the module, called on startup
|
||||
* \returns 0 on success or -1 if initialisation failed
|
||||
@ -100,6 +108,7 @@ int32_t AHRSCommsInitialize(void)
|
||||
{
|
||||
AltitudeActualConnectCallback(AltitudeActualUpdatedCb);
|
||||
PositionActualConnectCallback(PositionActualUpdatedCb);
|
||||
HomeLocationConnectCallback(HomeLocationUpdatedCb);
|
||||
|
||||
PIOS_OPAHRS_Init();
|
||||
|
||||
@ -180,12 +189,33 @@ static void ahrscommsTask(void* parameters)
|
||||
}
|
||||
}
|
||||
|
||||
if (HomeLocationIsUpdatedFlag) {
|
||||
struct opahrs_msg_v1 req;
|
||||
|
||||
load_magnetic_north(&(req.payload.user.v.req.north));
|
||||
if (PIOS_OPAHRS_SetMagNorth(&req) == OPAHRS_RESULT_OK) {
|
||||
HomeLocationIsUpdatedFlag = false;
|
||||
} else {
|
||||
/* Comms error */
|
||||
}
|
||||
}
|
||||
|
||||
/* Wait for the next update interval */
|
||||
vTaskDelay( settings.UpdatePeriod / portTICK_RATE_MS );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void load_magnetic_north(struct opahrs_msg_v1_req_north * mag_north)
|
||||
{
|
||||
HomeLocationData data;
|
||||
|
||||
HomeLocationGet(&data);
|
||||
mag_north->Be[0] = data.Be[0];
|
||||
mag_north->Be[1] = data.Be[1];
|
||||
mag_north->Be[2] = data.Be[2];
|
||||
}
|
||||
|
||||
static void load_altitude_actual(struct opahrs_msg_v1_req_altitude * altitude)
|
||||
{
|
||||
AltitudeActualData data;
|
||||
|
@ -32,6 +32,9 @@
|
||||
#include "buffer.h"
|
||||
#include "GPS.h"
|
||||
#include "positionactual.h"
|
||||
#include "homelocation.h"
|
||||
#include "WorldMagModel.h"
|
||||
#include "CoordinateConversions.h"
|
||||
|
||||
// constants/macros/typdefs
|
||||
#define NMEA_BUFFERSIZE 128
|
||||
@ -62,6 +65,7 @@
|
||||
|
||||
// Private functions
|
||||
static void gpsTask(void* parameters);
|
||||
static void setHomeLocation(PositionActualData gpsData);
|
||||
|
||||
// functions
|
||||
char* nmeaGetPacketBuffer(void);
|
||||
@ -127,6 +131,8 @@ static void gpsTask(void* parameters)
|
||||
portTickType xDelay = 100 / portTICK_RATE_MS;
|
||||
PositionActualData GpsData;
|
||||
uint32_t timeNowMs;
|
||||
uint8_t homeLocationSet = 0;
|
||||
|
||||
|
||||
// Loop forever
|
||||
while(1)
|
||||
@ -152,11 +158,53 @@ static void gpsTask(void* parameters)
|
||||
GpsData.Status = POSITIONACTUAL_STATUS_NOGPS;
|
||||
PositionActualSet(&GpsData);
|
||||
}
|
||||
else {
|
||||
// Had an update
|
||||
PositionActualGet(&GpsData);
|
||||
if(GpsData.Status == POSITIONACTUAL_STATUS_FIX3D && !homeLocationSet ) {
|
||||
setHomeLocation(GpsData);
|
||||
homeLocationSet = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Block task until next update
|
||||
vTaskDelay(xDelay);
|
||||
}
|
||||
}
|
||||
|
||||
static void setHomeLocation(PositionActualData gpsData)
|
||||
{
|
||||
HomeLocationData home;
|
||||
HomeLocationGet(&home);
|
||||
|
||||
// Store LLA
|
||||
home.Latitude = (int32_t) gpsData.Latitude * 10e6;
|
||||
home.Longitude = (int32_t) gpsData.Longitude * 10e6;
|
||||
home.Altitude = gpsData.GeoidSeparation;
|
||||
|
||||
// Compute home ECEF coordinates and the rotation matrix into NED
|
||||
double LLA[3] = {(double) home.Latitude / 10e6, (double) home.Longitude / 10e6, (double) home.Altitude};
|
||||
double ECEF[3];
|
||||
float RNE[3][3];
|
||||
RneFromLLA(LLA, RNE);
|
||||
LLA2ECEF(LLA, ECEF);
|
||||
// TODO: Currently UAVTalk only supports float but these conversions use double
|
||||
// need to find out if they require that precision and if so extend UAVTAlk
|
||||
home.ECEF[0] = ECEF[0];
|
||||
home.ECEF[1] = ECEF[1];
|
||||
home.ECEF[2] = ECEF[2];
|
||||
// Can't figure out how to directly cast home.RNE (float *) to a float[3][3]
|
||||
memcpy(&home.RNE[0], &RNE[0][0], 9 * sizeof(RNE[0][0]));
|
||||
|
||||
// Compute magnetic flux direction at home location
|
||||
WMM_Initialize(); // Set default values and constants
|
||||
// TODO: Extract time/date from GPS to seed this
|
||||
WMM_GetMagVector(LLA[0], LLA[1], LLA[2], 8, 17, 2010, home.Be);
|
||||
|
||||
HomeLocationSet(&home);
|
||||
}
|
||||
|
||||
|
||||
char* nmeaGetPacketBuffer(void)
|
||||
{
|
||||
return NmeaPacket;
|
||||
|
102
flight/OpenPilot/UAVObjects/homelocation.c
Normal file
102
flight/OpenPilot/UAVObjects/homelocation.c
Normal file
@ -0,0 +1,102 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file homelocation.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the HomeLocation object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: homelocation.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 "homelocation.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 HomeLocationInitialize()
|
||||
{
|
||||
// Register object with the object manager
|
||||
handle = UAVObjRegister(HOMELOCATION_OBJID, HOMELOCATION_NAME, HOMELOCATION_METANAME, 0,
|
||||
HOMELOCATION_ISSINGLEINST, HOMELOCATION_ISSETTINGS, HOMELOCATION_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)
|
||||
{
|
||||
HomeLocationData data;
|
||||
UAVObjMetadata metadata;
|
||||
|
||||
// Initialize object fields to their default values
|
||||
UAVObjGetInstanceData(obj, instId, &data);
|
||||
memset(&data, 0, sizeof(HomeLocationData));
|
||||
|
||||
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 = 10000;
|
||||
metadata.gcsTelemetryAcked = 0;
|
||||
metadata.gcsTelemetryUpdateMode = UPDATEMODE_MANUAL;
|
||||
metadata.gcsTelemetryUpdatePeriod = 0;
|
||||
metadata.loggingUpdateMode = UPDATEMODE_NEVER;
|
||||
metadata.loggingUpdatePeriod = 0;
|
||||
UAVObjSetMetadata(obj, &metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get object handle
|
||||
*/
|
||||
UAVObjHandle HomeLocationHandle()
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
||||
|
88
flight/OpenPilot/UAVObjects/inc/homelocation.h
Normal file
88
flight/OpenPilot/UAVObjects/inc/homelocation.h
Normal file
@ -0,0 +1,88 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file homelocation.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the HomeLocation object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: homelocation.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 HOMELOCATION_H
|
||||
#define HOMELOCATION_H
|
||||
|
||||
// Object constants
|
||||
#define HOMELOCATION_OBJID 933172238U
|
||||
#define HOMELOCATION_NAME "HomeLocation"
|
||||
#define HOMELOCATION_METANAME "HomeLocationMeta"
|
||||
#define HOMELOCATION_ISSINGLEINST 1
|
||||
#define HOMELOCATION_ISSETTINGS 0
|
||||
#define HOMELOCATION_NUMBYTES sizeof(HomeLocationData)
|
||||
|
||||
// Object access macros
|
||||
#define HomeLocationGet(dataOut) UAVObjGetData(HomeLocationHandle(), dataOut)
|
||||
#define HomeLocationSet(dataIn) UAVObjSetData(HomeLocationHandle(), dataIn)
|
||||
#define HomeLocationInstGet(instId, dataOut) UAVObjGetInstanceData(HomeLocationHandle(), instId, dataOut)
|
||||
#define HomeLocationInstSet(instId, dataIn) UAVObjSetInstanceData(HomeLocationHandle(), instId, dataIn)
|
||||
#define HomeLocationConnectQueue(queue) UAVObjConnectQueue(HomeLocationHandle(), queue, EV_MASK_ALL_UPDATES)
|
||||
#define HomeLocationConnectCallback(cb) UAVObjConnectCallback(HomeLocationHandle(), cb, EV_MASK_ALL_UPDATES)
|
||||
#define HomeLocationCreateInstance() UAVObjCreateInstance(HomeLocationHandle())
|
||||
#define HomeLocationRequestUpdate() UAVObjRequestUpdate(HomeLocationHandle())
|
||||
#define HomeLocationRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(HomeLocationHandle(), instId)
|
||||
#define HomeLocationUpdated() UAVObjUpdated(HomeLocationHandle())
|
||||
#define HomeLocationInstUpdated(instId) UAVObjUpdated(HomeLocationHandle(), instId)
|
||||
#define HomeLocationGetMetadata(dataOut) UAVObjGetMetadata(HomeLocationHandle(), dataOut)
|
||||
#define HomeLocationSetMetadata(dataIn) UAVObjSetMetadata(HomeLocationHandle(), dataIn)
|
||||
|
||||
// Object data
|
||||
typedef struct {
|
||||
int32_t Latitude;
|
||||
int32_t Longitude;
|
||||
float Altitude;
|
||||
float ECEF[3];
|
||||
float RNE[9];
|
||||
float Be[3];
|
||||
|
||||
} __attribute__((packed)) HomeLocationData;
|
||||
|
||||
// Field information
|
||||
// Field Latitude information
|
||||
// Field Longitude information
|
||||
// Field Altitude information
|
||||
// Field ECEF information
|
||||
/* Number of elements for field ECEF */
|
||||
#define HOMELOCATION_ECEF_NUMELEM 3
|
||||
// Field RNE information
|
||||
/* Number of elements for field RNE */
|
||||
#define HOMELOCATION_RNE_NUMELEM 9
|
||||
// Field Be information
|
||||
/* Number of elements for field Be */
|
||||
#define HOMELOCATION_BE_NUMELEM 3
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
int32_t HomeLocationInitialize();
|
||||
UAVObjHandle HomeLocationHandle();
|
||||
|
||||
#endif // HOMELOCATION_H
|
@ -44,6 +44,7 @@
|
||||
#include "flightsituationactual.h"
|
||||
#include "flighttelemetrystats.h"
|
||||
#include "gcstelemetrystats.h"
|
||||
#include "homelocation.h"
|
||||
#include "manualcontrolcommand.h"
|
||||
#include "manualcontrolsettings.h"
|
||||
#include "navigationdesired.h"
|
||||
@ -79,6 +80,7 @@ void UAVObjectsInitializeAll()
|
||||
FlightSituationActualInitialize();
|
||||
FlightTelemetryStatsInitialize();
|
||||
GCSTelemetryStatsInitialize();
|
||||
HomeLocationInitialize();
|
||||
ManualControlCommandInitialize();
|
||||
ManualControlSettingsInitialize();
|
||||
NavigationDesiredInitialize();
|
||||
|
@ -266,6 +266,28 @@ enum opahrs_result PIOS_OPAHRS_GetAttitude(struct opahrs_msg_v1 *rsp)
|
||||
return opahrs_msg_v1_recv_rsp (OPAHRS_MSG_V1_RSP_ATTITUDE, rsp);
|
||||
}
|
||||
|
||||
enum opahrs_result PIOS_OPAHRS_SetMagNorth(struct opahrs_msg_v1 *req)
|
||||
{
|
||||
struct opahrs_msg_v1 rsp;
|
||||
enum opahrs_result rc;
|
||||
|
||||
if (!req) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Make up an attituderaw request */
|
||||
opahrs_msg_v1_init_user_tx (req, OPAHRS_MSG_V1_REQ_NORTH);
|
||||
|
||||
/* Send the message until it is received */
|
||||
rc = opahrs_msg_v1_send_req (req);
|
||||
if (rc != OPAHRS_RESULT_OK) {
|
||||
/* Failed to send the request, bail out */
|
||||
return rc;
|
||||
}
|
||||
|
||||
return opahrs_msg_v1_recv_rsp (OPAHRS_MSG_V1_RSP_GPS, &rsp);
|
||||
}
|
||||
|
||||
enum opahrs_result PIOS_OPAHRS_SetPositionActual(struct opahrs_msg_v1 *req)
|
||||
{
|
||||
struct opahrs_msg_v1 rsp;
|
||||
|
@ -44,6 +44,7 @@ extern enum opahrs_result PIOS_OPAHRS_GetSerial(struct opahrs_msg_v1 *rsp);
|
||||
extern enum opahrs_result PIOS_OPAHRS_GetAttitude(struct opahrs_msg_v1 *rsp);
|
||||
extern enum opahrs_result PIOS_OPAHRS_GetAttitudeRaw(struct opahrs_msg_v1 *rsp);
|
||||
extern enum opahrs_result PIOS_OPAHRS_SetAltitudeActual(struct opahrs_msg_v1 *req);
|
||||
extern enum opahrs_result PIOS_OPAHRS_SetMagNorth(struct opahrs_msg_v1 *req);
|
||||
extern enum opahrs_result PIOS_OPAHRS_SetPositionActual(struct opahrs_msg_v1 *req);
|
||||
extern enum opahrs_result PIOS_OPAHRS_resync(void);
|
||||
|
||||
|
@ -190,6 +190,10 @@ struct opahrs_msg_v1_req_altitude {
|
||||
float temperature;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
struct opahrs_msg_v1_req_north {
|
||||
float Be[3];
|
||||
} __attribute__((__packed__));
|
||||
|
||||
struct opahrs_msg_v1_req_gps {
|
||||
float latitude;
|
||||
float longitude;
|
||||
@ -212,6 +216,7 @@ union opahrs_msg_v1_req {
|
||||
struct opahrs_msg_v1_req_reset reset;
|
||||
struct opahrs_msg_v1_req_serial serial;
|
||||
struct opahrs_msg_v1_req_altitude altitude;
|
||||
struct opahrs_msg_v1_req_north north;
|
||||
struct opahrs_msg_v1_req_gps gps;
|
||||
struct opahrs_msg_v1_req_attituderaw attituderaw;
|
||||
struct opahrs_msg_v1_req_attitude attitude;
|
||||
@ -233,6 +238,9 @@ struct opahrs_msg_v1_rsp_serial {
|
||||
struct opahrs_msg_v1_rsp_altitude {
|
||||
} __attribute__((__packed__));
|
||||
|
||||
struct opahrs_msg_v1_rsp_north {
|
||||
} __attribute__((__packed__));
|
||||
|
||||
struct opahrs_msg_v1_rsp_gps {
|
||||
} __attribute__((__packed__));
|
||||
|
||||
@ -284,6 +292,7 @@ union opahrs_msg_v1_rsp {
|
||||
struct opahrs_msg_v1_rsp_sync sync;
|
||||
struct opahrs_msg_v1_rsp_serial serial;
|
||||
struct opahrs_msg_v1_rsp_altitude altitude;
|
||||
struct opahrs_msg_v1_rsp_north north;
|
||||
struct opahrs_msg_v1_rsp_attituderaw attituderaw;
|
||||
struct opahrs_msg_v1_rsp_attitude attitude;
|
||||
struct opahrs_msg_v1_rsp_altitude gps;
|
||||
@ -295,6 +304,7 @@ enum opahrs_msg_v1_tag {
|
||||
OPAHRS_MSG_V1_REQ_RESET,
|
||||
OPAHRS_MSG_V1_REQ_SERIAL,
|
||||
OPAHRS_MSG_V1_REQ_ALTITUDE,
|
||||
OPAHRS_MSG_V1_REQ_NORTH,
|
||||
OPAHRS_MSG_V1_REQ_GPS,
|
||||
OPAHRS_MSG_V1_REQ_ATTITUDERAW,
|
||||
OPAHRS_MSG_V1_REQ_ATTITUDE,
|
||||
@ -302,6 +312,7 @@ enum opahrs_msg_v1_tag {
|
||||
OPAHRS_MSG_V1_RSP_SYNC,
|
||||
OPAHRS_MSG_V1_RSP_SERIAL,
|
||||
OPAHRS_MSG_V1_RSP_ALTITUDE,
|
||||
OPAHRS_MSG_V1_RSP_NORTH,
|
||||
OPAHRS_MSG_V1_RSP_GPS,
|
||||
OPAHRS_MSG_V1_RSP_ATTITUDERAW,
|
||||
OPAHRS_MSG_V1_RSP_ATTITUDE,
|
||||
|
@ -22,46 +22,16 @@
|
||||
651CF9F3120B700D00EEFD70 /* usb_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = usb_conf.h; sourceTree = "<group>"; };
|
||||
654330231218E9780063F913 /* insgps.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = insgps.c; path = ../../AHRS/insgps.c; sourceTree = SOURCE_ROOT; };
|
||||
6543304F121980300063F913 /* insgps.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = insgps.h; sourceTree = "<group>"; };
|
||||
6543305B1219868D0063F913 /* WorldMagModel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = WorldMagModel.c; path = ../../AHRS/WorldMagModel.c; sourceTree = SOURCE_ROOT; };
|
||||
65A2C7EF11E2A33D00D0391E /* FreeRTOSConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FreeRTOSConfig.h; path = ../../PiOS.posix/inc/FreeRTOSConfig.h; sourceTree = SOURCE_ROOT; };
|
||||
65A2C7F011E2A33D00D0391E /* pios_com.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pios_com.h; path = ../../PiOS.posix/inc/pios_com.h; sourceTree = SOURCE_ROOT; };
|
||||
65A2C7F111E2A33D00D0391E /* pios_com_priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pios_com_priv.h; path = ../../PiOS.posix/inc/pios_com_priv.h; sourceTree = SOURCE_ROOT; };
|
||||
65A2C7F211E2A33D00D0391E /* pios_delay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pios_delay.h; path = ../../PiOS.posix/inc/pios_delay.h; sourceTree = SOURCE_ROOT; };
|
||||
65A2C7F311E2A33D00D0391E /* pios_led.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pios_led.h; path = ../../PiOS.posix/inc/pios_led.h; sourceTree = SOURCE_ROOT; };
|
||||
65A2C7F411E2A33D00D0391E /* pios_posix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pios_posix.h; path = ../../PiOS.posix/inc/pios_posix.h; sourceTree = SOURCE_ROOT; };
|
||||
65A2C7F511E2A33D00D0391E /* pios_sdcard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pios_sdcard.h; path = ../../PiOS.posix/inc/pios_sdcard.h; sourceTree = SOURCE_ROOT; };
|
||||
65A2C7F611E2A33D00D0391E /* pios_sys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pios_sys.h; path = ../../PiOS.posix/inc/pios_sys.h; sourceTree = SOURCE_ROOT; };
|
||||
65A2C7F711E2A33D00D0391E /* pios_udp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pios_udp.h; path = ../../PiOS.posix/inc/pios_udp.h; sourceTree = SOURCE_ROOT; };
|
||||
65A2C7F811E2A33D00D0391E /* pios_udp_priv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pios_udp_priv.h; path = ../../PiOS.posix/inc/pios_udp_priv.h; sourceTree = SOURCE_ROOT; };
|
||||
65A2C7F911E2A33D00D0391E /* pios.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pios.h; path = ../../PiOS.posix/pios.h; sourceTree = SOURCE_ROOT; };
|
||||
65A2C7FE11E2A33D00D0391E /* croutine.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = croutine.c; path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/croutine.c; sourceTree = SOURCE_ROOT; };
|
||||
65A2C80011E2A33D00D0391E /* croutine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = croutine.h; path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/include/croutine.h; sourceTree = SOURCE_ROOT; };
|
||||
65A2C80111E2A33D00D0391E /* FreeRTOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FreeRTOS.h; path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/include/FreeRTOS.h; sourceTree = SOURCE_ROOT; };
|
||||
65A2C80211E2A33D00D0391E /* list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = list.h; path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/include/list.h; sourceTree = SOURCE_ROOT; };
|
||||
65A2C80311E2A33D00D0391E /* mpu_wrappers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mpu_wrappers.h; path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/include/mpu_wrappers.h; sourceTree = SOURCE_ROOT; };
|
||||
65A2C80411E2A33D00D0391E /* portable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = portable.h; path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/include/portable.h; sourceTree = SOURCE_ROOT; };
|
||||
65A2C80511E2A33D00D0391E /* projdefs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = projdefs.h; path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/include/projdefs.h; sourceTree = SOURCE_ROOT; };
|
||||
65A2C80611E2A33D00D0391E /* queue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = queue.h; path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/include/queue.h; sourceTree = SOURCE_ROOT; };
|
||||
65A2C80711E2A33D00D0391E /* semphr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = semphr.h; path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/include/semphr.h; sourceTree = SOURCE_ROOT; };
|
||||
65A2C80811E2A33D00D0391E /* StackMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StackMacros.h; path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/include/StackMacros.h; sourceTree = SOURCE_ROOT; };
|
||||
65A2C80911E2A33D00D0391E /* task.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = task.h; path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/include/task.h; sourceTree = SOURCE_ROOT; };
|
||||
65A2C80A11E2A33D00D0391E /* list.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = list.c; path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/list.c; sourceTree = SOURCE_ROOT; };
|
||||
65A2C80F11E2A33D00D0391E /* port.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = port.c; path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/port.c; sourceTree = SOURCE_ROOT; };
|
||||
65A2C81011E2A33D00D0391E /* portmacro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = portmacro.h; path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/portmacro.h; sourceTree = SOURCE_ROOT; };
|
||||
65A2C81211E2A33D00D0391E /* heap_3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = heap_3.c; path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/MemMang/heap_3.c; sourceTree = SOURCE_ROOT; };
|
||||
65A2C81311E2A33D00D0391E /* readme.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = readme.txt; path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/readme.txt; sourceTree = SOURCE_ROOT; };
|
||||
65A2C81411E2A33D00D0391E /* queue.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = queue.c; path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/queue.c; sourceTree = SOURCE_ROOT; };
|
||||
65A2C81511E2A33D00D0391E /* readme.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = readme.txt; path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/readme.txt; sourceTree = SOURCE_ROOT; };
|
||||
65A2C81611E2A33D00D0391E /* tasks.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tasks.c; path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/tasks.c; sourceTree = SOURCE_ROOT; };
|
||||
65A2C81711E2A33D00D0391E /* pios_com.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pios_com.c; path = ../../PiOS.posix/posix/pios_com.c; sourceTree = SOURCE_ROOT; };
|
||||
65A2C81811E2A33D00D0391E /* pios_com.c.old */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = pios_com.c.old; path = ../../PiOS.posix/posix/pios_com.c.old; sourceTree = SOURCE_ROOT; };
|
||||
65A2C81911E2A33D00D0391E /* pios_delay.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pios_delay.c; path = ../../PiOS.posix/posix/pios_delay.c; sourceTree = SOURCE_ROOT; };
|
||||
65A2C81A11E2A33D00D0391E /* pios_led.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pios_led.c; path = ../../PiOS.posix/posix/pios_led.c; sourceTree = SOURCE_ROOT; };
|
||||
65A2C81B11E2A33D00D0391E /* pios_sdcard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pios_sdcard.c; path = ../../PiOS.posix/posix/pios_sdcard.c; sourceTree = SOURCE_ROOT; };
|
||||
65A2C81C11E2A33D00D0391E /* pios_sys.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pios_sys.c; path = ../../PiOS.posix/posix/pios_sys.c; sourceTree = SOURCE_ROOT; };
|
||||
65A2C81D11E2A33D00D0391E /* pios_udp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pios_udp.c; path = ../../PiOS.posix/posix/pios_udp.c; sourceTree = SOURCE_ROOT; };
|
||||
65B35CFA121A4540003EAD18 /* CoordinateConversions.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = CoordinateConversions.c; path = ../../AHRS/CoordinateConversions.c; sourceTree = SOURCE_ROOT; };
|
||||
65B35CFB121A45C6003EAD18 /* CoordinateConversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoordinateConversions.h; sourceTree = "<group>"; };
|
||||
657CEEAD121DB6C8007A1FBE /* homelocation.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = homelocation.xml; sourceTree = "<group>"; };
|
||||
657CEEB7121DBC63007A1FBE /* CoordinateConversions.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CoordinateConversions.c; sourceTree = "<group>"; };
|
||||
657CEEB9121DBC63007A1FBE /* CoordinateConversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoordinateConversions.h; sourceTree = "<group>"; };
|
||||
657CEEBA121DBC63007A1FBE /* WorldMagModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorldMagModel.h; sourceTree = "<group>"; };
|
||||
657CEEBB121DBC63007A1FBE /* WorldMagModel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = WorldMagModel.c; sourceTree = "<group>"; };
|
||||
657CEEBF121DC054007A1FBE /* attituderaw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = attituderaw.c; sourceTree = "<group>"; };
|
||||
657CEEC0121DC054007A1FBE /* flightsituationactual.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = flightsituationactual.c; sourceTree = "<group>"; };
|
||||
657CEEC1121DC054007A1FBE /* homelocation.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = homelocation.c; sourceTree = "<group>"; };
|
||||
657CEEC2121DC054007A1FBE /* navigationdesired.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = navigationdesired.c; sourceTree = "<group>"; };
|
||||
657CEEC3121DC054007A1FBE /* navigationsettings.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = navigationsettings.c; sourceTree = "<group>"; };
|
||||
65B35D7F121C261E003EAD18 /* bin.pro */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = bin.pro; sourceTree = "<group>"; };
|
||||
65B35D80121C261E003EAD18 /* openpilotgcs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = openpilotgcs; sourceTree = "<group>"; };
|
||||
65B35D81121C261E003EAD18 /* openpilotgcs.pri */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = openpilotgcs.pri; sourceTree = "<group>"; };
|
||||
@ -2670,7 +2640,6 @@
|
||||
65E8EF7C11EEA61E00BBF654 /* flightbatterystate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = flightbatterystate.c; path = ../../OpenPilot/UAVObjects/flightbatterystate.c; sourceTree = SOURCE_ROOT; };
|
||||
65E8EF7D11EEA61E00BBF654 /* flighttelemetrystats.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = flighttelemetrystats.c; path = ../../OpenPilot/UAVObjects/flighttelemetrystats.c; sourceTree = SOURCE_ROOT; };
|
||||
65E8EF7E11EEA61E00BBF654 /* gcstelemetrystats.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = gcstelemetrystats.c; path = ../../OpenPilot/UAVObjects/gcstelemetrystats.c; sourceTree = SOURCE_ROOT; };
|
||||
65E8EF7F11EEA61E00BBF654 /* headingactual.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = headingactual.c; path = ../../OpenPilot/UAVObjects/headingactual.c; sourceTree = SOURCE_ROOT; };
|
||||
65E8EF8111EEA61E00BBF654 /* actuatorcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = actuatorcommand.h; path = ../../OpenPilot/UAVObjects/inc/actuatorcommand.h; sourceTree = SOURCE_ROOT; };
|
||||
65E8EF8211EEA61E00BBF654 /* actuatordesired.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = actuatordesired.h; path = ../../OpenPilot/UAVObjects/inc/actuatordesired.h; sourceTree = SOURCE_ROOT; };
|
||||
65E8EF8311EEA61E00BBF654 /* actuatorsettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = actuatorsettings.h; path = ../../OpenPilot/UAVObjects/inc/actuatorsettings.h; sourceTree = SOURCE_ROOT; };
|
||||
@ -2887,12 +2856,7 @@
|
||||
08FB7794FE84155DC02AAC07 /* OpenPilotOSX */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65B7E6AC120DF1CD000C1123 /* AHRS */,
|
||||
65E8EF1E11EEA61E00BBF654 /* OpenPilot */,
|
||||
65E8F02F11EFF25C00BBF654 /* PiOS */,
|
||||
65A2C7ED11E2A33D00D0391E /* PiOS.posix */,
|
||||
C6A0FF2B0290797F04C91782 /* Documentation */,
|
||||
1AB674ADFE9D54B511CA2CBB /* Products */,
|
||||
657CEEB5121DBC49007A1FBE /* flight */,
|
||||
65B35D7D121C261E003EAD18 /* ground */,
|
||||
);
|
||||
name = OpenPilotOSX;
|
||||
@ -2922,140 +2886,38 @@
|
||||
path = inc;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
65A2C7ED11E2A33D00D0391E /* PiOS.posix */ = {
|
||||
657CEEB5121DBC49007A1FBE /* flight */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65A2C7EE11E2A33D00D0391E /* inc */,
|
||||
65A2C7F911E2A33D00D0391E /* pios.h */,
|
||||
65A2C7FA11E2A33D00D0391E /* posix */,
|
||||
65B7E6AC120DF1CD000C1123 /* AHRS */,
|
||||
657CEEB6121DBC63007A1FBE /* Libraries */,
|
||||
65E8EF1E11EEA61E00BBF654 /* OpenPilot */,
|
||||
65E8F02F11EFF25C00BBF654 /* PiOS */,
|
||||
C6A0FF2B0290797F04C91782 /* Documentation */,
|
||||
1AB674ADFE9D54B511CA2CBB /* Products */,
|
||||
);
|
||||
name = PiOS.posix;
|
||||
path = ../../PiOS.posix;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
name = flight;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
65A2C7EE11E2A33D00D0391E /* inc */ = {
|
||||
657CEEB6121DBC63007A1FBE /* Libraries */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65A2C7EF11E2A33D00D0391E /* FreeRTOSConfig.h */,
|
||||
65A2C7F011E2A33D00D0391E /* pios_com.h */,
|
||||
65A2C7F111E2A33D00D0391E /* pios_com_priv.h */,
|
||||
65A2C7F211E2A33D00D0391E /* pios_delay.h */,
|
||||
65A2C7F311E2A33D00D0391E /* pios_led.h */,
|
||||
65A2C7F411E2A33D00D0391E /* pios_posix.h */,
|
||||
65A2C7F511E2A33D00D0391E /* pios_sdcard.h */,
|
||||
65A2C7F611E2A33D00D0391E /* pios_sys.h */,
|
||||
65A2C7F711E2A33D00D0391E /* pios_udp.h */,
|
||||
65A2C7F811E2A33D00D0391E /* pios_udp_priv.h */,
|
||||
);
|
||||
name = inc;
|
||||
path = ../../PiOS.posix/inc;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
65A2C7FA11E2A33D00D0391E /* posix */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65A2C7FB11E2A33D00D0391E /* Libraries */,
|
||||
65A2C81711E2A33D00D0391E /* pios_com.c */,
|
||||
65A2C81811E2A33D00D0391E /* pios_com.c.old */,
|
||||
65A2C81911E2A33D00D0391E /* pios_delay.c */,
|
||||
65A2C81A11E2A33D00D0391E /* pios_led.c */,
|
||||
65A2C81B11E2A33D00D0391E /* pios_sdcard.c */,
|
||||
65A2C81C11E2A33D00D0391E /* pios_sys.c */,
|
||||
65A2C81D11E2A33D00D0391E /* pios_udp.c */,
|
||||
);
|
||||
name = posix;
|
||||
path = ../../PiOS.posix/posix;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
65A2C7FB11E2A33D00D0391E /* Libraries */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65A2C7FC11E2A33D00D0391E /* FreeRTOS */,
|
||||
657CEEB7121DBC63007A1FBE /* CoordinateConversions.c */,
|
||||
657CEEB8121DBC63007A1FBE /* inc */,
|
||||
657CEEBB121DBC63007A1FBE /* WorldMagModel.c */,
|
||||
);
|
||||
name = Libraries;
|
||||
path = ../../PiOS.posix/posix/Libraries;
|
||||
path = ../../Libraries;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
65A2C7FC11E2A33D00D0391E /* FreeRTOS */ = {
|
||||
657CEEB8121DBC63007A1FBE /* inc */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65A2C7FD11E2A33D00D0391E /* Source */,
|
||||
657CEEB9121DBC63007A1FBE /* CoordinateConversions.h */,
|
||||
657CEEBA121DBC63007A1FBE /* WorldMagModel.h */,
|
||||
);
|
||||
name = FreeRTOS;
|
||||
path = ../../PiOS.posix/posix/Libraries/FreeRTOS;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
65A2C7FD11E2A33D00D0391E /* Source */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65A2C7FE11E2A33D00D0391E /* croutine.c */,
|
||||
65A2C7FF11E2A33D00D0391E /* include */,
|
||||
65A2C80A11E2A33D00D0391E /* list.c */,
|
||||
65A2C80B11E2A33D00D0391E /* portable */,
|
||||
65A2C81411E2A33D00D0391E /* queue.c */,
|
||||
65A2C81511E2A33D00D0391E /* readme.txt */,
|
||||
65A2C81611E2A33D00D0391E /* tasks.c */,
|
||||
);
|
||||
name = Source;
|
||||
path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
65A2C7FF11E2A33D00D0391E /* include */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65A2C80011E2A33D00D0391E /* croutine.h */,
|
||||
65A2C80111E2A33D00D0391E /* FreeRTOS.h */,
|
||||
65A2C80211E2A33D00D0391E /* list.h */,
|
||||
65A2C80311E2A33D00D0391E /* mpu_wrappers.h */,
|
||||
65A2C80411E2A33D00D0391E /* portable.h */,
|
||||
65A2C80511E2A33D00D0391E /* projdefs.h */,
|
||||
65A2C80611E2A33D00D0391E /* queue.h */,
|
||||
65A2C80711E2A33D00D0391E /* semphr.h */,
|
||||
65A2C80811E2A33D00D0391E /* StackMacros.h */,
|
||||
65A2C80911E2A33D00D0391E /* task.h */,
|
||||
);
|
||||
name = include;
|
||||
path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/include;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
65A2C80B11E2A33D00D0391E /* portable */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65A2C80C11E2A33D00D0391E /* GCC */,
|
||||
65A2C81111E2A33D00D0391E /* MemMang */,
|
||||
65A2C81311E2A33D00D0391E /* readme.txt */,
|
||||
);
|
||||
name = portable;
|
||||
path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/portable;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
65A2C80C11E2A33D00D0391E /* GCC */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65A2C80D11E2A33D00D0391E /* Posix */,
|
||||
);
|
||||
name = GCC;
|
||||
path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
65A2C80D11E2A33D00D0391E /* Posix */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65A2C80F11E2A33D00D0391E /* port.c */,
|
||||
65A2C81011E2A33D00D0391E /* portmacro.h */,
|
||||
);
|
||||
name = Posix;
|
||||
path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
65A2C81111E2A33D00D0391E /* MemMang */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65A2C81211E2A33D00D0391E /* heap_3.c */,
|
||||
);
|
||||
name = MemMang;
|
||||
path = ../../PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/MemMang;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
path = inc;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
65B35D7D121C261E003EAD18 /* ground */ = {
|
||||
isa = PBXGroup;
|
||||
@ -6818,6 +6680,7 @@
|
||||
65B367F1121C2620003EAD18 /* flightsituationactual.xml */,
|
||||
65B367F2121C2620003EAD18 /* flighttelemetrystats.xml */,
|
||||
65B367F3121C2620003EAD18 /* gcstelemetrystats.xml */,
|
||||
657CEEAD121DB6C8007A1FBE /* homelocation.xml */,
|
||||
65B367F4121C2620003EAD18 /* manualcontrolcommand.xml */,
|
||||
65B367F5121C2620003EAD18 /* manualcontrolsettings.xml */,
|
||||
65B367F6121C2620003EAD18 /* navigationdesired.xml */,
|
||||
@ -6836,8 +6699,6 @@
|
||||
65B7E6AC120DF1CD000C1123 /* AHRS */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65B35CFA121A4540003EAD18 /* CoordinateConversions.c */,
|
||||
6543305B1219868D0063F913 /* WorldMagModel.c */,
|
||||
654330231218E9780063F913 /* insgps.c */,
|
||||
65B7E6AD120DF1E2000C1123 /* ahrs_fsm.c */,
|
||||
65B7E6AE120DF1E2000C1123 /* ahrs.c */,
|
||||
@ -6851,7 +6712,6 @@
|
||||
65B7E6AF120DF1E2000C1123 /* inc */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65B35CFB121A45C6003EAD18 /* CoordinateConversions.h */,
|
||||
6543304F121980300063F913 /* insgps.h */,
|
||||
65B7E6B0120DF1E2000C1123 /* ahrs.h */,
|
||||
65B7E6B1120DF1E2000C1123 /* ahrs_fsm.h */,
|
||||
@ -7203,6 +7063,11 @@
|
||||
65E8EF6E11EEA61E00BBF654 /* UAVObjects */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
657CEEBF121DC054007A1FBE /* attituderaw.c */,
|
||||
657CEEC0121DC054007A1FBE /* flightsituationactual.c */,
|
||||
657CEEC1121DC054007A1FBE /* homelocation.c */,
|
||||
657CEEC2121DC054007A1FBE /* navigationdesired.c */,
|
||||
657CEEC3121DC054007A1FBE /* navigationsettings.c */,
|
||||
65E8EF6F11EEA61E00BBF654 /* actuatorcommand.c */,
|
||||
65E8EF7011EEA61E00BBF654 /* actuatordesired.c */,
|
||||
65E8EF7111EEA61E00BBF654 /* actuatorsettings.c */,
|
||||
@ -7219,7 +7084,6 @@
|
||||
65E8EF7C11EEA61E00BBF654 /* flightbatterystate.c */,
|
||||
65E8EF7D11EEA61E00BBF654 /* flighttelemetrystats.c */,
|
||||
65E8EF7E11EEA61E00BBF654 /* gcstelemetrystats.c */,
|
||||
65E8EF7F11EEA61E00BBF654 /* headingactual.c */,
|
||||
65E8EF8011EEA61E00BBF654 /* inc */,
|
||||
65E8EF9E11EEA61E00BBF654 /* manualcontrolcommand.c */,
|
||||
65E8EF9F11EEA61E00BBF654 /* manualcontrolsettings.c */,
|
||||
|
155
ground/src/plugins/uavobjects/homelocation.cpp
Normal file
155
ground/src/plugins/uavobjects/homelocation.cpp
Normal file
@ -0,0 +1,155 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file homelocation.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: homelocation.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 "homelocation.h"
|
||||
#include "uavobjectfield.h"
|
||||
|
||||
const QString HomeLocation::NAME = QString("HomeLocation");
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
HomeLocation::HomeLocation(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME)
|
||||
{
|
||||
// Create fields
|
||||
QList<UAVObjectField*> fields;
|
||||
QStringList LatitudeElemNames;
|
||||
LatitudeElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("Latitude"), QString("deg * 10e6"), UAVObjectField::INT32, LatitudeElemNames, QStringList()) );
|
||||
QStringList LongitudeElemNames;
|
||||
LongitudeElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("Longitude"), QString("deg * 10e6"), UAVObjectField::INT32, LongitudeElemNames, QStringList()) );
|
||||
QStringList AltitudeElemNames;
|
||||
AltitudeElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("Altitude"), QString("m over geoid"), UAVObjectField::FLOAT32, AltitudeElemNames, QStringList()) );
|
||||
QStringList ECEFElemNames;
|
||||
ECEFElemNames.append("0");
|
||||
ECEFElemNames.append("1");
|
||||
ECEFElemNames.append("2");
|
||||
fields.append( new UAVObjectField(QString("ECEF"), QString("m"), UAVObjectField::FLOAT32, ECEFElemNames, QStringList()) );
|
||||
QStringList RNEElemNames;
|
||||
RNEElemNames.append("0");
|
||||
RNEElemNames.append("1");
|
||||
RNEElemNames.append("2");
|
||||
RNEElemNames.append("3");
|
||||
RNEElemNames.append("4");
|
||||
RNEElemNames.append("5");
|
||||
RNEElemNames.append("6");
|
||||
RNEElemNames.append("7");
|
||||
RNEElemNames.append("8");
|
||||
fields.append( new UAVObjectField(QString("RNE"), QString(""), UAVObjectField::FLOAT32, RNEElemNames, QStringList()) );
|
||||
QStringList BeElemNames;
|
||||
BeElemNames.append("0");
|
||||
BeElemNames.append("1");
|
||||
BeElemNames.append("2");
|
||||
fields.append( new UAVObjectField(QString("Be"), QString(""), UAVObjectField::FLOAT32, BeElemNames, QStringList()) );
|
||||
|
||||
// Initialize object
|
||||
initializeFields(fields, (quint8*)&data, NUMBYTES);
|
||||
// Set the default field values
|
||||
setDefaultFieldValues();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default metadata for this object
|
||||
*/
|
||||
UAVObject::Metadata HomeLocation::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 = 10000;
|
||||
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 HomeLocation::setDefaultFieldValues()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the object data fields
|
||||
*/
|
||||
HomeLocation::DataFields HomeLocation::getData()
|
||||
{
|
||||
QMutexLocker locker(mutex);
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the object data fields
|
||||
*/
|
||||
void HomeLocation::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* HomeLocation::clone(quint32 instID)
|
||||
{
|
||||
HomeLocation* obj = new HomeLocation();
|
||||
obj->initialize(instID, this->getMetaObject());
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Static function to retrieve an instance of the object.
|
||||
*/
|
||||
HomeLocation* HomeLocation::GetInstance(UAVObjectManager* objMngr, quint32 instID)
|
||||
{
|
||||
return dynamic_cast<HomeLocation*>(objMngr->getObject(HomeLocation::OBJID, instID));
|
||||
}
|
94
ground/src/plugins/uavobjects/homelocation.h
Normal file
94
ground/src/plugins/uavobjects/homelocation.h
Normal file
@ -0,0 +1,94 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file homelocation.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: homelocation.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 HOMELOCATION_H
|
||||
#define HOMELOCATION_H
|
||||
|
||||
#include "uavdataobject.h"
|
||||
#include "uavobjectmanager.h"
|
||||
|
||||
class UAVOBJECTS_EXPORT HomeLocation: public UAVDataObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// Field structure
|
||||
typedef struct {
|
||||
qint32 Latitude;
|
||||
qint32 Longitude;
|
||||
float Altitude;
|
||||
float ECEF[3];
|
||||
float RNE[9];
|
||||
float Be[3];
|
||||
|
||||
} __attribute__((packed)) DataFields;
|
||||
|
||||
// Field information
|
||||
// Field Latitude information
|
||||
// Field Longitude information
|
||||
// Field Altitude information
|
||||
// Field ECEF information
|
||||
/* Number of elements for field ECEF */
|
||||
static const quint32 ECEF_NUMELEM = 3;
|
||||
// Field RNE information
|
||||
/* Number of elements for field RNE */
|
||||
static const quint32 RNE_NUMELEM = 9;
|
||||
// Field Be information
|
||||
/* Number of elements for field Be */
|
||||
static const quint32 BE_NUMELEM = 3;
|
||||
|
||||
|
||||
// Constants
|
||||
static const quint32 OBJID = 933172238U;
|
||||
static const QString NAME;
|
||||
static const bool ISSINGLEINST = 1;
|
||||
static const bool ISSETTINGS = 0;
|
||||
static const quint32 NUMBYTES = sizeof(DataFields);
|
||||
|
||||
// Functions
|
||||
HomeLocation();
|
||||
|
||||
DataFields getData();
|
||||
void setData(const DataFields& data);
|
||||
Metadata getDefaultMetadata();
|
||||
UAVDataObject* clone(quint32 instID);
|
||||
|
||||
static HomeLocation* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0);
|
||||
|
||||
private:
|
||||
DataFields data;
|
||||
|
||||
void setDefaultFieldValues();
|
||||
|
||||
};
|
||||
|
||||
#endif // HOMELOCATION_H
|
148
ground/src/plugins/uavobjects/homelocation.py
Normal file
148
ground/src/plugins/uavobjects/homelocation.py
Normal file
@ -0,0 +1,148 @@
|
||||
##
|
||||
##############################################################################
|
||||
#
|
||||
# @file homelocation.py
|
||||
# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
# @brief Implementation of the HomeLocation object. This file has been
|
||||
# automatically generated by the UAVObjectGenerator.
|
||||
#
|
||||
# @note Object definition file: homelocation.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',
|
||||
'i',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Longitude',
|
||||
'i',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Altitude',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'ECEF',
|
||||
'f',
|
||||
3,
|
||||
[
|
||||
'0',
|
||||
'1',
|
||||
'2',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'RNE',
|
||||
'f',
|
||||
9,
|
||||
[
|
||||
'0',
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Be',
|
||||
'f',
|
||||
3,
|
||||
[
|
||||
'0',
|
||||
'1',
|
||||
'2',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
class HomeLocation(uavobject.UAVObject):
|
||||
## Object constants
|
||||
OBJID = 933172238
|
||||
NAME = "HomeLocation"
|
||||
METANAME = "HomeLocationMeta"
|
||||
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 = HomeLocation()
|
||||
print (x)
|
||||
|
||||
if __name__ == "__main__":
|
||||
#import pdb ; pdb.run('main()')
|
||||
main()
|
@ -46,6 +46,7 @@
|
||||
#include "flightsituationactual.h"
|
||||
#include "flighttelemetrystats.h"
|
||||
#include "gcstelemetrystats.h"
|
||||
#include "homelocation.h"
|
||||
#include "manualcontrolcommand.h"
|
||||
#include "manualcontrolsettings.h"
|
||||
#include "navigationdesired.h"
|
||||
@ -81,6 +82,7 @@ void UAVObjectsInitialize(UAVObjectManager* objMngr)
|
||||
objMngr->registerObject( new FlightSituationActual() );
|
||||
objMngr->registerObject( new FlightTelemetryStats() );
|
||||
objMngr->registerObject( new GCSTelemetryStats() );
|
||||
objMngr->registerObject( new HomeLocation() );
|
||||
objMngr->registerObject( new ManualControlCommand() );
|
||||
objMngr->registerObject( new ManualControlSettings() );
|
||||
objMngr->registerObject( new NavigationDesired() );
|
||||
|
14
ground/src/shared/uavobjectdefinition/homelocation.xml
Normal file
14
ground/src/shared/uavobjectdefinition/homelocation.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<xml>
|
||||
<object name="HomeLocation" singleinstance="true" settings="false">
|
||||
<field name="Latitude" units="deg * 10e6" type="int32" elements="1"/>
|
||||
<field name="Longitude" units="deg * 10e6" type="int32" elements="1"/>
|
||||
<field name="Altitude" units="m over geoid" type="float" elements="1"/>
|
||||
<field name="ECEF" units="m" type="float" elements="3"/>
|
||||
<field name="RNE" units="" type="float" elements="9"/>
|
||||
<field name="Be" units="" type="float" elements="3"/>
|
||||
<access gcs="readwrite" flight="readwrite"/>
|
||||
<telemetrygcs acked="false" updatemode="manual" period="0"/>
|
||||
<telemetryflight acked="false" updatemode="periodic" period="10000"/>
|
||||
<logging updatemode="never" period="0"/>
|
||||
</object>
|
||||
</xml>
|
Loading…
Reference in New Issue
Block a user