QGeoPositionInfoSource and QNmeaPositionInfoSource



  • Hi guys!

    I'm trying to get GPS data from my Android device and I experienced some strange behavior. To get GPS data I used QGeoPositionInfoSource. Altough I set UpdateInterval to 500ms, I receive an update every ~20 seconds. That works when I use AllPositioningMethods (maybe I don't have in my house a good GPS signal but I have a great WiFi signal)

    Then I try to reproduce a GPS log with NMEA messages and in this case I have 2 different problems:

    1. I cannot read my log (probably a format problem, doesn't really matter)
    2. If I set an updateInterval, I can only read ONE message. If I don't set it, I read the entire file without delay between messages.

    Am I the only one who has these problems? Am I doing something wrong?

        source = QGeoPositionInfoSource::createDefaultSource(this);
        if (source) {
            connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),
                    this, SLOT(positionUpdated(QGeoPositionInfo)));
    
            source->setUpdateInterval(1000);
            source->setPreferredPositioningMethods(QGeoPositionInfoSource::AllPositioningMethods);
    
            source->startUpdates();
        }
    
        if(source2) {
            source2->createDefaultSource(this);
            QFile* logSource = new QFile(":/logs/nmealog.txt");
            source2->setDevice(logSource);
            source2->setUpdateInterval(500);
    
    
            connect(source2,SIGNAL(positionUpdated(QGeoPositionInfo)),
                    this,SLOT(positionUpdated2(QGeoPositionInfo)));
    
            source2->startUpdates();
    

    My log file was taken from geoflickr example.



  • Ok, I went out and tested my GPS source. I could get messages every 1 second and that was fantastic.
    I have two question now:

    1. Why 1 second is the limit? Can you read GPS with a frequency of 2Hz or 5Hz? I'd like to track the position of a car and if the speed is 15km/h, I get the position every 4 meters. Where could I find GPS' precision? Maybe the resolution is 10 meters and get position once per second is just fine.

    2. When I'm using AllPositioningMethods, I could get GPS every 20 seconds as I described before. Is this some kind of timeout or what is the problem? My configurable update interval works fine with SatellitePositioningMethods when I go out and get a strong GPS signal.

    Thanks!
    Fernando



  • Update:

    The second part of my original post is related to this unresolved bug.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.