Browse Source

Add gps coordinates to vehicle gps factgroup

QGC4.4
Jacob Walser 8 years ago
parent
commit
72e5769b1c
  1. 12
      src/Vehicle/GPSFact.json
  2. 10
      src/Vehicle/Vehicle.cc
  3. 8
      src/Vehicle/Vehicle.h

12
src/Vehicle/GPSFact.json

@ -1,5 +1,17 @@ @@ -1,5 +1,17 @@
[
{
"name": "lat",
"shortDescription": "Latitude",
"type": "double",
"decimalPlaces": 7
},
{
"name": "lon",
"shortDescription": "Longitude",
"type": "double",
"decimalPlaces": 7
},
{
"name": "hdop",
"shortDescription": "HDOP",
"type": "double",

10
src/Vehicle/Vehicle.cc

@ -680,6 +680,8 @@ void Vehicle::_handleGpsRawInt(mavlink_message_t& message) @@ -680,6 +680,8 @@ void Vehicle::_handleGpsRawInt(mavlink_message_t& message)
}
}
_gpsFactGroup.lat()->setRawValue(gpsRawInt.lat * 1e-7);
_gpsFactGroup.lon()->setRawValue(gpsRawInt.lon * 1e-7);
_gpsFactGroup.count()->setRawValue(gpsRawInt.satellites_visible == 255 ? 0 : gpsRawInt.satellites_visible);
_gpsFactGroup.hdop()->setRawValue(gpsRawInt.eph == UINT16_MAX ? std::numeric_limits<double>::quiet_NaN() : gpsRawInt.eph / 100.0);
_gpsFactGroup.vdop()->setRawValue(gpsRawInt.epv == UINT16_MAX ? std::numeric_limits<double>::quiet_NaN() : gpsRawInt.epv / 100.0);
@ -2458,6 +2460,8 @@ void Vehicle::triggerCamera(void) @@ -2458,6 +2460,8 @@ void Vehicle::triggerCamera(void)
1.0); // test shot flag
}
const char* VehicleGPSFactGroup::_latFactName = "lat";
const char* VehicleGPSFactGroup::_lonFactName = "lon";
const char* VehicleGPSFactGroup::_hdopFactName = "hdop";
const char* VehicleGPSFactGroup::_vdopFactName = "vdop";
const char* VehicleGPSFactGroup::_courseOverGroundFactName = "courseOverGround";
@ -2466,18 +2470,24 @@ const char* VehicleGPSFactGroup::_lockFactName = "lock"; @@ -2466,18 +2470,24 @@ const char* VehicleGPSFactGroup::_lockFactName = "lock";
VehicleGPSFactGroup::VehicleGPSFactGroup(QObject* parent)
: FactGroup(1000, ":/json/Vehicle/GPSFact.json", parent)
, _latFact (0, _latFactName, FactMetaData::valueTypeDouble)
, _lonFact (0, _lonFactName, FactMetaData::valueTypeDouble)
, _hdopFact (0, _hdopFactName, FactMetaData::valueTypeDouble)
, _vdopFact (0, _vdopFactName, FactMetaData::valueTypeDouble)
, _courseOverGroundFact (0, _courseOverGroundFactName, FactMetaData::valueTypeDouble)
, _countFact (0, _countFactName, FactMetaData::valueTypeInt32)
, _lockFact (0, _lockFactName, FactMetaData::valueTypeInt32)
{
_addFact(&_latFact, _latFactName);
_addFact(&_lonFact, _lonFactName);
_addFact(&_hdopFact, _hdopFactName);
_addFact(&_vdopFact, _vdopFactName);
_addFact(&_courseOverGroundFact, _courseOverGroundFactName);
_addFact(&_lockFact, _lockFactName);
_addFact(&_countFact, _countFactName);
_latFact.setRawValue(std::numeric_limits<float>::quiet_NaN());
_lonFact.setRawValue(std::numeric_limits<float>::quiet_NaN());
_hdopFact.setRawValue(std::numeric_limits<float>::quiet_NaN());
_vdopFact.setRawValue(std::numeric_limits<float>::quiet_NaN());
_courseOverGroundFact.setRawValue(std::numeric_limits<float>::quiet_NaN());

8
src/Vehicle/Vehicle.h

@ -113,18 +113,24 @@ class VehicleGPSFactGroup : public FactGroup @@ -113,18 +113,24 @@ class VehicleGPSFactGroup : public FactGroup
public:
VehicleGPSFactGroup(QObject* parent = NULL);
Q_PROPERTY(Fact* lat READ lat CONSTANT)
Q_PROPERTY(Fact* lon READ lon CONSTANT)
Q_PROPERTY(Fact* hdop READ hdop CONSTANT)
Q_PROPERTY(Fact* vdop READ vdop CONSTANT)
Q_PROPERTY(Fact* courseOverGround READ courseOverGround CONSTANT)
Q_PROPERTY(Fact* count READ count CONSTANT)
Q_PROPERTY(Fact* lock READ lock CONSTANT)
Fact* lat (void) { return &_latFact; }
Fact* lon (void) { return &_lonFact; }
Fact* hdop (void) { return &_hdopFact; }
Fact* vdop (void) { return &_vdopFact; }
Fact* courseOverGround (void) { return &_courseOverGroundFact; }
Fact* count (void) { return &_countFact; }
Fact* lock (void) { return &_lockFact; }
static const char* _latFactName;
static const char* _lonFactName;
static const char* _hdopFactName;
static const char* _vdopFactName;
static const char* _courseOverGroundFactName;
@ -132,6 +138,8 @@ public: @@ -132,6 +138,8 @@ public:
static const char* _lockFactName;
private:
Fact _latFact;
Fact _lonFact;
Fact _hdopFact;
Fact _vdopFact;
Fact _courseOverGroundFact;

Loading…
Cancel
Save