Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Getting QGeoPositionInfo::Direction when using gpsd
Forum Updated to NodeBB v4.3 + New Features

Getting QGeoPositionInfo::Direction when using gpsd

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 662 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Marek
    wrote on last edited by
    #1

    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:

        tcpSocket->write("?WATCH={\"enable\":true,\"nmea\":true}\n");
        nmeaSource=new QNmeaPositionInfoSource(QNmeaPositionInfoSource::RealTimeMode);
        nmeaSource->setUpdateInterval(1000);
        nmeaSource->setDevice(tcpSocket);
        connect(nmeaSource,SIGNAL(positionUpdated(QGeoPositionInfo)),this,SLOT(positionUpdated(QGeoPositionInfo)));
        nmeaSource->startUpdates();
    

    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?

    Best,
    Marek

    Pablo J. RoginaP 1 Reply Last reply
    0
    • M Marek

      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:

          tcpSocket->write("?WATCH={\"enable\":true,\"nmea\":true}\n");
          nmeaSource=new QNmeaPositionInfoSource(QNmeaPositionInfoSource::RealTimeMode);
          nmeaSource->setUpdateInterval(1000);
          nmeaSource->setDevice(tcpSocket);
          connect(nmeaSource,SIGNAL(positionUpdated(QGeoPositionInfo)),this,SLOT(positionUpdated(QGeoPositionInfo)));
          nmeaSource->startUpdates();
      

      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?

      Best,
      Marek

      Pablo J. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #2

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

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      M 1 Reply Last reply
      1
      • Pablo J. RoginaP Pablo J. Rogina

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

        M Offline
        M Offline
        Marek
        wrote on last edited by Marek
        #3

        @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();
        //later
        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?
        prev_coord.azimuthTo(coord)

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved