Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User mismael's Avatar
    Join Date
    Oct 2009
    Posts
    95
    hi everybody;
    i am using liblocation to get the direction of motion using the following code
    Code:
    if(device->fix->epd <= 10) //the accuracy must be less than 10 degree
        {
           data->m_track = device->fix->track;
         }
    but i always get a wrong direction, is there any other thing that i should do.?

  2. #2
    Nokia Developer Moderator divanov's Avatar
    Join Date
    Oct 2009
    Posts
    4,326
    Code:
    #include <QCoreApplication>
    #include <QDebug>
    
    extern "C" {
    #include <location/location-gps-device.h>
    #include <location/location-gpsd-control.h>
    }
    
    static void changed(LocationGPSDevice *device, gpointer userdata)
    {
        Q_UNUSED(userdata);
    
        qDebug() << QString("%1\t%2\t%3\t%4\t%5\t%6\t%7\t%8\t%9\t%10")
                    .arg(device->fix->time)
                    .arg(device->fix->ept)
                    .arg(device->fix->latitude)
                    .arg(device->fix->longitude)
                    .arg(device->fix->eph)
                    .arg(device->fix->speed)
                    .arg(device->fix->eps)
                    .arg(device->fix->track)
                    .arg(device->fix->epd)
                    .arg(device->satellites_in_use);
    }
    
    static void connected(LocationGPSDevice *device, gpointer userdata)
    {
        Q_UNUSED(device);
        Q_UNUSED(userdata);
    
        qDebug() << __PRETTY_FUNCTION__;
    }
    
    static void disconnected(LocationGPSDevice *device, gpointer userdata)
    {
        Q_UNUSED(device);
        Q_UNUSED(userdata);
    
        qDebug() << __PRETTY_FUNCTION__;
    }
    
    int main(int argc, char *argv[])
    {
        QCoreApplication app(argc, argv);
        LocationGPSDevice *device;
        LocationGPSDControl *control;
    
        g_type_init ();
    
        control = location_gpsd_control_get_default();
        if (control)
            location_gpsd_control_start(control);
    
        device = (LocationGPSDevice*)g_object_new(LOCATION_TYPE_GPS_DEVICE, NULL);
        if (device) {
            g_signal_connect(device, "changed", G_CALLBACK(changed), 0);
            g_signal_connect(device, "connected", G_CALLBACK(connected), 0);
            g_signal_connect(device, "disconnected", G_CALLBACK(disconnected), 0);
        }
    
        int ret = app.exec();
    
        if (device)
            g_object_unref(device);
        if (control)
            location_gpsd_control_stop(control);
    
        return ret;
    }
    What would be a log of this test app for you?
    Last edited by divanov; 2010-03-03 at 19:37. Reason: test app update

  3. #3
    Registered User mismael's Avatar
    Join Date
    Oct 2009
    Posts
    95
    here are a part of the log file

    Code:
    "Direction 192.12 +- nan [0]" 
    "Direction 192.12 +- nan [0]" 
    "Direction 192.12 +- nan [0]" 
    "Direction 192.12 +- nan [0]" 
    "Direction 192.12 +- nan [7]" 
    "Direction 307.19 +- 359.99 [8]" 
    "Direction 216.5 +- 359.99 [5]" 
    "Direction 63.33 +- 214.21 [5]" 
    "Direction 118.35 +- 359.99 [5]" 
    "Direction 105.53 +- 172.43 [5]" 
    "Direction 223.79 +- 240.71 [6]" 
    "Direction 68.98 +- 359.99 [4]" 
    "Direction 221.34 +- 41.75 [5]" 
    "Direction 221.34 +- 41.75 [5]" 
    "Direction 221.34 +- 41.75 [4]" 
    "Direction 235.97 +- 264.9 [4]" 
    "Direction 235.97 +- 264.9 [7]"

  4. #4
    Nokia Developer Moderator divanov's Avatar
    Join Date
    Oct 2009
    Posts
    4,326
    Cool, accuracy is never less than 10. What is speed of your motion?

    BTW, do you still insist that liblocation doesn't work with QCoreApplication?

  5. #5
    Registered User mismael's Avatar
    Join Date
    Oct 2009
    Posts
    95
    i was walking on my foot.
    now i am sure that liblocation work with QCOreApplication but i think that i should use g_type_init ();
    which i did not use on my code.

  6. #6
    Nokia Developer Moderator divanov's Avatar
    Join Date
    Oct 2009
    Posts
    4,326
    I've updated the test application to produce more informative log. A direction accuracy is proportional to speed.

  7. #7
    Registered User mismael's Avatar
    Join Date
    Oct 2009
    Posts
    95
    here is a part of the new log file
    Code:
    "Speed 0.648+-3.996 Direction 36.24+-359.99 [4]" 
    "Speed 2.016+-5.364 Direction 37.21+-341.16 [4]" 
    "Speed 3.42+-4.716 Direction 56.49+-121.19 [4]" 
    "Speed 2.484+-7.164 Direction 313.1+-181.82 [4]" 
    "Speed 1.116+-5.112 Direction 95.45+-359.99 [4]" 
    "Speed 1.296+-6.408 Direction 52.22+-359.99 [4]" 
    "Speed 2.7+-6.228 Direction 96.38+-202.68 [4]" 
    "Speed 2.916+-3.096 Direction 68.96+-145.8 [4]" 
    "Speed 3.132+-2.952 Direction 70.87+-107.7 [4]" 
    "Speed 3.6+-4.176 Direction 104.52+-54.75 [4]" 
    "Speed 0.936+-4.788 Direction 122.68+-359.99 [5]" 
    "Speed 3.312+-5.58 Direction 133.09+-74.36 [4]" 
    "Speed 3.384+-4.824 Direction 122.5+-60.33 [4]" 
    "Speed 5.688+-5.292 Direction 113.42+-22.59 [4]" 
    "Speed 3.816+-18.648 Direction 331.44+-72.88 [4]" 
    "Speed 0.828+-9.468 Direction 243.07+-359.99 [4]" 
    "Speed 0.828+-9.468 Direction 243.07+-359.99 [5]" 
    "Speed 0.828+-9.468 Direction 243.07+-359.99 [4]" 
    "Speed 7.704+-12.06 Direction 207.12+-71.76 [4]" 
    "Speed 6.444+-18.288 Direction 265.56+-109.1 [4]" 
    "Speed 8.928+-14.364 Direction 162.92+-110.81 [5]" 
    "Speed 8.928+-14.364 Direction 162.92+-110.81 [6]" 
    "Speed 1.656+-13.572 Direction 124.18+-359.99 [4]" 
    "Speed 3.888+-8.928 Direction 176.46+-338.14 [4]" 
    "Speed 2.844+-46.836 Direction 283.42+-321.52 [4]" 
    "Speed 2.844+-46.836 Direction 283.42+-321.52 [5]" 
    "Speed 2.844+-46.836 Direction 283.42+-321.52 [6]" 
    "Speed 2.844+-46.836 Direction 283.42+-321.52 [5]" 
    "Speed 12.528+-33.084 Direction 345.78+-16 [4]" 
    "Speed 12.528+-33.084 Direction 345.78+-16 [4]" 
    "Speed 12.528+-33.084 Direction 345.78+-16 [5]" 
    "Speed 9.072+-16.74 Direction 1.65+-17.74 [5]"

  8. #8
    Nokia Developer Moderator divanov's Avatar
    Join Date
    Oct 2009
    Posts
    4,326
    I've collected large set of data and it makes no sense. File a bug to external Maemo bugzilla.
    https://bugs.maemo.org/

  9. #9
    Nokia Developer Moderator divanov's Avatar
    Join Date
    Oct 2009
    Posts
    4,326
    Quote Originally Posted by divanov View Post
    I've collected large set of data and it makes no sense. File a bug to external Maemo bugzilla.
    https://bugs.maemo.org/
    Oh, wait, it actually does. You need to skip the data, where number of satellites were 0. Then it starts to make some sense.

Similar Threads

  1. i cant build helloworld project
    By akhin in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 2
    Last Post: 2008-12-22, 12:38
  2. symbian有一些常用加密算法的实现吗
    By xiao992004 in forum Symbian
    Replies: 8
    Last Post: 2008-09-12, 09:25
  3. carbidec++ helloworld project problem
    By akhin in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 0
    Last Post: 2007-03-11, 12:40
  4. carbide build problem help please
    By berkcekisbas in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2006-09-26, 19:41
  5. can not successfully link any sample using .NET
    By lobotomat in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2002-08-20, 00:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved