1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

AHRS: Making AHRS populate the NED/Vel fields of PositionActual. May rename object to PositionVelocityActual. Also created a GPSTime object which is populated from the GPRMC command. Also added a GPZDA parsing command, but by default OP GPS doesn't send this command. Made the computation of the world magnetic model use the current time to set the magnetic vector. Note: currently if you set your home location and save it to SD, this will not recompute the vector over time. I'm not sure how sensitive this is.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1435 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2010-08-27 19:59:25 +00:00 committed by peabody124
parent 6443b7c830
commit 16361dea12
13 changed files with 213 additions and 81 deletions

View File

@ -150,6 +150,7 @@ SRC += $(OPUAVOBJ)/examplesettings.c
SRC += $(OPUAVOBJ)/objectpersistence.c SRC += $(OPUAVOBJ)/objectpersistence.c
SRC += $(OPUAVOBJ)/positionactual.c SRC += $(OPUAVOBJ)/positionactual.c
SRC += $(OPUAVOBJ)/gpsposition.c SRC += $(OPUAVOBJ)/gpsposition.c
SRC += $(OPUAVOBJ)/gpstime.c
SRC += $(OPUAVOBJ)/gcstelemetrystats.c SRC += $(OPUAVOBJ)/gcstelemetrystats.c
SRC += $(OPUAVOBJ)/flighttelemetrystats.c SRC += $(OPUAVOBJ)/flighttelemetrystats.c
SRC += $(OPUAVOBJ)/systemstats.c SRC += $(OPUAVOBJ)/systemstats.c

View File

@ -59,6 +59,7 @@
#include "baroaltitude.h" #include "baroaltitude.h"
#include "stdbool.h" #include "stdbool.h"
#include "gpsposition.h" #include "gpsposition.h"
#include "positionactual.h"
#include "homelocation.h" #include "homelocation.h"
#include "ahrscalibration.h" #include "ahrscalibration.h"
#include "CoordinateConversions.h" #include "CoordinateConversions.h"
@ -393,55 +394,63 @@ static void load_baro_altitude(struct opahrs_msg_v1_req_update * update)
static void load_gps_position(struct opahrs_msg_v1_req_update * update) static void load_gps_position(struct opahrs_msg_v1_req_update * update)
{ {
GPSPositionData data; GPSPositionData data;
GPSPositionGet(&data); GPSPositionGet(&data);
HomeLocationData home; HomeLocationData home;
HomeLocationGet(&home); HomeLocationGet(&home);
update->gps.updated = TRUE; update->gps.updated = TRUE;
if(home.RNE[0] == 0 && home.RNE[1] && home.RNE[2] == 0 && home.RNE[3] == 0) { if(home.Set == HOMELOCATION_SET_FALSE) {
update->gps.NED[0] = 0; PositionActualData pos;
update->gps.NED[1] = 0; PositionActualGet(&pos);
update->gps.NED[2] = 0;
update->gps.groundspeed = 0; update->gps.NED[0] = pos.NED[0];
update->gps.heading = 0; update->gps.NED[1] = pos.NED[1];
update->gps.quality = 0; update->gps.NED[2] = pos.NED[2];
} else { update->gps.groundspeed = 0;
update->gps.groundspeed = data.Groundspeed; update->gps.heading = 0;
update->gps.heading = data.Heading; update->gps.quality = 0;
update->gps.quality = 0; } else {
double LLA[3] = {(double) data.Latitude / 1e7, (double) data.Longitude / 1e7, (double) data.Altitude}; update->gps.groundspeed = data.Groundspeed;
// convert from cm back to meters update->gps.heading = data.Heading;
double ECEF[3] = {(double) (home.ECEF[0] / 100), (double) (home.ECEF[1] / 100), (double) (home.ECEF[2] / 100)}; update->gps.quality = 0;
LLA2Base(LLA, ECEF, (float (*)[3]) home.RNE, update->gps.NED); double LLA[3] = {(double) data.Latitude / 1e7, (double) data.Longitude / 1e7, (double) (data.GeoidSeparation + data.Altitude)};
} // convert from cm back to meters
double ECEF[3] = {(double) (home.ECEF[0] / 100), (double) (home.ECEF[1] / 100), (double) (home.ECEF[2] / 100)};
LLA2Base(LLA, ECEF, (float (*)[3]) home.RNE, update->gps.NED);
}
} }
static void process_update(struct opahrs_msg_v1_rsp_update * update) static void process_update(struct opahrs_msg_v1_rsp_update * update)
{ {
AttitudeActualData data; AttitudeActualData data;
data.q1 = update->quaternion.q1;
data.q2 = update->quaternion.q2;
data.q3 = update->quaternion.q3;
data.q4 = update->quaternion.q4;
float q[4] = {data.q1, data.q2, data.q3, data.q4};
float rpy[3];
Quaternion2RPY(q,rpy);
data.Roll = rpy[0];
data.Pitch = rpy[1];
data.Yaw = rpy[2];
if(data.Yaw < 0) data.Yaw += 360;
AttitudeActualSet(&data); data.q1 = update->quaternion.q1;
data.q2 = update->quaternion.q2;
/* data.q3 = update->quaternion.q3;
* update->NED[] data.q4 = update->quaternion.q4;
* update->Vel[]
*/ float q[4] = {data.q1, data.q2, data.q3, data.q4};
float rpy[3];
Quaternion2RPY(q,rpy);
data.Roll = rpy[0];
data.Pitch = rpy[1];
data.Yaw = rpy[2];
if(data.Yaw < 0) data.Yaw += 360;
AttitudeActualSet(&data);
PositionActualData pos;
PositionActualGet(&pos);
pos.NED[0] = update->NED[0];
pos.NED[1] = update->NED[1];
pos.NED[2] = update->NED[2];
pos.Vel[0] = update->Vel[0];
pos.Vel[1] = update->Vel[1];
pos.Vel[2] = update->Vel[2];
PositionActualSet(&pos);
} }
static void update_attitude_raw(struct opahrs_msg_v1_rsp_attituderaw * attituderaw) static void update_attitude_raw(struct opahrs_msg_v1_rsp_attituderaw * attituderaw)

