From 9b95af200645273d15420c9cf76e6f154e036860 Mon Sep 17 00:00:00 2001 From: Corvus Corax Date: Wed, 22 May 2013 21:45:06 +0200 Subject: [PATCH] refaktored GPS Sensor UAVObjects --- .../Airspeed/revolution/gps_airspeed.c | 10 +-- flight/modules/Attitude/revolution/attitude.c | 40 +++++----- .../fixedwingpathfollower.c | 2 - flight/modules/GPS/GPS.c | 75 ++++++++++++++----- flight/modules/GPS/NMEA.c | 60 +++++++-------- flight/modules/GPS/UBX.c | 32 ++++---- flight/modules/GPS/inc/GPS.h | 4 +- flight/modules/GPS/inc/NMEA.h | 4 +- flight/modules/GPS/inc/UBX.h | 6 +- flight/modules/Osd/OsdEtStd/OsdEtStd.c | 12 +-- flight/modules/Osd/osdgen/osdgen.c | 12 +-- flight/modules/Sensors/simulated/sensors.c | 44 +++++------ flight/modules/StateEstimation/filterekf.c | 6 +- .../modules/StateEstimation/stateestimation.c | 28 +++---- .../VtolPathFollower/vtolpathfollower.c | 16 ++-- .../boards/coptercontrol/firmware/Makefile | 4 +- flight/targets/boards/osd/firmware/Makefile | 4 +- .../boards/revolution/firmware/UAVObjects.inc | 5 +- .../revolution/firmware/inc/pios_config.h | 1 + .../revolution/firmware/pios_board_sim.c | 4 +- .../boards/revoproto/firmware/UAVObjects.inc | 5 +- .../revoproto/firmware/inc/pios_config.h | 1 + .../revoproto/firmware/pios_board_sim.c | 4 +- .../boards/simposix/firmware/UAVObjects.inc | 5 +- .../default_configurations/Developer.xml | 10 +-- .../default_configurations/OpenPilotGCS.xml | 10 +-- .../OpenPilotGCS_wide.xml | 10 +-- .../pfd/default/PfdIndicators.qml | 4 +- .../pfd/default/PfdTerrainView.qml | 6 +- .../translations/openpilotgcs_de.ts | 2 +- .../translations/openpilotgcs_es.ts | 2 +- .../translations/openpilotgcs_fr.ts | 2 +- .../translations/openpilotgcs_ru.ts | 2 +- .../translations/openpilotgcs_zh_CN.ts | 2 +- .../plugins/antennatrack/telemetryparser.cpp | 4 +- .../plugins/gpsdisplay/telemetryparser.cpp | 4 +- .../src/plugins/hitl/hitlnoisegeneration.h | 20 ++--- .../src/plugins/hitl/simulator.cpp | 14 ++-- .../openpilotgcs/src/plugins/hitl/simulator.h | 8 +- .../src/plugins/opmap/opmapgadgetwidget.cpp | 10 +-- .../src/plugins/opmap/opmapgadgetwidget.h | 2 +- .../plugins/osgearthview/osgviewerwidget.cpp | 6 +- .../src/plugins/pfd/pfdgadgetwidget.cpp | 4 +- .../src/plugins/pfdqml/pfdqmlgadgetwidget.cpp | 2 +- .../plugins/qmlview/qmlviewgadgetwidget.cpp | 2 +- .../src/plugins/uavobjects/OPPlots.m | 14 ++-- .../src/plugins/uavobjects/uavobjects.pro | 10 ++- .../uavobjectutil/uavobjectutilmanager.cpp | 8 +- .../uavobjectutil/uavobjectutilmanager.h | 2 +- ...{gpsposition.xml => gpspositionsensor.xml} | 2 +- ...{gpsvelocity.xml => gpsvelocitysensor.xml} | 2 +- 51 files changed, 295 insertions(+), 253 deletions(-) rename shared/uavobjectdefinition/{gpsposition.xml => gpspositionsensor.xml} (94%) rename shared/uavobjectdefinition/{gpsvelocity.xml => gpsvelocitysensor.xml} (87%) diff --git a/flight/modules/Airspeed/revolution/gps_airspeed.c b/flight/modules/Airspeed/revolution/gps_airspeed.c index 6a0d665ec..7f63f622f 100644 --- a/flight/modules/Airspeed/revolution/gps_airspeed.c +++ b/flight/modules/Airspeed/revolution/gps_airspeed.c @@ -32,7 +32,7 @@ #include "openpilot.h" #include "gps_airspeed.h" -#include "gpsvelocity.h" +#include "gpsvelocitysensor.h" #include "attitudestate.h" #include "CoordinateConversions.h" #include @@ -66,8 +66,8 @@ void gps_airspeedInitialize() gps = (struct GPSGlobals *)pvPortMalloc(sizeof(struct GPSGlobals)); // GPS airspeed calculation variables - GPSVelocityData gpsVelData; - GPSVelocityGet(&gpsVelData); + GPSVelocitySensorData gpsVelData; + GPSVelocitySensorGet(&gpsVelData); gps->gpsVelOld_N = gpsVelData.North; 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 (fabsf(cosDiff) < cosf(DEG2RAD(5.0f))) { - GPSVelocityData gpsVelData; - GPSVelocityGet(&gpsVelData); + GPSVelocitySensorData gpsVelData; + GPSVelocitySensorGet(&gpsVelData); // 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); diff --git a/flight/modules/Attitude/revolution/attitude.c b/flight/modules/Attitude/revolution/attitude.c index c8058d3cf..da80f5ca4 100644 --- a/flight/modules/Attitude/revolution/attitude.c +++ b/flight/modules/Attitude/revolution/attitude.c @@ -59,8 +59,8 @@ #include "attitudesettings.h" #include "barosensor.h" #include "flightstatus.h" -#include "gpsposition.h" -#include "gpsvelocity.h" +#include "gpspositionsensor.h" +#include "gpsvelocitysensor.h" #include "gyrostate.h" #include "gyrosensor.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 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); @@ -172,8 +172,8 @@ int32_t AttitudeInitialize(void) AirspeedSensorInitialize(); AirspeedStateInitialize(); BaroSensorInitialize(); - GPSPositionInitialize(); - GPSVelocityInitialize(); + GPSPositionSensorInitialize(); + GPSVelocitySensorInitialize(); AttitudeSettingsInitialize(); AttitudeStateInitialize(); PositionStateInitialize(); @@ -233,8 +233,8 @@ int32_t AttitudeStart(void) MagSensorConnectQueue(magQueue); AirspeedSensorConnectQueue(airspeedQueue); BaroSensorConnectQueue(baroQueue); - GPSPositionConnectQueue(gpsQueue); - GPSVelocityConnectQueue(gpsVelQueue); + GPSPositionSensorConnectQueue(gpsQueue); + GPSVelocitySensorConnectQueue(gpsVelQueue); return 0; } @@ -541,8 +541,8 @@ static int32_t updateAttitudeComplementary(bool first_run) if (xQueueReceive(gpsQueue, &ev, 0) == pdTRUE && homeLocation.Set == HOMELOCATION_SET_TRUE) { float NED[3]; // Transform the GPS position into NED coordinates - GPSPositionData gpsPosition; - GPSPositionGet(&gpsPosition); + GPSPositionSensorData gpsPosition; + GPSPositionSensorGet(&gpsPosition); getNED(&gpsPosition, NED); PositionStateData positionState; @@ -555,8 +555,8 @@ static int32_t updateAttitudeComplementary(bool first_run) if (xQueueReceive(gpsVelQueue, &ev, 0) == pdTRUE) { // Transform the GPS position into NED coordinates - GPSVelocityData gpsVelocity; - GPSVelocityGet(&gpsVelocity); + GPSVelocitySensorData gpsVelocity; + GPSVelocitySensorGet(&gpsVelocity); VelocityStateData velocityState; VelocityStateGet(&velocityState); @@ -615,8 +615,8 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode) MagStateData magData; AirspeedSensorData airspeedData; BaroSensorData baroData; - GPSPositionData gpsData; - GPSVelocityData gpsVelData; + GPSPositionSensorData gpsData; + GPSVelocitySensorData gpsVelData; static bool mag_updated = false; 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; // Check if we are running simulation - if (!GPSPositionReadOnly()) { + if (!GPSPositionSensorReadOnly()) { gps_updated |= (xQueueReceive(gpsQueue, &ev, 0 / portTICK_RATE_MS) == pdTRUE) && outdoor_mode; } else { gps_updated |= pdTRUE && outdoor_mode; } - if (!GPSVelocityReadOnly()) { + if (!GPSVelocitySensorReadOnly()) { gps_vel_updated |= (xQueueReceive(gpsVelQueue, &ev, 0 / portTICK_RATE_MS) == pdTRUE) && outdoor_mode; } else { gps_vel_updated |= pdTRUE && outdoor_mode; @@ -708,8 +708,8 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode) BaroSensorGet(&baroData); AirspeedSensorGet(&airspeedData); - GPSPositionGet(&gpsData); - GPSVelocityGet(&gpsVelData); + GPSPositionSensorGet(&gpsData); + GPSVelocitySensorGet(&gpsVelData); // TODO: put in separate filter 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 }; if (outdoor_mode) { - GPSPositionData gpsPosition; - GPSPositionGet(&gpsPosition); + GPSPositionSensorData gpsPosition; + GPSPositionSensorGet(&gpsPosition); // Transform the GPS position into NED coordinates getNED(&gpsPosition, pos); @@ -1074,7 +1074,7 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode) * @returns 0 for success, -1 for failure */ 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), DEG2RAD((gpsPosition->Longitude - homeLocation.Longitude) / 10.0e6f), diff --git a/flight/modules/FixedWingPathFollower/fixedwingpathfollower.c b/flight/modules/FixedWingPathFollower/fixedwingpathfollower.c index 665496a44..438143d4f 100644 --- a/flight/modules/FixedWingPathFollower/fixedwingpathfollower.c +++ b/flight/modules/FixedWingPathFollower/fixedwingpathfollower.c @@ -53,8 +53,6 @@ #include "flightstatus.h" #include "pathstatus.h" #include "airspeedstate.h" -#include "gpsvelocity.h" -#include "gpsposition.h" #include "fixedwingpathfollowersettings.h" #include "fixedwingpathfollowerstatus.h" #include "homelocation.h" diff --git a/flight/modules/GPS/GPS.c b/flight/modules/GPS/GPS.c index 0fdb9142e..6c36cb5f3 100644 --- a/flight/modules/GPS/GPS.c +++ b/flight/modules/GPS/GPS.c @@ -32,11 +32,12 @@ #include -#include "gpsposition.h" +#include "gpspositionsensor.h" #include "homelocation.h" +#include "positionsensor.h" #include "gpstime.h" #include "gpssatellites.h" -#include "gpsvelocity.h" +#include "gpsvelocitysensor.h" #include "systemsettings.h" #include "taskinfo.h" #include "hwsettings.h" @@ -56,9 +57,12 @@ static void gpsTask(void *parameters); static void updateSettings(); #ifdef PIOS_GPS_SETS_HOMELOCATION -static void setHomeLocation(GPSPositionData *gpsData); +static void setHomeLocation(GPSPositionSensorData *gpsData); static float GravityAccel(float latitude, float longitude, float altitude); #endif +#ifdef PIOS_GPS_SETS_POSITIONSENSOR +static void setPositionSensor(GPSPositionSensorData *gpsData); +#endif // **************** // Private constants @@ -147,23 +151,27 @@ int32_t GPSInitialize(void) // These objects MUST be initialized for Revolution // because the rest of the system expects to just // attach to their queues - GPSPositionInitialize(); - GPSVelocityInitialize(); + GPSPositionSensorInitialize(); + GPSVelocitySensorInitialize(); GPSTimeInitialize(); GPSSatellitesInitialize(); HomeLocationInitialize(); + PositionSensorInitialize(); updateSettings(); #else if (gpsPort && gpsEnabled) { - GPSPositionInitialize(); - GPSVelocityInitialize(); + GPSPositionSensorInitialize(); + GPSVelocitySensorInitialize(); #if !defined(PIOS_GPS_MINIMAL) GPSTimeInitialize(); GPSSatellitesInitialize(); #endif -#ifdef PIOS_GPS_SETS_HOMELOCATION +#if (defined(PIOS_GPS_SETS_HOMELOCATION) || defined(PIOS_GPS_SETS_POSITIONSENSOR)) HomeLocationInitialize(); +#endif +#ifdef PIOS_GPS_SETS_POSITIONSENSOR + PositionSensorInitialize(); #endif updateSettings(); } @@ -202,7 +210,7 @@ static void gpsTask(__attribute__((unused)) void *parameters) portTickType xDelay = 100 / portTICK_RATE_MS; uint32_t timeNowMs = xTaskGetTickCount() * portTICK_RATE_MS; - GPSPositionData gpsposition; + GPSPositionSensorData gpspositionsensor; uint8_t gpsProtocol; SystemSettingsGPSDataProtocolGet(&gpsProtocol); @@ -210,7 +218,7 @@ static void gpsTask(__attribute__((unused)) void *parameters) timeOfLastUpdateMs = timeNowMs; timeOfLastCommandMs = timeNowMs; - GPSPositionGet(&gpsposition); + GPSPositionSensorGet(&gpspositionsensor); // Loop forever while (1) { uint8_t c; @@ -221,12 +229,12 @@ static void gpsTask(__attribute__((unused)) void *parameters) switch (gpsProtocol) { #if defined(PIOS_INCLUDE_GPS_NMEA_PARSER) 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; #endif #if defined(PIOS_INCLUDE_GPS_UBX_PARSER) 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; #endif default: @@ -246,25 +254,28 @@ static void gpsTask(__attribute__((unused)) void *parameters) if ((timeNowMs - timeOfLastUpdateMs) >= GPS_TIMEOUT_MS) { // 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. - uint8_t status = GPSPOSITION_STATUS_NOGPS; - GPSPositionStatusSet(&status); + uint8_t status = GPSPOSITIONSENSOR_STATUS_NOGPS; + GPSPositionSensorStatusSet(&status); AlarmsSet(SYSTEMALARMS_ALARM_GPS, SYSTEMALARMS_ALARM_ERROR); } else { // we appear to be receiving GPS sentences OK, we've had an update // criteria for GPS-OK taken from this post... // http://forums.openpilot.org/topic/1523-professors-insgps-in-svn/page__view__findpost__p__5220 - if ((gpsposition.PDOP < 3.5f) && (gpsposition.Satellites >= 7) && - (gpsposition.Status == GPSPOSITION_STATUS_FIX3D)) { + if ((gpspositionsensor.PDOP < 3.5f) && (gpspositionsensor.Satellites >= 7) && + (gpspositionsensor.Status == GPSPOSITIONSENSOR_STATUS_FIX3D)) { AlarmsClear(SYSTEMALARMS_ALARM_GPS); #ifdef PIOS_GPS_SETS_HOMELOCATION HomeLocationData home; HomeLocationGet(&home); if (home.Set == HOMELOCATION_SET_FALSE) { - setHomeLocation(&gpsposition); + setHomeLocation(&gpspositionsensor); } #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); } else { 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; @@ -325,6 +336,32 @@ static void setHomeLocation(GPSPositionData *gpsData) } #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. * FIXME: This should be in the GPSSettings object. But objects have diff --git a/flight/modules/GPS/NMEA.c b/flight/modules/GPS/NMEA.c index d5be3131d..cc16b64c0 100644 --- a/flight/modules/GPS/NMEA.c +++ b/flight/modules/GPS/NMEA.c @@ -33,7 +33,7 @@ #if defined(PIOS_INCLUDE_GPS_NMEA_PARSER) -#include "gpsposition.h" +#include "gpspositionsensor.h" #include "NMEA.h" #include "gpstime.h" #include "gpssatellites.h" @@ -65,16 +65,16 @@ struct nmea_parser { 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 nmeaProcessGPRMC(GPSPositionData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam); -static bool nmeaProcessGPVTG(GPSPositionData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam); -static bool nmeaProcessGPGSA(GPSPositionData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam); +static bool nmeaProcessGPGGA(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam); +static bool nmeaProcessGPRMC(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam); +static bool nmeaProcessGPVTG(GPSPositionSensorData *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) -static bool nmeaProcessGPZDA(GPSPositionData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam); -static bool nmeaProcessGPGSV(GPSPositionData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam); +static bool nmeaProcessGPZDA(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam); +static bool nmeaProcessGPGSV(GPSPositionSensorData *GpsData, bool *gpsDataUpdated, char *param[], uint8_t nbParam); #endif // PIOS_GPS_MINIMAL static const struct nmea_parser nmea_parsers[] = { @@ -106,7 +106,7 @@ static const struct nmea_parser nmea_parsers[] = { #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 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 * \return true if the sentence was successfully parsed * \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 *params[MAX_NB_PARAMS]; @@ -412,7 +412,7 @@ bool NMEA_update_position(char *nmea_sentence, GPSPositionData *GpsData) #endif // Send the message to the parser and get it update the GpsData // 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 // gpsDataUpdated flag to request this. bool gpsDataUpdated = false; @@ -420,8 +420,8 @@ bool NMEA_update_position(char *nmea_sentence, GPSPositionData *GpsData) if (!parser->handler(GpsData, &gpsDataUpdated, params, nbParams)) { // Parse failed DEBUG_MSG("PARSE FAILED (\"%s\")\n", params[0]); - if (gpsDataUpdated && (GpsData->Status == GPSPOSITION_STATUS_NOFIX)) { - GPSPositionSet(GpsData); + if (gpsDataUpdated && (GpsData->Status == GPSPOSITIONSENSOR_STATUS_NOFIX)) { + GPSPositionSensorSet(GpsData); } return false; } @@ -432,7 +432,7 @@ bool NMEA_update_position(char *nmea_sentence, GPSPositionData *GpsData) #ifdef DEBUG_MGSID_IN DEBUG_MSG("U"); #endif - GPSPositionSet(GpsData); + GPSPositionSensorSet(GpsData); } #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 - * \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 */ -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) { 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 // this function early 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] @@ -497,10 +497,10 @@ static bool nmeaProcessGPGGA(GPSPositionData *GpsData, bool *gpsDataUpdated, cha /** * 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 */ -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) { return false; @@ -565,10 +565,10 @@ static bool nmeaProcessGPRMC(GPSPositionData *GpsData, bool *gpsDataUpdated, cha /** * 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 */ -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...*/) { return false; @@ -590,10 +590,10 @@ static bool nmeaProcessGPVTG(GPSPositionData *GpsData, bool *gpsDataUpdated, cha #if !defined(PIOS_GPS_MINIMAL) /** * 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 */ -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) { return false; @@ -633,7 +633,7 @@ static uint8_t gsv_processed_mask; static uint16_t gsv_incomplete_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) { return false; @@ -717,10 +717,10 @@ static bool nmeaProcessGPGSV(__attribute__((unused)) GPSPositionData *GpsData, b /** * 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 */ -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) { return false; @@ -737,13 +737,13 @@ static bool nmeaProcessGPGSA(GPSPositionData *GpsData, bool *gpsDataUpdated, cha switch (atoi(param[2])) { case 1: - GpsData->Status = GPSPOSITION_STATUS_NOFIX; + GpsData->Status = GPSPOSITIONSENSOR_STATUS_NOFIX; break; case 2: - GpsData->Status = GPSPOSITION_STATUS_FIX2D; + GpsData->Status = GPSPOSITIONSENSOR_STATUS_FIX2D; break; case 3: - GpsData->Status = GPSPOSITION_STATUS_FIX3D; + GpsData->Status = GPSPOSITIONSENSOR_STATUS_FIX3D; break; default: /* Unhandled */ diff --git a/flight/modules/GPS/UBX.c b/flight/modules/GPS/UBX.c index bf8fe8039..a58e926e4 100644 --- a/flight/modules/GPS/UBX.c +++ b/flight/modules/GPS/UBX.c @@ -38,7 +38,7 @@ // 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 { 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 (GpsPosition->Status != GPSPOSITION_STATUS_NOFIX) { + if (GpsPosition->Status != GPSPOSITIONSENSOR_STATUS_NOFIX) { GpsPosition->Altitude = (float)posllh->hMSL * 0.001f; GpsPosition->GeoidSeparation = (float)(posllh->height - posllh->hMSL) * 0.001f; 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)) { 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) { switch (sol->gpsFix) { case STATUS_GPSFIX_2DFIX: - GpsPosition->Status = GPSPOSITION_STATUS_FIX2D; + GpsPosition->Status = GPSPOSITIONSENSOR_STATUS_FIX2D; break; case STATUS_GPSFIX_3DFIX: - GpsPosition->Status = GPSPOSITION_STATUS_FIX3D; + GpsPosition->Status = GPSPOSITIONSENSOR_STATUS_FIX3D; 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 - 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)) { 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 (GpsPosition->Status != GPSPOSITION_STATUS_NOFIX) { + if (GpsPosition->Status != GPSPOSITIONSENSOR_STATUS_NOFIX) { GpsVelocity.North = (float)velned->velN / 100.0f; GpsVelocity.East = (float)velned->velE / 100.0f; GpsVelocity.Down = (float)velned->velD / 100.0f; - GPSVelocitySet(&GpsVelocity); + GPSVelocitySensorSet(&GpsVelocity); GpsPosition->Groundspeed = (float)velned->gSpeed * 0.01f; 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 // 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; @@ -333,9 +333,9 @@ uint32_t parse_ubx_message(struct UBXPacket *ubx, GPSPositionData *GpsPosition) break; } if (msgtracker.msg_received == ALL_RECEIVED) { - GPSPositionSet(GpsPosition); + GPSPositionSensorSet(GpsPosition); msgtracker.msg_received = NONE_RECEIVED; - id = GPSPOSITION_OBJID; + id = GPSPOSITIONSENSOR_OBJID; } return id; } diff --git a/flight/modules/GPS/inc/GPS.h b/flight/modules/GPS/inc/GPS.h index ecc7470d8..6cecaa845 100644 --- a/flight/modules/GPS/inc/GPS.h +++ b/flight/modules/GPS/inc/GPS.h @@ -34,9 +34,9 @@ #ifndef GPS_H #define GPS_H -#include "gpsvelocity.h" +#include "gpsvelocitysensor.h" #include "gpssatellites.h" -#include "gpsposition.h" +#include "gpspositionsensor.h" #include "gpstime.h" #define NO_PARSER -3 // no parser available diff --git a/flight/modules/GPS/inc/NMEA.h b/flight/modules/GPS/inc/NMEA.h index a1e94a24e..04a7dc4ce 100644 --- a/flight/modules/GPS/inc/NMEA.h +++ b/flight/modules/GPS/inc/NMEA.h @@ -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 -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 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 */ diff --git a/flight/modules/GPS/inc/UBX.h b/flight/modules/GPS/inc/UBX.h index 9a1c86eeb..fd1ee0fb1 100644 --- a/flight/modules/GPS/inc/UBX.h +++ b/flight/modules/GPS/inc/UBX.h @@ -31,7 +31,7 @@ #ifndef UBX_H #define UBX_H #include "openpilot.h" -#include "gpsposition.h" +#include "gpspositionsensor.h" #include "GPS.h" @@ -218,7 +218,7 @@ struct UBXPacket { }; bool checksum_ubx_message(struct UBXPacket *); -uint32_t parse_ubx_message(struct UBXPacket *, GPSPositionData *); -int parse_ubx_stream(uint8_t, char *, GPSPositionData *, struct GPS_RX_STATS *); +uint32_t parse_ubx_message(struct UBXPacket *, GPSPositionSensorData *); +int parse_ubx_stream(uint8_t, char *, GPSPositionSensorData *, struct GPS_RX_STATS *); #endif /* UBX_H */ diff --git a/flight/modules/Osd/OsdEtStd/OsdEtStd.c b/flight/modules/Osd/OsdEtStd/OsdEtStd.c index 29b04c4cc..fdf74f072 100644 --- a/flight/modules/Osd/OsdEtStd/OsdEtStd.c +++ b/flight/modules/Osd/OsdEtStd/OsdEtStd.c @@ -32,7 +32,7 @@ #include "openpilot.h" #include "flightbatterystate.h" -#include "gpsposition.h" +#include "gpspositionsensor.h" #include "attitudestate.h" #include "barosensor.h" @@ -209,7 +209,7 @@ static void FlightBatteryStateUpdatedCb(__attribute__((unused)) UAVObjEvent *ev) newBattData = TRUE; } -static void GPSPositionUpdatedCb(__attribute__((unused)) UAVObjEvent *ev) +static void GPSPositionSensorUpdatedCb(__attribute__((unused)) UAVObjEvent *ev) { newPosData = TRUE; } @@ -440,17 +440,17 @@ static void Run(void) } if (newPosData) { - GPSPositionData positionData; + GPSPositionSensorData positionData; AttitudeStateData attitudeStateData; - GPSPositionGet(&positionData); + GPSPositionSensorGet(&positionData); AttitudeStateGet(&attitudeStateData); // DEBUG_MSG("%5d Pos: #stat=%d #sats=%d alt=%d\n\r", cnt, // positionData.Status, positionData.Satellites, (uint32_t)positionData.Altitude); // GPS Status - if (positionData.Status == GPSPOSITION_STATUS_FIX3D) { + if (positionData.Status == GPSPOSITIONSENSOR_STATUS_FIX3D) { msg[OSDMSG_GPS_STAT] = OSDMSG_GPS_STAT_FIX; } else { msg[OSDMSG_GPS_STAT] = OSDMSG_GPS_STAT_NOFIX; @@ -543,7 +543,7 @@ static void onTimer(UAVObjEvent *ev) */ int32_t OsdEtStdInitialize(void) { - GPSPositionConnectCallback(GPSPositionUpdatedCb); + GPSPositionSensorConnectCallback(GPSPositionSensorUpdatedCb); FlightBatteryStateConnectCallback(FlightBatteryStateUpdatedCb); BaroSensorConnectCallback(BaroSensorUpdatedCb); diff --git a/flight/modules/Osd/osdgen/osdgen.c b/flight/modules/Osd/osdgen/osdgen.c index 23539bcc7..c2f2a0b18 100644 --- a/flight/modules/Osd/osdgen/osdgen.c +++ b/flight/modules/Osd/osdgen/osdgen.c @@ -35,7 +35,7 @@ #include "osdgen.h" #include "attitudestate.h" -#include "gpsposition.h" +#include "gpspositionsensor.h" #include "homelocation.h" #include "gpstime.h" #include "gpssatellites.h" @@ -2036,8 +2036,8 @@ void calcHomeArrow(int16_t m_yaw) HomeLocationData home; HomeLocationGet(&home); - GPSPositionData gpsData; - GPSPositionGet(&gpsData); + GPSPositionSensorData gpsData; + GPSPositionSensorGet(&gpsData); /** http://www.movable-type.co.uk/scripts/latlong.html **/ float lat1, lat2, lon1, lon2, a, c, d, x, y, brng, u2g; @@ -2139,8 +2139,8 @@ void updateGraphics() OsdSettingsGet(&OsdSettings); AttitudeStateData attitude; AttitudeStateGet(&attitude); - GPSPositionData gpsData; - GPSPositionGet(&gpsData); + GPSPositionSensorData gpsData; + GPSPositionSensorGet(&gpsData); HomeLocationData home; HomeLocationGet(&home); BaroSensorData baro; @@ -2421,7 +2421,7 @@ int32_t osdgenInitialize(void) { AttitudeStateInitialize(); #ifdef PIOS_INCLUDE_GPS - GPSPositionInitialize(); + GPSPositionSensorInitialize(); #if !defined(PIOS_GPS_MINIMAL) GPSTimeInitialize(); GPSSatellitesInitialize(); diff --git a/flight/modules/Sensors/simulated/sensors.c b/flight/modules/Sensors/simulated/sensors.c index b236f6cd0..dd19a6d2d 100644 --- a/flight/modules/Sensors/simulated/sensors.c +++ b/flight/modules/Sensors/simulated/sensors.c @@ -58,8 +58,8 @@ #include "barosensor.h" #include "gyrosensor.h" #include "flightstatus.h" -#include "gpsposition.h" -#include "gpsvelocity.h" +#include "gpspositionsensor.h" +#include "gpsvelocitysensor.h" #include "homelocation.h" #include "sensor.h" #include "ratedesired.h" @@ -111,8 +111,8 @@ int32_t SensorsInitialize(void) AirspeedSensorInitialize(); GyroSensorInitialize(); // GyrosBiasInitialize(); - GPSPositionInitialize(); - GPSVelocityInitialize(); + GPSPositionSensorInitialize(); + GPSVelocitySensorInitialize(); MagSensorInitialize(); MagBiasInitialize(); RevoCalibrationInitialize(); @@ -243,12 +243,12 @@ static void simulateConstant() baroSensor.Altitude = 1; BaroSensorSet(&baroSensor); - GPSPositionData gpsPosition; - GPSPositionGet(&gpsPosition); + GPSPositionSensorData gpsPosition; + GPSPositionSensorGet(&gpsPosition); gpsPosition.Latitude = 0; gpsPosition.Longitude = 0; gpsPosition.Altitude = 0; - GPSPositionSet(&gpsPosition); + GPSPositionSensorSet(&gpsPosition); // Because most crafts wont get enough information from gravity to zero yaw gyro, we try // and make it average zero (weakly) @@ -305,12 +305,12 @@ static void simulateModelAgnostic() baroSensor.Altitude = 1; BaroSensorSet(&baroSensor); - GPSPositionData gpsPosition; - GPSPositionGet(&gpsPosition); + GPSPositionSensorData gpsPosition; + GPSPositionSensorGet(&gpsPosition); gpsPosition.Latitude = 0; gpsPosition.Longitude = 0; gpsPosition.Altitude = 0; - GPSPositionSet(&gpsPosition); + GPSPositionSensorSet(&gpsPosition); // Because most crafts wont get enough information from gravity to zero yaw gyro, we try // 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[2] = gps_drift[2] * 0.95 + rand_gauss() / 10.0; - GPSPositionData gpsPosition; - GPSPositionGet(&gpsPosition); + GPSPositionSensorData gpsPosition; + GPSPositionSensorGet(&gpsPosition); 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.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.Satellites = 7; gpsPosition.PDOP = 1; - GPSPositionSet(&gpsPosition); + GPSPositionSensorSet(&gpsPosition); last_gps_time = PIOS_DELAY_GetRaw(); } // Update GPS Velocity measurements static uint32_t last_gps_vel_time = 1000; // Delay by a millisecond if (PIOS_DELAY_DiffuS(last_gps_vel_time) / 1.0e6 > GPS_PERIOD) { - GPSVelocityData gpsVelocity; - GPSVelocityGet(&gpsVelocity); + GPSVelocitySensorData gpsVelocity; + GPSVelocitySensorGet(&gpsVelocity); gpsVelocity.North = vel[0] + gps_vel_drift[0]; gpsVelocity.East = vel[1] + gps_vel_drift[1]; gpsVelocity.Down = vel[2] + gps_vel_drift[2]; - GPSVelocitySet(&gpsVelocity); + GPSVelocitySensorSet(&gpsVelocity); 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[2] = gps_drift[2] * 0.95 + rand_gauss() / 10.0; - GPSPositionData gpsPosition; - GPSPositionGet(&gpsPosition); + GPSPositionSensorData gpsPosition; + GPSPositionSensorGet(&gpsPosition); 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.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.Satellites = 7; gpsPosition.PDOP = 1; - GPSPositionSet(&gpsPosition); + GPSPositionSensorSet(&gpsPosition); last_gps_time = PIOS_DELAY_GetRaw(); } // Update GPS Velocity measurements static uint32_t last_gps_vel_time = 1000; // Delay by a millisecond if (PIOS_DELAY_DiffuS(last_gps_vel_time) / 1.0e6 > GPS_PERIOD) { - GPSVelocityData gpsVelocity; - GPSVelocityGet(&gpsVelocity); + GPSVelocitySensorData gpsVelocity; + GPSVelocitySensorGet(&gpsVelocity); gpsVelocity.North = vel[0] + gps_vel_drift[0]; gpsVelocity.East = vel[1] + gps_vel_drift[1]; gpsVelocity.Down = vel[2] + gps_vel_drift[2]; - GPSVelocitySet(&gpsVelocity); + GPSVelocitySensorSet(&gpsVelocity); last_gps_vel_time = PIOS_DELAY_GetRaw(); } diff --git a/flight/modules/StateEstimation/filterekf.c b/flight/modules/StateEstimation/filterekf.c index e6e20e648..34fd3204d 100644 --- a/flight/modules/StateEstimation/filterekf.c +++ b/flight/modules/StateEstimation/filterekf.c @@ -34,7 +34,7 @@ #include #include -#include +#include #include #include @@ -219,8 +219,8 @@ static int32_t filter(stateFilter *self, stateEstimation *state) } if (this->usePos) { - GPSPositionData gpsData; - GPSPositionGet(&gpsData); + GPSPositionSensorData gpsData; + GPSPositionSensorGet(&gpsData); // Have a minimum requirement for gps usage if ((gpsData.Satellites < 7) || (gpsData.PDOP > 4.0f) || diff --git a/flight/modules/StateEstimation/stateestimation.c b/flight/modules/StateEstimation/stateestimation.c index dd8247d71..82a4dad6c 100644 --- a/flight/modules/StateEstimation/stateestimation.c +++ b/flight/modules/StateEstimation/stateestimation.c @@ -36,8 +36,8 @@ #include #include #include -#include -#include +#include +#include #include #include @@ -181,7 +181,7 @@ static const filterPipeline *ekf16Queue = &(filterPipeline) { static void settingsUpdatedCb(UAVObjEvent *objEv); static void sensorUpdatedCb(UAVObjEvent *objEv); static void StateEstimationCb(void); -static void getNED(GPSPositionData *gpsPosition, float *NED); +static void getNED(GPSPositionSensorData *gpsPosition, float *NED); static bool sane(float value); static inline int32_t maxint32_t(int32_t a, int32_t b) @@ -205,8 +205,8 @@ int32_t StateEstimationInitialize(void) MagSensorInitialize(); BaroSensorInitialize(); AirspeedSensorInitialize(); - GPSPositionInitialize(); - GPSVelocityInitialize(); + GPSPositionSensorInitialize(); + GPSVelocitySensorInitialize(); GyroStateInitialize(); AccelStateInitialize(); @@ -223,8 +223,8 @@ int32_t StateEstimationInitialize(void) MagSensorConnectCallback(&sensorUpdatedCb); BaroSensorConnectCallback(&sensorUpdatedCb); AirspeedSensorConnectCallback(&sensorUpdatedCb); - GPSPositionConnectCallback(&sensorUpdatedCb); - GPSVelocityConnectCallback(&sensorUpdatedCb); + GPSPositionSensorConnectCallback(&sensorUpdatedCb); + GPSVelocitySensorConnectCallback(&sensorUpdatedCb); uint32_t stack_required = STACK_SIZE_BYTES; // Initialize Filters @@ -353,7 +353,7 @@ static void StateEstimationCb(void) SANITYCHECK3(GyroSensor, gyro, x, y, z); SANITYCHECK3(AccelSensor, accel, 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) \ if (ISSET(states.updated, SENSORUPDATES_##shortname)) { \ sensorname##Data s; \ @@ -369,10 +369,10 @@ static void StateEstimationCb(void) 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 - // 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)) { - GPSPositionData s; - GPSPositionGet(&s); + GPSPositionSensorData 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)) { getNED(&s, states.pos); } else { @@ -529,11 +529,11 @@ static void sensorUpdatedCb(UAVObjEvent *ev) updatedSensors |= SENSORUPDATES_mag; } - if (ev->obj == GPSPositionHandle()) { + if (ev->obj == GPSPositionSensorHandle()) { updatedSensors |= SENSORUPDATES_pos; } - if (ev->obj == GPSVelocityHandle()) { + if (ev->obj == GPSVelocitySensorHandle()) { updatedSensors |= SENSORUPDATES_vel; } @@ -557,7 +557,7 @@ static void sensorUpdatedCb(UAVObjEvent *ev) * @param[out] NED frame coordinates * @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), DEG2RAD((gpsPosition->Longitude - homeLocation.Longitude) / 10.0e6f), diff --git a/flight/modules/VtolPathFollower/vtolpathfollower.c b/flight/modules/VtolPathFollower/vtolpathfollower.c index 764c094d0..e9a12979c 100644 --- a/flight/modules/VtolPathFollower/vtolpathfollower.c +++ b/flight/modules/VtolPathFollower/vtolpathfollower.c @@ -58,8 +58,8 @@ #include "manualcontrol.h" #include "flightstatus.h" #include "pathstatus.h" -#include "gpsvelocity.h" -#include "gpsposition.h" +#include "gpsvelocitysensor.h" +#include "gpspositionsensor.h" #include "homelocation.h" #include "vtolpathfollowersettings.h" #include "nedaccel.h" @@ -481,8 +481,8 @@ void updateEndpointVelocity() { // this used to work with the NEDposition UAVObject // however this UAVObject has been removed - GPSPositionData gpsPosition; - GPSPositionGet(&gpsPosition); + GPSPositionSensorData gpsPosition; + GPSPositionSensorGet(&gpsPosition); HomeLocationData homeLocation; HomeLocationGet(&homeLocation); float lat = DEG2RAD(homeLocation.Latitude / 10.0e6f); @@ -602,8 +602,8 @@ static void updateVtolDesiredAttitude(bool yaw_attitude) break; case VTOLPATHFOLLOWERSETTINGS_VELOCITYSOURCE_NEDVEL: { - GPSVelocityData gpsVelocity; - GPSVelocityGet(&gpsVelocity); + GPSVelocitySensorData gpsVelocity; + GPSVelocitySensorGet(&gpsVelocity); northVel = gpsVelocity.North; eastVel = gpsVelocity.East; downVel = gpsVelocity.Down; @@ -611,8 +611,8 @@ static void updateVtolDesiredAttitude(bool yaw_attitude) break; case VTOLPATHFOLLOWERSETTINGS_VELOCITYSOURCE_GPSPOS: { - GPSPositionData gpsPosition; - GPSPositionGet(&gpsPosition); + GPSPositionSensorData gpsPosition; + GPSPositionSensorGet(&gpsPosition); northVel = gpsPosition.Groundspeed * cosf(DEG2RAD(gpsPosition.Heading)); eastVel = gpsPosition.Groundspeed * sinf(DEG2RAD(gpsPosition.Heading)); downVel = velocityState.Down; diff --git a/flight/targets/boards/coptercontrol/firmware/Makefile b/flight/targets/boards/coptercontrol/firmware/Makefile index e3c0a8c23..6ca39951e 100644 --- a/flight/targets/boards/coptercontrol/firmware/Makefile +++ b/flight/targets/boards/coptercontrol/firmware/Makefile @@ -99,8 +99,8 @@ ifndef TESTAPP SRC += $(OPUAVSYNTHDIR)/attitudesettings.c SRC += $(OPUAVSYNTHDIR)/camerastabsettings.c SRC += $(OPUAVSYNTHDIR)/cameradesired.c - SRC += $(OPUAVSYNTHDIR)/gpsposition.c - SRC += $(OPUAVSYNTHDIR)/gpsvelocity.c + SRC += $(OPUAVSYNTHDIR)/gpspositionsensor.c + SRC += $(OPUAVSYNTHDIR)/gpsvelocitysensor.c SRC += $(OPUAVSYNTHDIR)/hwsettings.c SRC += $(OPUAVSYNTHDIR)/gcsreceiver.c SRC += $(OPUAVSYNTHDIR)/receiveractivity.c diff --git a/flight/targets/boards/osd/firmware/Makefile b/flight/targets/boards/osd/firmware/Makefile index 7c88af224..9ffd1385f 100644 --- a/flight/targets/boards/osd/firmware/Makefile +++ b/flight/targets/boards/osd/firmware/Makefile @@ -87,9 +87,9 @@ ifndef TESTAPP SRC += $(OPUAVSYNTHDIR)/taskinfo.c SRC += $(OPUAVSYNTHDIR)/mixerstatus.c SRC += $(OPUAVSYNTHDIR)/homelocation.c - SRC += $(OPUAVSYNTHDIR)/gpsposition.c + SRC += $(OPUAVSYNTHDIR)/gpspositionsensor.c SRC += $(OPUAVSYNTHDIR)/gpssatellites.c - SRC += $(OPUAVSYNTHDIR)/gpsvelocity.c + SRC += $(OPUAVSYNTHDIR)/gpsvelocitysensor.c SRC += $(OPUAVSYNTHDIR)/gpstime.c SRC += $(OPUAVSYNTHDIR)/osdsettings.c SRC += $(OPUAVSYNTHDIR)/barosensor.c diff --git a/flight/targets/boards/revolution/firmware/UAVObjects.inc b/flight/targets/boards/revolution/firmware/UAVObjects.inc index 1ee34b95d..188b15bab 100644 --- a/flight/targets/boards/revolution/firmware/UAVObjects.inc +++ b/flight/targets/boards/revolution/firmware/UAVObjects.inc @@ -45,10 +45,10 @@ UAVOBJSRCFILENAMES += flightplanstatus UAVOBJSRCFILENAMES += flighttelemetrystats UAVOBJSRCFILENAMES += gcstelemetrystats UAVOBJSRCFILENAMES += gcsreceiver -UAVOBJSRCFILENAMES += gpsposition +UAVOBJSRCFILENAMES += gpspositionsensor UAVOBJSRCFILENAMES += gpssatellites UAVOBJSRCFILENAMES += gpstime -UAVOBJSRCFILENAMES += gpsvelocity +UAVOBJSRCFILENAMES += gpsvelocitysensor UAVOBJSRCFILENAMES += fixedwingpathfollowersettings UAVOBJSRCFILENAMES += fixedwingpathfollowerstatus UAVOBJSRCFILENAMES += vtolpathfollowersettings @@ -65,6 +65,7 @@ UAVOBJSRCFILENAMES += overosyncsettings UAVOBJSRCFILENAMES += pathaction UAVOBJSRCFILENAMES += pathdesired UAVOBJSRCFILENAMES += pathstatus +UAVOBJSRCFILENAMES += positionsensor UAVOBJSRCFILENAMES += positionstate UAVOBJSRCFILENAMES += ratedesired UAVOBJSRCFILENAMES += relaytuning diff --git a/flight/targets/boards/revolution/firmware/inc/pios_config.h b/flight/targets/boards/revolution/firmware/inc/pios_config.h index f170eebfe..0ce0ff3ab 100644 --- a/flight/targets/boards/revolution/firmware/inc/pios_config.h +++ b/flight/targets/boards/revolution/firmware/inc/pios_config.h @@ -137,6 +137,7 @@ #define PIOS_INCLUDE_GPS_NMEA_PARSER #define PIOS_INCLUDE_GPS_UBX_PARSER #define PIOS_GPS_SETS_HOMELOCATION +#define PIOS_GPS_SETS_POSITIONSENSOR /* Stabilization options */ /* #define PIOS_QUATERNION_STABILIZATION */ diff --git a/flight/targets/boards/revolution/firmware/pios_board_sim.c b/flight/targets/boards/revolution/firmware/pios_board_sim.c index 9cf758199..9def851ae 100644 --- a/flight/targets/boards/revolution/firmware/pios_board_sim.c +++ b/flight/targets/boards/revolution/firmware/pios_board_sim.c @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include #include @@ -139,7 +139,7 @@ void PIOS_Board_Init(void) AccelSensorInitialize(); BaroSensorInitialize(); MagSensorInitialize(); - GPSPositionInitialize(); + GPSPositionSensorInitialize(); GyroSensorInitialize(); /* Initialize the alarms library */ diff --git a/flight/targets/boards/revoproto/firmware/UAVObjects.inc b/flight/targets/boards/revoproto/firmware/UAVObjects.inc index 5742838ba..996708520 100644 --- a/flight/targets/boards/revoproto/firmware/UAVObjects.inc +++ b/flight/targets/boards/revoproto/firmware/UAVObjects.inc @@ -50,10 +50,10 @@ UAVOBJSRCFILENAMES += flightplanstatus UAVOBJSRCFILENAMES += flighttelemetrystats UAVOBJSRCFILENAMES += gcstelemetrystats UAVOBJSRCFILENAMES += gcsreceiver -UAVOBJSRCFILENAMES += gpsposition +UAVOBJSRCFILENAMES += gpspositionsensor UAVOBJSRCFILENAMES += gpssatellites UAVOBJSRCFILENAMES += gpstime -UAVOBJSRCFILENAMES += gpsvelocity +UAVOBJSRCFILENAMES += gpsvelocitysensor UAVOBJSRCFILENAMES += fixedwingpathfollowersettings UAVOBJSRCFILENAMES += fixedwingpathfollowerstatus UAVOBJSRCFILENAMES += vtolpathfollowersettings @@ -70,6 +70,7 @@ UAVOBJSRCFILENAMES += overosyncsettings UAVOBJSRCFILENAMES += pathaction UAVOBJSRCFILENAMES += pathdesired UAVOBJSRCFILENAMES += pathstatus +UAVOBJSRCFILENAMES += positionsensor UAVOBJSRCFILENAMES += positionstate UAVOBJSRCFILENAMES += ratedesired UAVOBJSRCFILENAMES += relaytuning diff --git a/flight/targets/boards/revoproto/firmware/inc/pios_config.h b/flight/targets/boards/revoproto/firmware/inc/pios_config.h index 30be6bb7a..8b1bba11c 100644 --- a/flight/targets/boards/revoproto/firmware/inc/pios_config.h +++ b/flight/targets/boards/revoproto/firmware/inc/pios_config.h @@ -137,6 +137,7 @@ #define PIOS_INCLUDE_GPS_NMEA_PARSER #define PIOS_INCLUDE_GPS_UBX_PARSER #define PIOS_GPS_SETS_HOMELOCATION +#define PIOS_GPS_SETS_POSITIONSENSOR /* Stabilization options */ /* #define PIOS_QUATERNION_STABILIZATION */ diff --git a/flight/targets/boards/revoproto/firmware/pios_board_sim.c b/flight/targets/boards/revoproto/firmware/pios_board_sim.c index 27d998798..9b4c60bc0 100644 --- a/flight/targets/boards/revoproto/firmware/pios_board_sim.c +++ b/flight/targets/boards/revoproto/firmware/pios_board_sim.c @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include #include @@ -139,7 +139,7 @@ void PIOS_Board_Init(void) AccelSensorInitialize(); BaroSensorInitialize(); MagSensorInitialize(); - GPSPositionInitialize(); + GPSPositionSensorInitialize(); GyroStatInitialize(); GyroSensorInitialize(); diff --git a/flight/targets/boards/simposix/firmware/UAVObjects.inc b/flight/targets/boards/simposix/firmware/UAVObjects.inc index 5134a536d..4901ca9eb 100644 --- a/flight/targets/boards/simposix/firmware/UAVObjects.inc +++ b/flight/targets/boards/simposix/firmware/UAVObjects.inc @@ -49,10 +49,10 @@ UAVOBJSRCFILENAMES += flightplansettings UAVOBJSRCFILENAMES += flightplanstatus UAVOBJSRCFILENAMES += flighttelemetrystats UAVOBJSRCFILENAMES += gcstelemetrystats -UAVOBJSRCFILENAMES += gpsposition +UAVOBJSRCFILENAMES += gpspositionsensor UAVOBJSRCFILENAMES += gpssatellites UAVOBJSRCFILENAMES += gpstime -UAVOBJSRCFILENAMES += gpsvelocity +UAVOBJSRCFILENAMES += gpsvelocitysensor UAVOBJSRCFILENAMES += vtolpathfollowersettings UAVOBJSRCFILENAMES += fixedwingpathfollowersettings UAVOBJSRCFILENAMES += fixedwingpathfollowerstatus @@ -68,6 +68,7 @@ UAVOBJSRCFILENAMES += overosyncstats UAVOBJSRCFILENAMES += pathaction UAVOBJSRCFILENAMES += pathdesired UAVOBJSRCFILENAMES += pathstatus +UAVOBJSRCFILENAMES += positionsensor UAVOBJSRCFILENAMES += positionstate UAVOBJSRCFILENAMES += ratedesired UAVOBJSRCFILENAMES += revocalibration diff --git a/ground/openpilotgcs/share/openpilotgcs/default_configurations/Developer.xml b/ground/openpilotgcs/share/openpilotgcs/default_configurations/Developer.xml index 233061c29..99d6599b3 100644 --- a/ground/openpilotgcs/share/openpilotgcs/default_configurations/Developer.xml +++ b/ground/openpilotgcs/share/openpilotgcs/default_configurations/Developer.xml @@ -449,7 +449,7 @@ Lucida Grande,13,-1,5,50,0,0,0,0,0 - GPSPosition + GPSPositionSensor 3.6 120 0 @@ -554,7 +554,7 @@ Lucida Grande,13,-1,5,50,0,0,0,0,0 - GPSPosition + GPSPositionSensor 3.6 120 0 @@ -764,7 +764,7 @@ Lucida Grande,13,-1,5,50,0,0,0,0,0 - GPSPosition + GPSPositionSensor 3.6 120 0 @@ -1202,7 +1202,7 @@ 0 0 0 - GPSPosition + GPSPositionSensor Satellites false 0 @@ -1225,7 +1225,7 @@ 0 33 0 - GPSPosition + GPSPositionSensor Status false 66 diff --git a/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS.xml b/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS.xml index 4ad20f5da..0c2236054 100644 --- a/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS.xml +++ b/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS.xml @@ -449,7 +449,7 @@ foreground needle MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - GPSPosition + GPSPositionSensor 3.6 120 0 @@ -551,7 +551,7 @@ %%DATAPATH%%dials/default/speed.svg needle MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - GPSPosition + GPSPositionSensor 3.6 120 0 @@ -750,7 +750,7 @@ %%DATAPATH%%dials/hi-contrast/speed.svg needle MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - GPSPosition + GPSPositionSensor 3.6 120 0 @@ -1219,7 +1219,7 @@ 0 0 0 - GPSPosition + GPSPositionSensor Satellites false 0 @@ -1242,7 +1242,7 @@ 0 33 0 - GPSPosition + GPSPositionSensor Status false 66 diff --git a/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS_wide.xml b/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS_wide.xml index 4273cf797..89a57f21e 100644 --- a/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS_wide.xml +++ b/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS_wide.xml @@ -449,7 +449,7 @@ foreground needle MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - GPSPosition + GPSPositionSensor 3.6 120 0 @@ -551,7 +551,7 @@ %%DATAPATH%%dials/default/speed.svg needle MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - GPSPosition + GPSPositionSensor 3.6 120 0 @@ -750,7 +750,7 @@ %%DATAPATH%%dials/hi-contrast/speed.svg needle MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0 - GPSPosition + GPSPositionSensor 3.6 120 0 @@ -1219,7 +1219,7 @@ 0 0 0 - GPSPosition + GPSPositionSensor Satellites false 0 @@ -1242,7 +1242,7 @@ 0 33 0 - GPSPosition + GPSPositionSensor Status false 66 diff --git a/ground/openpilotgcs/share/openpilotgcs/pfd/default/PfdIndicators.qml b/ground/openpilotgcs/share/openpilotgcs/pfd/default/PfdIndicators.qml index 8d821e7c3..51e68dde3 100644 --- a/ground/openpilotgcs/share/openpilotgcs/pfd/default/PfdIndicators.qml +++ b/ground/openpilotgcs/share/openpilotgcs/pfd/default/PfdIndicators.qml @@ -31,12 +31,12 @@ Item { Text { id: gps_text - text: "GPS: " + GPSPosition.Satellites + "\nPDP: " + GPSPosition.PDOP + text: "GPS: " + GPSPositionSensor.Satellites + "\nPDP: " + GPSPositionSensor.PDOP color: "white" font.family: "Arial" font.pixelSize: telemetry_status.height * 0.75 - visible: GPSPosition.Satellites > 0 + visible: GPSPositionSensor.Satellites > 0 property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "gps-txt") x: Math.floor(scaledBounds.x * sceneItem.width) diff --git a/ground/openpilotgcs/share/openpilotgcs/pfd/default/PfdTerrainView.qml b/ground/openpilotgcs/share/openpilotgcs/pfd/default/PfdTerrainView.qml index 6a9a8d24b..2beebf05f 100644 --- a/ground/openpilotgcs/share/openpilotgcs/pfd/default/PfdTerrainView.qml +++ b/ground/openpilotgcs/share/openpilotgcs/pfd/default/PfdTerrainView.qml @@ -12,9 +12,9 @@ OsgEarth { roll: AttitudeState.Roll latitude: qmlWidget.actualPositionUsed ? - GPSPosition.Latitude/10000000.0 : qmlWidget.latitude + GPSPositionSensor.Latitude/10000000.0 : qmlWidget.latitude longitude: qmlWidget.actualPositionUsed ? - GPSPosition.Longitude/10000000.0 : qmlWidget.longitude + GPSPositionSensor.Longitude/10000000.0 : qmlWidget.longitude altitude: qmlWidget.actualPositionUsed ? - GPSPosition.Altitude : qmlWidget.altitude + GPSPositionSensor.Altitude : qmlWidget.altitude } diff --git a/ground/openpilotgcs/share/openpilotgcs/translations/openpilotgcs_de.ts b/ground/openpilotgcs/share/openpilotgcs/translations/openpilotgcs_de.ts index cfd19556d..b173f1ff1 100644 --- a/ground/openpilotgcs/share/openpilotgcs/translations/openpilotgcs_de.ts +++ b/ground/openpilotgcs/share/openpilotgcs/translations/openpilotgcs_de.ts @@ -1807,7 +1807,7 @@ p, li { white-space: pre-wrap; } - GPSPosition + GPSPositionSensor diff --git a/ground/openpilotgcs/share/openpilotgcs/translations/openpilotgcs_es.ts b/ground/openpilotgcs/share/openpilotgcs/translations/openpilotgcs_es.ts index 5182fddf2..d200b257f 100644 --- a/ground/openpilotgcs/share/openpilotgcs/translations/openpilotgcs_es.ts +++ b/ground/openpilotgcs/share/openpilotgcs/translations/openpilotgcs_es.ts @@ -1808,7 +1808,7 @@ p, li { white-space: pre-wrap; } - GPSPosition + GPSPositionSensor diff --git a/ground/openpilotgcs/share/openpilotgcs/translations/openpilotgcs_fr.ts b/ground/openpilotgcs/share/openpilotgcs/translations/openpilotgcs_fr.ts index e74746db8..2fed8d566 100644 --- a/ground/openpilotgcs/share/openpilotgcs/translations/openpilotgcs_fr.ts +++ b/ground/openpilotgcs/share/openpilotgcs/translations/openpilotgcs_fr.ts @@ -1829,7 +1829,7 @@ p, li { white-space: pre-wrap; } - GPSPosition + GPSPositionSensor diff --git a/ground/openpilotgcs/share/openpilotgcs/translations/openpilotgcs_ru.ts b/ground/openpilotgcs/share/openpilotgcs/translations/openpilotgcs_ru.ts index e368aca9d..5acabb9f8 100644 --- a/ground/openpilotgcs/share/openpilotgcs/translations/openpilotgcs_ru.ts +++ b/ground/openpilotgcs/share/openpilotgcs/translations/openpilotgcs_ru.ts @@ -1761,7 +1761,7 @@ Sat SNR is displayed above (in dBHz) - GPSPosition + GPSPositionSensor diff --git a/ground/openpilotgcs/share/openpilotgcs/translations/openpilotgcs_zh_CN.ts b/ground/openpilotgcs/share/openpilotgcs/translations/openpilotgcs_zh_CN.ts index b80073462..d01683dc6 100644 --- a/ground/openpilotgcs/share/openpilotgcs/translations/openpilotgcs_zh_CN.ts +++ b/ground/openpilotgcs/share/openpilotgcs/translations/openpilotgcs_zh_CN.ts @@ -2647,7 +2647,7 @@ Sat SNR is displayed above (in dBHz) - GPSPosition + GPSPositionSensor diff --git a/ground/openpilotgcs/src/plugins/antennatrack/telemetryparser.cpp b/ground/openpilotgcs/src/plugins/antennatrack/telemetryparser.cpp index 6bbdef701..3b9669521 100644 --- a/ground/openpilotgcs/src/plugins/antennatrack/telemetryparser.cpp +++ b/ground/openpilotgcs/src/plugins/antennatrack/telemetryparser.cpp @@ -39,12 +39,12 @@ TelemetryParser::TelemetryParser(QObject *parent) : GPSParser(parent) { ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); UAVObjectManager *objManager = pm->getObject(); - UAVDataObject *gpsObj = dynamic_cast(objManager->getObject("GPSPosition")); + UAVDataObject *gpsObj = dynamic_cast(objManager->getObject("GPSPositionSensor")); if (gpsObj != NULL) { connect(gpsObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateGPS(UAVObject *))); } else { - qDebug() << "Error: Object is unknown (GPSPosition)."; + qDebug() << "Error: Object is unknown (GPSPositionSensor)."; } gpsObj = dynamic_cast(objManager->getObject("HomeLocation")); diff --git a/ground/openpilotgcs/src/plugins/gpsdisplay/telemetryparser.cpp b/ground/openpilotgcs/src/plugins/gpsdisplay/telemetryparser.cpp index 70fc4bc1a..780fc7854 100644 --- a/ground/openpilotgcs/src/plugins/gpsdisplay/telemetryparser.cpp +++ b/ground/openpilotgcs/src/plugins/gpsdisplay/telemetryparser.cpp @@ -39,12 +39,12 @@ TelemetryParser::TelemetryParser(QObject *parent) : GPSParser(parent) { ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); UAVObjectManager *objManager = pm->getObject(); - UAVDataObject *gpsObj = dynamic_cast(objManager->getObject("GPSPosition")); + UAVDataObject *gpsObj = dynamic_cast(objManager->getObject("GPSPositionSensor")); if (gpsObj != NULL) { connect(gpsObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateGPS(UAVObject *))); } else { - qDebug() << "Error: Object is unknown (GPSPosition)."; + qDebug() << "Error: Object is unknown (GPSPositionSensor)."; } gpsObj = dynamic_cast(objManager->getObject("GPSTime")); diff --git a/ground/openpilotgcs/src/plugins/hitl/hitlnoisegeneration.h b/ground/openpilotgcs/src/plugins/hitl/hitlnoisegeneration.h index 9ecbbd205..22df94b72 100644 --- a/ground/openpilotgcs/src/plugins/hitl/hitlnoisegeneration.h +++ b/ground/openpilotgcs/src/plugins/hitl/hitlnoisegeneration.h @@ -37,16 +37,16 @@ #include struct Noise { - AccelState::DataFields accelStateData; - AttitudeState::DataFields attStateData; - BaroSensor::DataFields baroAltData; - AirspeedState::DataFields airspeedState; - GPSPosition::DataFields gpsPosData; - GPSVelocity::DataFields gpsVelData; - GyroState::DataFields gyroStateData; - HomeLocation::DataFields homeData; - PositionState::DataFields positionStateData; - VelocityState::DataFields velocityStateData; + AccelState::DataFields accelStateData; + AttitudeState::DataFields attStateData; + BaroSensor::DataFields baroAltData; + AirspeedState::DataFields airspeedState; + GPSPositionSensor::DataFields gpsPosData; + GPSVelocitySensor::DataFields gpsVelData; + GyroState::DataFields gyroStateData; + HomeLocation::DataFields homeData; + PositionState::DataFields positionStateData; + VelocityState::DataFields velocityStateData; }; class HitlNoiseGeneration { diff --git a/ground/openpilotgcs/src/plugins/hitl/simulator.cpp b/ground/openpilotgcs/src/plugins/hitl/simulator.cpp index 13bd35bbf..67e0de65b 100644 --- a/ground/openpilotgcs/src/plugins/hitl/simulator.cpp +++ b/ground/openpilotgcs/src/plugins/hitl/simulator.cpp @@ -156,8 +156,8 @@ void Simulator::onStart() attSettings = AttitudeSettings::GetInstance(objManager); accelState = AccelState::GetInstance(objManager); gyroState = GyroState::GetInstance(objManager); - gpsPos = GPSPosition::GetInstance(objManager); - gpsVel = GPSVelocity::GetInstance(objManager); + gpsPos = GPSPositionSensor::GetInstance(objManager); + gpsVel = GPSVelocitySensor::GetInstance(objManager); telStats = GCSTelemetryStats::GetInstance(objManager); groundTruth = GroundTruth::GetInstance(objManager); @@ -633,8 +633,8 @@ void Simulator::updateUAVOs(Output2Hardware out) if (gpsPosTime.msecsTo(currentTime) >= settings.gpsPosRate) { qDebug() << " GPS time:" << gpsPosTime << ", currentTime: " << currentTime << ", difference: " << gpsPosTime.msecsTo(currentTime); // Update GPS Position objects - GPSPosition::DataFields gpsPosData; - memset(&gpsPosData, 0, sizeof(GPSPosition::DataFields)); + GPSPositionSensor::DataFields gpsPosData; + memset(&gpsPosData, 0, sizeof(GPSPositionSensor::DataFields)); gpsPosData.Altitude = out.altitude + noise.gpsPosData.Altitude; gpsPosData.Heading = out.heading + noise.gpsPosData.Heading; gpsPosData.Groundspeed = out.groundspeed + noise.gpsPosData.Groundspeed; @@ -644,13 +644,13 @@ void Simulator::updateUAVOs(Output2Hardware out) gpsPosData.PDOP = 3.0; gpsPosData.VDOP = gpsPosData.PDOP * 1.5; gpsPosData.Satellites = 10; - gpsPosData.Status = GPSPosition::STATUS_FIX3D; + gpsPosData.Status = GPSPositionSensor::STATUS_FIX3D; gpsPos->setData(gpsPosData); // Update GPS Velocity.{North,East,Down} - GPSVelocity::DataFields gpsVelData; - memset(&gpsVelData, 0, sizeof(GPSVelocity::DataFields)); + GPSVelocitySensor::DataFields gpsVelData; + memset(&gpsVelData, 0, sizeof(GPSVelocitySensor::DataFields)); gpsVelData.North = out.velNorth + noise.gpsVelData.North; gpsVelData.East = out.velEast + noise.gpsVelData.East; gpsVelData.Down = out.velDown + noise.gpsVelData.Down; diff --git a/ground/openpilotgcs/src/plugins/hitl/simulator.h b/ground/openpilotgcs/src/plugins/hitl/simulator.h index ecf4ca872..7d9ac4ad9 100644 --- a/ground/openpilotgcs/src/plugins/hitl/simulator.h +++ b/ground/openpilotgcs/src/plugins/hitl/simulator.h @@ -49,8 +49,8 @@ #include "flightstatus.h" #include "gcsreceiver.h" #include "gcstelemetrystats.h" -#include "gpsposition.h" -#include "gpsvelocity.h" +#include "gpspositionsensor.h" +#include "gpsvelocitysensor.h" #include "groundtruth.h" #include "gyrostate.h" #include "homelocation.h" @@ -326,8 +326,8 @@ protected: AttitudeState *attState; AttitudeSettings *attSettings; VelocityState *velState; - GPSPosition *gpsPos; - GPSVelocity *gpsVel; + GPSPositionSensor *gpsPos; + GPSVelocitySensor *gpsVel; PositionState *posState; HomeLocation *posHome; AccelState *accelState; diff --git a/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp index a5a60b187..114435773 100644 --- a/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp @@ -50,7 +50,7 @@ #include "positionstate.h" #include "homelocation.h" -#include "gpsposition.h" +#include "gpspositionsensor.h" #include "gyrostate.h" #include "attitudestate.h" #include "positionstate.h" @@ -579,10 +579,10 @@ void OPMapGadgetWidget::updatePosition() // ************* // get the current GPS position and heading - GPSPosition *gpsPositionObj = GPSPosition::GetInstance(obm); + GPSPositionSensor *gpsPositionObj = GPSPositionSensor::GetInstance(obm); Q_ASSERT(gpsPositionObj); - GPSPosition::DataFields gpsPositionData = gpsPositionObj->getData(); + GPSPositionSensor::DataFields gpsPositionData = gpsPositionObj->getData(); gps_heading = gpsPositionData.Heading; gps_latitude = gpsPositionData.Latitude; @@ -2236,7 +2236,7 @@ double OPMapGadgetWidget::getUAV_Yaw() return yaw; } -bool OPMapGadgetWidget::getGPSPosition(double &latitude, double &longitude, double &altitude) +bool OPMapGadgetWidget::getGPSPositionSensor(double &latitude, double &longitude, double &altitude) { double LLA[3]; @@ -2244,7 +2244,7 @@ bool OPMapGadgetWidget::getGPSPosition(double &latitude, double &longitude, doub return false; } - if (obum->getGPSPosition(LLA) < 0) { + if (obum->getGPSPositionSensor(LLA) < 0) { return false; // error } latitude = LLA[0]; diff --git a/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.h b/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.h index 7de84fce2..f5db4d5a0 100644 --- a/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.h +++ b/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.h @@ -113,7 +113,7 @@ public: void setMaxUpdateRate(int update_rate); void setHomePosition(QPointF pos); void setOverlayOpacity(qreal value); - bool getGPSPosition(double &latitude, double &longitude, double &altitude); + bool getGPSPositionSensor(double &latitude, double &longitude, double &altitude); signals: void defaultLocationAndZoomChanged(double lng, double lat, double zoom); void overlayOpacityChanged(qreal); diff --git a/ground/openpilotgcs/src/plugins/osgearthview/osgviewerwidget.cpp b/ground/openpilotgcs/src/plugins/osgearthview/osgviewerwidget.cpp index cd08ce5dd..fce21f931 100644 --- a/ground/openpilotgcs/src/plugins/osgearthview/osgviewerwidget.cpp +++ b/ground/openpilotgcs/src/plugins/osgearthview/osgviewerwidget.cpp @@ -96,7 +96,7 @@ using namespace osgEarth::Annotation; #include "utils/worldmagmodel.h" #include "utils/coordinateconversions.h" #include "attitudestate.h" -#include "gpsposition.h" +#include "gpspositionsensor.h" #include "homelocation.h" #include "positionstate.h" #include "systemsettings.h" @@ -270,8 +270,8 @@ void OsgViewerWidget::paintEvent(QPaintEvent *event) CoordinateConversions().NED2LLA_HomeLLA(homeLLA, NED, LLA); uavPos->getLocator()->setPosition(osg::Vec3d(LLA[1], LLA[0], LLA[2])); // Note this takes longtitude first } else { - GPSPosition *gpsPosObj = GPSPosition::GetInstance(objMngr); - GPSPosition::DataFields gpsPos = gpsPosObj->getData(); + GPSPositionSensor *gpsPosObj = GPSPositionSensor::GetInstance(objMngr); + GPSPositionSensor::DataFields gpsPos = gpsPosObj->getData(); uavPos->getLocator()->setPosition(osg::Vec3d(gpsPos.Longitude / 10.0e6, gpsPos.Latitude / 10.0e6, gpsPos.Altitude)); } diff --git a/ground/openpilotgcs/src/plugins/pfd/pfdgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/pfd/pfdgadgetwidget.cpp index bbb1f4c48..1ccf3a7e9 100644 --- a/ground/openpilotgcs/src/plugins/pfd/pfdgadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/pfd/pfdgadgetwidget.cpp @@ -170,11 +170,11 @@ void PFDGadgetWidget::connectNeedles() } if (gcsGPSStats) { - gpsObj = dynamic_cast(objManager->getObject("GPSPosition")); + gpsObj = dynamic_cast(objManager->getObject("GPSPositionSensor")); if (gpsObj != NULL) { connect(gpsObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(updateGPS(UAVObject *))); } else { - qDebug() << "Error: Object is unknown (GPSPosition)."; + qDebug() << "Error: Object is unknown (GPSPositionSensor)."; } } diff --git a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.cpp index aca816bea..307347067 100644 --- a/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/pfdqml/pfdqmlgadgetwidget.cpp @@ -55,7 +55,7 @@ PfdQmlGadgetWidget::PfdQmlGadgetWidget(QWidget *parent) : "VelocityDesired" << "PositionDesired" << "AttitudeHoldDesired" << - "GPSPosition" << + "GPSPositionSensor" << "GCSTelemetryStats" << "FlightBatteryState"; diff --git a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetwidget.cpp index 337faf7c0..9abbb4b23 100644 --- a/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/qmlview/qmlviewgadgetwidget.cpp @@ -52,7 +52,7 @@ QmlViewGadgetWidget::QmlViewGadgetWidget(QWidget *parent) : objectsToExport << "VelocityState" << "PositionState" << "AttitudeState" << - "GPSPosition" << + "GPSPositionSensor" << "GCSTelemetryStats" << "FlightBatteryState"; diff --git a/ground/openpilotgcs/src/plugins/uavobjects/OPPlots.m b/ground/openpilotgcs/src/plugins/uavobjects/OPPlots.m index 3dabe5a39..9b0303a39 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/OPPlots.m +++ b/ground/openpilotgcs/src/plugins/uavobjects/OPPlots.m @@ -10,9 +10,9 @@ function OPPlots() [VelocityState.East] [VelocityState.Down]]/100; - TimeGPSPos = [GPSPosition.timestamp]/1000; - Vgps=[[GPSPosition.Groundspeed].*cos([GPSPosition.Heading]*pi/180) - [GPSPosition.Groundspeed].*sin([GPSPosition.Heading]*pi/180)]; + TimeGPSPos = [GPSPositionSensor.timestamp]/1000; + Vgps=[[GPSPositionSensor.Groundspeed].*cos([GPSPositionSensor.Heading]*pi/180) + [GPSPositionSensor.Groundspeed].*sin([GPSPositionSensor.Heading]*pi/180)]; figure(1); plot(TimeVA,VA(1,:),TimeVA,VA(2,:),TimeGPSPos,Vgps(1,:),TimeGPSPos,Vgps(2,:)); @@ -30,10 +30,10 @@ function OPPlots() [PositionState.East] [PositionState.Down]]/100; - TimeGPSPos = [GPSPosition.timestamp]/1000; - LLA=[[GPSPosition.Latitude]*1e-7; - [GPSPosition.Longitude]*1e-7; - [GPSPosition.Altitude]+[GPSPosition.GeoidSeparation]]; + TimeGPSPos = [GPSPositionSensor.timestamp]/1000; + LLA=[[GPSPositionSensor.Latitude]*1e-7; + [GPSPositionSensor.Longitude]*1e-7; + [GPSPositionSensor.Altitude]+[GPSPositionSensor.GeoidSeparation]]; BaseECEF = LLA2ECEF([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); diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro b/ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro index 4ff9d4050..a4c5c51d7 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro @@ -59,13 +59,14 @@ HEADERS += $$UAVOBJECT_SYNTHETICS/accessorydesired.h \ $$UAVOBJECT_SYNTHETICS/actuatorsettings.h \ $$UAVOBJECT_SYNTHETICS/actuatordesired.h \ $$UAVOBJECT_SYNTHETICS/actuatorcommand.h \ - $$UAVOBJECT_SYNTHETICS/gpsposition.h \ + $$UAVOBJECT_SYNTHETICS/gpspositionsensor.h \ $$UAVOBJECT_SYNTHETICS/gpstime.h \ $$UAVOBJECT_SYNTHETICS/gpssatellites.h \ $$UAVOBJECT_SYNTHETICS/pathaction.h \ $$UAVOBJECT_SYNTHETICS/pathdesired.h \ $$UAVOBJECT_SYNTHETICS/pathstatus.h \ - $$UAVOBJECT_SYNTHETICS/gpsvelocity.h \ + $$UAVOBJECT_SYNTHETICS/gpsvelocitysensor.h \ + $$UAVOBJECT_SYNTHETICS/positionsensor.h \ $$UAVOBJECT_SYNTHETICS/positionstate.h \ $$UAVOBJECT_SYNTHETICS/flightbatterystate.h \ $$UAVOBJECT_SYNTHETICS/homelocation.h \ @@ -143,13 +144,14 @@ SOURCES += $$UAVOBJECT_SYNTHETICS/accessorydesired.cpp \ $$UAVOBJECT_SYNTHETICS/actuatorsettings.cpp \ $$UAVOBJECT_SYNTHETICS/actuatordesired.cpp \ $$UAVOBJECT_SYNTHETICS/actuatorcommand.cpp \ - $$UAVOBJECT_SYNTHETICS/gpsposition.cpp \ + $$UAVOBJECT_SYNTHETICS/gpspositionsensor.cpp \ $$UAVOBJECT_SYNTHETICS/gpstime.cpp \ $$UAVOBJECT_SYNTHETICS/gpssatellites.cpp \ $$UAVOBJECT_SYNTHETICS/pathaction.cpp \ $$UAVOBJECT_SYNTHETICS/pathdesired.cpp \ $$UAVOBJECT_SYNTHETICS/pathstatus.cpp \ - $$UAVOBJECT_SYNTHETICS/gpsvelocity.cpp \ + $$UAVOBJECT_SYNTHETICS/gpsvelocitysensor.cpp \ + $$UAVOBJECT_SYNTHETICS/positionsensor.cpp \ $$UAVOBJECT_SYNTHETICS/positionstate.cpp \ $$UAVOBJECT_SYNTHETICS/flightbatterystate.cpp \ $$UAVOBJECT_SYNTHETICS/homelocation.cpp \ diff --git a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp index c89683412..dd92585cf 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp @@ -38,7 +38,7 @@ #include "firmwareiapobj.h" #include "homelocation.h" -#include "gpsposition.h" +#include "gpspositionsensor.h" // ****************************** // constructor/destructor @@ -377,13 +377,13 @@ int UAVObjectUtilManager::getHomeLocation(bool &set, double LLA[3]) // ****************************** // 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); - GPSPosition::DataFields gpsPositionData = gpsPosition->getData(); + GPSPositionSensor::DataFields gpsPositionData = gpsPosition->getData(); LLA[0] = gpsPositionData.Latitude; LLA[1] = gpsPositionData.Longitude; diff --git a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.h b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.h index 68260693c..7ad27b8d1 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.h +++ b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.h @@ -55,7 +55,7 @@ public: int setHomeLocation(double LLA[3], bool save_to_sdcard); int getHomeLocation(bool &set, double LLA[3]); - int getGPSPosition(double LLA[3]); + int getGPSPositionSensor(double LLA[3]); int getBoardModel(); QByteArray getBoardCPUSerial(); diff --git a/shared/uavobjectdefinition/gpsposition.xml b/shared/uavobjectdefinition/gpspositionsensor.xml similarity index 94% rename from shared/uavobjectdefinition/gpsposition.xml rename to shared/uavobjectdefinition/gpspositionsensor.xml index 7a8ae82db..e7a497ab4 100644 --- a/shared/uavobjectdefinition/gpsposition.xml +++ b/shared/uavobjectdefinition/gpspositionsensor.xml @@ -1,5 +1,5 @@ - + Raw GPS data from @ref GPSModule. Should only be used by @ref AHRSCommsModule. diff --git a/shared/uavobjectdefinition/gpsvelocity.xml b/shared/uavobjectdefinition/gpsvelocitysensor.xml similarity index 87% rename from shared/uavobjectdefinition/gpsvelocity.xml rename to shared/uavobjectdefinition/gpsvelocitysensor.xml index 8673463a8..21e32338e 100644 --- a/shared/uavobjectdefinition/gpsvelocity.xml +++ b/shared/uavobjectdefinition/gpsvelocitysensor.xml @@ -1,5 +1,5 @@ - + Raw GPS data from @ref GPSModule.