Nominate our 2022 Qt Champions!

Getting QGeoPositionInfo::Direction when using gpsd

  • Hi

    I need Direction and GroundSpeed from gps, it is no problem when I'm using QGeoPositionInfo on mobile platform, QGeoPositionInfo has attributes QGeoPositionInfo::Direction and QGeoPositionInfo::GroundSpeed but when I try to use this when reading from gpsd:

        nmeaSource=new QNmeaPositionInfoSource(QNmeaPositionInfoSource::RealTimeMode);

    I have this attribute only for a few first coordinates then Qt stops providing that.
    When I check with gpsmon it always has correct Direction and Speed. How can I overcome that?


  • @Marek have you checked connecting QTcpSocket's error() signal?

    What about capturing network traffic when you're using Qt app and then with the gpsmon tool and comparing them to see if you can find something there?

  • @Pablo-J.-Rogina I have function to check tcp socket errors

    But I have reliable latitude and longitude data all the time, it's just Direction and GroundSpeed that is causing problem for me.
    If I save previous coordinates given by Qt
    QGeoCoordinate prev_coord=info.coordinate();
    QGeoCoordinate coord=info.coordinate();
    I should be able to calculate bearing and distance (assuming I have gps coords once a second, it will be speed) myself using:
    qreal azimuthTo(const QGeoCoordinate &other) const
    qreal distanceTo(const QGeoCoordinate &other) const

    Am I right?

Log in to reply