View File

@ -35,6 +35,7 @@
#include "NMEA.h" #include "NMEA.h"
#include "gpsposition.h" #include "gpsposition.h"
#include "homelocation.h" #include "homelocation.h"
#include "gpstime.h"
#include "WorldMagModel.h" #include "WorldMagModel.h"
#include "CoordinateConversions.h" #include "CoordinateConversions.h"
@ -236,30 +237,35 @@ static bool GPS_copy_sentence_from_cbuffer (char * dest, uint32_t dest_len, cBuf
static void setHomeLocation(GPSPositionData * gpsData) static void setHomeLocation(GPSPositionData * gpsData)
{ {
HomeLocationData home; HomeLocationData home;
HomeLocationGet(&home); HomeLocationGet(&home);
GPSTimeData gps;
// Store LLA GPSTimeGet(&gps);
home.Latitude = gpsData->Latitude;
home.Longitude = gpsData->Longitude; if(gps.Year >= 2000)
home.Altitude = gpsData->GeoidSeparation; {
// Store LLA
// Compute home ECEF coordinates and the rotation matrix into NED home.Latitude = gpsData->Latitude;
double LLA[3] = {(double) home.Latitude / 10e6, (double) home.Longitude / 10e6, (double) home.Altitude}; home.Longitude = gpsData->Longitude;
double ECEF[3]; home.Altitude = gpsData->Altitude + gpsData->GeoidSeparation;
RneFromLLA(LLA, (float (*)[3]) home.RNE);
LLA2ECEF(LLA, ECEF); // Compute home ECEF coordinates and the rotation matrix into NED
// TODO: Currently UAVTalk only supports float but these conversions use double double LLA[3] = {(double) home.Latitude / 10e6, (double) home.Longitude / 10e6, (double) home.Altitude};
// need to find out if they require that precision and if so extend UAVTAlk double ECEF[3];
home.ECEF[0] = (int32_t) (ECEF[0] * 100); RneFromLLA(LLA, (float (*)[3]) home.RNE);
home.ECEF[1] = (int32_t) (ECEF[1] * 100); LLA2ECEF(LLA, ECEF);
home.ECEF[2] = (int32_t) (ECEF[2] * 100); // 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
// Compute magnetic flux direction at home location home.ECEF[0] = (int32_t) (ECEF[0] * 100);
WMM_GetMagVector(LLA[0], LLA[1], LLA[2], 8, 17, 2010, &home.Be[0]); home.ECEF[1] = (int32_t) (ECEF[1] * 100);
home.ECEF[2] = (int32_t) (ECEF[2] * 100);
home.Set = HOMELOCATION_SET_TRUE;
HomeLocationSet(&home); // Compute magnetic flux direction at home location
WMM_GetMagVector(LLA[0], LLA[1], LLA[2], gps.Month, gps.Day, gps.Year, &home.Be[0]);
home.Set = HOMELOCATION_SET_TRUE;
HomeLocationSet(&home);
}
} }

View File

@ -2,6 +2,7 @@
#include "pios.h" #include "pios.h"
#include "NMEA.h" #include "NMEA.h"
#include "gpsposition.h" #include "gpsposition.h"
#include "gpstime.h"
// Debugging // Debugging
//#define GPSDEBUG //#define GPSDEBUG
@ -28,6 +29,7 @@ static bool nmeaProcessGPGGA (GPSPositionData * GpsData, char * sentence);
static bool nmeaProcessGPRMC (GPSPositionData * GpsData, char * sentence); static bool nmeaProcessGPRMC (GPSPositionData * GpsData, char * sentence);
static bool nmeaProcessGPVTG (GPSPositionData * GpsData, char * sentence); static bool nmeaProcessGPVTG (GPSPositionData * GpsData, char * sentence);
static bool nmeaProcessGPGSA (GPSPositionData * GpsData, char * sentence); static bool nmeaProcessGPGSA (GPSPositionData * GpsData, char * sentence);
static bool nmeaProcessGPZDA (GPSPositionData * GpsData, char * sentence);
static struct nmea_parser nmea_parsers[] = { static struct nmea_parser nmea_parsers[] = {
{ {
@ -46,6 +48,10 @@ static struct nmea_parser nmea_parsers[] = {
.prefix = "GPRMC", .prefix = "GPRMC",
.handler = nmeaProcessGPRMC, .handler = nmeaProcessGPRMC,
}, },
{
.prefix = "GPZDA",
.handler = nmeaProcessGPZDA,
},
}; };
@ -244,14 +250,20 @@ static bool nmeaProcessGPRMC (GPSPositionData * GpsData, char * sentence)
char * next = sentence; char * next = sentence;
char * tokens; char * tokens;
char * delimiter = ",*"; char * delimiter = ",*";
GPSTimeData gpst;
GPSTimeGet(&gpst);
#ifdef NMEA_DEBUG_RMC #ifdef NMEA_DEBUG_RMC
PIOS_COM_SendFormattedStringNonBlocking(COM_DEBUG_USART,"$%s\r\n",sentence); PIOS_COM_SendFormattedStringNonBlocking(COM_DEBUG_USART,"$%s\r\n",sentence);
#endif #endif
// get UTC time [hhmmss.sss] // get UTC time [hhmmss.sss]
tokens = strsep(&next, delimiter); tokens = strsep(&next, delimiter);
float hms = NMEA_real_to_float(tokens);
gpst.Second = (int) hms % 100;
gpst.Minute = (((int) hms - gpst.Second) / 100) % 100;
gpst.Hour = (int) hms / 10000;
// next field: Navigation receiver warning A = OK, V = warning // next field: Navigation receiver warning A = OK, V = warning
tokens = strsep(&next, delimiter); tokens = strsep(&next, delimiter);
@ -293,7 +305,13 @@ static bool nmeaProcessGPRMC (GPSPositionData * GpsData, char * sentence)
// next field: Date of fix // next field: Date of fix
// get Date of fix // get Date of fix
tokens = strsep(&next, delimiter); tokens = strsep(&next, delimiter);
// TODO: Should really not use a float here to be safe
float date = NMEA_real_to_float(tokens);
gpst.Year = (int) date % 100;
gpst.Month = (((int) date - gpst.Year) / 100) % 100;
gpst.Day = (int) (date / 10000);
gpst.Year += 2000;
// next field: Magnetic variation // next field: Magnetic variation
tokens = strsep(&next, delimiter); tokens = strsep(&next, delimiter);
@ -305,7 +323,8 @@ static bool nmeaProcessGPRMC (GPSPositionData * GpsData, char * sentence)
// next field: checksum // next field: checksum
tokens = strsep(&next, delimiter); tokens = strsep(&next, delimiter);
GPSTimeSet(&gpst);
return true; return true;
} }
@ -356,6 +375,45 @@ static bool nmeaProcessGPVTG (GPSPositionData * GpsData, char * sentence)
return true; return true;
} }
/**
* Parse an NMEA GPZDA sentence and update the @ref GPSTime object
* \param[in] A pointer to a GPSPosition UAVObject to be updated (unused).
* \param[in] An NMEA sentence with a valid checksum
*/
static bool nmeaProcessGPZDA (GPSPositionData * GpsData, char * sentence)
{
char * next = sentence;
char * tokens;
char * delimiter = ",*";
#ifdef NMEA_DEBUG_VTG
PIOS_COM_SendFormattedStringNonBlocking(COM_DEBUG_USART,"$%s\r\n",sentence);
#endif
GPSTimeData gpst;
GPSTimeGet(&gpst);
tokens = strsep(&next, delimiter);
float hms = NMEA_real_to_float(tokens);
gpst.Second = (int) hms % 100;
gpst.Minute = (((int) hms - gpst.Second) / 100) % 100;
gpst.Hour = (int) hms / 10000;
tokens = strsep(&next, delimiter);
gpst.Day = (uint8_t) NMEA_real_to_float(next);
tokens = strsep(&next, delimiter);
gpst.Month = (uint8_t) NMEA_real_to_float(next);
tokens = strsep(&next, delimiter);
gpst.Year = (uint16_t) NMEA_real_to_float(next);
GPSTimeSet(&gpst);
return true;
}
/** /**
* Parse an NMEA GPGSA sentence and update the given UAVObject * Parse an NMEA GPGSA sentence and update the given UAVObject
* \param[in] A pointer to a GPSPosition UAVObject to be updated. * \param[in] A pointer to a GPSPosition UAVObject to be updated.

View File

@ -41,7 +41,7 @@
#define POSITIONACTUAL_H #define POSITIONACTUAL_H
// Object constants // Object constants
#define POSITIONACTUAL_OBJID 1265479538U #define POSITIONACTUAL_OBJID 2253458392U
#define POSITIONACTUAL_NAME "PositionActual" #define POSITIONACTUAL_NAME "PositionActual"
#define POSITIONACTUAL_METANAME "PositionActualMeta" #define POSITIONACTUAL_METANAME "PositionActualMeta"
#define POSITIONACTUAL_ISSINGLEINST 1 #define POSITIONACTUAL_ISSINGLEINST 1
@ -82,6 +82,8 @@ typedef struct {
float PDOP; float PDOP;
float HDOP; float HDOP;
float VDOP; float VDOP;
float NED[3];
float Vel[3];
} __attribute__((packed)) PositionActualData; } __attribute__((packed)) PositionActualData;
@ -99,6 +101,12 @@ typedef enum { POSITIONACTUAL_STATUS_NOGPS=0, POSITIONACTUAL_STATUS_NOFIX=1, POS
// Field PDOP information // Field PDOP information
// Field HDOP information // Field HDOP information
// Field VDOP information // Field VDOP information
// Field NED information
/* Number of elements for field NED */
#define POSITIONACTUAL_NED_NUMELEM 3
// Field Vel information
/* Number of elements for field Vel */
#define POSITIONACTUAL_VEL_NUMELEM 3
// Generic interface functions // Generic interface functions

