gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gpsd-dev] Minimum working example for libgps


From: David Huichen Dai
Subject: Re: [gpsd-dev] Minimum working example for libgps
Date: Sat, 4 Nov 2017 15:13:31 +0800



On Fri, Nov 3, 2017 at 9:26 PM, Eric S. Raymond <address@hidden> wrote:
David Huichen Dai <address@hidden>:
> 2. This is only a toy program. In my project, I need to have the latest
> coordinates immediately whenever I want, I dont want to wait for any time
> before I can have the coordinates, also not in a loop as in this toy
> program. How could I achieve this?

You can never have this at all.

The problem is that your sensor only reports at 1-second intervals.  The best
you can do is sample at least once per second (0.5s is optimal) and cache
the last result.

​Thanks for your reply. Why do you say that my sensor reports at 1-second interval? ​I set the gps_waiting time to 2 seconds, which means I wait for up to 2 seconds to get the coordinates, not sampling every 2 seconds, right?

Do I need a separate thread to sample the coordinates, store them in a variable, and access it from other thread when I need the coordinates? Is this the common way to use the libgps?

Thank you~


David


 
--
                <a href="" href="http://www.catb.org/~esr/" rel="noreferrer" target="_blank">http://www.catb.org/~esr/">Eric S. Raymond</a>

My work is funded by the Internet Civil Engineering Institute: https://icei.org
Please visit their site and donate: the civilization you save might be your own.





--
==================================================
David Huichen Dai, PhD
Research assistant
Lab of Broadband Network Switching Technology and Communication
Dept. of Computer Science and Technology
Tsinghua University, Beijing, P.R. China, 100084
Tel: 86-010-6277-3441
Email: address@hidden; address@hidden
==================================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]