38
UM001
4.3.6
Payload Length
When parsing the packet you will need to know the length of the payload (in bytes) in order to know
where the packet ends in the data stream. In order to reduce the overhead of the packet header length,
the length of the payload is not included in the header. Instead it should be derived based upon
determining the type of data present in the packet. All output data types are fixed length, thus the total
length of the payload can be determined based upon inspection of the group byte and the group field
bytes. In most applications you will likely only use a few binary output types, thus hard coding the payload
length in your parser is the easiest approach. If you want to develop a more generic parser that can handle
all available data output types supported by the VN-100, the easiest approach is to use a table lookup.
Below is a table with the payload size (in bytes) for all available output types.
Binary Output Payload Length In Bytes
Group
1
Group
2
Group
3
Group 4
Group
5
Group
6
Group 7
Field 1
8
8
2
8
2
2
8
Field 2
8
8
12
8
12
24
8
Field 3
8
8
12
2
16
24
2
Field 4
12
2
12
1
36
12
1
Field 5
16
8
4
1
12
12
1
Field 6
12
8
4
24
12
12
24
Field 7
24
8
16
24
12
12
24
Field 8
12
4
12
12
12
12
12
Field 9
12
4
12
12
12
12
12
Field 10
24
1
12
12
12
4
12
Field 11
20
1
12
4
28
4
4
Field 12
28
0
2
4
24
68
4
Field 13
2
0
40
2
0
64
2
Field 14
4
0
0
28
0
0
28
Field 15
8
0
0
2+(N*8)
0
0
2+(N*8)
Field 16
0
0
0
12+(N*28)
0
0
12+(N*28)
The messages highlighted in red in the above table are variable length messages. The size of these
messages will be dependent upon the number of packets present. See the description of the fields in
the appropriate group section below for more information on how to determine the length of these
packets.
The above lookup table can be implemented in C as shown below using a simple 2D array. Assuming you
are only using group 1 through 7, with support for 16 fields per group, then this lookup table could be
implimented using an 8x16 array of bytes consuming only 128 bytes of memory. With the exception of
the SatInfo and RawMeas fields in the GPS group, all other fields have a fixed length. The two variable
length fields can be handled seperately with a case statement. For these two fields the lookup table
contains the length of the fixed portion of the variable length packet (2 for the SatInfo and 12 for the
RawMeas fields).
Содержание VN-100
Страница 1: ...UM001 1 Firmware v2 1 0 0 Document Revision 2 22 VN 100 User Manual Embedded Navigation Solutions...
Страница 9: ...UM001 9 2 Specifications 2 1 VN 100 Surface Mount Sensor SMD Electrical Pin assignments top down view...
Страница 14: ...14 UM001 2 3 VN 100 Surface Mount Sensor SMD Dimensions Measurements are in inches 2 4 VN 100 Rugged Dimensions...
Страница 102: ...102 UM001 8 3 Factory Defaults Settings Name Default Factory Value Magnetometer Calibration Control 1 3 5...
Страница 113: ...UM001 113 9 5 Factory Defaults Settings Name Default Factory Value Velocity Compensation Control 1 0 1 0 01...