View File

@ -46,6 +46,7 @@
#include "flighttelemetrystats.h" #include "flighttelemetrystats.h"
#include "gcstelemetrystats.h" #include "gcstelemetrystats.h"
#include "gpsposition.h" #include "gpsposition.h"
#include "gpstime.h"
#include "homelocation.h" #include "homelocation.h"
#include "manualcontrolcommand.h" #include "manualcontrolcommand.h"
#include "manualcontrolsettings.h" #include "manualcontrolsettings.h"
@ -84,6 +85,7 @@ void UAVObjectsInitializeAll()
FlightTelemetryStatsInitialize(); FlightTelemetryStatsInitialize();
GCSTelemetryStatsInitialize(); GCSTelemetryStatsInitialize();
GPSPositionInitialize(); GPSPositionInitialize();
GPSTimeInitialize();
HomeLocationInitialize(); HomeLocationInitialize();
ManualControlCommandInitialize(); ManualControlCommandInitialize();
ManualControlSettingsInitialize(); ManualControlSettingsInitialize();

View File

@ -22,6 +22,9 @@
651CF9F3120B700D00EEFD70 /* usb_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = usb_conf.h; sourceTree = "<group>"; }; 651CF9F3120B700D00EEFD70 /* usb_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = usb_conf.h; sourceTree = "<group>"; };
65209A1812208B0600453371 /* baroaltitude.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = baroaltitude.xml; sourceTree = "<group>"; }; 65209A1812208B0600453371 /* baroaltitude.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = baroaltitude.xml; sourceTree = "<group>"; };
65209A1912208B0600453371 /* gpsposition.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = gpsposition.xml; sourceTree = "<group>"; }; 65209A1912208B0600453371 /* gpsposition.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = gpsposition.xml; sourceTree = "<group>"; };
65322D2F12283CCD0046CD7C /* NMEA.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = NMEA.c; sourceTree = "<group>"; };
65322D3012283CD60046CD7C /* NMEA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NMEA.h; sourceTree = "<group>"; };
65322D3B122841F60046CD7C /* gpstime.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = gpstime.xml; sourceTree = "<group>"; };
654330231218E9780063F913 /* insgps.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = insgps.c; path = ../../AHRS/insgps.c; sourceTree = SOURCE_ROOT; }; 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>"; }; 6543304F121980300063F913 /* insgps.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = insgps.h; sourceTree = "<group>"; };
655268BC121FBD2900410C6E /* ahrscalibration.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = ahrscalibration.xml; sourceTree = "<group>"; }; 655268BC121FBD2900410C6E /* ahrscalibration.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = ahrscalibration.xml; sourceTree = "<group>"; };
@ -2648,10 +2651,8 @@
65E8EF8211EEA61E00BBF654 /* actuatordesired.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = actuatordesired.h; path = ../../OpenPilot/UAVObjects/inc/actuatordesired.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; }; 65E8EF8311EEA61E00BBF654 /* actuatorsettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = actuatorsettings.h; path = ../../OpenPilot/UAVObjects/inc/actuatorsettings.h; sourceTree = SOURCE_ROOT; };
65E8EF8411EEA61E00BBF654 /* ahrsstatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ahrsstatus.h; path = ../../OpenPilot/UAVObjects/inc/ahrsstatus.h; sourceTree = SOURCE_ROOT; }; 65E8EF8411EEA61E00BBF654 /* ahrsstatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ahrsstatus.h; path = ../../OpenPilot/UAVObjects/inc/ahrsstatus.h; sourceTree = SOURCE_ROOT; };
65E8EF8511EEA61E00BBF654 /* altitudeactual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = altitudeactual.h; path = ../../OpenPilot/UAVObjects/inc/altitudeactual.h; sourceTree = SOURCE_ROOT; };
65E8EF8611EEA61E00BBF654 /* attitudeactual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = attitudeactual.h; path = ../../OpenPilot/UAVObjects/inc/attitudeactual.h; sourceTree = SOURCE_ROOT; }; 65E8EF8611EEA61E00BBF654 /* attitudeactual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = attitudeactual.h; path = ../../OpenPilot/UAVObjects/inc/attitudeactual.h; sourceTree = SOURCE_ROOT; };
65E8EF8711EEA61E00BBF654 /* attitudedesired.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = attitudedesired.h; path = ../../OpenPilot/UAVObjects/inc/attitudedesired.h; sourceTree = SOURCE_ROOT; }; 65E8EF8711EEA61E00BBF654 /* attitudedesired.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = attitudedesired.h; path = ../../OpenPilot/UAVObjects/inc/attitudedesired.h; sourceTree = SOURCE_ROOT; };
65E8EF8811EEA61E00BBF654 /* attitudesettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = attitudesettings.h; path = ../../OpenPilot/UAVObjects/inc/attitudesettings.h; sourceTree = SOURCE_ROOT; };
65E8EF8911EEA61E00BBF654 /* eventdispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = eventdispatcher.h; path = ../../OpenPilot/UAVObjects/inc/eventdispatcher.h; sourceTree = SOURCE_ROOT; }; 65E8EF8911EEA61E00BBF654 /* eventdispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = eventdispatcher.h; path = ../../OpenPilot/UAVObjects/inc/eventdispatcher.h; sourceTree = SOURCE_ROOT; };
65E8EF8A11EEA61E00BBF654 /* exampleobject1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = exampleobject1.h; path = ../../OpenPilot/UAVObjects/inc/exampleobject1.h; sourceTree = SOURCE_ROOT; }; 65E8EF8A11EEA61E00BBF654 /* exampleobject1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = exampleobject1.h; path = ../../OpenPilot/UAVObjects/inc/exampleobject1.h; sourceTree = SOURCE_ROOT; };
65E8EF8B11EEA61E00BBF654 /* exampleobject2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = exampleobject2.h; path = ../../OpenPilot/UAVObjects/inc/exampleobject2.h; sourceTree = SOURCE_ROOT; }; 65E8EF8B11EEA61E00BBF654 /* exampleobject2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = exampleobject2.h; path = ../../OpenPilot/UAVObjects/inc/exampleobject2.h; sourceTree = SOURCE_ROOT; };
@ -2659,7 +2660,6 @@
65E8EF8D11EEA61E00BBF654 /* flightbatterystate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = flightbatterystate.h; path = ../../OpenPilot/UAVObjects/inc/flightbatterystate.h; sourceTree = SOURCE_ROOT; }; 65E8EF8D11EEA61E00BBF654 /* flightbatterystate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = flightbatterystate.h; path = ../../OpenPilot/UAVObjects/inc/flightbatterystate.h; sourceTree = SOURCE_ROOT; };
65E8EF8E11EEA61E00BBF654 /* flighttelemetrystats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = flighttelemetrystats.h; path = ../../OpenPilot/UAVObjects/inc/flighttelemetrystats.h; sourceTree = SOURCE_ROOT; }; 65E8EF8E11EEA61E00BBF654 /* flighttelemetrystats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = flighttelemetrystats.h; path = ../../OpenPilot/UAVObjects/inc/flighttelemetrystats.h; sourceTree = SOURCE_ROOT; };
65E8EF8F11EEA61E00BBF654 /* gcstelemetrystats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = gcstelemetrystats.h; path = ../../OpenPilot/UAVObjects/inc/gcstelemetrystats.h; sourceTree = SOURCE_ROOT; }; 65E8EF8F11EEA61E00BBF654 /* gcstelemetrystats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = gcstelemetrystats.h; path = ../../OpenPilot/UAVObjects/inc/gcstelemetrystats.h; sourceTree = SOURCE_ROOT; };
65E8EF9011EEA61E00BBF654 /* headingactual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = headingactual.h; path = ../../OpenPilot/UAVObjects/inc/headingactual.h; sourceTree = SOURCE_ROOT; };
65E8EF9111EEA61E00BBF654 /* manualcontrolcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = manualcontrolcommand.h; path = ../../OpenPilot/UAVObjects/inc/manualcontrolcommand.h; sourceTree = SOURCE_ROOT; }; 65E8EF9111EEA61E00BBF654 /* manualcontrolcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = manualcontrolcommand.h; path = ../../OpenPilot/UAVObjects/inc/manualcontrolcommand.h; sourceTree = SOURCE_ROOT; };
65E8EF9211EEA61E00BBF654 /* manualcontrolsettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = manualcontrolsettings.h; path = ../../OpenPilot/UAVObjects/inc/manualcontrolsettings.h; sourceTree = SOURCE_ROOT; }; 65E8EF9211EEA61E00BBF654 /* manualcontrolsettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = manualcontrolsettings.h; path = ../../OpenPilot/UAVObjects/inc/manualcontrolsettings.h; sourceTree = SOURCE_ROOT; };
65E8EF9311EEA61E00BBF654 /* objectpersistence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = objectpersistence.h; path = ../../OpenPilot/UAVObjects/inc/objectpersistence.h; sourceTree = SOURCE_ROOT; }; 65E8EF9311EEA61E00BBF654 /* objectpersistence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = objectpersistence.h; path = ../../OpenPilot/UAVObjects/inc/objectpersistence.h; sourceTree = SOURCE_ROOT; };
@ -6687,6 +6687,7 @@
65B367F2121C2620003EAD18 /* flighttelemetrystats.xml */, 65B367F2121C2620003EAD18 /* flighttelemetrystats.xml */,
65B367F3121C2620003EAD18 /* gcstelemetrystats.xml */, 65B367F3121C2620003EAD18 /* gcstelemetrystats.xml */,
65209A1912208B0600453371 /* gpsposition.xml */, 65209A1912208B0600453371 /* gpsposition.xml */,
65322D3B122841F60046CD7C /* gpstime.xml */,
657CEEAD121DB6C8007A1FBE /* homelocation.xml */, 657CEEAD121DB6C8007A1FBE /* homelocation.xml */,
65B367F4121C2620003EAD18 /* manualcontrolcommand.xml */, 65B367F4121C2620003EAD18 /* manualcontrolcommand.xml */,
65B367F5121C2620003EAD18 /* manualcontrolsettings.xml */, 65B367F5121C2620003EAD18 /* manualcontrolsettings.xml */,
@ -6886,6 +6887,7 @@
65E8EF3D11EEA61E00BBF654 /* GPS */ = { 65E8EF3D11EEA61E00BBF654 /* GPS */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
65322D2F12283CCD0046CD7C /* NMEA.c */,
65E8EF3F11EEA61E00BBF654 /* GPS.c */, 65E8EF3F11EEA61E00BBF654 /* GPS.c */,
65E8EF4011EEA61E00BBF654 /* inc */, 65E8EF4011EEA61E00BBF654 /* inc */,
); );
@ -6896,6 +6898,7 @@
65E8EF4011EEA61E00BBF654 /* inc */ = { 65E8EF4011EEA61E00BBF654 /* inc */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
65322D3012283CD60046CD7C /* NMEA.h */,
65E8EF4211EEA61E00BBF654 /* GPS.h */, 65E8EF4211EEA61E00BBF654 /* GPS.h */,
); );
name = inc; name = inc;
@ -7116,10 +7119,8 @@
65E8EF8211EEA61E00BBF654 /* actuatordesired.h */, 65E8EF8211EEA61E00BBF654 /* actuatordesired.h */,
65E8EF8311EEA61E00BBF654 /* actuatorsettings.h */, 65E8EF8311EEA61E00BBF654 /* actuatorsettings.h */,
65E8EF8411EEA61E00BBF654 /* ahrsstatus.h */, 65E8EF8411EEA61E00BBF654 /* ahrsstatus.h */,
65E8EF8511EEA61E00BBF654 /* altitudeactual.h */,
65E8EF8611EEA61E00BBF654 /* attitudeactual.h */, 65E8EF8611EEA61E00BBF654 /* attitudeactual.h */,
65E8EF8711EEA61E00BBF654 /* attitudedesired.h */, 65E8EF8711EEA61E00BBF654 /* attitudedesired.h */,
65E8EF8811EEA61E00BBF654 /* attitudesettings.h */,
65E8EF8911EEA61E00BBF654 /* eventdispatcher.h */, 65E8EF8911EEA61E00BBF654 /* eventdispatcher.h */,
65E8EF8A11EEA61E00BBF654 /* exampleobject1.h */, 65E8EF8A11EEA61E00BBF654 /* exampleobject1.h */,
65E8EF8B11EEA61E00BBF654 /* exampleobject2.h */, 65E8EF8B11EEA61E00BBF654 /* exampleobject2.h */,
@ -7127,7 +7128,6 @@
65E8EF8D11EEA61E00BBF654 /* flightbatterystate.h */, 65E8EF8D11EEA61E00BBF654 /* flightbatterystate.h */,
65E8EF8E11EEA61E00BBF654 /* flighttelemetrystats.h */, 65E8EF8E11EEA61E00BBF654 /* flighttelemetrystats.h */,
65E8EF8F11EEA61E00BBF654 /* gcstelemetrystats.h */, 65E8EF8F11EEA61E00BBF654 /* gcstelemetrystats.h */,
65E8EF9011EEA61E00BBF654 /* headingactual.h */,
65E8EF9111EEA61E00BBF654 /* manualcontrolcommand.h */, 65E8EF9111EEA61E00BBF654 /* manualcontrolcommand.h */,
65E8EF9211EEA61E00BBF654 /* manualcontrolsettings.h */, 65E8EF9211EEA61E00BBF654 /* manualcontrolsettings.h */,
65E8EF9311EEA61E00BBF654 /* objectpersistence.h */, 65E8EF9311EEA61E00BBF654 /* objectpersistence.h */,

