| |
ZL3AI > APRDIG 08.02.03 10:48l 232 Lines 9991 Bytes #999 (0) @ WW
BID : 869-ZL3AI
Read: GUEST
Subj: TAPR Digest, Feb 05, 3/5
Path: DB0FHN<DB0ZWI<DB0HST<HB9OK<IK6PYS<ON0AR<ZL2BAU<ZL3VML
Sent: 030207/1009Z @:ZL3VML.#80.NZL.OC #:58989 [Chch-NZ] FBB7.00i $:869-ZL3AI
From: ZL3AI@ZL3VML.#80.NZL.OC
To : APRDIG@WW
Subject: re: aprs spec/words of warning
From: "Paetzold, Kevin" <Kevin.Paetzold@stratus.com>
Date: Wed, 5 Feb 2003 13:15:36 -0500
X-Message-Number: 19
My two cents on the thread about character based protocol spec vs. binary:
One issue with binary is the big-endian/little endian issue. When
representing a numeric quantity larger than one byte which way will it be
represented? Most protocols (eg. TCP/IP) are defined with a big endian
perspective even though most computers these days are little endian.
However I can assure you that there are lots of big endian machines out
there. Character strings would not seem to have this issue and would avoid
potential misunderstandings (and bugs) IMHO.
Another potential issue (which is something that has been hard for many
people to learn) is that many of the official ANSI specs for various
programming languages are not at all clear on how bit fields are
represented in memory. Although I do not lay awake at night reading the
ANSI C spec the last time it was clear that bit field operations are not
ANSI standard. This would seem to have the potential for many
transportability issues, misunderstandings (and bugs) IMHO.
73,
K1KWP
----------------------------------------------------------------------
Subject: re: aprs spec/words of warning
From: Miller Scott Contr 30SCS/FTI <Scott.Miller@vandenberg.af.mil>
Date: Wed, 5 Feb 2003 18:38:36 -0000
X-Message-Number: 20
Trust me, in working with James on a test implementation, we've found a
number of those misunderstandings. =] We've settled on big-endian numbers
because it's the standard for TCP/IP and the functions to deal with it
(ntohl(), ntohs()) are readily available. Yes, C bitfields are even less
safe than C structures in general for cross-platform use, but that's what
bit masks are for. Take the GIF format, for example, or as someone just
pointed out to me, the WAV file format. They both use a binary format, and
they're intended for cross-platform use. The key is to make sure
EVERYTHING is explicitly defined in the spec (big-endian, MSB-to-LSB bit
order, two's complement, etc). I've also made some changes to avoid the
use of negative numbers where possible - things like altitude are biased to
place the whole range in the positive domain. If you want to go deeper
than 10,000 meters below MSL, though, you're going to need to find a
different protocol. =]
Scott / N1VG
----------------------------------------------------------------------
Subject: re: aprs spec/words of warning
From: Miller Scott Contr 30SCS/FTI <Scott.Miller@vandenberg.af.mil>
Date: Wed, 5 Feb 2003 19:10:22 -0000
X-Message-Number: 21
Ok, I've had lots of comments about endian issues and bit fields and such,
so here's a representation of a simple message element, in this case the GPS
Data Quality element. Note that fields in () are optional, and MSB-to-LSB
order and big-endian numbering are specified elsewhere in the document.
MSG #10 - GPS Data Quality
7 6 5 4 3 2 1 0 Field Type Units
+---------------+
0 |F F|V V|S S S S| See note
+---------------+
(1) | | PDOP 8-bit integer PDOP * 10
+---------------+
(2) | | HDOP 8-bit integer HDOP * 10
+---------------+
(3) | | VDOP 8-bit integer VDOP * 10
+---------------+
Packed fields:
F = Fix Type (2 bits)
Values: 00 - Unknown / Not available
01 - No fix
02 - 2D fix
03 - 3D fix
V = Fix Validity (2 bits)
Values: 00 - Invalid
01 - Valid SPS
02 - Valid DGPS
03 - Valid PPS
S = Satellites used
The Satellites field indicates the number of satellites in use, as reported
by the NMEA 0183 $GPGGA sentence. PDOP, HDOP, and VDOP optionally indicate
the position, horizontal, and vertical dilution of precision, respectively.
DOP values are represented as integers equal to ten times the GPS-reported
DOP. DOP values over 25.5 are reported as 255.
Example:
05 10 D8 19 0D 15 (Valid 3D GPS fix, PDOP = 2.5, HDOP = 1.3, VDOP = 2.1)
---
Extracting the fix validity can be done with the following C statement:
fixtype = (buf[0] & 0x30) >> 4;
You just mask it for the relevant bits and shift the result to where you
need it. No need to worry about data structures or bitfields. I challenge
anyone to show me an ASCII text extraction routine that compiles tighter
than that.
Scott / N1VG
----------------------------------------------------------------------
Subject: Re: New spec - working notes
From: Miller Scott Contr 30SCS/FTI <Scott.Miller@vandenberg.af.mil>
Date: Wed, 5 Feb 2003 20:25:57 -0000
X-Message-Number: 22
Thanks for the info, Gerry. I'll probably have some more questions for you
on the weather format.
I've modified the position format to make the low-order bytes optional.
This gives you the ability to send a position with 3.4-meter horizontal (at
the equator) and 2.5-meter vertical resolution in a total of 10 bytes,
including 2 bytes of header. If this proves to be not worth the trouble, I
might change it back to the original format.
Scott / N1VG
-----Original Message-----
From: Gerry Creager N5JXS [mailto:gerry.creager@tamu.edu]
Sent: Monday, February 03, 2003 6:21 AM
To: Miller Scott Contr 30SCS/FTI
Cc: TAPR APRS Special Interest Group
Subject: Re: [aprssig] Re: New spec - working notes
DGPS can reasonably provide decimeter accuracies. Vertical will remain
problemmatic, typically with a standard deviation increase of 1.414 that
of horizontal positioning.
A good rule of thumb is that one gets an order of magnitude improvement
in accuracy with the incorporation of code-phase differential GPS.
Thus, the typical 6m accuracy will resolve to 0.6m horizontal, while the
vertical, will resolve to about 1m.
Use of carrier-phase kinematic techniques, generally out of the reach of
this group, will yield cm accuracy in horizontal and vertical measurement.
I suggest that, for temp ranges, we typically need resolution at the 1
deg C range. We're talking a tactical system here, where a quicklook is
more important than 4-balls resolution.
gerry
----------------------------------------------------------------------
Subject: Re: A brief explanation
From: Henk de Groot <henk.de.groot@hetnet.nl>
Date: Wed, 05 Feb 2003 21:18:28 +0100
X-Message-Number: 23
At 00:30 5-2-03 +0000, Miller Scott Contr 30SCS/FTI wrote:
>work on it anyway. It WILL be used, even if only for my own backbone links
>and SAR applications. But the more input I can get from people, the better
>the chances are that it'll turn out to be something really useful, and worth
>adopting. This isn't just MY protocol, it's YOURS, too. It'll be there for
>all the Amateur community to use, and for that matter, commercial interests
>as well.
When you selected a PID then I will enable DIGI_NED to allow that type of
packets for digipeating. When it becomes more clear how to send short
messages and objects I will add that too, so you can have the same features
as currently for APRS.
I like the way you design the protocol right now, at least the parts I saw.
You may want to have a clear definition how bits in the byte are origanized
(which ones are the 4 bits if you have a for bit value).
I saw the comment about bitfields, big-endian, little endian etc. On entry
just use bytes and filter the bits you need out of that. Don't use structs
at the raw data. What I do in DIGI_NED is break down the raw AX.25 data
byte by byte and transfer the data to a C structure. Then this structure,
obviously now in machine and compiler dependent format, is used everywhere.
This works because all code is compiled with the same compiler and same
flags and runs on one and the same CPU. So my code completely acts on this
"uiframe" structure. Then finally when the data needs to be transmitted,
the structure is broken down and the raw frame is build up byte by byte,
then it is offered for transmission to the MAC layer (via the Linux AX.25
driver or a resident MAC layer driver.
Although I run DIGI_NED only on little-endian machines I know that it also
runs on big-endian systems, somebody tried it and it worked first time! So
it is quite possible to make portable C code that works accross different
architectures. But no assumptions should be made about the architecture and
C structures. Using structures to overlay raw data is a beginners error. It
was fun when the 68000 came out that could not fetch a word value on a byte
boundary... That did cause a bus-error. Compilers inserted padding bytes
and it had to be explained over and over to designers by they could not get
their structures correctly alligned with the data.
I see you fill nicely multiples of 8 bits and don't allow any data to be
spread over 2 bytes (unless of course it doesn't fit in a byte). That's
good. You don't want a 4 bit value with one bit in one byte and the other 3
bits in another byte. If you need a 16 bit value, make sure it starts on a
word boundary, or a 32 bit word on a longword boundary. I know some
processors have to do byte fetches to get those values if they are not
alligned and the 68000 cannot do it at all.
Keep up the good work. Even if it does not catches on, you will learn a
lot, also about traditional APRS while exploring its possibilities.
One thing though. I think it should be able to concatinate multiple binary
data blocks in a single packet, otherwise it will be hard to make a single
beacon that sends out position, WX data, speed and comment in one go. That
can be done with the old protocol. You don't want to send independent
packets for each type of data I think.
Just some thoughts and remarks. As said, so for what has been posted looks
good to me.
Kind regards,
Henk.
----------------------------------------------------------------------
Read previous mail | Read next mail
| |