[Top][All Lists]

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

Re: [gpsd-dev] Adding additional parameters to gps_data_t structure

From: Gary E. Miller
Subject: Re: [gpsd-dev] Adding additional parameters to gps_data_t structure
Date: Wed, 3 Jul 2019 22:54:56 -0700

Yo address@hidden!

On Wed, 03 Jul 2019 23:19:27 -0500
address@hidden wrote:

> I have removed the 3 parameters (velN, velE,height) from fix_t
> structure and added in separate structure which i created inside the
> gps_data_t structure.

Please don't do that.  They belong right next to the ecef stuff.

> Now in application I am able to receive all the
> data but not my 3 parameters which is always 0.

Which means possibly you forgot to set to NAN, or you are setting the
values to zero.

> As i told before I am able to get the value for 3 parameters in
> client buffer. But if i read in application it is always zero.

Not a surprise.

> gpsd:CLIENT:=> client(0):   
> {"class":"TPV","device":"/dev/ttyLP2","mode":3,"time":"2019-07-03T14:46:51.000Z","ept":0.005,"lat":12.912552367,"lon":77.615069416,"alt":910.134,"epx":13.902,"epy":13.902,"epv":17.850,"track":300.1925,"speed":0.395,"climb":0.028,"eps":0.99,"epc":35.70,"velN":0.23,"velE":-0.25,"height":824.98}\x0d\x0a

Where is velD?  

> I have already done all the above steps , sharing patch for your 
> understanding.

More than understanding.  With your permission I hope to eventually
merge in to git head.  Does gpsd have that permission from you?

The patch shows good progress, but needs work:

cgps.c: You just added 2 blank lines?

driver_nmea0183.c: I can't match you addition of gpsd_log() with 
my copy of the source.  What version source did you base on?  Besst to
base on git head.


Uh, don't do this:

+       gpsd_log(&session->context->errout, LOG_INF, "Modifying sAcc from 
VELNED \r\n");
+       session->newdata.eps = session->driver.ubx.last_serr;

We do not modify data from the GPS.  Scale and range per the doc only.

This is not gonna happen:

+        msg[0] = 0x01;          /* class */
+        msg[1] = 0x02;          /* msg id  = NAV-POSLLH */
+        msg[2] = 0x01;          /* rate */
+        (void)ubx_write(session, 0x06u, 0x01, msg, 3);
+        msg[0] = 0x01;          /* class */
+        msg[1] = 0x012;          /* msg id  = NAV-VELNED */
+        msg[2] = 0x01;          /* rate */
+        (void)ubx_write(session, 0x06u, 0x01, msg, 3);

We already over fill the u-blox input buffer on init.  Move to
ubxtool, or we gotta figure out a way to queue the init stuff.

This breaks regressions:

-                        if len(fields) > 14:
-                            self.fix.mode = default(14, MODE_SET, int)
+                        if len(fields) > 17:
+                            self.fix.mode = default(17, MODE_SET, int)

Make it an "else if"

I see you expanded some indents to 8 from 4.  All new indents are 4.
Try to match the existing formatting.

Like, don't do this:

+               {
+               }

Style consistency is important.  So unless you want to reformat ALL
the code, dont do that.

Bad socket is an error, leave it:

                if (BAD_SOCKET(ssock))
-                   gpsd_log(&context.errout, LOG_ERROR,
+                   gpsd_log(&context.errout, LOG_INF,

Uh, gpsd.h-tail??  WTF?  What version is this???

gpsd.h-tail was removed in January 2017!

get on git head!

As I said before, these need to be in gps_fix_t:

+           double last_serr;
+           double last_velN;        /*North component of velocity vector*/
+           double last_velE;        /*East velocity component*/
+           double last_height;   /*Height above ellipsoid*/

Many drivers can use it, not ubx specific, so does not belong in a ubx 
only structure.

And, where is velD?

Let us agree on what gpsd.h looks like, get that patch into git head,
then move on.


+       if (isnan(gpsdata->cust_param.velN) == 0)

No, read the comment on the top of a recent gpsd_json.c for why that
is a bad idea.


+struct cust_param_t {
+       double velN;        /*North component of velocity vector*/
+       double velE;        /*East velocity component*/
+       double height;      /*Height above ellipsoid*/

Put in gps_fit_t and that goes away.  You are working too hard.

Once again, where is velD?

Actually a pretty good first cut.  Don't be discouraged.  Let us
get on the same source code version (git head), get gpsd.h nailed down,
then the rest will be not too hard to fix.

Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        address@hidden  Tel:+1 541 382 8588

            Veritas liberabit vos. -- Quid est veritas?
    "If you can’t measure it, you can’t improve it." - Lord Kelvin

Attachment: pgpztf3NGdxmd.pgp
Description: OpenPGP digital signature

reply via email to

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