View File

@ -80,6 +80,16 @@ PositionActual::PositionActual(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS,
QStringList VDOPElemNames; QStringList VDOPElemNames;
VDOPElemNames.append("0"); VDOPElemNames.append("0");
fields.append( new UAVObjectField(QString("VDOP"), QString(""), UAVObjectField::FLOAT32, VDOPElemNames, QStringList()) ); fields.append( new UAVObjectField(QString("VDOP"), QString(""), UAVObjectField::FLOAT32, VDOPElemNames, QStringList()) );
QStringList NEDElemNames;
NEDElemNames.append("0");
NEDElemNames.append("1");
NEDElemNames.append("2");
fields.append( new UAVObjectField(QString("NED"), QString("m"), UAVObjectField::FLOAT32, NEDElemNames, QStringList()) );
QStringList VelElemNames;
VelElemNames.append("0");
VelElemNames.append("1");
VelElemNames.append("2");
fields.append( new UAVObjectField(QString("Vel"), QString("m"), UAVObjectField::FLOAT32, VelElemNames, QStringList()) );
// Initialize object // Initialize object
initializeFields(fields, (quint8*)&data, NUMBYTES); initializeFields(fields, (quint8*)&data, NUMBYTES);

View File

@ -54,6 +54,8 @@ public:
float PDOP; float PDOP;
float HDOP; float HDOP;
float VDOP; float VDOP;
float NED[3];
float Vel[3];
} __attribute__((packed)) DataFields; } __attribute__((packed)) DataFields;
@ -71,10 +73,16 @@ public:
// Field PDOP information // Field PDOP information
// Field HDOP information // Field HDOP information
// Field VDOP information // Field VDOP information
// Field NED information
/* Number of elements for field NED */
static const quint32 NED_NUMELEM = 3;
// Field Vel information
/* Number of elements for field Vel */
static const quint32 VEL_NUMELEM = 3;
// Constants // Constants
static const quint32 OBJID = 1265479538U; static const quint32 OBJID = 2253458392U;
static const QString NAME; static const QString NAME;
static const bool ISSINGLEINST = 1; static const bool ISSINGLEINST = 1;
static const bool ISSETTINGS = 0; static const bool ISSETTINGS = 0;

