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

refaktored GPS Sensor UAVObjects

This commit is contained in:
Corvus Corax 2013-05-22 21:45:06 +02:00
parent b56de3b66b
commit 9b95af2006
51 changed files with 295 additions and 253 deletions

View File

@ -32,7 +32,7 @@
#include "openpilot.h" #include "openpilot.h"
#include "gps_airspeed.h" #include "gps_airspeed.h"
#include "gpsvelocity.h" #include "gpsvelocitysensor.h"
#include "attitudestate.h" #include "attitudestate.h"
#include "CoordinateConversions.h" #include "CoordinateConversions.h"
#include <pios_math.h> #include <pios_math.h>
@ -66,8 +66,8 @@ void gps_airspeedInitialize()
gps = (struct GPSGlobals *)pvPortMalloc(sizeof(struct GPSGlobals)); gps = (struct GPSGlobals *)pvPortMalloc(sizeof(struct GPSGlobals));
// GPS airspeed calculation variables // GPS airspeed calculation variables
GPSVelocityData gpsVelData; GPSVelocitySensorData gpsVelData;
GPSVelocityGet(&gpsVelData); GPSVelocitySensorGet(&gpsVelData);
gps->gpsVelOld_N = gpsVelData.North; gps->gpsVelOld_N = gpsVelData.North;
gps->gpsVelOld_E = gpsVelData.East; gps->gpsVelOld_E = gpsVelData.East;
@ -115,8 +115,8 @@ void gps_airspeedGet(float *v_air_GPS)
// If there's more than a 5 degree difference between two fuselage measurements, then we have sufficient delta to continue. // If there's more than a 5 degree difference between two fuselage measurements, then we have sufficient delta to continue.
if (fabsf(cosDiff) < cosf(DEG2RAD(5.0f))) { if (fabsf(cosDiff) < cosf(DEG2RAD(5.0f))) {
GPSVelocityData gpsVelData; GPSVelocitySensorData gpsVelData;
GPSVelocityGet(&gpsVelData); GPSVelocitySensorGet(&gpsVelData);
// Calculate the norm^2 of the difference between the two GPS vectors // Calculate the norm^2 of the difference between the two GPS vectors
float normDiffGPS2 = powf(gpsVelData.North - gps->gpsVelOld_N, 2.0f) + powf(gpsVelData.East - gps->gpsVelOld_E, 2.0f) + powf(gpsVelData.Down - gps->gpsVelOld_D, 2.0f); float normDiffGPS2 = powf(gpsVelData.North - gps->gpsVelOld_N, 2.0f) + powf(gpsVelData.East - gps->gpsVelOld_E, 2.0f) + powf(gpsVelData.Down - gps->gpsVelOld_D, 2.0f);

View File

@ -59,8 +59,8 @@
#include "attitudesettings.h" #include "attitudesettings.h"
#include "barosensor.h" #include "barosensor.h"
#include "flightstatus.h" #include "flightstatus.h"
#include "gpsposition.h" #include "gpspositionsensor.h"
#include "gpsvelocity.h" #include "gpsvelocitysensor.h"
#include "gyrostate.h" #include "gyrostate.h"
#include "gyrosensor.h" #include "gyrosensor.h"
#include "homelocation.h" #include "homelocation.h"
@ -123,7 +123,7 @@ static int32_t updateAttitudeComplementary(bool first_run);
static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode); static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode);
static void settingsUpdatedCb(UAVObjEvent *objEv); static void settingsUpdatedCb(UAVObjEvent *objEv);
static int32_t getNED(GPSPositionData *gpsPosition, float *NED); static int32_t getNED(GPSPositionSensorData *gpsPosition, float *NED);
static void magOffsetEstimation(MagSensorData *mag); static void magOffsetEstimation(MagSensorData *mag);
@ -172,8 +172,8 @@ int32_t AttitudeInitialize(void)
AirspeedSensorInitialize(); AirspeedSensorInitialize();
AirspeedStateInitialize(); AirspeedStateInitialize();
BaroSensorInitialize(); BaroSensorInitialize();
GPSPositionInitialize(); GPSPositionSensorInitialize();
GPSVelocityInitialize(); GPSVelocitySensorInitialize();
AttitudeSettingsInitialize(); AttitudeSettingsInitialize();
AttitudeStateInitialize(); AttitudeStateInitialize();
PositionStateInitialize(); PositionStateInitialize();
@ -233,8 +233,8 @@ int32_t AttitudeStart(void)
MagSensorConnectQueue(magQueue); MagSensorConnectQueue(magQueue);
AirspeedSensorConnectQueue(airspeedQueue); AirspeedSensorConnectQueue(airspeedQueue);
BaroSensorConnectQueue(baroQueue); BaroSensorConnectQueue(baroQueue);
GPSPositionConnectQueue(gpsQueue); GPSPositionSensorConnectQueue(gpsQueue);
GPSVelocityConnectQueue(gpsVelQueue); GPSVelocitySensorConnectQueue(gpsVelQueue);
return 0; return 0;
} }
@ -541,8 +541,8 @@ static int32_t updateAttitudeComplementary(bool first_run)
if (xQueueReceive(gpsQueue, &ev, 0) == pdTRUE && homeLocation.Set == HOMELOCATION_SET_TRUE) { if (xQueueReceive(gpsQueue, &ev, 0) == pdTRUE && homeLocation.Set == HOMELOCATION_SET_TRUE) {
float NED[3]; float NED[3];
// Transform the GPS position into NED coordinates // Transform the GPS position into NED coordinates
GPSPositionData gpsPosition; GPSPositionSensorData gpsPosition;
GPSPositionGet(&gpsPosition); GPSPositionSensorGet(&gpsPosition);
getNED(&gpsPosition, NED); getNED(&gpsPosition, NED);
PositionStateData positionState; PositionStateData positionState;
@ -555,8 +555,8 @@ static int32_t updateAttitudeComplementary(bool first_run)
if (xQueueReceive(gpsVelQueue, &ev, 0) == pdTRUE) { if (xQueueReceive(gpsVelQueue, &ev, 0) == pdTRUE) {
// Transform the GPS position into NED coordinates // Transform the GPS position into NED coordinates
GPSVelocityData gpsVelocity; GPSVelocitySensorData gpsVelocity;
GPSVelocityGet(&gpsVelocity); GPSVelocitySensorGet(&gpsVelocity);
VelocityStateData velocityState; VelocityStateData velocityState;
VelocityStateGet(&velocityState); VelocityStateGet(&velocityState);
@ -615,8 +615,8 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode)
MagStateData magData; MagStateData magData;
AirspeedSensorData airspeedData; AirspeedSensorData airspeedData;
BaroSensorData baroData; BaroSensorData baroData;
GPSPositionData gpsData; GPSPositionSensorData gpsData;
GPSVelocityData gpsVelData; GPSVelocitySensorData gpsVelData;
static bool mag_updated = false; static bool mag_updated = false;
static bool baro_updated; static bool baro_updated;
@ -677,13 +677,13 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode)
airspeed_updated |= xQueueReceive(airspeedQueue, &ev, 0 / portTICK_RATE_MS) == pdTRUE; airspeed_updated |= xQueueReceive(airspeedQueue, &ev, 0 / portTICK_RATE_MS) == pdTRUE;
// Check if we are running simulation // Check if we are running simulation
if (!GPSPositionReadOnly()) { if (!GPSPositionSensorReadOnly()) {
gps_updated |= (xQueueReceive(gpsQueue, &ev, 0 / portTICK_RATE_MS) == pdTRUE) && outdoor_mode; gps_updated |= (xQueueReceive(gpsQueue, &ev, 0 / portTICK_RATE_MS) == pdTRUE) && outdoor_mode;
} else { } else {
gps_updated |= pdTRUE && outdoor_mode; gps_updated |= pdTRUE && outdoor_mode;
} }
if (!GPSVelocityReadOnly()) { if (!GPSVelocitySensorReadOnly()) {
gps_vel_updated |= (xQueueReceive(gpsVelQueue, &ev, 0 / portTICK_RATE_MS) == pdTRUE) && outdoor_mode; gps_vel_updated |= (xQueueReceive(gpsVelQueue, &ev, 0 / portTICK_RATE_MS) == pdTRUE) && outdoor_mode;
} else { } else {
gps_vel_updated |= pdTRUE && outdoor_mode; gps_vel_updated |= pdTRUE && outdoor_mode;
@ -708,8 +708,8 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode)
BaroSensorGet(&baroData); BaroSensorGet(&baroData);
AirspeedSensorGet(&airspeedData); AirspeedSensorGet(&airspeedData);
GPSPositionGet(&gpsData); GPSPositionSensorGet(&gpsData);
GPSVelocityGet(&gpsVelData); GPSVelocitySensorGet(&gpsVelData);
// TODO: put in separate filter // TODO: put in separate filter
AccelStateData accelState; AccelStateData accelState;
@ -845,8 +845,8 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode)
float pos[3] = { 0.0f, 0.0f, 0.0f }; float pos[3] = { 0.0f, 0.0f, 0.0f };
if (outdoor_mode) { if (outdoor_mode) {
GPSPositionData gpsPosition; GPSPositionSensorData gpsPosition;
GPSPositionGet(&gpsPosition); GPSPositionSensorGet(&gpsPosition);
// Transform the GPS position into NED coordinates // Transform the GPS position into NED coordinates
getNED(&gpsPosition, pos); getNED(&gpsPosition, pos);
@ -1074,7 +1074,7 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode)
* @returns 0 for success, -1 for failure * @returns 0 for success, -1 for failure
*/ */
float T[3]; float T[3];
static int32_t getNED(GPSPositionData *gpsPosition, float *NED) static int32_t getNED(GPSPositionSensorData *gpsPosition, float *NED)
{ {
float dL[3] = { DEG2RAD((gpsPosition->Latitude - homeLocation.Latitude) / 10.0e6f), float dL[3] = { DEG2RAD((gpsPosition->Latitude - homeLocation.Latitude) / 10.0e6f),
DEG2RAD((gpsPosition->Longitude - homeLocation.Longitude) / 10.0e6f), DEG2RAD((gpsPosition->Longitude - homeLocation.Longitude) / 10.0e6f),

View File

@ -53,8 +53,6 @@
#include "flightstatus.h" #include "flightstatus.h"
#include "pathstatus.h" #include "pathstatus.h"
#include "airspeedstate.h" #include "airspeedstate.h"
#include "gpsvelocity.h"
#include "gpsposition.h"
#include "fixedwingpathfollowersettings.h" #include "fixedwingpathfollowersettings.h"
#include "fixedwingpathfollowerstatus.h" #include "fixedwingpathfollowerstatus.h"
#include "homelocation.h" #include "homelocation.h"

View File

@ -32,11 +32,12 @@
#include <openpilot.h> #include <openpilot.h>
#include "gpsposition.h" #include "gpspositionsensor.h"
#include "homelocation.h" #include "homelocation.h"
#include "positionsensor.h"
#include "gpstime.h" #include "gpstime.h"
#include "gpssatellites.h" #include "gpssatellites.h"
#include "gpsvelocity.h" #include "gpsvelocitysensor.h"
#include "systemsettings.h" #include "systemsettings.h"
#include "taskinfo.h" #include "taskinfo.h"
#include "hwsettings.h" #include "hwsettings.h"
@ -56,9 +57,12 @@ static void gpsTask(void *parameters);
static void updateSettings(); static void updateSettings();
#ifdef PIOS_GPS_SETS_HOMELOCATION #ifdef PIOS_GPS_SETS_HOMELOCATION
static void setHomeLocation(GPSPositionData *gpsData); static void setHomeLocation(GPSPositionSensorData *gpsData);
static float GravityAccel(float latitude, float longitude, float altitude); static float GravityAccel(float latitude, float longitude, float altitude);
#endif #endif
#ifdef PIOS_GPS_SETS_POSITIONSENSOR
static void setPositionSensor(GPSPositionSensorData *gpsData);
#endif
// **************** // ****************
// Private constants // Private constants
@ -147,23 +151,27 @@ int32_t GPSInitialize(void)
// These objects MUST be initialized for Revolution // These objects MUST be initialized for Revolution
// because the rest of the system expects to just // because the rest of the system expects to just
// attach to their queues // attach to their queues
GPSPositionInitialize(); GPSPositionSensorInitialize();
GPSVelocityInitialize(); GPSVelocitySensorInitialize();
GPSTimeInitialize(); GPSTimeInitialize();
GPSSatellitesInitialize(); GPSSatellitesInitialize();
HomeLocationInitialize(); HomeLocationInitialize();
PositionSensorInitialize();
updateSettings(); updateSettings();
#else #else
if (gpsPort && gpsEnabled) { if (gpsPort && gpsEnabled) {
GPSPositionInitialize(); GPSPositionSensorInitialize();
GPSVelocityInitialize(); GPSVelocitySensorInitialize();
#if !defined(PIOS_GPS_MINIMAL) #if !defined(PIOS_GPS_MINIMAL)
GPSTimeInitialize(); GPSTimeInitialize();
GPSSatellitesInitialize(); GPSSatellitesInitialize();
#endif #endif
#ifdef PIOS_GPS_SETS_HOMELOCATION #if (defined(PIOS_GPS_SETS_HOMELOCATION) || defined(PIOS_GPS_SETS_POSITIONSENSOR))
HomeLocationInitialize(); HomeLocationInitialize();
#endif
#ifdef PIOS_GPS_SETS_POSITIONSENSOR
PositionSensorInitialize();
#endif #endif
updateSettings(); updateSettings();
} }
@ -202,7 +210,7 @@ static void gpsTask(__attribute__((unused)) void *parameters)
portTickType xDelay = 100 / portTICK_RATE_MS; portTickType xDelay = 100 / portTICK_RATE_MS;
uint32_t timeNowMs = xTaskGetTickCount() * portTICK_RATE_MS; uint32_t timeNowMs = xTaskGetTickCount() * portTICK_RATE_MS;
GPSPositionData gpsposition; GPSPositionSensorData gpspositionsensor;
uint8_t gpsProtocol; uint8_t gpsProtocol;
SystemSettingsGPSDataProtocolGet(&gpsProtocol); SystemSettingsGPSDataProtocolGet(&gpsProtocol);
@ -210,7 +218,7 @@ static void gpsTask(__attribute__((unused)) void *parameters)
timeOfLastUpdateMs = timeNowMs; timeOfLastUpdateMs = timeNowMs;
timeOfLastCommandMs = timeNowMs; timeOfLastCommandMs = timeNowMs;
GPSPositionGet(&gpsposition); GPSPositionSensorGet(&gpspositionsensor);
// Loop forever // Loop forever
while (1) { while (1) {
uint8_t c; uint8_t c;
@ -221,12 +229,12 @@ static void gpsTask(__attribute__((unused)) void *parameters)
switch (gpsProtocol) { switch (gpsProtocol) {
#if defined(PIOS_INCLUDE_GPS_NMEA_PARSER) #if defined(PIOS_INCLUDE_GPS_NMEA_PARSER)
case SYSTEMSETTINGS_GPSDATAPROTOCOL_NMEA: case SYSTEMSETTINGS_GPSDATAPROTOCOL_NMEA:
res = parse_nmea_stream(c, gps_rx_buffer, &gpsposition, &gpsRxStats); res = parse_nmea_stream(c, gps_rx_buffer, &gpspositionsensor, &gpsRxStats);
break; break;
#endif #endif
#if defined(PIOS_INCLUDE_GPS_UBX_PARSER) #if defined(PIOS_INCLUDE_GPS_UBX_PARSER)
case SYSTEMSETTINGS_GPSDATAPROTOCOL_UBX: case SYSTEMSETTINGS_GPSDATAPROTOCOL_UBX:
res = parse_ubx_stream(c, gps_rx_buffer, &gpsposition, &gpsRxStats); res = parse_ubx_stream(c, gps_rx_buffer, &gpspositionsensor, &gpsRxStats);
break; break;
#endif #endif
default: default:
@ -246,25 +254,28 @@ static void gpsTask(__attribute__((unused)) void *parameters)
if ((timeNowMs - timeOfLastUpdateMs) >= GPS_TIMEOUT_MS) { if ((timeNowMs - timeOfLastUpdateMs) >= GPS_TIMEOUT_MS) {
// we have not received any valid GPS sentences for a while. // we have not received any valid GPS sentences for a while.
// either the GPS is not plugged in or a hardware problem or the GPS has locked up. // either the GPS is not plugged in or a hardware problem or the GPS has locked up.
uint8_t status = GPSPOSITION_STATUS_NOGPS; uint8_t status = GPSPOSITIONSENSOR_STATUS_NOGPS;
GPSPositionStatusSet(&status); GPSPositionSensorStatusSet(&status);
AlarmsSet(SYSTEMALARMS_ALARM_GPS, SYSTEMALARMS_ALARM_ERROR); AlarmsSet(SYSTEMALARMS_ALARM_GPS, SYSTEMALARMS_ALARM_ERROR);
} else { } else {
// we appear to be receiving GPS sentences OK, we've had an update // we appear to be receiving GPS sentences OK, we've had an update
// criteria for GPS-OK taken from this post... // criteria for GPS-OK taken from this post...
// http://forums.openpilot.org/topic/1523-professors-insgps-in-svn/page__view__findpost__p__5220 // http://forums.openpilot.org/topic/1523-professors-insgps-in-svn/page__view__findpost__p__5220
if ((gpsposition.PDOP < 3.5f) && (gpsposition.Satellites >= 7) && if ((gpspositionsensor.PDOP < 3.5f) && (gpspositionsensor.Satellites >= 7) &&
(gpsposition.Status == GPSPOSITION_STATUS_FIX3D)) { (gpspositionsensor.Status == GPSPOSITIONSENSOR_STATUS_FIX3D)) {
AlarmsClear(SYSTEMALARMS_ALARM_GPS); AlarmsClear(SYSTEMALARMS_ALARM_GPS);
#ifdef PIOS_GPS_SETS_HOMELOCATION #ifdef PIOS_GPS_SETS_HOMELOCATION
HomeLocationData home; HomeLocationData home;
HomeLocationGet(&home); HomeLocationGet(&home);
if (home.Set == HOMELOCATION_SET_FALSE) { if (home.Set == HOMELOCATION_SET_FALSE) {
setHomeLocation(&gpsposition); setHomeLocation(&gpspositionsensor);
} }
#endif #endif
} else if (gpsposition.Status == GPSPOSITION_STATUS_FIX3D) { #ifdef PIOS_GPS_SETS_POSITIONSENSOR
setPositionSensor(&gpspositionsensor);
#endif
} else if (gpspositionsensor.Status == GPSPOSITIONSENSOR_STATUS_FIX3D) {
AlarmsSet(SYSTEMALARMS_ALARM_GPS, SYSTEMALARMS_ALARM_WARNING); AlarmsSet(SYSTEMALARMS_ALARM_GPS, SYSTEMALARMS_ALARM_WARNING);
} else { } else {
AlarmsSet(SYSTEMALARMS_ALARM_GPS, SYSTEMALARMS_ALARM_CRITICAL); AlarmsSet(SYSTEMALARMS_ALARM_GPS, SYSTEMALARMS_ALARM_CRITICAL);
@ -292,7 +303,7 @@ static float GravityAccel(float latitude, __attribute__((unused)) float longitud
// **************** // ****************
static void setHomeLocation(GPSPositionData *gpsData) static void setHomeLocation(GPSPositionSensorData *gpsData)
{ {
HomeLocationData home; HomeLocationData home;
@ -325,6 +336,32 @@ static void setHomeLocation(GPSPositionData *gpsData)
} }
#endif /* ifdef PIOS_GPS_SETS_HOMELOCATION */ #endif /* ifdef PIOS_GPS_SETS_HOMELOCATION */
#ifdef PIOS_GPS_SETS_POSITIONSENSOR
static void setPositionSensor(GPSPositionSensorData *gpsData)
{
HomeLocationData home;
HomeLocationGet(&home);
PositionSensorData pos;
PositionSensorGet(&pos);
float ECEF[3];
float Rne[3][3];
{
float LLA[3] = { home.Latitude, home.Longitude, home.Altitude };
LLA2ECEF(LLA, ECEF);
RneFromLLA(LLA, Rne);
}
{ float LLA[3] = { gpsData->Latitude, gpsData->Longitude, gpsData->Altitude + gpsData->GeoidSeparation };
float NED[3];
LLA2Base(LLA, ECEF, Rne, NED);
pos.North = NED[0];
pos.East = NED[1];
pos.Down = NED[2]; }
PositionSensorSet(&pos);
}
#endif /* ifdef PIOS_GPS_SETS_POSITIONSENSOR */
/** /**
* Update the GPS settings, called on startup. * Update the GPS settings, called on startup.
* FIXME: This should be in the GPSSettings object. But objects have * FIXME: This should be in the GPSSettings object. But objects have

View File

@ -33,7 +33,7 @@
#if defined(PIOS_INCLUDE_GPS_NMEA_PARSER) #if defined(PIOS_INCLUDE_GPS_NMEA_PARSER)
#include "gpsposition.h" #include "gpspositionsensor.h"
#include "NMEA.h" #include "NMEA.h"
#include "gpstime.h" #include "gpstime.h"
#include "gpssatellites.h" #include "gpssatellites.h"
@ -65,16 +65,16 @@
struct nmea_parser { struct nmea_parser {
const char *prefix; const char *prefix;
bool (*handler)(GPSPositionData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam); bool (*handler)(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam);
}; };
static bool nmeaProcessGPGGA(GPSPositionData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam); static bool nmeaProcessGPGGA(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam);
static bool nmeaProcessGPRMC(GPSPositionData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam); static bool nmeaProcessGPRMC(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam);
static bool nmeaProcessGPVTG(GPSPositionData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam); static bool nmeaProcessGPVTG(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam);
static bool nmeaProcessGPGSA(GPSPositionData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam); static bool nmeaProcessGPGSA(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam);
#if !defined(PIOS_GPS_MINIMAL) #if !defined(PIOS_GPS_MINIMAL)
static bool nmeaProcessGPZDA(GPSPositionData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam); static bool nmeaProcessGPZDA(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam);
static bool nmeaProcessGPGSV(GPSPositionData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam); static bool nmeaProcessGPGSV(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam);
#endif // PIOS_GPS_MINIMAL #endif // PIOS_GPS_MINIMAL
static const struct nmea_parser nmea_parsers[] = { static const struct nmea_parser nmea_parsers[] = {
@ -106,7 +106,7 @@ static const struct nmea_parser nmea_parsers[] = {
#endif // PIOS_GPS_MINIMAL #endif // PIOS_GPS_MINIMAL
}; };
int parse_nmea_stream(uint8_t c, char *gps_rx_buffer, GPSPositionData *GpsData, struct GPS_RX_STATS *gpsRxStats) int parse_nmea_stream(uint8_t c, char *gps_rx_buffer, GPSPositionSensorData *GpsData, struct GPS_RX_STATS *gpsRxStats)
{ {
static uint8_t rx_count = 0; static uint8_t rx_count = 0;
static bool start_flag = false; static bool start_flag = false;
@ -351,12 +351,12 @@ static bool NMEA_latlon_to_fixed_point(int32_t *latlon, char *nmea_latlon, bool
/** /**
* Parses a complete NMEA sentence and updates the GPSPosition UAVObject * Parses a complete NMEA sentence and updates the GPSPositionSensor UAVObject
* \param[in] An NMEA sentence with a valid checksum * \param[in] An NMEA sentence with a valid checksum
* \return true if the sentence was successfully parsed * \return true if the sentence was successfully parsed
* \return false if any errors were encountered with the parsing * \return false if any errors were encountered with the parsing
*/ */
bool NMEA_update_position(char *nmea_sentence, GPSPositionData *GpsData) bool NMEA_update_position(char *nmea_sentence, GPSPositionSensorData *GpsData)
{ {
char *p = nmea_sentence; char *p = nmea_sentence;
char *params[MAX_NB_PARAMS]; char *params[MAX_NB_PARAMS];
@ -412,7 +412,7 @@ bool NMEA_update_position(char *nmea_sentence, GPSPositionData *GpsData)
#endif #endif
// Send the message to the parser and get it update the GpsData // Send the message to the parser and get it update the GpsData
// Information from various different NMEA messages are temporarily // Information from various different NMEA messages are temporarily
// cumulated in the GpsData structure. An actual GPSPosition update // cumulated in the GpsData structure. An actual GPSPositionSensor update
// is triggered by GGA messages only. This message type sets the // is triggered by GGA messages only. This message type sets the
// gpsDataUpdated flag to request this. // gpsDataUpdated flag to request this.
bool gpsDataUpdated = false; bool gpsDataUpdated = false;
@ -420,8 +420,8 @@ bool NMEA_update_position(char *nmea_sentence, GPSPositionData *GpsData)
if (!parser->handler(GpsData, &gpsDataUpdated, params, nbParams)) { if (!parser->handler(GpsData, &gpsDataUpdated, params, nbParams)) {
// Parse failed // Parse failed
DEBUG_MSG("PARSE FAILED (\"%s\")\n", params[0]); DEBUG_MSG("PARSE FAILED (\"%s\")\n", params[0]);
if (gpsDataUpdated && (GpsData->Status == GPSPOSITION_STATUS_NOFIX)) { if (gpsDataUpdated && (GpsData->Status == GPSPOSITIONSENSOR_STATUS_NOFIX)) {
GPSPositionSet(GpsData); GPSPositionSensorSet(GpsData);
} }
return false; return false;
} }
@ -432,7 +432,7 @@ bool NMEA_update_position(char *nmea_sentence, GPSPositionData *GpsData)
#ifdef DEBUG_MGSID_IN #ifdef DEBUG_MGSID_IN
DEBUG_MSG("U"); DEBUG_MSG("U");
#endif #endif
GPSPositionSet(GpsData); GPSPositionSensorSet(GpsData);
} }
#ifdef DEBUG_MGSID_IN #ifdef DEBUG_MGSID_IN
@ -444,10 +444,10 @@ bool NMEA_update_position(char *nmea_sentence, GPSPositionData *GpsData)
/** /**
* Parse an NMEA GPGGA sentence and update the given UAVObject * Parse an NMEA GPGGA sentence and update the given UAVObject
* \param[in] A pointer to a GPSPosition UAVObject to be updated. * \param[in] A pointer to a GPSPositionSensor UAVObject to be updated.
* \param[in] An NMEA sentence with a valid checksum * \param[in] An NMEA sentence with a valid checksum
*/ */
static bool nmeaProcessGPGGA(GPSPositionData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam) static bool nmeaProcessGPGGA(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam)
{ {
if (nbParam != 15) { if (nbParam != 15) {
return false; return false;
@ -470,7 +470,7 @@ static bool nmeaProcessGPGGA(GPSPositionData *GpsData, bool *gpsDataUpdated, cha
// do this first to make sure we get this information, even if later checks exit // do this first to make sure we get this information, even if later checks exit
// this function early // this function early
if (param[6][0] == '0') { if (param[6][0] == '0') {
GpsData->Status = GPSPOSITION_STATUS_NOFIX; // treat invalid fix as NOFIX GpsData->Status = GPSPOSITIONSENSOR_STATUS_NOFIX; // treat invalid fix as NOFIX
} }
// get latitude [DDMM.mmmmm] [N|S] // get latitude [DDMM.mmmmm] [N|S]
@ -497,10 +497,10 @@ static bool nmeaProcessGPGGA(GPSPositionData *GpsData, bool *gpsDataUpdated, cha
/** /**
* Parse an NMEA GPRMC sentence and update the given UAVObject * Parse an NMEA GPRMC sentence and update the given UAVObject
* \param[in] A pointer to a GPSPosition UAVObject to be updated. * \param[in] A pointer to a GPSPositionSensor UAVObject to be updated.
* \param[in] An NMEA sentence with a valid checksum * \param[in] An NMEA sentence with a valid checksum
*/ */
static bool nmeaProcessGPRMC(GPSPositionData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam) static bool nmeaProcessGPRMC(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam)
{ {
if (nbParam != 13) { if (nbParam != 13) {
return false; return false;
@ -565,10 +565,10 @@ static bool nmeaProcessGPRMC(GPSPositionData *GpsData, bool *gpsDataUpdated, cha
/** /**
* Parse an NMEA GPVTG sentence and update the given UAVObject * Parse an NMEA GPVTG sentence and update the given UAVObject
* \param[in] A pointer to a GPSPosition UAVObject to be updated. * \param[in] A pointer to a GPSPositionSensor UAVObject to be updated.
* \param[in] An NMEA sentence with a valid checksum * \param[in] An NMEA sentence with a valid checksum
*/ */
static bool nmeaProcessGPVTG(GPSPositionData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam) static bool nmeaProcessGPVTG(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam)
{ {
if (nbParam != 9 && nbParam != 10 /*GTOP GPS seems to gemnerate an extra parameter...*/) { if (nbParam != 9 && nbParam != 10 /*GTOP GPS seems to gemnerate an extra parameter...*/) {
return false; return false;
@ -590,10 +590,10 @@ static bool nmeaProcessGPVTG(GPSPositionData *GpsData, bool *gpsDataUpdated, cha
#if !defined(PIOS_GPS_MINIMAL) #if !defined(PIOS_GPS_MINIMAL)
/** /**
* Parse an NMEA GPZDA sentence and update the @ref GPSTime object * 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] A pointer to a GPSPositionSensor UAVObject to be updated (unused).
* \param[in] An NMEA sentence with a valid checksum * \param[in] An NMEA sentence with a valid checksum
*/ */
static bool nmeaProcessGPZDA(__attribute__((unused)) GPSPositionData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam) static bool nmeaProcessGPZDA(__attribute__((unused)) GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam)
{ {
if (nbParam != 7) { if (nbParam != 7) {
return false; return false;
@ -633,7 +633,7 @@ static uint8_t gsv_processed_mask;
static uint16_t gsv_incomplete_error; static uint16_t gsv_incomplete_error;
static uint16_t gsv_duplicate_error; static uint16_t gsv_duplicate_error;
static bool nmeaProcessGPGSV(__attribute__((unused)) GPSPositionData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam) static bool nmeaProcessGPGSV(__attribute__((unused)) GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam)
{ {
if (nbParam < 4) { if (nbParam < 4) {
return false; return false;
@ -717,10 +717,10 @@ static bool nmeaProcessGPGSV(__attribute__((unused)) GPSPositionData *GpsData, b
/** /**
* 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 GPSPositionSensor UAVObject to be updated.
* \param[in] An NMEA sentence with a valid checksum * \param[in] An NMEA sentence with a valid checksum
*/ */
static bool nmeaProcessGPGSA(GPSPositionData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam) static bool nmeaProcessGPGSA(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam)
{ {
if (nbParam != 18) { if (nbParam != 18) {
return false; return false;
@ -737,13 +737,13 @@ static bool nmeaProcessGPGSA(GPSPositionData *GpsData, bool *gpsDataUpdated, cha
switch (atoi(param[2])) { switch (atoi(param[2])) {
case 1: case 1:
GpsData->Status = GPSPOSITION_STATUS_NOFIX; GpsData->Status = GPSPOSITIONSENSOR_STATUS_NOFIX;
break; break;
case 2: case 2:
GpsData->Status = GPSPOSITION_STATUS_FIX2D; GpsData->Status = GPSPOSITIONSENSOR_STATUS_FIX2D;
break; break;
case 3: case 3:
GpsData->Status = GPSPOSITION_STATUS_FIX3D; GpsData->Status = GPSPOSITIONSENSOR_STATUS_FIX3D;
break; break;
default: default:
/* Unhandled */ /* Unhandled */

View File

@ -38,7 +38,7 @@
// parse incoming character stream for messages in UBX binary format // parse incoming character stream for messages in UBX binary format
int parse_ubx_stream(uint8_t c, char *gps_rx_buffer, GPSPositionData *GpsData, struct GPS_RX_STATS *gpsRxStats) int parse_ubx_stream(uint8_t c, char *gps_rx_buffer, GPSPositionSensorData *GpsData, struct GPS_RX_STATS *gpsRxStats)
{ {
enum proto_states { enum proto_states {
START, START,
@ -193,10 +193,10 @@ bool checksum_ubx_message(struct UBXPacket *ubx)
} }
} }
void parse_ubx_nav_posllh(struct UBX_NAV_POSLLH *posllh, GPSPositionData *GpsPosition) void parse_ubx_nav_posllh(struct UBX_NAV_POSLLH *posllh, GPSPositionSensorData *GpsPosition)
{ {
if (check_msgtracker(posllh->iTOW, POSLLH_RECEIVED)) { if (check_msgtracker(posllh->iTOW, POSLLH_RECEIVED)) {
if (GpsPosition->Status != GPSPOSITION_STATUS_NOFIX) { if (GpsPosition->Status != GPSPOSITIONSENSOR_STATUS_NOFIX) {
GpsPosition->Altitude = (float)posllh->hMSL * 0.001f; GpsPosition->Altitude = (float)posllh->hMSL * 0.001f;
GpsPosition->GeoidSeparation = (float)(posllh->height - posllh->hMSL) * 0.001f; GpsPosition->GeoidSeparation = (float)(posllh->height - posllh->hMSL) * 0.001f;
GpsPosition->Latitude = posllh->lat; GpsPosition->Latitude = posllh->lat;
@ -205,7 +205,7 @@ void parse_ubx_nav_posllh(struct UBX_NAV_POSLLH *posllh, GPSPositionData *GpsPos
} }
} }
void parse_ubx_nav_sol(struct UBX_NAV_SOL *sol, GPSPositionData *GpsPosition) void parse_ubx_nav_sol(struct UBX_NAV_SOL *sol, GPSPositionSensorData *GpsPosition)
{ {
if (check_msgtracker(sol->iTOW, SOL_RECEIVED)) { if (check_msgtracker(sol->iTOW, SOL_RECEIVED)) {
GpsPosition->Satellites = sol->numSV; GpsPosition->Satellites = sol->numSV;
@ -213,20 +213,20 @@ void parse_ubx_nav_sol(struct UBX_NAV_SOL *sol, GPSPositionData *GpsPosition)
if (sol->flags & STATUS_FLAGS_GPSFIX_OK) { if (sol->flags & STATUS_FLAGS_GPSFIX_OK) {
switch (sol->gpsFix) { switch (sol->gpsFix) {
case STATUS_GPSFIX_2DFIX: case STATUS_GPSFIX_2DFIX:
GpsPosition->Status = GPSPOSITION_STATUS_FIX2D; GpsPosition->Status = GPSPOSITIONSENSOR_STATUS_FIX2D;
break; break;
case STATUS_GPSFIX_3DFIX: case STATUS_GPSFIX_3DFIX:
GpsPosition->Status = GPSPOSITION_STATUS_FIX3D; GpsPosition->Status = GPSPOSITIONSENSOR_STATUS_FIX3D;
break; break;
default: GpsPosition->Status = GPSPOSITION_STATUS_NOFIX; default: GpsPosition->Status = GPSPOSITIONSENSOR_STATUS_NOFIX;
} }
} else { // fix is not valid so we make sure to treat is as NOFIX } else { // fix is not valid so we make sure to treat is as NOFIX
GpsPosition->Status = GPSPOSITION_STATUS_NOFIX; GpsPosition->Status = GPSPOSITIONSENSOR_STATUS_NOFIX;
} }
} }
} }
void parse_ubx_nav_dop(struct UBX_NAV_DOP *dop, GPSPositionData *GpsPosition) void parse_ubx_nav_dop(struct UBX_NAV_DOP *dop, GPSPositionSensorData *GpsPosition)
{ {
if (check_msgtracker(dop->iTOW, DOP_RECEIVED)) { if (check_msgtracker(dop->iTOW, DOP_RECEIVED)) {
GpsPosition->HDOP = (float)dop->hDOP * 0.01f; GpsPosition->HDOP = (float)dop->hDOP * 0.01f;
@ -235,16 +235,16 @@ void parse_ubx_nav_dop(struct UBX_NAV_DOP *dop, GPSPositionData *GpsPosition)
} }
} }
void parse_ubx_nav_velned(struct UBX_NAV_VELNED *velned, GPSPositionData *GpsPosition) void parse_ubx_nav_velned(struct UBX_NAV_VELNED *velned, GPSPositionSensorData *GpsPosition)
{ {
GPSVelocityData GpsVelocity; GPSVelocitySensorData GpsVelocity;
if (check_msgtracker(velned->iTOW, VELNED_RECEIVED)) { if (check_msgtracker(velned->iTOW, VELNED_RECEIVED)) {
if (GpsPosition->Status != GPSPOSITION_STATUS_NOFIX) { if (GpsPosition->Status != GPSPOSITIONSENSOR_STATUS_NOFIX) {
GpsVelocity.North = (float)velned->velN / 100.0f; GpsVelocity.North = (float)velned->velN / 100.0f;
GpsVelocity.East = (float)velned->velE / 100.0f; GpsVelocity.East = (float)velned->velE / 100.0f;
GpsVelocity.Down = (float)velned->velD / 100.0f; GpsVelocity.Down = (float)velned->velD / 100.0f;
GPSVelocitySet(&GpsVelocity); GPSVelocitySensorSet(&GpsVelocity);
GpsPosition->Groundspeed = (float)velned->gSpeed * 0.01f; GpsPosition->Groundspeed = (float)velned->gSpeed * 0.01f;
GpsPosition->Heading = (float)velned->heading * 1.0e-5f; GpsPosition->Heading = (float)velned->heading * 1.0e-5f;
} }
@ -302,7 +302,7 @@ void parse_ubx_nav_svinfo(struct UBX_NAV_SVINFO *svinfo)
// UBX message parser // UBX message parser
// returns UAVObjectID if a UAVObject structure is ready for further processing // returns UAVObjectID if a UAVObject structure is ready for further processing
uint32_t parse_ubx_message(struct UBXPacket *ubx, GPSPositionData *GpsPosition) uint32_t parse_ubx_message(struct UBXPacket *ubx, GPSPositionSensorData *GpsPosition)
{ {
uint32_t id = 0; uint32_t id = 0;
@ -333,9 +333,9 @@ uint32_t parse_ubx_message(struct UBXPacket *ubx, GPSPositionData *GpsPosition)
break; break;
} }
if (msgtracker.msg_received == ALL_RECEIVED) { if (msgtracker.msg_received == ALL_RECEIVED) {
GPSPositionSet(GpsPosition); GPSPositionSensorSet(GpsPosition);
msgtracker.msg_received = NONE_RECEIVED; msgtracker.msg_received = NONE_RECEIVED;
id = GPSPOSITION_OBJID; id = GPSPOSITIONSENSOR_OBJID;
} }
return id; return id;
} }

View File

@ -34,9 +34,9 @@
#ifndef GPS_H #ifndef GPS_H
#define GPS_H #define GPS_H
#include "gpsvelocity.h" #include "gpsvelocitysensor.h"
#include "gpssatellites.h" #include "gpssatellites.h"
#include "gpsposition.h" #include "gpspositionsensor.h"
#include "gpstime.h" #include "gpstime.h"
#define NO_PARSER -3 // no parser available #define NO_PARSER -3 // no parser available

View File

@ -37,8 +37,8 @@
#define NMEA_MAX_PACKET_LENGTH 96 // 82 max NMEA msg size plus 12 margin (because some vendors add custom crap) plus CR plus Linefeed #define NMEA_MAX_PACKET_LENGTH 96 // 82 max NMEA msg size plus 12 margin (because some vendors add custom crap) plus CR plus Linefeed
extern bool NMEA_update_position(char *nmea_sentence, GPSPositionData *GpsData); extern bool NMEA_update_position(char *nmea_sentence, GPSPositionSensorData *GpsData);
extern bool NMEA_checksum(char *nmea_sentence); extern bool NMEA_checksum(char *nmea_sentence);
extern int parse_nmea_stream(uint8_t, char *, GPSPositionData *, struct GPS_RX_STATS *); extern int parse_nmea_stream(uint8_t, char *, GPSPositionSensorData *, struct GPS_RX_STATS *);
#endif /* NMEA_H */ #endif /* NMEA_H */

View File

@ -31,7 +31,7 @@
#ifndef UBX_H #ifndef UBX_H
#define UBX_H #define UBX_H
#include "openpilot.h" #include "openpilot.h"
#include "gpsposition.h" #include "gpspositionsensor.h"
#include "GPS.h" #include "GPS.h"
@ -218,7 +218,7 @@ struct UBXPacket {
}; };
bool checksum_ubx_message(struct UBXPacket *); bool checksum_ubx_message(struct UBXPacket *);
uint32_t parse_ubx_message(struct UBXPacket *, GPSPositionData *); uint32_t parse_ubx_message(struct UBXPacket *, GPSPositionSensorData *);
int parse_ubx_stream(uint8_t, char *, GPSPositionData *, struct GPS_RX_STATS *); int parse_ubx_stream(uint8_t, char *, GPSPositionSensorData *, struct GPS_RX_STATS *);
#endif /* UBX_H */ #endif /* UBX_H */

View File

@ -32,7 +32,7 @@
#include "openpilot.h" #include "openpilot.h"
#include "flightbatterystate.h" #include "flightbatterystate.h"
#include "gpsposition.h" #include "gpspositionsensor.h"
#include "attitudestate.h" #include "attitudestate.h"
#include "barosensor.h" #include "barosensor.h"
@ -209,7 +209,7 @@ static void FlightBatteryStateUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
newBattData = TRUE; newBattData = TRUE;
} }
static void GPSPositionUpdatedCb(__attribute__((unused)) UAVObjEvent *ev) static void GPSPositionSensorUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
{ {
newPosData = TRUE; newPosData = TRUE;
} }
@ -440,17 +440,17 @@ static void Run(void)
} }
if (newPosData) { if (newPosData) {
GPSPositionData positionData; GPSPositionSensorData positionData;
AttitudeStateData attitudeStateData; AttitudeStateData attitudeStateData;
GPSPositionGet(&positionData); GPSPositionSensorGet(&positionData);
AttitudeStateGet(&attitudeStateData); AttitudeStateGet(&attitudeStateData);
// DEBUG_MSG("%5d Pos: #stat=%d #sats=%d alt=%d\n\r", cnt, // DEBUG_MSG("%5d Pos: #stat=%d #sats=%d alt=%d\n\r", cnt,
// positionData.Status, positionData.Satellites, (uint32_t)positionData.Altitude); // positionData.Status, positionData.Satellites, (uint32_t)positionData.Altitude);
// GPS Status // GPS Status
if (positionData.Status == GPSPOSITION_STATUS_FIX3D) { if (positionData.Status == GPSPOSITIONSENSOR_STATUS_FIX3D) {
msg[OSDMSG_GPS_STAT] = OSDMSG_GPS_STAT_FIX; msg[OSDMSG_GPS_STAT] = OSDMSG_GPS_STAT_FIX;
} else { } else {
msg[OSDMSG_GPS_STAT] = OSDMSG_GPS_STAT_NOFIX; msg[OSDMSG_GPS_STAT] = OSDMSG_GPS_STAT_NOFIX;
@ -543,7 +543,7 @@ static void onTimer(UAVObjEvent *ev)
*/ */
int32_t OsdEtStdInitialize(void) int32_t OsdEtStdInitialize(void)
{ {
GPSPositionConnectCallback(GPSPositionUpdatedCb); GPSPositionSensorConnectCallback(GPSPositionSensorUpdatedCb);
FlightBatteryStateConnectCallback(FlightBatteryStateUpdatedCb); FlightBatteryStateConnectCallback(FlightBatteryStateUpdatedCb);
BaroSensorConnectCallback(BaroSensorUpdatedCb); BaroSensorConnectCallback(BaroSensorUpdatedCb);

View File

@ -35,7 +35,7 @@
#include "osdgen.h" #include "osdgen.h"
#include "attitudestate.h" #include "attitudestate.h"
#include "gpsposition.h" #include "gpspositionsensor.h"
#include "homelocation.h" #include "homelocation.h"
#include "gpstime.h" #include "gpstime.h"
#include "gpssatellites.h" #include "gpssatellites.h"
@ -2036,8 +2036,8 @@ void calcHomeArrow(int16_t m_yaw)
HomeLocationData home; HomeLocationData home;
HomeLocationGet(&home); HomeLocationGet(&home);
GPSPositionData gpsData; GPSPositionSensorData gpsData;
GPSPositionGet(&gpsData); GPSPositionSensorGet(&gpsData);
/** http://www.movable-type.co.uk/scripts/latlong.html **/ /** http://www.movable-type.co.uk/scripts/latlong.html **/
float lat1, lat2, lon1, lon2, a, c, d, x, y, brng, u2g; float lat1, lat2, lon1, lon2, a, c, d, x, y, brng, u2g;
@ -2139,8 +2139,8 @@ void updateGraphics()
OsdSettingsGet(&OsdSettings); OsdSettingsGet(&OsdSettings);
AttitudeStateData attitude; AttitudeStateData attitude;
AttitudeStateGet(&attitude); AttitudeStateGet(&attitude);
GPSPositionData gpsData; GPSPositionSensorData gpsData;
GPSPositionGet(&gpsData); GPSPositionSensorGet(&gpsData);
HomeLocationData home; HomeLocationData home;
HomeLocationGet(&home); HomeLocationGet(&home);
BaroSensorData baro; BaroSensorData baro;
@ -2421,7 +2421,7 @@ int32_t osdgenInitialize(void)
{ {
AttitudeStateInitialize(); AttitudeStateInitialize();
#ifdef PIOS_INCLUDE_GPS #ifdef PIOS_INCLUDE_GPS
GPSPositionInitialize(); GPSPositionSensorInitialize();
#if !defined(PIOS_GPS_MINIMAL) #if !defined(PIOS_GPS_MINIMAL)
GPSTimeInitialize(); GPSTimeInitialize();
GPSSatellitesInitialize(); GPSSatellitesInitialize();

View File

@ -58,8 +58,8 @@
#include "barosensor.h" #include "barosensor.h"
#include "gyrosensor.h" #include "gyrosensor.h"
#include "flightstatus.h" #include "flightstatus.h"
#include "gpsposition.h" #include "gpspositionsensor.h"
#include "gpsvelocity.h" #include "gpsvelocitysensor.h"
#include "homelocation.h" #include "homelocation.h"
#include "sensor.h" #include "sensor.h"
#include "ratedesired.h" #include "ratedesired.h"
@ -111,8 +111,8 @@ int32_t SensorsInitialize(void)
AirspeedSensorInitialize(); AirspeedSensorInitialize();
GyroSensorInitialize(); GyroSensorInitialize();
// GyrosBiasInitialize(); // GyrosBiasInitialize();
GPSPositionInitialize(); GPSPositionSensorInitialize();
GPSVelocityInitialize(); GPSVelocitySensorInitialize();
MagSensorInitialize(); MagSensorInitialize();
MagBiasInitialize(); MagBiasInitialize();
RevoCalibrationInitialize(); RevoCalibrationInitialize();
@ -243,12 +243,12 @@ static void simulateConstant()
baroSensor.Altitude = 1; baroSensor.Altitude = 1;
BaroSensorSet(&baroSensor); BaroSensorSet(&baroSensor);
GPSPositionData gpsPosition; GPSPositionSensorData gpsPosition;
GPSPositionGet(&gpsPosition); GPSPositionSensorGet(&gpsPosition);
gpsPosition.Latitude = 0; gpsPosition.Latitude = 0;
gpsPosition.Longitude = 0; gpsPosition.Longitude = 0;
gpsPosition.Altitude = 0; gpsPosition.Altitude = 0;
GPSPositionSet(&gpsPosition); GPSPositionSensorSet(&gpsPosition);
// Because most crafts wont get enough information from gravity to zero yaw gyro, we try // Because most crafts wont get enough information from gravity to zero yaw gyro, we try
// and make it average zero (weakly) // and make it average zero (weakly)
@ -305,12 +305,12 @@ static void simulateModelAgnostic()
baroSensor.Altitude = 1; baroSensor.Altitude = 1;
BaroSensorSet(&baroSensor); BaroSensorSet(&baroSensor);
GPSPositionData gpsPosition; GPSPositionSensorData gpsPosition;
GPSPositionGet(&gpsPosition); GPSPositionSensorGet(&gpsPosition);
gpsPosition.Latitude = 0; gpsPosition.Latitude = 0;
gpsPosition.Longitude = 0; gpsPosition.Longitude = 0;
gpsPosition.Altitude = 0; gpsPosition.Altitude = 0;
GPSPositionSet(&gpsPosition); GPSPositionSensorSet(&gpsPosition);
// Because most crafts wont get enough information from gravity to zero yaw gyro, we try // Because most crafts wont get enough information from gravity to zero yaw gyro, we try
// and make it average zero (weakly) // and make it average zero (weakly)
@ -500,8 +500,8 @@ static void simulateModelQuadcopter()
gps_drift[1] = gps_drift[1] * 0.95 + rand_gauss() / 10.0; gps_drift[1] = gps_drift[1] * 0.95 + rand_gauss() / 10.0;
gps_drift[2] = gps_drift[2] * 0.95 + rand_gauss() / 10.0; gps_drift[2] = gps_drift[2] * 0.95 + rand_gauss() / 10.0;
GPSPositionData gpsPosition; GPSPositionSensorData gpsPosition;
GPSPositionGet(&gpsPosition); GPSPositionSensorGet(&gpsPosition);
gpsPosition.Latitude = homeLocation.Latitude + ((pos[0] + gps_drift[0]) / T[0] * 10.0e6); gpsPosition.Latitude = homeLocation.Latitude + ((pos[0] + gps_drift[0]) / T[0] * 10.0e6);
gpsPosition.Longitude = homeLocation.Longitude + ((pos[1] + gps_drift[1]) / T[1] * 10.0e6); gpsPosition.Longitude = homeLocation.Longitude + ((pos[1] + gps_drift[1]) / T[1] * 10.0e6);
gpsPosition.Altitude = homeLocation.Altitude + ((pos[2] + gps_drift[2]) / T[2]); gpsPosition.Altitude = homeLocation.Altitude + ((pos[2] + gps_drift[2]) / T[2]);
@ -509,19 +509,19 @@ static void simulateModelQuadcopter()
gpsPosition.Heading = 180 / M_PI * atan2(vel[1] + gps_vel_drift[1], vel[0] + gps_vel_drift[0]); gpsPosition.Heading = 180 / M_PI * atan2(vel[1] + gps_vel_drift[1], vel[0] + gps_vel_drift[0]);
gpsPosition.Satellites = 7; gpsPosition.Satellites = 7;
gpsPosition.PDOP = 1; gpsPosition.PDOP = 1;
GPSPositionSet(&gpsPosition); GPSPositionSensorSet(&gpsPosition);
last_gps_time = PIOS_DELAY_GetRaw(); last_gps_time = PIOS_DELAY_GetRaw();
} }
// Update GPS Velocity measurements // Update GPS Velocity measurements
static uint32_t last_gps_vel_time = 1000; // Delay by a millisecond static uint32_t last_gps_vel_time = 1000; // Delay by a millisecond
if (PIOS_DELAY_DiffuS(last_gps_vel_time) / 1.0e6 > GPS_PERIOD) { if (PIOS_DELAY_DiffuS(last_gps_vel_time) / 1.0e6 > GPS_PERIOD) {
GPSVelocityData gpsVelocity; GPSVelocitySensorData gpsVelocity;
GPSVelocityGet(&gpsVelocity); GPSVelocitySensorGet(&gpsVelocity);
gpsVelocity.North = vel[0] + gps_vel_drift[0]; gpsVelocity.North = vel[0] + gps_vel_drift[0];
gpsVelocity.East = vel[1] + gps_vel_drift[1]; gpsVelocity.East = vel[1] + gps_vel_drift[1];
gpsVelocity.Down = vel[2] + gps_vel_drift[2]; gpsVelocity.Down = vel[2] + gps_vel_drift[2];
GPSVelocitySet(&gpsVelocity); GPSVelocitySensorSet(&gpsVelocity);
last_gps_vel_time = PIOS_DELAY_GetRaw(); last_gps_vel_time = PIOS_DELAY_GetRaw();
} }
@ -783,8 +783,8 @@ static void simulateModelAirplane()
gps_drift[1] = gps_drift[1] * 0.95 + rand_gauss() / 10.0; gps_drift[1] = gps_drift[1] * 0.95 + rand_gauss() / 10.0;
gps_drift[2] = gps_drift[2] * 0.95 + rand_gauss() / 10.0; gps_drift[2] = gps_drift[2] * 0.95 + rand_gauss() / 10.0;
GPSPositionData gpsPosition; GPSPositionSensorData gpsPosition;
GPSPositionGet(&gpsPosition); GPSPositionSensorGet(&gpsPosition);
gpsPosition.Latitude = homeLocation.Latitude + ((pos[0] + gps_drift[0]) / T[0] * 10.0e6); gpsPosition.Latitude = homeLocation.Latitude + ((pos[0] + gps_drift[0]) / T[0] * 10.0e6);
gpsPosition.Longitude = homeLocation.Longitude + ((pos[1] + gps_drift[1]) / T[1] * 10.0e6); gpsPosition.Longitude = homeLocation.Longitude + ((pos[1] + gps_drift[1]) / T[1] * 10.0e6);
gpsPosition.Altitude = homeLocation.Altitude + ((pos[2] + gps_drift[2]) / T[2]); gpsPosition.Altitude = homeLocation.Altitude + ((pos[2] + gps_drift[2]) / T[2]);
@ -792,19 +792,19 @@ static void simulateModelAirplane()
gpsPosition.Heading = 180 / M_PI * atan2(vel[1] + gps_vel_drift[1], vel[0] + gps_vel_drift[0]); gpsPosition.Heading = 180 / M_PI * atan2(vel[1] + gps_vel_drift[1], vel[0] + gps_vel_drift[0]);
gpsPosition.Satellites = 7; gpsPosition.Satellites = 7;
gpsPosition.PDOP = 1; gpsPosition.PDOP = 1;
GPSPositionSet(&gpsPosition); GPSPositionSensorSet(&gpsPosition);
last_gps_time = PIOS_DELAY_GetRaw(); last_gps_time = PIOS_DELAY_GetRaw();
} }
// Update GPS Velocity measurements // Update GPS Velocity measurements
static uint32_t last_gps_vel_time = 1000; // Delay by a millisecond static uint32_t last_gps_vel_time = 1000; // Delay by a millisecond
if (PIOS_DELAY_DiffuS(last_gps_vel_time) / 1.0e6 > GPS_PERIOD) { if (PIOS_DELAY_DiffuS(last_gps_vel_time) / 1.0e6 > GPS_PERIOD) {
GPSVelocityData gpsVelocity; GPSVelocitySensorData gpsVelocity;
GPSVelocityGet(&gpsVelocity); GPSVelocitySensorGet(&gpsVelocity);
gpsVelocity.North = vel[0] + gps_vel_drift[0]; gpsVelocity.North = vel[0] + gps_vel_drift[0];
gpsVelocity.East = vel[1] + gps_vel_drift[1]; gpsVelocity.East = vel[1] + gps_vel_drift[1];
gpsVelocity.Down = vel[2] + gps_vel_drift[2]; gpsVelocity.Down = vel[2] + gps_vel_drift[2];
GPSVelocitySet(&gpsVelocity); GPSVelocitySensorSet(&gpsVelocity);
last_gps_vel_time = PIOS_DELAY_GetRaw(); last_gps_vel_time = PIOS_DELAY_GetRaw();
} }

View File

@ -34,7 +34,7 @@
#include <ekfconfiguration.h> #include <ekfconfiguration.h>
#include <ekfstatevariance.h> #include <ekfstatevariance.h>
#include <gpsposition.h> #include <gpspositionsensor.h>
#include <attitudestate.h> #include <attitudestate.h>
#include <homelocation.h> #include <homelocation.h>
@ -219,8 +219,8 @@ static int32_t filter(stateFilter *self, stateEstimation *state)
} }
if (this->usePos) { if (this->usePos) {
GPSPositionData gpsData; GPSPositionSensorData gpsData;
GPSPositionGet(&gpsData); GPSPositionSensorGet(&gpsData);
// Have a minimum requirement for gps usage // Have a minimum requirement for gps usage
if ((gpsData.Satellites < 7) || if ((gpsData.Satellites < 7) ||
(gpsData.PDOP > 4.0f) || (gpsData.PDOP > 4.0f) ||

View File

@ -36,8 +36,8 @@
#include <magsensor.h> #include <magsensor.h>
#include <barosensor.h> #include <barosensor.h>
#include <airspeedsensor.h> #include <airspeedsensor.h>
#include <gpsposition.h> #include <gpspositionsensor.h>
#include <gpsvelocity.h> #include <gpsvelocitysensor.h>
#include <gyrostate.h> #include <gyrostate.h>
#include <accelstate.h> #include <accelstate.h>
@ -181,7 +181,7 @@ static const filterPipeline *ekf16Queue = &(filterPipeline) {
static void settingsUpdatedCb(UAVObjEvent *objEv); static void settingsUpdatedCb(UAVObjEvent *objEv);
static void sensorUpdatedCb(UAVObjEvent *objEv); static void sensorUpdatedCb(UAVObjEvent *objEv);
static void StateEstimationCb(void); static void StateEstimationCb(void);
static void getNED(GPSPositionData *gpsPosition, float *NED); static void getNED(GPSPositionSensorData *gpsPosition, float *NED);
static bool sane(float value); static bool sane(float value);
static inline int32_t maxint32_t(int32_t a, int32_t b) static inline int32_t maxint32_t(int32_t a, int32_t b)
@ -205,8 +205,8 @@ int32_t StateEstimationInitialize(void)
MagSensorInitialize(); MagSensorInitialize();
BaroSensorInitialize(); BaroSensorInitialize();
AirspeedSensorInitialize(); AirspeedSensorInitialize();
GPSPositionInitialize(); GPSPositionSensorInitialize();
GPSVelocityInitialize(); GPSVelocitySensorInitialize();
GyroStateInitialize(); GyroStateInitialize();
AccelStateInitialize(); AccelStateInitialize();
@ -223,8 +223,8 @@ int32_t StateEstimationInitialize(void)
MagSensorConnectCallback(&sensorUpdatedCb); MagSensorConnectCallback(&sensorUpdatedCb);
BaroSensorConnectCallback(&sensorUpdatedCb); BaroSensorConnectCallback(&sensorUpdatedCb);
AirspeedSensorConnectCallback(&sensorUpdatedCb); AirspeedSensorConnectCallback(&sensorUpdatedCb);
GPSPositionConnectCallback(&sensorUpdatedCb); GPSPositionSensorConnectCallback(&sensorUpdatedCb);
GPSVelocityConnectCallback(&sensorUpdatedCb); GPSVelocitySensorConnectCallback(&sensorUpdatedCb);
uint32_t stack_required = STACK_SIZE_BYTES; uint32_t stack_required = STACK_SIZE_BYTES;
// Initialize Filters // Initialize Filters
@ -353,7 +353,7 @@ static void StateEstimationCb(void)
SANITYCHECK3(GyroSensor, gyro, x, y, z); SANITYCHECK3(GyroSensor, gyro, x, y, z);
SANITYCHECK3(AccelSensor, accel, x, y, z); SANITYCHECK3(AccelSensor, accel, x, y, z);
SANITYCHECK3(MagSensor, mag, x, y, z); SANITYCHECK3(MagSensor, mag, x, y, z);
SANITYCHECK3(GPSVelocity, vel, North, East, Down); SANITYCHECK3(GPSVelocitySensor, vel, North, East, Down);
#define SANITYCHECK1(sensorname, shortname, a1, EXTRACHECK) \ #define SANITYCHECK1(sensorname, shortname, a1, EXTRACHECK) \
if (ISSET(states.updated, SENSORUPDATES_##shortname)) { \ if (ISSET(states.updated, SENSORUPDATES_##shortname)) { \
sensorname##Data s; \ sensorname##Data s; \
@ -369,10 +369,10 @@ static void StateEstimationCb(void)
SANITYCHECK1(AirspeedSensor, airspeed, CalibratedAirspeed, s.SensorConnected == AIRSPEEDSENSOR_SENSORCONNECTED_TRUE); SANITYCHECK1(AirspeedSensor, airspeed, CalibratedAirspeed, s.SensorConnected == AIRSPEEDSENSOR_SENSORCONNECTED_TRUE);
states.airspeed[1] = 0.0f; // sensor does not provide true airspeed, needs to be calculated by filter states.airspeed[1] = 0.0f; // sensor does not provide true airspeed, needs to be calculated by filter
// GPS is a tiny bit more tricky as GPSPosition is not float (otherwise the conversion to NED could sit in a filter) but integers, for precision reasons // GPS is a tiny bit more tricky as GPSPositionSensor is not float (otherwise the conversion to NED could sit in a filter) but integers, for precision reasons
if (ISSET(states.updated, SENSORUPDATES_pos)) { if (ISSET(states.updated, SENSORUPDATES_pos)) {
GPSPositionData s; GPSPositionSensorData s;
GPSPositionGet(&s); GPSPositionSensorGet(&s);
if (homeLocation.Set == HOMELOCATION_SET_TRUE && sane(s.Latitude) && sane(s.Longitude) && sane(s.Altitude) && (fabsf(s.Latitude) > 1e-5f || fabsf(s.Latitude) > 1e-5f || fabsf(s.Latitude) > 1e-5f)) { if (homeLocation.Set == HOMELOCATION_SET_TRUE && sane(s.Latitude) && sane(s.Longitude) && sane(s.Altitude) && (fabsf(s.Latitude) > 1e-5f || fabsf(s.Latitude) > 1e-5f || fabsf(s.Latitude) > 1e-5f)) {
getNED(&s, states.pos); getNED(&s, states.pos);
} else { } else {
@ -529,11 +529,11 @@ static void sensorUpdatedCb(UAVObjEvent *ev)
updatedSensors |= SENSORUPDATES_mag; updatedSensors |= SENSORUPDATES_mag;
} }
if (ev->obj == GPSPositionHandle()) { if (ev->obj == GPSPositionSensorHandle()) {
updatedSensors |= SENSORUPDATES_pos; updatedSensors |= SENSORUPDATES_pos;
} }
if (ev->obj == GPSVelocityHandle()) { if (ev->obj == GPSVelocitySensorHandle()) {
updatedSensors |= SENSORUPDATES_vel; updatedSensors |= SENSORUPDATES_vel;
} }
@ -557,7 +557,7 @@ static void sensorUpdatedCb(UAVObjEvent *ev)
* @param[out] NED frame coordinates * @param[out] NED frame coordinates
* @returns 0 for success, -1 for failure * @returns 0 for success, -1 for failure
*/ */
static void getNED(GPSPositionData *gpsPosition, float *NED) static void getNED(GPSPositionSensorData *gpsPosition, float *NED)
{ {
float dL[3] = { DEG2RAD((gpsPosition->Latitude - homeLocation.Latitude) / 10.0e6f), float dL[3] = { DEG2RAD((gpsPosition->Latitude - homeLocation.Latitude) / 10.0e6f),
DEG2RAD((gpsPosition->Longitude - homeLocation.Longitude) / 10.0e6f), DEG2RAD((gpsPosition->Longitude - homeLocation.Longitude) / 10.0e6f),

View File

@ -58,8 +58,8 @@
#include "manualcontrol.h" #include "manualcontrol.h"
#include "flightstatus.h" #include "flightstatus.h"
#include "pathstatus.h" #include "pathstatus.h"
#include "gpsvelocity.h" #include "gpsvelocitysensor.h"
#include "gpsposition.h" #include "gpspositionsensor.h"
#include "homelocation.h" #include "homelocation.h"
#include "vtolpathfollowersettings.h" #include "vtolpathfollowersettings.h"
#include "nedaccel.h" #include "nedaccel.h"
@ -481,8 +481,8 @@ void updateEndpointVelocity()
{ {
// this used to work with the NEDposition UAVObject // this used to work with the NEDposition UAVObject
// however this UAVObject has been removed // however this UAVObject has been removed
GPSPositionData gpsPosition; GPSPositionSensorData gpsPosition;
GPSPositionGet(&gpsPosition); GPSPositionSensorGet(&gpsPosition);
HomeLocationData homeLocation; HomeLocationData homeLocation;
HomeLocationGet(&homeLocation); HomeLocationGet(&homeLocation);
float lat = DEG2RAD(homeLocation.Latitude / 10.0e6f); float lat = DEG2RAD(homeLocation.Latitude / 10.0e6f);
@ -602,8 +602,8 @@ static void updateVtolDesiredAttitude(bool yaw_attitude)
break; break;
case VTOLPATHFOLLOWERSETTINGS_VELOCITYSOURCE_NEDVEL: case VTOLPATHFOLLOWERSETTINGS_VELOCITYSOURCE_NEDVEL:
{ {
GPSVelocityData gpsVelocity; GPSVelocitySensorData gpsVelocity;
GPSVelocityGet(&gpsVelocity); GPSVelocitySensorGet(&gpsVelocity);
northVel = gpsVelocity.North; northVel = gpsVelocity.North;
eastVel = gpsVelocity.East; eastVel = gpsVelocity.East;
downVel = gpsVelocity.Down; downVel = gpsVelocity.Down;
@ -611,8 +611,8 @@ static void updateVtolDesiredAttitude(bool yaw_attitude)
break; break;
case VTOLPATHFOLLOWERSETTINGS_VELOCITYSOURCE_GPSPOS: case VTOLPATHFOLLOWERSETTINGS_VELOCITYSOURCE_GPSPOS:
{ {
GPSPositionData gpsPosition; GPSPositionSensorData gpsPosition;
GPSPositionGet(&gpsPosition); GPSPositionSensorGet(&gpsPosition);
northVel = gpsPosition.Groundspeed * cosf(DEG2RAD(gpsPosition.Heading)); northVel = gpsPosition.Groundspeed * cosf(DEG2RAD(gpsPosition.Heading));
eastVel = gpsPosition.Groundspeed * sinf(DEG2RAD(gpsPosition.Heading)); eastVel = gpsPosition.Groundspeed * sinf(DEG2RAD(gpsPosition.Heading));
downVel = velocityState.Down; downVel = velocityState.Down;

View File

@ -99,8 +99,8 @@ ifndef TESTAPP
SRC += $(OPUAVSYNTHDIR)/attitudesettings.c SRC += $(OPUAVSYNTHDIR)/attitudesettings.c
SRC += $(OPUAVSYNTHDIR)/camerastabsettings.c SRC += $(OPUAVSYNTHDIR)/camerastabsettings.c
SRC += $(OPUAVSYNTHDIR)/cameradesired.c SRC += $(OPUAVSYNTHDIR)/cameradesired.c
SRC += $(OPUAVSYNTHDIR)/gpsposition.c SRC += $(OPUAVSYNTHDIR)/gpspositionsensor.c
SRC += $(OPUAVSYNTHDIR)/gpsvelocity.c SRC += $(OPUAVSYNTHDIR)/gpsvelocitysensor.c
SRC += $(OPUAVSYNTHDIR)/hwsettings.c SRC += $(OPUAVSYNTHDIR)/hwsettings.c
SRC += $(OPUAVSYNTHDIR)/gcsreceiver.c SRC += $(OPUAVSYNTHDIR)/gcsreceiver.c
SRC += $(OPUAVSYNTHDIR)/receiveractivity.c SRC += $(OPUAVSYNTHDIR)/receiveractivity.c

View File

@ -87,9 +87,9 @@ ifndef TESTAPP
SRC += $(OPUAVSYNTHDIR)/taskinfo.c SRC += $(OPUAVSYNTHDIR)/taskinfo.c
SRC += $(OPUAVSYNTHDIR)/mixerstatus.c SRC += $(OPUAVSYNTHDIR)/mixerstatus.c
SRC += $(OPUAVSYNTHDIR)/homelocation.c SRC += $(OPUAVSYNTHDIR)/homelocation.c
SRC += $(OPUAVSYNTHDIR)/gpsposition.c SRC += $(OPUAVSYNTHDIR)/gpspositionsensor.c
SRC += $(OPUAVSYNTHDIR)/gpssatellites.c SRC += $(OPUAVSYNTHDIR)/gpssatellites.c
SRC += $(OPUAVSYNTHDIR)/gpsvelocity.c SRC += $(OPUAVSYNTHDIR)/gpsvelocitysensor.c
SRC += $(OPUAVSYNTHDIR)/gpstime.c SRC += $(OPUAVSYNTHDIR)/gpstime.c
SRC += $(OPUAVSYNTHDIR)/osdsettings.c SRC += $(OPUAVSYNTHDIR)/osdsettings.c
SRC += $(OPUAVSYNTHDIR)/barosensor.c SRC += $(OPUAVSYNTHDIR)/barosensor.c

View File

@ -45,10 +45,10 @@ UAVOBJSRCFILENAMES += flightplanstatus
UAVOBJSRCFILENAMES += flighttelemetrystats UAVOBJSRCFILENAMES += flighttelemetrystats
UAVOBJSRCFILENAMES += gcstelemetrystats UAVOBJSRCFILENAMES += gcstelemetrystats
UAVOBJSRCFILENAMES += gcsreceiver UAVOBJSRCFILENAMES += gcsreceiver
UAVOBJSRCFILENAMES += gpsposition UAVOBJSRCFILENAMES += gpspositionsensor
UAVOBJSRCFILENAMES += gpssatellites UAVOBJSRCFILENAMES += gpssatellites
UAVOBJSRCFILENAMES += gpstime UAVOBJSRCFILENAMES += gpstime
UAVOBJSRCFILENAMES += gpsvelocity UAVOBJSRCFILENAMES += gpsvelocitysensor
UAVOBJSRCFILENAMES += fixedwingpathfollowersettings UAVOBJSRCFILENAMES += fixedwingpathfollowersettings
UAVOBJSRCFILENAMES += fixedwingpathfollowerstatus UAVOBJSRCFILENAMES += fixedwingpathfollowerstatus
UAVOBJSRCFILENAMES += vtolpathfollowersettings UAVOBJSRCFILENAMES += vtolpathfollowersettings
@ -65,6 +65,7 @@ UAVOBJSRCFILENAMES += overosyncsettings
UAVOBJSRCFILENAMES += pathaction UAVOBJSRCFILENAMES += pathaction
UAVOBJSRCFILENAMES += pathdesired UAVOBJSRCFILENAMES += pathdesired
UAVOBJSRCFILENAMES += pathstatus UAVOBJSRCFILENAMES += pathstatus
UAVOBJSRCFILENAMES += positionsensor
UAVOBJSRCFILENAMES += positionstate UAVOBJSRCFILENAMES += positionstate
UAVOBJSRCFILENAMES += ratedesired UAVOBJSRCFILENAMES += ratedesired
UAVOBJSRCFILENAMES += relaytuning UAVOBJSRCFILENAMES += relaytuning

View File

@ -137,6 +137,7 @@
#define PIOS_INCLUDE_GPS_NMEA_PARSER #define PIOS_INCLUDE_GPS_NMEA_PARSER
#define PIOS_INCLUDE_GPS_UBX_PARSER #define PIOS_INCLUDE_GPS_UBX_PARSER
#define PIOS_GPS_SETS_HOMELOCATION #define PIOS_GPS_SETS_HOMELOCATION
#define PIOS_GPS_SETS_POSITIONSENSOR
/* Stabilization options */ /* Stabilization options */
/* #define PIOS_QUATERNION_STABILIZATION */ /* #define PIOS_QUATERNION_STABILIZATION */

View File

@ -33,7 +33,7 @@
#include <accelssensor.h> #include <accelssensor.h>
#include <barosensor.h> #include <barosensor.h>
#include <gpsposition.h> #include <gpspositionsensor.h>
#include <gyrosensor.h> #include <gyrosensor.h>
#include <magsensor.h> #include <magsensor.h>
#include <manualcontrolsettings.h> #include <manualcontrolsettings.h>
@ -139,7 +139,7 @@ void PIOS_Board_Init(void)
AccelSensorInitialize(); AccelSensorInitialize();
BaroSensorInitialize(); BaroSensorInitialize();
MagSensorInitialize(); MagSensorInitialize();
GPSPositionInitialize(); GPSPositionSensorInitialize();
GyroSensorInitialize(); GyroSensorInitialize();
/* Initialize the alarms library */ /* Initialize the alarms library */

View File

@ -50,10 +50,10 @@ UAVOBJSRCFILENAMES += flightplanstatus
UAVOBJSRCFILENAMES += flighttelemetrystats UAVOBJSRCFILENAMES += flighttelemetrystats
UAVOBJSRCFILENAMES += gcstelemetrystats UAVOBJSRCFILENAMES += gcstelemetrystats
UAVOBJSRCFILENAMES += gcsreceiver UAVOBJSRCFILENAMES += gcsreceiver
UAVOBJSRCFILENAMES += gpsposition UAVOBJSRCFILENAMES += gpspositionsensor
UAVOBJSRCFILENAMES += gpssatellites UAVOBJSRCFILENAMES += gpssatellites
UAVOBJSRCFILENAMES += gpstime UAVOBJSRCFILENAMES += gpstime
UAVOBJSRCFILENAMES += gpsvelocity UAVOBJSRCFILENAMES += gpsvelocitysensor
UAVOBJSRCFILENAMES += fixedwingpathfollowersettings UAVOBJSRCFILENAMES += fixedwingpathfollowersettings
UAVOBJSRCFILENAMES += fixedwingpathfollowerstatus UAVOBJSRCFILENAMES += fixedwingpathfollowerstatus
UAVOBJSRCFILENAMES += vtolpathfollowersettings UAVOBJSRCFILENAMES += vtolpathfollowersettings
@ -70,6 +70,7 @@ UAVOBJSRCFILENAMES += overosyncsettings
UAVOBJSRCFILENAMES += pathaction UAVOBJSRCFILENAMES += pathaction
UAVOBJSRCFILENAMES += pathdesired UAVOBJSRCFILENAMES += pathdesired
UAVOBJSRCFILENAMES += pathstatus UAVOBJSRCFILENAMES += pathstatus
UAVOBJSRCFILENAMES += positionsensor
UAVOBJSRCFILENAMES += positionstate UAVOBJSRCFILENAMES += positionstate
UAVOBJSRCFILENAMES += ratedesired UAVOBJSRCFILENAMES += ratedesired
UAVOBJSRCFILENAMES += relaytuning UAVOBJSRCFILENAMES += relaytuning

View File

@ -137,6 +137,7 @@
#define PIOS_INCLUDE_GPS_NMEA_PARSER #define PIOS_INCLUDE_GPS_NMEA_PARSER
#define PIOS_INCLUDE_GPS_UBX_PARSER #define PIOS_INCLUDE_GPS_UBX_PARSER
#define PIOS_GPS_SETS_HOMELOCATION #define PIOS_GPS_SETS_HOMELOCATION
#define PIOS_GPS_SETS_POSITIONSENSOR
/* Stabilization options */ /* Stabilization options */
/* #define PIOS_QUATERNION_STABILIZATION */ /* #define PIOS_QUATERNION_STABILIZATION */

View File

@ -33,7 +33,7 @@
#include <accelsensor.h> #include <accelsensor.h>
#include <barosensor.h> #include <barosensor.h>
#include <gpsposition.h> #include <gpspositionsensor.h>
#include <gyrosensor.h> #include <gyrosensor.h>
#include <magsensor.h> #include <magsensor.h>
#include <manualcontrolsettings.h> #include <manualcontrolsettings.h>
@ -139,7 +139,7 @@ void PIOS_Board_Init(void)
AccelSensorInitialize(); AccelSensorInitialize();
BaroSensorInitialize(); BaroSensorInitialize();
MagSensorInitialize(); MagSensorInitialize();
GPSPositionInitialize(); GPSPositionSensorInitialize();
GyroStatInitialize(); GyroStatInitialize();
GyroSensorInitialize(); GyroSensorInitialize();

View File

@ -49,10 +49,10 @@ UAVOBJSRCFILENAMES += flightplansettings
UAVOBJSRCFILENAMES += flightplanstatus UAVOBJSRCFILENAMES += flightplanstatus
UAVOBJSRCFILENAMES += flighttelemetrystats UAVOBJSRCFILENAMES += flighttelemetrystats
UAVOBJSRCFILENAMES += gcstelemetrystats UAVOBJSRCFILENAMES += gcstelemetrystats
UAVOBJSRCFILENAMES += gpsposition UAVOBJSRCFILENAMES += gpspositionsensor
UAVOBJSRCFILENAMES += gpssatellites UAVOBJSRCFILENAMES += gpssatellites
UAVOBJSRCFILENAMES += gpstime UAVOBJSRCFILENAMES += gpstime
UAVOBJSRCFILENAMES += gpsvelocity UAVOBJSRCFILENAMES += gpsvelocitysensor
UAVOBJSRCFILENAMES += vtolpathfollowersettings UAVOBJSRCFILENAMES += vtolpathfollowersettings
UAVOBJSRCFILENAMES += fixedwingpathfollowersettings UAVOBJSRCFILENAMES += fixedwingpathfollowersettings
UAVOBJSRCFILENAMES += fixedwingpathfollowerstatus UAVOBJSRCFILENAMES += fixedwingpathfollowerstatus
@ -68,6 +68,7 @@ UAVOBJSRCFILENAMES += overosyncstats
UAVOBJSRCFILENAMES += pathaction UAVOBJSRCFILENAMES += pathaction
UAVOBJSRCFILENAMES += pathdesired UAVOBJSRCFILENAMES += pathdesired
UAVOBJSRCFILENAMES += pathstatus UAVOBJSRCFILENAMES += pathstatus
UAVOBJSRCFILENAMES += positionsensor
UAVOBJSRCFILENAMES += positionstate UAVOBJSRCFILENAMES += positionstate
UAVOBJSRCFILENAMES += ratedesired UAVOBJSRCFILENAMES += ratedesired
UAVOBJSRCFILENAMES += revocalibration UAVOBJSRCFILENAMES += revocalibration

View File

@ -449,7 +449,7 @@
<dialNeedleID2></dialNeedleID2> <dialNeedleID2></dialNeedleID2>
<dialNeedleID3></dialNeedleID3> <dialNeedleID3></dialNeedleID3>
<font>Lucida Grande,13,-1,5,50,0,0,0,0,0</font> <font>Lucida Grande,13,-1,5,50,0,0,0,0,0</font>
<needle1DataObject>GPSPosition</needle1DataObject> <needle1DataObject>GPSPositionSensor</needle1DataObject>
<needle1Factor>3.6</needle1Factor> <needle1Factor>3.6</needle1Factor>
<needle1MaxValue>120</needle1MaxValue> <needle1MaxValue>120</needle1MaxValue>
<needle1MinValue>0</needle1MinValue> <needle1MinValue>0</needle1MinValue>
@ -554,7 +554,7 @@
<dialNeedleID2></dialNeedleID2> <dialNeedleID2></dialNeedleID2>
<dialNeedleID3></dialNeedleID3> <dialNeedleID3></dialNeedleID3>
<font>Lucida Grande,13,-1,5,50,0,0,0,0,0</font> <font>Lucida Grande,13,-1,5,50,0,0,0,0,0</font>
<needle1DataObject>GPSPosition</needle1DataObject> <needle1DataObject>GPSPositionSensor</needle1DataObject>
<needle1Factor>3.6</needle1Factor> <needle1Factor>3.6</needle1Factor>
<needle1MaxValue>120</needle1MaxValue> <needle1MaxValue>120</needle1MaxValue>
<needle1MinValue>0</needle1MinValue> <needle1MinValue>0</needle1MinValue>
@ -764,7 +764,7 @@
<dialNeedleID2></dialNeedleID2> <dialNeedleID2></dialNeedleID2>
<dialNeedleID3></dialNeedleID3> <dialNeedleID3></dialNeedleID3>
<font>Lucida Grande,13,-1,5,50,0,0,0,0,0</font> <font>Lucida Grande,13,-1,5,50,0,0,0,0,0</font>
<needle1DataObject>GPSPosition</needle1DataObject> <needle1DataObject>GPSPositionSensor</needle1DataObject>
<needle1Factor>3.6</needle1Factor> <needle1Factor>3.6</needle1Factor>
<needle1MaxValue>120</needle1MaxValue> <needle1MaxValue>120</needle1MaxValue>
<needle1MinValue>0</needle1MinValue> <needle1MinValue>0</needle1MinValue>
@ -1202,7 +1202,7 @@
<minValue>0</minValue> <minValue>0</minValue>
<redMax>0</redMax> <redMax>0</redMax>
<redMin>0</redMin> <redMin>0</redMin>
<sourceDataObject>GPSPosition</sourceDataObject> <sourceDataObject>GPSPositionSensor</sourceDataObject>
<sourceObjectField>Satellites</sourceObjectField> <sourceObjectField>Satellites</sourceObjectField>
<useOpenGLFlag>false</useOpenGLFlag> <useOpenGLFlag>false</useOpenGLFlag>
<yellowMax>0</yellowMax> <yellowMax>0</yellowMax>
@ -1225,7 +1225,7 @@
<minValue>0</minValue> <minValue>0</minValue>
<redMax>33</redMax> <redMax>33</redMax>
<redMin>0</redMin> <redMin>0</redMin>
<sourceDataObject>GPSPosition</sourceDataObject> <sourceDataObject>GPSPositionSensor</sourceDataObject>
<sourceObjectField>Status</sourceObjectField> <sourceObjectField>Status</sourceObjectField>
<useOpenGLFlag>false</useOpenGLFlag> <useOpenGLFlag>false</useOpenGLFlag>
<yellowMax>66</yellowMax> <yellowMax>66</yellowMax>

View File

@ -449,7 +449,7 @@
<dialForegroundID>foreground</dialForegroundID> <dialForegroundID>foreground</dialForegroundID>
<dialNeedleID1>needle</dialNeedleID1> <dialNeedleID1>needle</dialNeedleID1>
<font>MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0</font> <font>MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0</font>
<needle1DataObject>GPSPosition</needle1DataObject> <needle1DataObject>GPSPositionSensor</needle1DataObject>
<needle1Factor>3.6</needle1Factor> <needle1Factor>3.6</needle1Factor>
<needle1MaxValue>120</needle1MaxValue> <needle1MaxValue>120</needle1MaxValue>
<needle1MinValue>0</needle1MinValue> <needle1MinValue>0</needle1MinValue>
@ -551,7 +551,7 @@
<dialFile>%%DATAPATH%%dials/default/speed.svg</dialFile> <dialFile>%%DATAPATH%%dials/default/speed.svg</dialFile>
<dialNeedleID1>needle</dialNeedleID1> <dialNeedleID1>needle</dialNeedleID1>
<font>MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0</font> <font>MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0</font>
<needle1DataObject>GPSPosition</needle1DataObject> <needle1DataObject>GPSPositionSensor</needle1DataObject>
<needle1Factor>3.6</needle1Factor> <needle1Factor>3.6</needle1Factor>
<needle1MaxValue>120</needle1MaxValue> <needle1MaxValue>120</needle1MaxValue>
<needle1MinValue>0</needle1MinValue> <needle1MinValue>0</needle1MinValue>
@ -750,7 +750,7 @@
<dialFile>%%DATAPATH%%dials/hi-contrast/speed.svg</dialFile> <dialFile>%%DATAPATH%%dials/hi-contrast/speed.svg</dialFile>
<dialNeedleID1>needle</dialNeedleID1> <dialNeedleID1>needle</dialNeedleID1>
<font>MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0</font> <font>MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0</font>
<needle1DataObject>GPSPosition</needle1DataObject> <needle1DataObject>GPSPositionSensor</needle1DataObject>
<needle1Factor>3.6</needle1Factor> <needle1Factor>3.6</needle1Factor>
<needle1MaxValue>120</needle1MaxValue> <needle1MaxValue>120</needle1MaxValue>
<needle1MinValue>0</needle1MinValue> <needle1MinValue>0</needle1MinValue>
@ -1219,7 +1219,7 @@
<minValue>0</minValue> <minValue>0</minValue>
<redMax>0</redMax> <redMax>0</redMax>
<redMin>0</redMin> <redMin>0</redMin>
<sourceDataObject>GPSPosition</sourceDataObject> <sourceDataObject>GPSPositionSensor</sourceDataObject>
<sourceObjectField>Satellites</sourceObjectField> <sourceObjectField>Satellites</sourceObjectField>
<useOpenGLFlag>false</useOpenGLFlag> <useOpenGLFlag>false</useOpenGLFlag>
<yellowMax>0</yellowMax> <yellowMax>0</yellowMax>
@ -1242,7 +1242,7 @@
<minValue>0</minValue> <minValue>0</minValue>
<redMax>33</redMax> <redMax>33</redMax>
<redMin>0</redMin> <redMin>0</redMin>
<sourceDataObject>GPSPosition</sourceDataObject> <sourceDataObject>GPSPositionSensor</sourceDataObject>
<sourceObjectField>Status</sourceObjectField> <sourceObjectField>Status</sourceObjectField>
<useOpenGLFlag>false</useOpenGLFlag> <useOpenGLFlag>false</useOpenGLFlag>
<yellowMax>66</yellowMax> <yellowMax>66</yellowMax>

View File

@ -449,7 +449,7 @@
<dialForegroundID>foreground</dialForegroundID> <dialForegroundID>foreground</dialForegroundID>
<dialNeedleID1>needle</dialNeedleID1> <dialNeedleID1>needle</dialNeedleID1>
<font>MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0</font> <font>MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0</font>
<needle1DataObject>GPSPosition</needle1DataObject> <needle1DataObject>GPSPositionSensor</needle1DataObject>
<needle1Factor>3.6</needle1Factor> <needle1Factor>3.6</needle1Factor>
<needle1MaxValue>120</needle1MaxValue> <needle1MaxValue>120</needle1MaxValue>
<needle1MinValue>0</needle1MinValue> <needle1MinValue>0</needle1MinValue>
@ -551,7 +551,7 @@
<dialFile>%%DATAPATH%%dials/default/speed.svg</dialFile> <dialFile>%%DATAPATH%%dials/default/speed.svg</dialFile>
<dialNeedleID1>needle</dialNeedleID1> <dialNeedleID1>needle</dialNeedleID1>
<font>MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0</font> <font>MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0</font>
<needle1DataObject>GPSPosition</needle1DataObject> <needle1DataObject>GPSPositionSensor</needle1DataObject>
<needle1Factor>3.6</needle1Factor> <needle1Factor>3.6</needle1Factor>
<needle1MaxValue>120</needle1MaxValue> <needle1MaxValue>120</needle1MaxValue>
<needle1MinValue>0</needle1MinValue> <needle1MinValue>0</needle1MinValue>
@ -750,7 +750,7 @@
<dialFile>%%DATAPATH%%dials/hi-contrast/speed.svg</dialFile> <dialFile>%%DATAPATH%%dials/hi-contrast/speed.svg</dialFile>
<dialNeedleID1>needle</dialNeedleID1> <dialNeedleID1>needle</dialNeedleID1>
<font>MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0</font> <font>MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0</font>
<needle1DataObject>GPSPosition</needle1DataObject> <needle1DataObject>GPSPositionSensor</needle1DataObject>
<needle1Factor>3.6</needle1Factor> <needle1Factor>3.6</needle1Factor>
<needle1MaxValue>120</needle1MaxValue> <needle1MaxValue>120</needle1MaxValue>
<needle1MinValue>0</needle1MinValue> <needle1MinValue>0</needle1MinValue>
@ -1219,7 +1219,7 @@
<minValue>0</minValue> <minValue>0</minValue>
<redMax>0</redMax> <redMax>0</redMax>
<redMin>0</redMin> <redMin>0</redMin>
<sourceDataObject>GPSPosition</sourceDataObject> <sourceDataObject>GPSPositionSensor</sourceDataObject>
<sourceObjectField>Satellites</sourceObjectField> <sourceObjectField>Satellites</sourceObjectField>
<useOpenGLFlag>false</useOpenGLFlag> <useOpenGLFlag>false</useOpenGLFlag>
<yellowMax>0</yellowMax> <yellowMax>0</yellowMax>
@ -1242,7 +1242,7 @@
<minValue>0</minValue> <minValue>0</minValue>
<redMax>33</redMax> <redMax>33</redMax>
<redMin>0</redMin> <redMin>0</redMin>
<sourceDataObject>GPSPosition</sourceDataObject> <sourceDataObject>GPSPositionSensor</sourceDataObject>
<sourceObjectField>Status</sourceObjectField> <sourceObjectField>Status</sourceObjectField>
<useOpenGLFlag>false</useOpenGLFlag> <useOpenGLFlag>false</useOpenGLFlag>
<yellowMax>66</yellowMax> <yellowMax>66</yellowMax>

View File

@ -31,12 +31,12 @@ Item {
Text { Text {
id: gps_text id: gps_text
text: "GPS: " + GPSPosition.Satellites + "\nPDP: " + GPSPosition.PDOP text: "GPS: " + GPSPositionSensor.Satellites + "\nPDP: " + GPSPositionSensor.PDOP
color: "white" color: "white"
font.family: "Arial" font.family: "Arial"
font.pixelSize: telemetry_status.height * 0.75 font.pixelSize: telemetry_status.height * 0.75
visible: GPSPosition.Satellites > 0 visible: GPSPositionSensor.Satellites > 0
property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "gps-txt") property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "gps-txt")
x: Math.floor(scaledBounds.x * sceneItem.width) x: Math.floor(scaledBounds.x * sceneItem.width)

View File

@ -12,9 +12,9 @@ OsgEarth {
roll: AttitudeState.Roll roll: AttitudeState.Roll
latitude: qmlWidget.actualPositionUsed ? latitude: qmlWidget.actualPositionUsed ?
GPSPosition.Latitude/10000000.0 : qmlWidget.latitude GPSPositionSensor.Latitude/10000000.0 : qmlWidget.latitude
longitude: qmlWidget.actualPositionUsed ? longitude: qmlWidget.actualPositionUsed ?
GPSPosition.Longitude/10000000.0 : qmlWidget.longitude GPSPositionSensor.Longitude/10000000.0 : qmlWidget.longitude
altitude: qmlWidget.actualPositionUsed ? altitude: qmlWidget.actualPositionUsed ?
GPSPosition.Altitude : qmlWidget.altitude GPSPositionSensor.Altitude : qmlWidget.altitude
} }

View File

@ -1807,7 +1807,7 @@ p, li { white-space: pre-wrap; }
</message> </message>
<message> <message>
<location/> <location/>
<source>GPSPosition</source> <source>GPSPositionSensor</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>

View File

@ -1808,7 +1808,7 @@ p, li { white-space: pre-wrap; }
</message> </message>
<message> <message>
<location/> <location/>
<source>GPSPosition</source> <source>GPSPositionSensor</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>

View File

@ -1829,7 +1829,7 @@ p, li { white-space: pre-wrap; }
</message> </message>
<message> <message>
<location/> <location/>
<source>GPSPosition</source> <source>GPSPositionSensor</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>

View File

@ -1761,7 +1761,7 @@ Sat SNR is displayed above (in dBHz)</source>
</message> </message>
<message> <message>
<location/> <location/>
<source>GPSPosition</source> <source>GPSPositionSensor</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>

View File

@ -2647,7 +2647,7 @@ Sat SNR is displayed above (in dBHz)</source>
</message> </message>
<message> <message>
<location/> <location/>
<source>GPSPosition</source> <source>GPSPositionSensor</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>

View File

@ -39,12 +39,12 @@ TelemetryParser::TelemetryParser(QObject *parent) : GPSParser(parent)
{ {
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>(); UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
UAVDataObject *gpsObj = dynamic_cast<UAVDataObject *>(objManager->getObject("GPSPosition")); UAVDataObject *gpsObj = dynamic_cast<UAVDataObject *>(objManager->getObject("GPSPositionSensor"));
if (gpsObj != NULL) { if (gpsObj != NULL) {
connect(gpsObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateGPS(UAVObject *))); connect(gpsObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateGPS(UAVObject *)));
} else { } else {
qDebug() << "Error: Object is unknown (GPSPosition)."; qDebug() << "Error: Object is unknown (GPSPositionSensor).";
} }
gpsObj = dynamic_cast<UAVDataObject *>(objManager->getObject("HomeLocation")); gpsObj = dynamic_cast<UAVDataObject *>(objManager->getObject("HomeLocation"));

View File

@ -39,12 +39,12 @@ TelemetryParser::TelemetryParser(QObject *parent) : GPSParser(parent)
{ {
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>(); UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
UAVDataObject *gpsObj = dynamic_cast<UAVDataObject *>(objManager->getObject("GPSPosition")); UAVDataObject *gpsObj = dynamic_cast<UAVDataObject *>(objManager->getObject("GPSPositionSensor"));
if (gpsObj != NULL) { if (gpsObj != NULL) {
connect(gpsObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateGPS(UAVObject *))); connect(gpsObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateGPS(UAVObject *)));
} else { } else {
qDebug() << "Error: Object is unknown (GPSPosition)."; qDebug() << "Error: Object is unknown (GPSPositionSensor).";
} }
gpsObj = dynamic_cast<UAVDataObject *>(objManager->getObject("GPSTime")); gpsObj = dynamic_cast<UAVDataObject *>(objManager->getObject("GPSTime"));

View File

@ -41,8 +41,8 @@ struct Noise {
AttitudeState::DataFields attStateData; AttitudeState::DataFields attStateData;
BaroSensor::DataFields baroAltData; BaroSensor::DataFields baroAltData;
AirspeedState::DataFields airspeedState; AirspeedState::DataFields airspeedState;
GPSPosition::DataFields gpsPosData; GPSPositionSensor::DataFields gpsPosData;
GPSVelocity::DataFields gpsVelData; GPSVelocitySensor::DataFields gpsVelData;
GyroState::DataFields gyroStateData; GyroState::DataFields gyroStateData;
HomeLocation::DataFields homeData; HomeLocation::DataFields homeData;
PositionState::DataFields positionStateData; PositionState::DataFields positionStateData;

View File

@ -156,8 +156,8 @@ void Simulator::onStart()
attSettings = AttitudeSettings::GetInstance(objManager); attSettings = AttitudeSettings::GetInstance(objManager);
accelState = AccelState::GetInstance(objManager); accelState = AccelState::GetInstance(objManager);
gyroState = GyroState::GetInstance(objManager); gyroState = GyroState::GetInstance(objManager);
gpsPos = GPSPosition::GetInstance(objManager); gpsPos = GPSPositionSensor::GetInstance(objManager);
gpsVel = GPSVelocity::GetInstance(objManager); gpsVel = GPSVelocitySensor::GetInstance(objManager);
telStats = GCSTelemetryStats::GetInstance(objManager); telStats = GCSTelemetryStats::GetInstance(objManager);
groundTruth = GroundTruth::GetInstance(objManager); groundTruth = GroundTruth::GetInstance(objManager);
@ -633,8 +633,8 @@ void Simulator::updateUAVOs(Output2Hardware out)
if (gpsPosTime.msecsTo(currentTime) >= settings.gpsPosRate) { if (gpsPosTime.msecsTo(currentTime) >= settings.gpsPosRate) {
qDebug() << " GPS time:" << gpsPosTime << ", currentTime: " << currentTime << ", difference: " << gpsPosTime.msecsTo(currentTime); qDebug() << " GPS time:" << gpsPosTime << ", currentTime: " << currentTime << ", difference: " << gpsPosTime.msecsTo(currentTime);
// Update GPS Position objects // Update GPS Position objects
GPSPosition::DataFields gpsPosData; GPSPositionSensor::DataFields gpsPosData;
memset(&gpsPosData, 0, sizeof(GPSPosition::DataFields)); memset(&gpsPosData, 0, sizeof(GPSPositionSensor::DataFields));
gpsPosData.Altitude = out.altitude + noise.gpsPosData.Altitude; gpsPosData.Altitude = out.altitude + noise.gpsPosData.Altitude;
gpsPosData.Heading = out.heading + noise.gpsPosData.Heading; gpsPosData.Heading = out.heading + noise.gpsPosData.Heading;
gpsPosData.Groundspeed = out.groundspeed + noise.gpsPosData.Groundspeed; gpsPosData.Groundspeed = out.groundspeed + noise.gpsPosData.Groundspeed;
@ -644,13 +644,13 @@ void Simulator::updateUAVOs(Output2Hardware out)
gpsPosData.PDOP = 3.0; gpsPosData.PDOP = 3.0;
gpsPosData.VDOP = gpsPosData.PDOP * 1.5; gpsPosData.VDOP = gpsPosData.PDOP * 1.5;
gpsPosData.Satellites = 10; gpsPosData.Satellites = 10;
gpsPosData.Status = GPSPosition::STATUS_FIX3D; gpsPosData.Status = GPSPositionSensor::STATUS_FIX3D;
gpsPos->setData(gpsPosData); gpsPos->setData(gpsPosData);
// Update GPS Velocity.{North,East,Down} // Update GPS Velocity.{North,East,Down}
GPSVelocity::DataFields gpsVelData; GPSVelocitySensor::DataFields gpsVelData;
memset(&gpsVelData, 0, sizeof(GPSVelocity::DataFields)); memset(&gpsVelData, 0, sizeof(GPSVelocitySensor::DataFields));
gpsVelData.North = out.velNorth + noise.gpsVelData.North; gpsVelData.North = out.velNorth + noise.gpsVelData.North;
gpsVelData.East = out.velEast + noise.gpsVelData.East; gpsVelData.East = out.velEast + noise.gpsVelData.East;
gpsVelData.Down = out.velDown + noise.gpsVelData.Down; gpsVelData.Down = out.velDown + noise.gpsVelData.Down;

View File

@ -49,8 +49,8 @@
#include "flightstatus.h" #include "flightstatus.h"
#include "gcsreceiver.h" #include "gcsreceiver.h"
#include "gcstelemetrystats.h" #include "gcstelemetrystats.h"
#include "gpsposition.h" #include "gpspositionsensor.h"
#include "gpsvelocity.h" #include "gpsvelocitysensor.h"
#include "groundtruth.h" #include "groundtruth.h"
#include "gyrostate.h" #include "gyrostate.h"
#include "homelocation.h" #include "homelocation.h"
@ -326,8 +326,8 @@ protected:
AttitudeState *attState; AttitudeState *attState;
AttitudeSettings *attSettings; AttitudeSettings *attSettings;
VelocityState *velState; VelocityState *velState;
GPSPosition *gpsPos; GPSPositionSensor *gpsPos;
GPSVelocity *gpsVel; GPSVelocitySensor *gpsVel;
PositionState *posState; PositionState *posState;
HomeLocation *posHome; HomeLocation *posHome;
AccelState *accelState; AccelState *accelState;

View File

@ -50,7 +50,7 @@
#include "positionstate.h" #include "positionstate.h"
#include "homelocation.h" #include "homelocation.h"
#include "gpsposition.h" #include "gpspositionsensor.h"
#include "gyrostate.h" #include "gyrostate.h"
#include "attitudestate.h" #include "attitudestate.h"
#include "positionstate.h" #include "positionstate.h"
@ -579,10 +579,10 @@ void OPMapGadgetWidget::updatePosition()
// ************* // *************
// get the current GPS position and heading // get the current GPS position and heading
GPSPosition *gpsPositionObj = GPSPosition::GetInstance(obm); GPSPositionSensor *gpsPositionObj = GPSPositionSensor::GetInstance(obm);
Q_ASSERT(gpsPositionObj); Q_ASSERT(gpsPositionObj);
GPSPosition::DataFields gpsPositionData = gpsPositionObj->getData(); GPSPositionSensor::DataFields gpsPositionData = gpsPositionObj->getData();
gps_heading = gpsPositionData.Heading; gps_heading = gpsPositionData.Heading;
gps_latitude = gpsPositionData.Latitude; gps_latitude = gpsPositionData.Latitude;
@ -2236,7 +2236,7 @@ double OPMapGadgetWidget::getUAV_Yaw()
return yaw; return yaw;
} }
bool OPMapGadgetWidget::getGPSPosition(double &latitude, double &longitude, double &altitude) bool OPMapGadgetWidget::getGPSPositionSensor(double &latitude, double &longitude, double &altitude)
{ {
double LLA[3]; double LLA[3];
@ -2244,7 +2244,7 @@ bool OPMapGadgetWidget::getGPSPosition(double &latitude, double &longitude, doub
return false; return false;
} }
if (obum->getGPSPosition(LLA) < 0) { if (obum->getGPSPositionSensor(LLA) < 0) {
return false; // error return false; // error
} }
latitude = LLA[0]; latitude = LLA[0];

View File

@ -113,7 +113,7 @@ public:
void setMaxUpdateRate(int update_rate); void setMaxUpdateRate(int update_rate);
void setHomePosition(QPointF pos); void setHomePosition(QPointF pos);
void setOverlayOpacity(qreal value); void setOverlayOpacity(qreal value);
bool getGPSPosition(double &latitude, double &longitude, double &altitude); bool getGPSPositionSensor(double &latitude, double &longitude, double &altitude);
signals: signals:
void defaultLocationAndZoomChanged(double lng, double lat, double zoom); void defaultLocationAndZoomChanged(double lng, double lat, double zoom);
void overlayOpacityChanged(qreal); void overlayOpacityChanged(qreal);

View File

@ -96,7 +96,7 @@ using namespace osgEarth::Annotation;
#include "utils/worldmagmodel.h" #include "utils/worldmagmodel.h"
#include "utils/coordinateconversions.h" #include "utils/coordinateconversions.h"
#include "attitudestate.h" #include "attitudestate.h"
#include "gpsposition.h" #include "gpspositionsensor.h"
#include "homelocation.h" #include "homelocation.h"
#include "positionstate.h" #include "positionstate.h"
#include "systemsettings.h" #include "systemsettings.h"
@ -270,8 +270,8 @@ void OsgViewerWidget::paintEvent(QPaintEvent *event)
CoordinateConversions().NED2LLA_HomeLLA(homeLLA, NED, LLA); CoordinateConversions().NED2LLA_HomeLLA(homeLLA, NED, LLA);
uavPos->getLocator()->setPosition(osg::Vec3d(LLA[1], LLA[0], LLA[2])); // Note this takes longtitude first uavPos->getLocator()->setPosition(osg::Vec3d(LLA[1], LLA[0], LLA[2])); // Note this takes longtitude first
} else { } else {
GPSPosition *gpsPosObj = GPSPosition::GetInstance(objMngr); GPSPositionSensor *gpsPosObj = GPSPositionSensor::GetInstance(objMngr);
GPSPosition::DataFields gpsPos = gpsPosObj->getData(); GPSPositionSensor::DataFields gpsPos = gpsPosObj->getData();
uavPos->getLocator()->setPosition(osg::Vec3d(gpsPos.Longitude / 10.0e6, gpsPos.Latitude / 10.0e6, gpsPos.Altitude)); uavPos->getLocator()->setPosition(osg::Vec3d(gpsPos.Longitude / 10.0e6, gpsPos.Latitude / 10.0e6, gpsPos.Altitude));
} }

View File

@ -170,11 +170,11 @@ void PFDGadgetWidget::connectNeedles()
} }
if (gcsGPSStats) { if (gcsGPSStats) {
gpsObj = dynamic_cast<UAVDataObject *>(objManager->getObject("GPSPosition")); gpsObj = dynamic_cast<UAVDataObject *>(objManager->getObject("GPSPositionSensor"));
if (gpsObj != NULL) { if (gpsObj != NULL) {
connect(gpsObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateGPS(UAVObject *))); connect(gpsObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateGPS(UAVObject *)));
} else { } else {
qDebug() << "Error: Object is unknown (GPSPosition)."; qDebug() << "Error: Object is unknown (GPSPositionSensor).";
} }
} }

View File

@ -55,7 +55,7 @@ PfdQmlGadgetWidget::PfdQmlGadgetWidget(QWidget *parent) :
"VelocityDesired" << "VelocityDesired" <<
"PositionDesired" << "PositionDesired" <<
"AttitudeHoldDesired" << "AttitudeHoldDesired" <<
"GPSPosition" << "GPSPositionSensor" <<
"GCSTelemetryStats" << "GCSTelemetryStats" <<
"FlightBatteryState"; "FlightBatteryState";

View File

@ -52,7 +52,7 @@ QmlViewGadgetWidget::QmlViewGadgetWidget(QWidget *parent) :
objectsToExport << "VelocityState" << objectsToExport << "VelocityState" <<
"PositionState" << "PositionState" <<
"AttitudeState" << "AttitudeState" <<
"GPSPosition" << "GPSPositionSensor" <<
"GCSTelemetryStats" << "GCSTelemetryStats" <<
"FlightBatteryState"; "FlightBatteryState";

View File

@ -10,9 +10,9 @@ function OPPlots()
[VelocityState.East] [VelocityState.East]
[VelocityState.Down]]/100; [VelocityState.Down]]/100;
TimeGPSPos = [GPSPosition.timestamp]/1000; TimeGPSPos = [GPSPositionSensor.timestamp]/1000;
Vgps=[[GPSPosition.Groundspeed].*cos([GPSPosition.Heading]*pi/180) Vgps=[[GPSPositionSensor.Groundspeed].*cos([GPSPositionSensor.Heading]*pi/180)
[GPSPosition.Groundspeed].*sin([GPSPosition.Heading]*pi/180)]; [GPSPositionSensor.Groundspeed].*sin([GPSPositionSensor.Heading]*pi/180)];
figure(1); figure(1);
plot(TimeVA,VA(1,:),TimeVA,VA(2,:),TimeGPSPos,Vgps(1,:),TimeGPSPos,Vgps(2,:)); plot(TimeVA,VA(1,:),TimeVA,VA(2,:),TimeGPSPos,Vgps(1,:),TimeGPSPos,Vgps(2,:));
@ -30,10 +30,10 @@ function OPPlots()
[PositionState.East] [PositionState.East]
[PositionState.Down]]/100; [PositionState.Down]]/100;
TimeGPSPos = [GPSPosition.timestamp]/1000; TimeGPSPos = [GPSPositionSensor.timestamp]/1000;
LLA=[[GPSPosition.Latitude]*1e-7; LLA=[[GPSPositionSensor.Latitude]*1e-7;
[GPSPosition.Longitude]*1e-7; [GPSPositionSensor.Longitude]*1e-7;
[GPSPosition.Altitude]+[GPSPosition.GeoidSeparation]]; [GPSPositionSensor.Altitude]+[GPSPositionSensor.GeoidSeparation]];
BaseECEF = LLA2ECEF([HomeLocation.Latitude*1e-7, HomeLocation.Longitude*1e-7, HomeLocation.Altitude]'); BaseECEF = LLA2ECEF([HomeLocation.Latitude*1e-7, HomeLocation.Longitude*1e-7, HomeLocation.Altitude]');
Rne = RneFromLLA([HomeLocation.Latitude*1e-7, HomeLocation.Longitude*1e-7, HomeLocation.Altitude]'); Rne = RneFromLLA([HomeLocation.Latitude*1e-7, HomeLocation.Longitude*1e-7, HomeLocation.Altitude]');
GPSPos=LLA2Base(LLA,BaseECEF,Rne); GPSPos=LLA2Base(LLA,BaseECEF,Rne);

View File

@ -59,13 +59,14 @@ HEADERS += $$UAVOBJECT_SYNTHETICS/accessorydesired.h \
$$UAVOBJECT_SYNTHETICS/actuatorsettings.h \ $$UAVOBJECT_SYNTHETICS/actuatorsettings.h \
$$UAVOBJECT_SYNTHETICS/actuatordesired.h \ $$UAVOBJECT_SYNTHETICS/actuatordesired.h \
$$UAVOBJECT_SYNTHETICS/actuatorcommand.h \ $$UAVOBJECT_SYNTHETICS/actuatorcommand.h \
$$UAVOBJECT_SYNTHETICS/gpsposition.h \ $$UAVOBJECT_SYNTHETICS/gpspositionsensor.h \
$$UAVOBJECT_SYNTHETICS/gpstime.h \ $$UAVOBJECT_SYNTHETICS/gpstime.h \
$$UAVOBJECT_SYNTHETICS/gpssatellites.h \ $$UAVOBJECT_SYNTHETICS/gpssatellites.h \
$$UAVOBJECT_SYNTHETICS/pathaction.h \ $$UAVOBJECT_SYNTHETICS/pathaction.h \
$$UAVOBJECT_SYNTHETICS/pathdesired.h \ $$UAVOBJECT_SYNTHETICS/pathdesired.h \
$$UAVOBJECT_SYNTHETICS/pathstatus.h \ $$UAVOBJECT_SYNTHETICS/pathstatus.h \
$$UAVOBJECT_SYNTHETICS/gpsvelocity.h \ $$UAVOBJECT_SYNTHETICS/gpsvelocitysensor.h \
$$UAVOBJECT_SYNTHETICS/positionsensor.h \
$$UAVOBJECT_SYNTHETICS/positionstate.h \ $$UAVOBJECT_SYNTHETICS/positionstate.h \
$$UAVOBJECT_SYNTHETICS/flightbatterystate.h \ $$UAVOBJECT_SYNTHETICS/flightbatterystate.h \
$$UAVOBJECT_SYNTHETICS/homelocation.h \ $$UAVOBJECT_SYNTHETICS/homelocation.h \
@ -143,13 +144,14 @@ SOURCES += $$UAVOBJECT_SYNTHETICS/accessorydesired.cpp \
$$UAVOBJECT_SYNTHETICS/actuatorsettings.cpp \ $$UAVOBJECT_SYNTHETICS/actuatorsettings.cpp \
$$UAVOBJECT_SYNTHETICS/actuatordesired.cpp \ $$UAVOBJECT_SYNTHETICS/actuatordesired.cpp \
$$UAVOBJECT_SYNTHETICS/actuatorcommand.cpp \ $$UAVOBJECT_SYNTHETICS/actuatorcommand.cpp \
$$UAVOBJECT_SYNTHETICS/gpsposition.cpp \ $$UAVOBJECT_SYNTHETICS/gpspositionsensor.cpp \
$$UAVOBJECT_SYNTHETICS/gpstime.cpp \ $$UAVOBJECT_SYNTHETICS/gpstime.cpp \
$$UAVOBJECT_SYNTHETICS/gpssatellites.cpp \ $$UAVOBJECT_SYNTHETICS/gpssatellites.cpp \
$$UAVOBJECT_SYNTHETICS/pathaction.cpp \ $$UAVOBJECT_SYNTHETICS/pathaction.cpp \
$$UAVOBJECT_SYNTHETICS/pathdesired.cpp \ $$UAVOBJECT_SYNTHETICS/pathdesired.cpp \
$$UAVOBJECT_SYNTHETICS/pathstatus.cpp \ $$UAVOBJECT_SYNTHETICS/pathstatus.cpp \
$$UAVOBJECT_SYNTHETICS/gpsvelocity.cpp \ $$UAVOBJECT_SYNTHETICS/gpsvelocitysensor.cpp \
$$UAVOBJECT_SYNTHETICS/positionsensor.cpp \
$$UAVOBJECT_SYNTHETICS/positionstate.cpp \ $$UAVOBJECT_SYNTHETICS/positionstate.cpp \
$$UAVOBJECT_SYNTHETICS/flightbatterystate.cpp \ $$UAVOBJECT_SYNTHETICS/flightbatterystate.cpp \
$$UAVOBJECT_SYNTHETICS/homelocation.cpp \ $$UAVOBJECT_SYNTHETICS/homelocation.cpp \

View File

@ -38,7 +38,7 @@
#include "firmwareiapobj.h" #include "firmwareiapobj.h"
#include "homelocation.h" #include "homelocation.h"
#include "gpsposition.h" #include "gpspositionsensor.h"
// ****************************** // ******************************
// constructor/destructor // constructor/destructor
@ -377,13 +377,13 @@ int UAVObjectUtilManager::getHomeLocation(bool &set, double LLA[3])
// ****************************** // ******************************
// GPS // GPS
int UAVObjectUtilManager::getGPSPosition(double LLA[3]) int UAVObjectUtilManager::getGPSPositionSensor(double LLA[3])
{ {
GPSPosition *gpsPosition = GPSPosition::GetInstance(obm); GPSPositionSensor *gpsPosition = GPSPositionSensor::GetInstance(obm);
Q_ASSERT(gpsPosition != NULL); Q_ASSERT(gpsPosition != NULL);
GPSPosition::DataFields gpsPositionData = gpsPosition->getData(); GPSPositionSensor::DataFields gpsPositionData = gpsPosition->getData();
LLA[0] = gpsPositionData.Latitude; LLA[0] = gpsPositionData.Latitude;
LLA[1] = gpsPositionData.Longitude; LLA[1] = gpsPositionData.Longitude;

View File

@ -55,7 +55,7 @@ public:
int setHomeLocation(double LLA[3], bool save_to_sdcard); int setHomeLocation(double LLA[3], bool save_to_sdcard);
int getHomeLocation(bool &set, double LLA[3]); int getHomeLocation(bool &set, double LLA[3]);
int getGPSPosition(double LLA[3]); int getGPSPositionSensor(double LLA[3]);
int getBoardModel(); int getBoardModel();
QByteArray getBoardCPUSerial(); QByteArray getBoardCPUSerial();

View File

@ -1,5 +1,5 @@
<xml> <xml>
<object name="GPSPosition" singleinstance="true" settings="false"> <object name="GPSPositionSensor" singleinstance="true" settings="false">
<description>Raw GPS data from @ref GPSModule. Should only be used by @ref AHRSCommsModule.</description> <description>Raw GPS data from @ref GPSModule. Should only be used by @ref AHRSCommsModule.</description>
<field name="Status" units="" type="enum" elements="1" options="NoGPS,NoFix,Fix2D,Fix3D"/> <field name="Status" units="" type="enum" elements="1" options="NoGPS,NoFix,Fix2D,Fix3D"/>
<field name="Latitude" units="degrees x 10^-7" type="int32" elements="1"/> <field name="Latitude" units="degrees x 10^-7" type="int32" elements="1"/>

View File

@ -1,5 +1,5 @@
<xml> <xml>
<object name="GPSVelocity" singleinstance="true" settings="false"> <object name="GPSVelocitySensor" singleinstance="true" settings="false">
<description>Raw GPS data from @ref GPSModule.</description> <description>Raw GPS data from @ref GPSModule.</description>
<field name="North" units="m/s" type="float" elements="1"/> <field name="North" units="m/s" type="float" elements="1"/>
<field name="East" units="m/s" type="float" elements="1"/> <field name="East" units="m/s" type="float" elements="1"/>