1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +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 "gps_airspeed.h"
#include "gpsvelocity.h"
#include "gpsvelocitysensor.h"
#include "attitudestate.h"
#include "CoordinateConversions.h"
#include <pios_math.h>
@ -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);

View File

@ -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),

View File

@ -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"

View File

@ -32,11 +32,12 @@
#include <openpilot.h>
#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

View File

@ -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 */

View File

@ -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;
}

View File

@ -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

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
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 */

View File

@ -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 */

View File

@ -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);

View File

@ -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();

View File

@ -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();
}

View File

@ -34,7 +34,7 @@
#include <ekfconfiguration.h>
#include <ekfstatevariance.h>
#include <gpsposition.h>
#include <gpspositionsensor.h>
#include <attitudestate.h>
#include <homelocation.h>
@ -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) ||

View File

@ -36,8 +36,8 @@
#include <magsensor.h>
#include <barosensor.h>
#include <airspeedsensor.h>
#include <gpsposition.h>
#include <gpsvelocity.h>
#include <gpspositionsensor.h>
#include <gpsvelocitysensor.h>
#include <gyrostate.h>
#include <accelstate.h>
@ -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),

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 */

View File

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

View File

@ -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

View File

@ -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 */

View File

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

View File

@ -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

View File

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

View File

@ -449,7 +449,7 @@
<dialForegroundID>foreground</dialForegroundID>
<dialNeedleID1>needle</dialNeedleID1>
<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>
<needle1MaxValue>120</needle1MaxValue>
<needle1MinValue>0</needle1MinValue>
@ -551,7 +551,7 @@
<dialFile>%%DATAPATH%%dials/default/speed.svg</dialFile>
<dialNeedleID1>needle</dialNeedleID1>
<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>
<needle1MaxValue>120</needle1MaxValue>
<needle1MinValue>0</needle1MinValue>
@ -750,7 +750,7 @@
<dialFile>%%DATAPATH%%dials/hi-contrast/speed.svg</dialFile>
<dialNeedleID1>needle</dialNeedleID1>
<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>
<needle1MaxValue>120</needle1MaxValue>
<needle1MinValue>0</needle1MinValue>
@ -1219,7 +1219,7 @@
<minValue>0</minValue>
<redMax>0</redMax>
<redMin>0</redMin>
<sourceDataObject>GPSPosition</sourceDataObject>
<sourceDataObject>GPSPositionSensor</sourceDataObject>
<sourceObjectField>Satellites</sourceObjectField>
<useOpenGLFlag>false</useOpenGLFlag>
<yellowMax>0</yellowMax>
@ -1242,7 +1242,7 @@
<minValue>0</minValue>
<redMax>33</redMax>
<redMin>0</redMin>
<sourceDataObject>GPSPosition</sourceDataObject>
<sourceDataObject>GPSPositionSensor</sourceDataObject>
<sourceObjectField>Status</sourceObjectField>
<useOpenGLFlag>false</useOpenGLFlag>
<yellowMax>66</yellowMax>

View File

@ -449,7 +449,7 @@
<dialForegroundID>foreground</dialForegroundID>
<dialNeedleID1>needle</dialNeedleID1>
<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>
<needle1MaxValue>120</needle1MaxValue>
<needle1MinValue>0</needle1MinValue>
@ -551,7 +551,7 @@
<dialFile>%%DATAPATH%%dials/default/speed.svg</dialFile>
<dialNeedleID1>needle</dialNeedleID1>
<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>
<needle1MaxValue>120</needle1MaxValue>
<needle1MinValue>0</needle1MinValue>
@ -750,7 +750,7 @@
<dialFile>%%DATAPATH%%dials/hi-contrast/speed.svg</dialFile>
<dialNeedleID1>needle</dialNeedleID1>
<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>
<needle1MaxValue>120</needle1MaxValue>
<needle1MinValue>0</needle1MinValue>
@ -1219,7 +1219,7 @@
<minValue>0</minValue>
<redMax>0</redMax>
<redMin>0</redMin>
<sourceDataObject>GPSPosition</sourceDataObject>
<sourceDataObject>GPSPositionSensor</sourceDataObject>
<sourceObjectField>Satellites</sourceObjectField>
<useOpenGLFlag>false</useOpenGLFlag>
<yellowMax>0</yellowMax>
@ -1242,7 +1242,7 @@
<minValue>0</minValue>
<redMax>33</redMax>
<redMin>0</redMin>
<sourceDataObject>GPSPosition</sourceDataObject>
<sourceDataObject>GPSPositionSensor</sourceDataObject>
<sourceObjectField>Status</sourceObjectField>
<useOpenGLFlag>false</useOpenGLFlag>
<yellowMax>66</yellowMax>

View File

@ -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)

View File

@ -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
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -39,12 +39,12 @@ TelemetryParser::TelemetryParser(QObject *parent) : GPSParser(parent)
{
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
UAVDataObject *gpsObj = dynamic_cast<UAVDataObject *>(objManager->getObject("GPSPosition"));
UAVDataObject *gpsObj = dynamic_cast<UAVDataObject *>(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<UAVDataObject *>(objManager->getObject("HomeLocation"));

View File

@ -39,12 +39,12 @@ TelemetryParser::TelemetryParser(QObject *parent) : GPSParser(parent)
{
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
UAVDataObject *gpsObj = dynamic_cast<UAVDataObject *>(objManager->getObject("GPSPosition"));
UAVDataObject *gpsObj = dynamic_cast<UAVDataObject *>(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<UAVDataObject *>(objManager->getObject("GPSTime"));

View File

@ -37,16 +37,16 @@
#include <coreplugin/threadmanager.h>
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 {

View File

@ -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;

View File

@ -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;

View File

@ -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];

View File

@ -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);

View File

@ -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));
}

View File

@ -170,11 +170,11 @@ void PFDGadgetWidget::connectNeedles()
}
if (gcsGPSStats) {
gpsObj = dynamic_cast<UAVDataObject *>(objManager->getObject("GPSPosition"));
gpsObj = dynamic_cast<UAVDataObject *>(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).";
}
}

View File

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

View File

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

View File

@ -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);

View File

@ -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 \

View File

@ -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;

View File

@ -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();

View File

@ -1,5 +1,5 @@
<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>
<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"/>

View File

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