View File

@ -151,12 +151,36 @@ _fields = [ \
{ {
} }
), ),
uavobject.UAVObjectField(
'NED',
'f',
3,
[
'0',
'1',
'2',
],
{
}
),
uavobject.UAVObjectField(
'Vel',
'f',
3,
[
'0',
'1',
'2',
],
{
}
),
] ]
class PositionActual(uavobject.UAVObject): class PositionActual(uavobject.UAVObject):
## Object constants ## Object constants
OBJID = 1265479538 OBJID = 2253458392
NAME = "PositionActual" NAME = "PositionActual"
METANAME = "PositionActualMeta" METANAME = "PositionActualMeta"
ISSINGLEINST = 1 ISSINGLEINST = 1

View File

@ -38,6 +38,7 @@ HEADERS += uavobjects_global.h \
navigationsettings.h \ navigationsettings.h \
navigationdesired.h \ navigationdesired.h \
gpsposition.h \ gpsposition.h \
gpstime.h \
positionactual.h \ positionactual.h \
flightbatterystate.h \ flightbatterystate.h \
homelocation.h homelocation.h
@ -75,6 +76,7 @@ SOURCES += uavobject.cpp \
navigationsettings.cpp \ navigationsettings.cpp \
navigationdesired.cpp \ navigationdesired.cpp \
gpsposition.cpp \ gpsposition.cpp \
gpstime.cpp \
positionactual.cpp \ positionactual.cpp \
flightbatterystate.cpp \ flightbatterystate.cpp \
homelocation.cpp homelocation.cpp

View File

@ -48,6 +48,7 @@
#include "flighttelemetrystats.h" #include "flighttelemetrystats.h"
#include "gcstelemetrystats.h" #include "gcstelemetrystats.h"
#include "gpsposition.h" #include "gpsposition.h"
#include "gpstime.h"
#include "homelocation.h" #include "homelocation.h"
#include "manualcontrolcommand.h" #include "manualcontrolcommand.h"
#include "manualcontrolsettings.h" #include "manualcontrolsettings.h"
@ -86,6 +87,7 @@ void UAVObjectsInitialize(UAVObjectManager* objMngr)
objMngr->registerObject( new FlightTelemetryStats() ); objMngr->registerObject( new FlightTelemetryStats() );
objMngr->registerObject( new GCSTelemetryStats() ); objMngr->registerObject( new GCSTelemetryStats() );
objMngr->registerObject( new GPSPosition() ); objMngr->registerObject( new GPSPosition() );
objMngr->registerObject( new GPSTime() );
objMngr->registerObject( new HomeLocation() ); objMngr->registerObject( new HomeLocation() );
objMngr->registerObject( new ManualControlCommand() ); objMngr->registerObject( new ManualControlCommand() );
objMngr->registerObject( new ManualControlSettings() ); objMngr->registerObject( new ManualControlSettings() );

View File

@ -12,6 +12,8 @@
<field name="PDOP" units="" type="float" elements="1"/> <field name="PDOP" units="" type="float" elements="1"/>
<field name="HDOP" units="" type="float" elements="1"/> <field name="HDOP" units="" type="float" elements="1"/>
<field name="VDOP" units="" type="float" elements="1"/> <field name="VDOP" units="" type="float" elements="1"/>
<field name="NED" units="m" type="float" elements="3"/>
<field name="Vel" units="m" type="float" elements="3"/>
<access gcs="readwrite" flight="readwrite"/> <access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="false" updatemode="manual" period="0"/> <telemetrygcs acked="false" updatemode="manual" period="0"/>
<telemetryflight acked="false" updatemode="periodic" period="1000"/> <telemetryflight acked="false" updatemode="periodic" period="1000"/>