--------------------------------------------------------------------
Title:     DVLNAV DATA I/O and LOG FORMAT DOCUMENTATION
           
Author:    Louis L. Whitcomb  and James Kinsey
           Department of Mechanical Engineering
           Johns Hopkins University
           and
           Deep Submergence Laboratory
           Woods Hole Oceanographic Institution
 
Created and Written: 05 June 2001  Rev 01

Abstract:  This note documents the dvlnav reatime data Input/output
           and data log formats.

----------------------------------------------------------------------
----------------------------------------------------------------------

----------------------------------------------------------------------
TABLE OF CONTENTS 

----------------------------------------------------------------------
PART 0:   MODIFICATION HISTORY
----------------------------------------------------------------------

----------------------------------------------------------------------
PART I:   REATIME DATA INPUT/OUTPUT STRING FORMATS

PART      SECTION   SECTION NAME
--------  --------- --------------------------------------------------
I         1         Overview

I         2         String input from HOST to DVLNAV
                    I.2.1 $PWHDEP NMEA Depth Sensor String
                    I.2.2 $PWHALT NMEA Altitude Sensor String
                    I.2.3 $PWHLBL NMEA LBL Travel Time String
                    I.2.4 $PWHTMP NMEA Water temperature Sensor String
                    I.2.5 $PWHSOS NMEA Sound Velocity Sensor String
                    I.2.6 $PWHCTD NMEA CTD Sensor String
                    I.2.7 $PWHTIM NMEA Time String
                    I.2.8  XBW 	  ASCII Crossbow Gyro String
                    I.2.9  VIS 	  ASCII Magnetomoeter String 
                    I.2.10 VIS 	  ASCII CTD String
                    I.2.11 VDS 	  ASCII Depth String String
                    I.2.12 $PWHMAG NMEA Magnetometer String
                    I.2.13 PNS    ASCII Platform Navigation String for
                                  externally input of 
                                  vehicle, ship, or depressor position.
                    I.2.14 PAS    ASCII Platform Navigation (position) String
                                  externally input of 
                                  vehicle or depressor heading, pith, roll.


I         3         String output from DVLNAV to HOST
                    I.3.1 $PWHGYRO NMEA Octans  heading and attitude. 
                    I.3.2 $PWHMAGD NMEA DVL     heading and attitude. 
                    I.3.3 $PWHLBX NMEA LBL     nav fix. String
                    I.3.4 $PWHDOP NMEA Doppler nav fix, cog, sog, etc. 
                    I.3.5 $PWHTRB NMEA Target  ID, range, bearing.  
                    I.3.6 $PWHTIM NMEA Time  
                    I.3.7 VNS     ASCII Vehicle pos and vel in UTM.
                    I.3.8 $PWHCFG NMEA Site configuration data.  
                    I.3.9 DVX     ASCII Doppler navigation string sent to host

----------------------------------------------------------------------
PART II: DSL DATA FORMAT LOG FILE LOG STRING SPECIFICATIONS

PART      SECTION   SECTION NAME
--------  --------- --------------------------------------------------
II        1         OVERVIEW OF LOG FILE FORMATS
II        2         PNS format for cooked host data
II        3         VIS format for cooked octans data
II        4.1       OCT format for raw octans ascii NMEA strings
II        4.2       OCB format for raw octans BINARY strings
II        5         VIS format for cooked doppler data
II        6         RDB format for raw doppler data 
II        7         HST format for raw host strings received from host 
II        8         HTX format for raw host strings transmitted to host
II        9         STD format for stderr log
II       10         CPU format for CPU and DISK usage 
II       11         MSC format for miscellaneous derived realtime nav info
II       12         SIM format for simulation data


----------------------------------------------------------------------
Part III: COMMA-DELIMITED LOG FILES SPECIFICATIONS (for SPREADSHEETS)

PART      SECTION   SECTION NAME
--------  --------- --------------------------------------------------
III       1         Overview: file content, file name conventions.
III       2         Comma-Delimited Log File Format


----------------------------------------------------------------------
Part IV: Vehicle Coordinate Frame Convention Specification

PART      SECTION   SECTION NAME
--------  --------- --------------------------------------------------
IV        1         Vehicle Coordinate Frame Convention Specification 

----------------------------------------------------------------------



----------------------------------------------------------------------
Part 0: Modification history
----------------------------------------------------------------------
Rev  1 Jun  5 2001  LLW Created and written
Rev  2 Jun  5 2001  LLW Added octans PAS log format, Section 3
Rev  4 Jun  5 2001  LLW Added doppler & host PNS log format, Section 4
Rev  6 Jun  6 2001  LLW & JCK I/O Formats
Rev  9 Jun  7 2001  LLW & JCK Host NMEA I/O protocol.
Rev 14 Jun 10 2001  LLW & JCK Revised PNS, VIS, and NMEA formats.
                        Added Host VIS dvlnav output format.
Rev 18 Jun 10 2001  LLW Added VNS output string format.
                        Implementred and tested Alvin host NMEA output
                        strings.
Rev 19 Jun 10 2001  LLW DSL Format (from Jon Howland) for Crossbow
                        Depth, CTD, and Magnetometer
Rev 20 Jun 17 2001  LLW & KH Added Lat and Lon to LBX string.
                        Typo corrections. 

Rev 21 Sept 6 2001  LLW & KH Added $PWHTRB Note.
                        Oct 11 2001 DVLNAV V128 Release to Alvin

Rev 23 Jan 10 2002  DAS Corrected errors in $PWHDEP string documentation.

Rev 24 Mar 1  2002  LLW $PWHDOP and $PWHLBL implementation have
                        been corrected to report depth as positive, 
                        and to confirm to to this documentation.

Rev 26 Apr 11 2002  LLW Added new comma-delimited one-hertz output file
                        format, first revision, based on Dan Fornari's 
                        specification.
                        Modified filename convention to include year.

Rev 28 Apr 14 2002  LLW Added additional unit convention comments
                        to Part III comma delimited log format.
                        Added time zone to comma delimited log format.
                        Added octans status, Maggie time.

Rev 29 Apr 17 2002  LLW Added new $PWHCFG string format spec

Rev 30 Apr 19 2002  LLW Added lat, lon to $PWHDOP
                        Removed salinity and temp from $PWHCFG
                        Added XY Origin in UTM to $PWHCFG

Rev 31 Apr 19 2002  LLW Modified $PWHDOP and $PWHLBL to have identical data fields
                        for first seven fields:
                        $PWHLBX,<X>,<Y>,<DEPTH>,<lat>,<lon>,<ALT>,<Vertical Velocity>,
                        $PWHDOP,<X>,<Y>,<DEPTH>,<lat>,<lon>,<ALT>,<Vertical Velocity>,

Rev 32 Apr 21 2002  LLW Modified $PWHDOP to report FILTERED cog, sog, cow, sow
                        Modified $PWHMTW to $PWHTMP and added string tag field
                        to identify low temp, hi temp, ICL temp, etc.
                        Added $PWHMAG maggie string.
                        Revised $PWHCFG string.
                        Addex X,Y,Z vel to science spreadsheet log.
                        Modified $PWHRB to report NAME or # of origin and
                        destination for range and bearing.

Rev 33 Apr 23 2002  LLW Changed .CSV to log both altitude and doppler altitude.


Rev 34 Apr 23 2002  LLW Typo corrections in Part III Section II .CSV format
                        pitch data sign definition.
                        April 24 2002 DVLNAV V155 Release to Alvin.

Rev 35 May 06 2002  LLW Added DVL temp to .CSV format

Rev 36 May 09 2002  LLW DVLNAV V157 Release to Alvin
                        Added logging of targets (both pre-loaded and 
                        on-the-fly dropped targets to CSV file.

Rev 37 May 20 2002  LLW Changed order from Lon Lat to Lat Lon in .CSV .
                        Fixed sign bug in $PWHLBX and $PWHDOP vertical vel.
                        $PWHLBX and $PWHDOP changed to report Z depth, not
                        Z lbl solution depth.
                        Fixed bracket problem in INI file format.

Rev 38 May 21 2002  LLW DVLNAV V159 Release to Alvin
                        Fixed bug in $PWHDOP in which Doppler fix status 
                        was always incorrectly reported as zero.
                        Added referenced to DVLNAV version numbers
                        in this modification history.

Rev 39 Aug 18 2003  LLW DVLNAV V172.01 Data format revsions:

                        (1) Part II Section 4: 
                        Added additional data fields to VIS data string 
                        logged on every DVL ping:
                        - Sound velocity and sound velocity source for
                          Doppler fix computation
                        - World Vehicle Position XYZHPR

                        (2) Added additional data fields to PNS data string 
                        logged on every LBL fix and at one hertz:

                        - Sound velocity and sound velocity source for
                          Doppler fix computation

                        - Sound velocity and sound velocity source for
                          LBL fix computation

                        - World vehicle top and bottom transducer position

Rev 40 Aug 18 2003  LLW&JCk  DVLNAV V172.02 
                        Change Doppler VIS string:
                            - octans and xbow attitudes are now cooked vehicle attitude, not raw instrument atitude.
                            - added cooked doppler vehicle attitude
 


Rev 40 Aug 20 2003  LLW&JCk  DVLNAV V173

                    Updated Doppler VIS string documentation

Rev 41 Aug 21 2003  LLW  DVLNAV V173.01

                    Created new SIM simulation data log format. This string
                    is logged only when the "simulation mode" is active,
                    at the simulation update rate of 10 Hz. Documented
                    in Part II of this document.

Rev 41 Aug 21 2003  LLW  DVLNAV V174
                    Added logging of DVL instrument velocities to SIM log string                    

Rev 41 Aug 21 2003  LLW  DVLNAV V174.05

                    V174.05 added two-transponder-on-the-vehicle LBL, enabling
                    the computation of LBL vehicle haading.

                    The LBL PNS log format string has been revised to delete
                    the four (unused) complementary filter fix pos fields,
                    and instead logs LBL mode and LBL heading information

                    Corrected numbering error in PNS LBL log strings

  
Rev 45 Nov 22 2003  LLW revised to version dvlnav_data_formats_rev_45.txt
                    Added documentation for PNS, PAS, DVX, OCT, OCB, RDB,
                    HST, HTX, STD, and MSC data formats.

Rev 46 Dec 07 2003  Corrected error in $PWHALT documentation.  Was
                    incorrectly reported as $PWALT.


----------------------------------------------------------------------
Part I Section 1: OVERVIEW
----------------------------------------------------------------------

DVLNAV presently communicates to three devices:

1. Vehicle host computer - as specified in this document
2. Octans gyro  - see Octans manual for Octans STD1 NMEA protocol.
3. RDI Doppler  - see RDI manual for PD5 Binary protocol.

All data is communicated via the ASCII readable data strings via RS232
serial or network UDP sockets as specified in this document. 

All normal serial port communication settings are supported.

All strings are printable ASCII, terminated with <cr><lf> in this
order.

Conventions:

<cr> denotes carriage return, decimal 13, hex 0D, keyboard CTRL-m
<lf> denotes line-feed,      decimal 10, hex 0A, keyboard CTRL-j

Strings are in either of two formats: NMEA or DSL standard

NMEA strings have the following format:

  1. A leading $ (dollar sign) character
  2. A multi character identity string, terminated with a comma (",")
  3. Data fields delimited by commas. 
     The final data field has no trailing comma.
  4. A * (asterix) character.
  5. A two digit hexadecimal checksum.  
     The checksum is computed from all characters between (but
     not including) the leading $ and trailing * characters.
     The value of the checksum is the exclusive-or (XOR) of
     the characters between the $ and the *. 

Here are some sample valid NMEA strings:
$PWHDEP,493.016,2,K*6C
$PWHDEP,493.037,1,K*6C
$PWHDEP,494.414,2,K*6D
$PWHDEP,495.346,1,K*6F
$PWHDEP,495.445,2,K*68
$PWHALT,500.000,K*76
$PWHALT,500.376,K*74
$PWHALT,528.488,K*78
$PWHALT,529.076,K*7C
$PWHLBL,2059588,1394115,1908726,2997037*0E
$PWHLBL,2063857,1397374,1912297,2993600*0C
$PWHLBL,2067484,1391127,1909341,2993404*0E
$PWHLBL,2071128,1391391,1909711,2992674*00
$PWHLBL,2073126,1388771,1908596,2992443*04
$PWHMTW,0.017052,C*5D
$PWHMTW,0.153121,C*59
$PWHMTW,0.251564,C*5D
$PWHMTW,0.577777,C*5E
$PWHMTW,1.032416,C*5F
$PWHMTW,1.609285,C*5D
$PWHSOS,1500.000*36
$PWHCTD,36.256299,12.512598,485.587769*22
$PWHCTD,36.811789,13.623578,495.345547*26
$PWHCTD,37.342583,14.685167,468.367608*29
$PWHCTD,37.841448,15.682896,492.192721*21
$PWHCTD,38.041757,16.083513,481.599601*21
$PWHCTD,38.483534,16.967067,497.791131*20
$PWHCTD,38.877829,17.755659,469.480821*29
$PWHCTD,39.346987,18.693975,477.767897*29
$PWHCTD,39.605305,19.210610,499.375805*25





----------------------------------------------------------------------
PART I SECTION 2: STRINGS SENT FROM HOST TO DVLNAV
----------------------------------------------------------------------

Sensor strings are normally generated by the host when a sensor
value is received by the host.

Some sensors, e.g. sound velocity probe and CTD, may not be present.
In this case, the host should not send the corresponding strings.

The time string should be transmitted by the host once a second.




----------------------------------------------------------------------
I.2.1: $PWHDEP NMEA DEPTH SENSOR STRING from host to dvlnav
----------------------------------------------------------------------
// 1/12/02 DAS Corrected error in <Datum> enum

FORMAT:
$PWHDEP,<depth in decimal meters>,<depth sensor number>,<datum>*<checksum><cr><lf>

<depth in decimal meters> may contain any number of digits before and
after the decimal point.  It should be a positive number. A "+" sign is
allowed but not required.

<depth sensor number> should an integer, normally 1 or 2, indicating
that the sensor reading is from depth sensor 1 or 2.

<datum> is a character specifying the sensor datum
        K indicates that sensor value is measured from keel
        T indicates that sensor value is measured from transducer

<checksum> is the two digit hexadecimal checksum

EXAMPLE:
$PWHDEP,468.242,1,K*68
$PWHDEP,468.368,1,K*61
$PWHDEP,469.113,1,K*6E
$PWHDEP,469.238,2,K*67
$PWHDEP,469.251,2,K*68
$PWHDEP,469.481,1,K*60
$PWHDEP,470.064,2,K*64
$PWHDEP,470.112,2,K*64
$PWHDEP,470.924,1,K*6A
$PWHDEP,471.512,1,K*62
$PWHDEP,471.681,2,K*68
$PWHDEP,471.791,2,K*68
$PWHDEP,473.563,1,K*66
$PWHDEP,474.005,2,K*67
$PWHDEP,474.217,2,K*66
$PWHDEP,474.333,1,K*62
$PWHDEP,476.863,1,K*6E
$PWHDEP,476.921,2,K*6A
$PWHDEP,477.274,2,K*60

DATA SOURCE FILE:
host.h
host.cpp



----------------------------------------------------------------------
I.2.2: $PWHALT NMEA ALTIMETER ALTITUDE STRING from host to dvlnav
----------------------------------------------------------------------

FORMAT:  
$PWHALT,<altitude in meters>,<datum>*<checksum><cr><lf> 

<altitude in meters> may contain any number of digits before and
after the decimal point.  It should be a positive number. A "+" sign is
allowed but not required.  

<datum> is a character specifying the sensor datum
        K indicates that sensor value is measured from keel
        T indicates that sensor value is measured from transducer

<checksum> is the two digit hexadecimal checksum
 
EXAMPLE: 
$PWHALT,506.963,K*7C
$PWHALT,507.807,K*7E
$PWHALT,510.518,K*7B
$PWHALT,511.469,K*7D
$PWHALT,514.412,K*74
$PWHALT,515.410,K*77
$PWHALT,518.400,K*7B
$PWHALT,519.383,K*76
$PWHALT,522.232,K*75
$PWHALT,523.137,K*72
$PWHALT,525.667,K*76
$PWHALT,526.437,K*72
$PWHALT,528.488,K*78
$PWHALT,529.076,K*7C
$PWHALT,530.519,K*78
$PWHALT,530.887,K*72
$PWHALT,531.632,K*73
$PWHALT,531.758,K*7E

DATA SOURCE FILE:
host.h
host.cpp



----------------------------------------------------------------------
I.2.3: $PWHLBL NMEA LBL TRAVEL TIME STRING from host to dvlnav
----------------------------------------------------------------------

FORMAT:  
$PWHLBL,<tt A>,<tt B>,<tt C>,<tt D>*<checksum><cr><lf>  

<tt A> is the round-trip travel time between the vehicle LBL ducer and
the transponder A in positive integer units of microseconds.  It can
contain any number of digits.  It should not contain a decimal point.

Units are microseconds (need to check with Alvin boys about this).

<tt B> same format as <tt A>, but for transponder B.

<tt C> same format as <tt A>, but for transponder C.

<tt D> same format as <tt A>, but for transponder D.

<checksum> is the two digit hexadecimal checksum
 
EXAMPLE: 
$PWHLBL,2055546,1397837,1911208,2996497*04
$PWHLBL,2058602,1401780,1914264,2994357*07
$PWHLBL,2059205,1395915,1910974,2995100*02
$PWHLBL,2059588,1394115,1908726,2997037*0E
$PWHLBL,2063857,1397374,1912297,2993600*0C
$PWHLBL,2067484,1391127,1909341,2993404*0E
$PWHLBL,2071128,1391391,1909711,2992674*00
$PWHLBL,2073126,1388771,1908596,2992443*04


----------------------------------------------------------------------
I.2.4: $PWHTMP NMEA WATER TEMPERATURE SENSOR STRING from host to dvlnav
----------------------------------------------------------------------

FORMAT:  
$PWHTMP,<water temperature in C>,<scale character>,<Sensor ID String>*<checksum><cr><lf>

<water temperature in C> may contain any number of digits before and
after the decimal point.  It should be a positive number. A "+" sign is
allowed but not required.

<scale character> is a character specifying the sensor datum
        C indicates centigrade (use this please)
        F indicates Fahrenheit (will be converted to C by dvlnav)

<Sensor ID String> Ascii string identifying the sensor source.
        recognized tags are:
        H     High Temp Probe
        L     Low Temp Probe
        I1    ICL Probe #1
        I2    ICL Probe #2
 

<checksum> is the two digit hexadecimal checksum

EXAMPLE:

DATA SOURCE FILE:
host.h
host.cpp



----------------------------------------------------------------------
I.2.5: $PWHSOS NMEA SOUND VELOCITY SENSOR STRING from host to dvlnav
----------------------------------------------------------------------

FORMAT:
$PWHSOS,<sound velocity in meters per second>*<checksum><cr><lf>

<sound velocity in meters per second> may contain any number of digits
before and after the decimal point.  It should be a positive number. A
"+" sign is allowed but not required.

<checksum> is the two digit hexadecimal checksum

EXAMPLE:
$PWHSOS,1500.000*36



----------------------------------------------------------------------
I.2.6: $PWHCTD NMEA CTD SENSOR STRING from host to dvlnav
----------------------------------------------------------------------

FORMAT:  
$PWHCTD,<conductivity>,<temp>,<depth>*<checksum><cr><lf>

All data fields may contain any number of digits before and after the
decimal point.  They should be positive numbers. A "+" sign is allowed
but not required.

<conductivity>  is decimal units of Seimens per meter.
<temp>          is decimal units of degrees C.
<depth>         is decimal units of depth in meters.

Note:  1 Siemen/meter = 10 mmho/cm.
       To convert from Siemen/meter to mmho/cm, multiply
       the Siemen/meter value by 10.
       To convert from mmho/cm to Siemen/meter, divide
       the mmho/cm value by 10.

<checksum> is the two digit hexadecimal checksum

EXAMPLE:
$PWHCTD,36.256299,12.512598,485.587769*22
$PWHCTD,36.811789,13.623578,495.345547*26
$PWHCTD,37.342583,14.685167,468.367608*29
$PWHCTD,37.841448,15.682896,492.192721*21
$PWHCTD,38.041757,16.083513,481.599601*21
$PWHCTD,38.483534,16.967067,497.791131*20
$PWHCTD,38.877829,17.755659,469.480821*29
$PWHCTD,39.346987,18.693975,477.767897*29
$PWHCTD,39.605305,19.210610,499.375805*25

DATA SOURCE FILE:
host.h
host.cpp



----------------------------------------------------------------------
I.2.7: $PWHTIM TIME STRING from host to dvlnav
----------------------------------------------------------------------

This string is used to send

FORMAT:
$PWHTIM,<YYYY>/<MM>/<DD> <HH>:<MM>:<SS.SSS>,<source>*<checksum><cr><lf>

Where:

   1.  <YYYY> is a four digit YEAR.
   2.  <MM>   is a two digit MONTH, with January=1.
   3.  <DD>   is a two digit DAY OF MONTH.
   4.  <HH>   is a two digit HOUR OF DAY in 24 hour format.
   5.  <MM>   is a two digit MINUTE OF HOUR.
   6.  <SS.SSS>  is seconds, in decimal notation to any second resolution.
              PREFERRED RESOLUTION FOR SECONDS IS 0.001 SECOND!

<source> is a character specifying the source of the time stamp
         H if the time stamp is from the HOST computer
         D if the time stamp is from the DVLNAV computer


<checksum> is the two digit hexadecimal checksum

EXAMPLE:
Note: checksum is not valid ont his example:

$PWHTIM,2001/06/07 09:39:43.411,H*00<cr><lf>

DATA SOURCE FILE:
host.h
host.cpp



-------------------------------------------------------------------------
I.2.8: XBW Format for Crossbow Data (from Jon Howland)
-------------------------------------------------------------------------
LOG DATA DESCRIPTION
This XBW String logs data from the Crossbow AHRS

See Appendix on angle conventions.

The crossbow's absolute heading reference is magnetic.  The value logged
has been corrected by adding the magnetic variation.  The applied
variation is logged with the data.

Reported accelerations and magnetic field strengths are in the
instrument coordinate frame.

LOG DATA SOURCE

This data string is generated by the SIO_crossbow thread of the rov
program every time a new Crossbow data message is received.

LOG DATA FREQUENCY
Between 5 and 10 Hz

LOG DATA FIELDS

1.  "XBW"
2.  Date/time string:  YYYY/MM/DD HH:MM:SS.SSS
3.  "AHRS"
4.  vehicle name as entered into the rov configuration file
5.  Heading in degrees (magnetic, NOT TRUE)
6.  Pitch in degrees
7.  Roll in degrees
8.  Heading Rate in degrees/second
9.  Pitch Rate in degrees/second
10. Roll Rate in degrees/second
11. X Acceleration in G
12. Y Acceleration in G
13. Z Acceleration in G
14. X Magnetic Field in Gauss
15. Y Magnetic Field in Gauss
16. Z Magnetic Field in Gauss
17. magnetic variation in degrees (already applied to item 5, heading)
18. Temperature in degrees C.
19. Magnetic variation (aka declanation) source code - how was
    the magnetic variation determined? Codes are: 
    1000 = USGS tables based on local XY origin Lat and Lon
    1001 = Unknown
    1002 = config file (manually entered into the config file) 
    1003 = Jasontalk command (i.e. from pilot gui, engineer gui, or backdoor).
    9999 = This variation value is wrong, don't use it.
 
LOG DATA STRING SAMPLE

LOG DATA SOURCE FILE

SIO_crossbow.c

LOG DATA STRING SOURCE CODE


-------------------------------------------------------------------------
I.2.9: VIS Format for Magnetometer
-------------------------------------------------------------------------

Not implemented.



-------------------------------------------------------------------------
I.2.10: VIS Format for SBE37 CTD Data (from Jon Howland)
-------------------------------------------------------------------------

LOG DATA DESCRIPTION

This String logs data from the Seabird SBE37 Conductivity/
Temperature/Depth instrument

The SBE37 can be purchased with or without a depth sensor, so this
format will accomodate both varieties.

LOG DATA SOURCE

This data string is generated by the SIO_seabird thread of the rov 
program every time a new ctd data message is received.

LOG DATA FREQUENCY
?

LOG DATA FIELDS

1.  "VIS"
2.  Date/time string:  YYYY/MM/DD HH:MM:SS.SS
3.  "SBE37"
4.  vehicle name as entered into the rov configuration file
5.  Conductivity
6.  Temperature
7.  Depth, if available


LOG DATA STRING SAMPLE

LOG DATA SOURCE FILE

SIO_seabird.c

LOG DATA STRING SOURCE CODE


-------------------------------------------------------------------------
I.2.11: VDS Format for Paroscientific Data (from Jon Howland)
-------------------------------------------------------------------------
LOG DATA DESCRIPTION
This string logs data from the Paroscientific depth sensor

Depth is logged as positive down

LOG DATA SOURCE

This data string is generated by the SIO_parosci thread of the rov 
program every time a new paroscientific data message is received.

LOG DATA FREQUENCY

Currently in flux--between 5 and 10 Hz

LOG DATA FIELDS

1.  "VDS"
2.  Date/time string:  YYYY/MM/DD HH:MM:SS.SS
3.  "PAR"
4.  vehicle name as entered into the rov configuration file
5.  Depth in meters



LOG DATA STRING SAMPLE

LOG DATA SOURCE FILE

SIO_parosci.c

LOG DATA STRING SOURCE CODE




----------------------------------------------------------------------
I.2.12: $PWHMAG MAGNETOMETER DATA
----------------------------------------------------------------------

DATA DESCRIPTION:

Vehicle navigation string sent from HOST to DVLNAV, presently via
RS232 and UDP, containing magnetometer data.

DATA SOURCE:
Host (athena)

DATA FREQUENCY:
Several hertz once maggie is energized.

DATA FORMAT:

FORMAT: $PWHMAG,<timestamp>:<X>,<Y>,<Z1>,<Z2>,<Magnitude>,0*<checksum><cr><lf> 

<timestamp>                 YYYY/MM/DD HH:MM:SS.SSS 
<X>                         Magnetic component in gauss.
<Y>                         Magnetic component in gauss.
<Z1>                        Magnetic component in gauss.
<Z2>                        Magnetic component in gauss.
<Magnitude>                 Magnitude gauss.
,0                          Verbatim dummy data
<checksum>                  Two digit hexadecimal checksum

EXAMPLE:





----------------------------------------------------------------------
I.2.13: PNS Platform Navigation String
----------------------------------------------------------------------

DATA DESCRIPTION: 
The PNS platform navigation string contains a X, Y, Depth navigation
fix of the ROV, SHIP, or the DEPRESSOR (medea).  It is sent from an
external navigation source (LBL, USBL, GPS, etc) to dvlnav.

The ROV's LBL position is set with this external data input.

DATA SOURCE:
Host 

DATA FREQUENCY:
Determined by the host


DATA FORMAT:
PNS <DATE AND TIME> <DATA SOURCE> <COORDINATE SYSTEM> <VEHICLE> <X> <Y> <Depth> <Pdop> <Sats>

DATA FIELDS:
1.	"PNS"

2.	Date/time string:  YYYY/MM/DD HH:MM:SS.SSS

3. 	Three letter data source tag indicating the system that generated the
        data contained in this message.  DVLNAV presently logs this
        information but does not use it.  Examples:
               GPS = Global Positioning System
               LBL = Long Baseline Acoustic Navigation

4.      Three character flag indicating coordinate convention 
               UTM = Universal Transverse Mercator
               GLL = Latitude and Longitude in decimal degrees
               NEN = LBL XY coordinates, meters

        Dvlnav uses this field to convert the fix data into its
        internal representation of XY.     

5.      Three character vehicle label.  Presently supported are:
               ROV  = The ROV LBL position
               FSH  = The ROV LBL position
               SHP  = The SHIP's position
               MED  = The depressor weight's posision

6.	Vehicle X East in meters  (UTM and NEN) or decimal degrees longitude (GLL) 
7.	Vehicle Y North in meters (UTM and NEN) or decimal degrees latitude (GLL)
8.	Vehicle Z Depth in meters
9.      GPS Pdop. This field should be zero for non-gos navigation sources.
10.     GPS # Satellites. This field should be zero for non-GPS navigation sources. 
              

EXAMPLE:
GPS fix for the SHIP in Lat/Lon:
PNS 02/07/22 18:02:51.20 WRN GLL SHP  45.828080 -125.130062 20.60  1.1 8

GPS fix for the SHIP in UTM:
PNS 02/07/22 18:02:51.20 GPS UTM SHP 334555.37 5077152.58   20.60  1.1 08

LBL fix for the depressor weight Medea in LBL XY coordinates:
PNS 02/07/22 18:02:12.00 LBL NEN MED 334567.50 5077138.79 1619.31  0.0 0

LBL fix for the ROV in LBL XY coordinates:
PNS 02/07/22 18:02:22.00 LBL NEN ROV 334568.32 5077137.85 1618.46  0.0 00




----------------------------------------------------------------------
I.2.14: PAS Platform Atitude String
----------------------------------------------------------------------

DATA DESCRIPTION: 
The PAS platform navigation string contains a heading, pitch, and roll
fix for the SHIP, or the DEPRESSOR (medea).  It is sent from an
external navigation source (GYRO, Asgtek GPS, etc) to dvlnav.

Note: The ROV's atitude cannot be set with this input.  To set the
ROV's atitude, use one of the gyro or mag compass stings.

DATA SOURCE:
Host 

DATA FREQUENCY:
Determined by the host


DATA FORMAT:
PAS <DATE AND TIME> <VEHICLE> <Heading> <Pitch> <Roll>

DATA FIELDS:
1.	"PAS"

2.	Date/time string:  YYYY/MM/DD HH:MM:SS.SSS

3.      Three character vehicle label.  Presently supported are:
               ROV  = The ROV LBL position
               FSH  = The ROV LBL position
               SHP  = The SHIP's position
               MED  = The depressor weight's posision

6.	Vehicle Heading in Degrees TRUE.
7.	Pitch in Degrees.  +Pitch is bow UP. 
                           -Pitch is bow DOWN.
8.	Roll  in Degrees.  +Roll  is Starboard side DOWN.  
                           -Roll is Starboard side UP.


EXAMPLE:

Example of data from ships gyro with no roll or pitch information:
PAS 02/07/22 18:02:52.84 SHP 352.1   0.0   0.0   
PAS 02/07/22 18:04:05.62 SHP 352.2   0.0   0.0  



----------------------------------------------------------------------
PART I SECTION 3: STRINGS SENT HOST FROM DVLNAV
----------------------------------------------------------------------

----------------------------------------------------------------------
I.3.1: $PWHGYRO OCTANS HEADING AND ATTITUDE STRING sent from dvlnav to host
----------------------------------------------------------------------

This string contains the octans attitude.

FORMAT:
$PWHGYRO,<heading>,<pitch>,<roll>,<age>,<status>*<checksum><cr><lf>

<heading> is the vehicle heading in degrees TRUE.
<pitch>   is the vehicle pitch in degrees.
<roll>    is the vehicle roll in degrees.

See Appendix on attitude conventions.

All angles are reported to a precision of 0.001 degree, with
a leading + or - character.

<age> is the time in seconds since this heading reading was
      received from the octans.  Normally under 0.1 second.
      If the octans is turned off, for example, the time will
      increase.

<status> is an 8-digit hexadecimal octans status word.
      A value of ALL ZEROS indicates normal operation.
      Nonzero values indicate various errors.
      See the OCTANS interface manual for a description
      of the octans $PHINF string, page 6, for a description
      of the bit map of this status word.
      When the octans is first powered up, the status word
      is non-zero for 2-5 minutes while the unit finds north.
 
      If the OCTANS status is persists with a non-zero value
      more than 5-minutes after power-on, with any of the 
      bits bit 0 through bit 5 set, check that you have correctly
      configured DVLNAV with the site origin latitude.  DVLNAV
      sends this latitude to the OCTANS.  If the configured
      latitude is not within a degree or so of the true latitude,
      the octans staus bits will remain set (non-zero) indicating
      the error.
                                      
      Per the the OCTANS interface manual description of the octans
      $PHINF string, page 6, the bit map of this status word is:
      
      Bit 0 Heading not valid         
      Bit 1 Roll not valid
      Bit 2 Pitch not valid
      Bit 3 Position (Heave, surge and sway)
      not valid
      Bit 4 Position calculation starting
      Bit 5 Initialization
      Bit 6 Reserved
      Bit 7 Reserved
      Bit 8 FOG X1 Error
      Bit 9 FOG X2 Error
      Bit 10 FOG X3 Error
      Bit 11 Optical source error
      Bit 12 Accelerometer X1 error
      Bit 13 Accelerometer X2 error
      Bit 14 Accelerometer X3 error
      Bit 15 Analog input A or B error
      Bit 16 Serial input A error
      Bit 17 Serial input B error
      Bit 18 Serial input C error
      Bit 19 FIFO Full
      Bit 20 Serial output A full
      Bit 21 Serial output B full
      Bit 22 Serial output C full
      Bit 23 Manual log used
      Bit 24 Manual latitude used     



<checksum> is the two digit hexadecimal checksum

FREQUENCY:
Two Hertz.

EXAMPLE:
$PWHGYRO,+1.546,-0.038,-0.008,0.030,00000000*4D  

DATA SOURCE FILE:
host.h
host.cpp



----------------------------------------------------------------------
I.3.2: $PWHMAGD DOPPLER HEADING AND ATTITUDE STRING sent from dvlnav to host
----------------------------------------------------------------------

FORMAT:
$PWHMAGD,<true heading>,<pitch>,<roll>,<variation>,<age>,<status>*<checksum><cr><lf>

<true heading> is the vehicle heading in degrees TRUE, computed from
          the doppler's flux-gate compass, corrected for local
          variation.
<pitch>   is the vehicle pitch in degrees.
<roll>    is the vehicle roll in degrees.
<variation>  is the local variation in decimal degrees.
          negative indicates WEST local variation
          positive indicates EAST local variation
          true heading = mag heading  + variation
          mag heading  = true heading - variation

All angles are reported to a precision of 0.001 degree, with
a leading + or - character.

<age> is the time in seconds since this heading reading was
      received from the sensor.  Normally under 0.1 second.
      If the octans is turned off, for example, the time will
      increase.

<status> is a decimal status flag
      0 indicates that this string data is GOOD
      1 indicates that this string data is BAD

<checksum> is the two digit hexadecimal checksum

EXAMPLE:
$PWHMAGD,+0.000,+0.000,+0.000,992278787.134,0.000,0*74  

DATA SOURCE FILE:
host.h
host.cpp



----------------------------------------------------------------------
I.3.3: $PWHLBX LBL NAV STRING sent from dvlnav to host
----------------------------------------------------------------------

FORMAT:
$PWHLBX,<X>,<Y>,<DEPTH>,<lat>,<lon>,<ALT>,<Vertical Velocity>,<TTS>,<TTB>,
        <status>,<method>,<xp1>,<xp2>,<side>,<sound speed>,
        <range A>,<range B>,<range C>,<range D>,
        <range status A>,<range status B>,<range status C>,<range status D>,
        <age>*<checksum><cr><lf>

The floating point fields may contain any number of digits before and
after the decimal point. X and Y will be prefixed with a + or - to indicate sign

<X>         vehicle LBL X coordinate in local XY frame, meters, float.
<Y>         vehicle LBL Y coordinate in local XY frame, meters, float.
<DEPTH>     Vehicle depth using presently selected depth sensor, meters, float.
<lat>       latitude in decimal degrees, +=North, -=Soutn
<lon>       longitude in decimal degrees, +=East, -=West
<ALT>       user-selected  altitude, meters, float. 
<VVel>      Vertical velocity, filtered, in METERS/MINUTE.  +=UP, -=Down 
<TTS>       Time at surface in GMT HH:MM:SS
<TTB>       Time at bottom in GMT HH:MM:SS 
<status>    Status of this LBL fix, integer:
            RANGE_UNKNOWN       = 0  <- bad
            RANGE_GOOD          = 1  <- this means a good fix
            RANGE_OLD           = 2  <- bad
            RANGE_TOO_LONG      = 3  <- bad
            RANGE_TOO_SHORT     = 4  <- bad
            RANGE_FAILED_MEDIAN = 5  <- bad
            RANGE_HIGH_ERROR    = 6  <- bad

<method>    LBL solution method, integer:
            LBL_XPNDR2 = 0  two transponder solution 
                            Alvin normally uses LBL_XPNDR2
            LBL_AUTO   = 1  automatic 2-4 transponder solution

<xp1>       The label (A,B,C,D) of the first transponder of the
            baseline when in two-transponder LBL_XPNDR2 mode. 

<xp2>       The label (A,B,C,D) of the first transponder of the
            baseline when in two-transponder LBL_XPNDR2 mode. 

<side>      Baseline side of this fix, integer:
            CW           = 0        
            CCW          = 1
            ON_BASELINE  = 2
            SIDE_UNKNOWN = 3 

<sound speed> Speed of sound used in this fix, meters/second, float.

<range A>   Range to transponder A, meters, float. 
<range B>   Range to transponder B, meters, float. 
<range C>   Range to transponder C, meters, float. 
<range D>   Range to transponder D, meters, float. 

<range status A>   Range status to transponder A, integer.
<range status B>   Range status to transponder B, integer.
<range status C>   Range status to transponder C, integer.
<range status D>   Range status to transponder D, integer.

                   Range status codes are as follows:
                   RANGE_UNKNOWN       = 0
                   RANGE_GOOD          = 1
                   RANGE_OLD           = 2
                   RANGE_TOO_LONG      = 3
                   RANGE_TOO_SHORT     = 4
                   RANGE_FAILED_MEDIAN = 5
                   RANGE_HIGH_ERROR    = 6


<age> Time in seconds since this fix was computed
      Normally under 0.01 second.

<checksum> is the two digit hexadecimal checksum

EXAMPLE: 

DATA SOURCE FILE:
host.h
host.cpp



----------------------------------------------------------------------
I.3.4: $PWHDOP DOPPLER NAV STRING sent from dvlnav to host
----------------------------------------------------------------------

FORMAT: $PWHDOP,<X>,<Y>,<DEPTH>,<lat>,<lon>,<ALT>,<Vertical Velocity>,
                <TTS>,<TTB>,<method/status>,<bt beams>,<wt beams>,
                <Tfix>,<Treset>,<Xdot>,<Ydot>,<Zdot>,
                <vcog>,<vsog>,<vcow>,<vsow>,<wcog>,<wsog>,<temp>,
                <sos>*<checksum><cr><lf>

The floating point fields may contain any number of digits before and
after the decimal point. X and Y will be prefixed with a + or - to indicate sign

<X>         Vehicle Doppler X coordinate in local XY frame, meters, float.
            This is the position of the Vehicle frame origin, not necessarily the doppler
            instrument, in world coordinates.
<Y>         Vehicle Doppler Y coordinate in local XY frame, meters, float.
            This is the position of the Vehicle frame origin, not necessarily the doppler
            instrument, in world coordinates.
<DEPTH>     Vehicle depth using presently selected depth sensor, meters, float.
<lat>       latitude in decimal degrees, +=North, -=Soutn
<lon>       longitude in decimal degrees, +=East, -=West
<ALT>       Doppler altitude, meters, float. Zero if no lock.
<VVel>      Vertical velocity, filtered, in METERS/MINUTE.  +=UP, -=Down 
<TTS>       Time at surface in GMT HH:MM:SS
<TTB>       Time at bottom in GMT HH:MM:SS 
<method/status>   Method of this Doppler fix, integer:
            NONE (bad)   = 0
            BOTTOM TRACK = 1
            WATER TRACK  = 2

<bt beams>  Number of Bottom Track beams locked on bottom.
            Need minimum of three for good bt fix.
            Integer.

<wt beams>  Number of Water Track beams locked on water column.
            Need minimum of three for good wt fix.
            Integer.

<Tfix>      Time since this fix.

<Treset>    Time since doppler track was reset to LBL, seconds, float.

<Xdot>      Doppler World  X velocity in local XY frame, meters per sec, float.
<Ydot>      Doppler World  Y velocity in local XY frame, meters per sec, float.
<Zdot>      Doppler World  Z velocity in local XY frame, meters per sec, float.
            Note that the above velocities are the velocities of the Doppler
            instrument in world coordiantes, not the vehicle origin velocity.
              
<vcog>      Vehicle course over ground, degrees TRUE, float.
            Only valid if have 3 or 4 bottom track beams.
<scog>      Vehicle speed over ground, METERS/MINUTE, float.
            Only valid if have 3 or 4 bottom track beams.

<vcow>      Vehicle course over water, degrees TRUE, float.
            Only valid if have 3 or 4 water track beams.
<vsow>      Vehicle speed over water, METERS/MINUTE, float.
            Only valid if have 3 or 4 water track beams.

<wcog>      Water column course over ground, degrees TRUE, float.
            This is the water current direction w/respect to earth.
            Only valid if have 3 or 4 water track beams and
                               3 or 4 bottom track beams.
<wsog>      Water column speed over water, METERS/MINUTE, float.
            This is the water current speed w/respect to earth.
            Only valid if have 3 or 4 water track beams and
                               3 or 4 bottom track beams.

<temp>      Temp sensor in DVL, Centigrade
<SOS>       Speed of sound employed in dvl fix computation

<checksum>  is the two digit hexadecimal checksum

EXAMPLE:



DATA SOURCE FILE:
host.h
host.cpp



----------------------------------------------------------------------
I.3.5: $PWHTRB TARGET RANGE AND BEARING STRING sent from dvlnav to host
----------------------------------------------------------------------

The range/bearing function will normally be used with the
the vehicle selected as the ORIGIN, and a numbered Target selected
as the destination.

Targets 0-998 are loaded from the DVLNAV config file, or dropped
interactively during a dive.

Target 0 is the current vehicle position.
target 999 is the current position of the DVLNAV map cursor.

Note that at present the following fields of this string are computed
and transmitted properly:

   1)   Origin target number
   2)   Destination  target number
   3)   Range
   4)   Bearing
   5)   Slant range
   6)   Vertical range
   7)   Origin X, Y, Depth
   8)   Destination X, Y, Depth
   9)   Origin label
   10)  Destination Label

At present the cross-track error, velocities, and time fields (e.g. time
to go) are not computed and are reported as zero. 

FORMAT:  
$PWHTRB,<status>,<origin id>,<destination id>,
       <bearing>,<XYrange>,<XYcross track>,<XYrangevel>,<XYttg>,
       <Zrange>,<Zvel>,<Zttg>,<slant_range>,
       <origin X>,<origin Y>,<origin Depth>,
       <destination X>,<destination Y>,<destination Depth>,
       <origin label lenght>,<origin label>,
       <destination label length>,<destination label>,*<checksum><cr><lf> 

<status>    Status of this range and bearing, integer:
            GOOD = 1
            BAD  = 0

<origin id>        Target NAME or number of origin for range, integer.
                   The vehicle position is Target number 0.
<destination id>   Target NAME or number of destination for range, integer.

<bearing>          Bearing in degrees TRUE from origin to destination, float.
<XYrange>          Horizontal Range in meters from origin to destination, float.
<XYcross track>    Horizontal cross track of vehicle in meters
                   w/respect to line from origin to destination, float.
                   Positive when vehicle is to right of line.
                   Negative when vehicle is to right of line.
<XYrangevel>       Horizontal component of vehicle velocity along line 
                   from origin to destination in m/s,float.
                   Positive for motion from origin toward dest.
                   Negative for motion from dest toward origin.
<XYttg>            Horizontal time to goal in seconds, float. XYrange/XYrangevel.
                   Maximum of 86400 seconds (24 hours).

<Zrange>           Destination depth minus origin depth.
<Zvel>             Vehicle vertical velocity in m/s, float.
<Zttg>             Vertical time to goal in seconds, float. Zrange/Zvel.
<slant_range>      Slant range in meters, float.

<origin X>         Origin X in local XY frame, meters, float.
<origin Y>         Origin Y in local XY frame, meters, float.
<origin Depth>     Origin Depth, meters, float.

<destination X>    Destination X in local XY frame, meters, float.
<destination Y>    Destination Y in local XY frame, meters, float.
<destination Depth> Destination depth, meters, float.

<origin label len>  Number of characters in origin label, integer.
                    Minimum of 1.

<origin label>      ASCII string label for the origin.
                    It is variable length.
                    It will never be zero length.
                    It is delimited by normal NMEA comma characters.
                    It may contain spaces.
                    If the original label is empty (no characters)
                    then the label will read "NO LABEL".
                    If the original label string contains any comma
                    characters they are suppressed and have been
                    converted to space characters.

<destination label len>  Number of characters in destination label.
                    Minimum of 1.
<destination label> ASCII string label for the destination.
                    See <origin label>.


<checksum> is the two digit hexadecimal checksum
 
EXAMPLE: 
$PWHTRB,1,0,2,+44.928,+11.531,+0.000,+0.000,+0.000,-500.833,+0.000,+0.000,+500.966,+1.824,+1.803,+500.833,+9.967,+9.967,+0.000,5,Alvin,12,New Target 1*00<cr><lf>


DATA SOURCE FILE:
host.h
host.cpp



----------------------------------------------------------------------
I.3.6: $PWHTIM TIME STRING sent from DVLNAV to HOST
----------------------------------------------------------------------

See Section I.3.6 for specification.


----------------------------------------------------------------------
I.3.7: VNS VEHICLE NAVIGATION STRING from DVLNAV to HOST
----------------------------------------------------------------------

DATA DESCRIPTION:

Vehicle navigation string sent to HOST, presently via UDP only
to the DSL topside host

This string contains the "best estimate" of vehicle position based on
currently selected DVLNAV navigation method.

LOG DATA SOURCE:
dvlnav

DATA FREQUENCY:
Once every time a new LBL travel time arrives.
and
Once periodically, usually this is once a second.

DATA FORMAT:

VNS <date time> <tag> <tag> <tag> <X> <Y> <DEPTH> <Xvel> <Yvel> <DEPTHvel> <UTM ZONE>
    <fix status>
    <X source> <Y source> <Z source>
    <Xdot source> <Ydot source> <Zdot source>
    <cr><lf>
 

LOG DATA FIELDS:
1.     "VNS"
2.     Date/time string: YYYY/MM/DD HH:MM:SS.SSS
3.     "DVN UTM FSH"

4-6.   Vehicle X,Y, DEPTH Position in UTM coordinates
       Vehicle "best estimate" vehicle position based
       on most recent data and dvlnav operating mode.
       Order is X, Y, DEPTH.
       Units are UTM and depth.
       Float.

7-9.   Vehicle Xvel, Yvel, DepthVel
       Vehicle "best estimate" vehicle velocity based
       on most recent data and dvlnav operating mode.
       order is Xdot, Ydot, Depth_dot 
       Units are meters/second w/respec to UTM axes. 
       Float.

10.    UTM zone
       The UTM zone in which the vehicle is operating.
       Integer.

11.    Fix status - this fix was generated in response to
       0 = 1 hertz timer message
       1 = new lbl or layback nav data
       2 = new dvl data
       Integer.

12-14. Vehicle position source
       Sensor from which the orginal vehicle position data originated
       ASCII STRING.

15-17. Vehicle position source
       Sensor from which the orginal vehicle velocity data originated
       ASCII STRING.


FILE:
dvlnav.cpp

SOURCE CODE:
/* ----------------------------------------------------------------------

   Function for printing standard VNS string to send to topside

   MODIFICATION HISTORY
   DATE         WHO             WHAT
   -----------  --------------  ----------------------------
   09 JUN 2001  Louis Whitcomb  Created and Written

   ---------------------------------------------------------------------- */



int dvlnav_vns_sprintf(dvlnav_t * dvlnav, char * msg, int data_flag)
{
   int dof;
   int msglen = 0;

   char dsl_time_string[256];

   /* read the system clock and print a GMT date/time string */
   rov_sprintf_dsl_time_string(dsl_time_string);

   /* construct the dsl log string header*/
   msglen += sprintf(&msg[msglen],"VNS %s ",dsl_time_string);

   msglen += sprintf(&msg[msglen],"DVN UTM FSH",dsl_time_string);

   // log cooked vehicle 3-dof pos
   for(dof=0; dof<3; dof++)
     msglen += sprintf(&msg[msglen]," %lf", dvlnav->world_vehicle.pos[dof] * rad_to_deg);

   // log cooked vehicle 3-dof vel
   for(dof=0; dof<3; dof++)
     msglen += sprintf(&msg[msglen]," %lf", dvlnav->world_vehicle.vel[dof] * rad_to_deg);
   // utm zone
   msglen += sprintf(&msg[msglen], " %d",dvlnav->cfg_utm_zone );

   // this was generated in response to
   //     0 = 1 hertz timer message
   //     1 = new lbl or layback nav data
   //     2 = new dvl data
   msglen += sprintf(&msg[msglen], " %d",data_flag );

   // pos source names
   for(dof=0; dof<3; dof++)
      msglen += sprintf(&msg[msglen], " pos_src[%s]=%s",
                        DOF_NAME(dof),
                        DATA_SOURCE_NAME(dvlnav->world_vehicle.pos_source[dof]));

   // vel source names
   for(dof=0; dof<3; dof++)
      msglen += sprintf(&msg[msglen], " vel_src[%s]=%s",
                        DOF_NAME(dof),
                        DATA_SOURCE_NAME(dvlnav->world_vehicle.vel_source[dof]));



   msglen += sprintf(&msg[msglen], "\r\n");

   static int first_time = 1;
   if(first_time)
      {
         int fields = 1;
         char * s = msg;

         first_time = 0;

         while( *s != 0)
           {

             // detect fields by transition from space to non-space
             if((*s == ' ') && (*(s+1) != ' '))
                fields++;

             s++;

           }

         stderr_printf("DVLNAV VNS contains %d chars and %d space-delimited fields including the PNS and date/time fields.",
                        strlen(msg),
                        fields
                        );

         stderr_printf("DVLNAV VNS string is: %s",msg);
      }


   return msglen;
}

 
EXAMPLE: 
VNS 2001/06/10 15:23:20.693 DVN UTM FSH 0.977534 -1.797968 496.030000 0.353075 -0.346054 7.463840 43 0 pos_src[DOF_X]=SRC_DOPPLER_BT pos_src[DOF_Y]=SRC_DOPPLER_BT pos_src[DOF_Z]=SRC_HOST vel_src[DOF_X]=SRC_DOPPLER_BT vel_src[DOF_Y]=SRC_DOPPLER_BT vel_src[DOF_Z]=SRC_HOST  
VNS 2001/06/10 15:23:21.695 DVN UTM FSH 1.328729 -2.147685 500.000000 0.352591 -0.348850 0.937656 43 0 pos_src[DOF_X]=SRC_DOPPLER_BT pos_src[DOF_Y]=SRC_DOPPLER_BT pos_src[DOF_Z]=SRC_HOST vel_src[DOF_X]=SRC_DOPPLER_BT vel_src[DOF_Y]=SRC_DOPPLER_BT vel_src[DOF_Z]=SRC_HOST  
VNS 2001/06/10 15:23:22.696 DVN UTM FSH 1.691652 -2.487447 497.791000 0.375240 -0.326993 -3.952618 43 0 pos_src[DOF_X]=SRC_DOPPLER_BT pos_src[DOF_Y]=SRC_DOPPLER_BT pos_src[DOF_Z]=SRC_HOST vel_src[DOF_X]=SRC_DOPPLER_BT vel_src[DOF_Y]=SRC_DOPPLER_BT vel_src[DOF_Z]=SRC_HOST  
VNS 2001/06/10 15:23:23.698 DVN UTM FSH 2.091485 -2.784075 488.531000 0.420471 -0.259949 -9.155001 43 0 pos_src[DOF_X]=SRC_DOPPLER_BT pos_src[DOF_Y]=SRC_DOPPLER_BT pos_src[DOF_Z]=SRC_HOST vel_src[DOF_X]=SRC_DOPPLER_BT vel_src[DOF_Y]=SRC_DOPPLER_BT vel_src[DOF_Z]=SRC_HOST  
VNS 2001/06/10 15:23:24.699 DVN UTM FSH 2.552934 -2.968099 480.617000 0.489219 -0.100897 -9.907730 43 0 pos_src[DOF_X]=SRC_DOPPLER_BT pos_src[DOF_Y]=SRC_DOPPLER_BT pos_src[DOF_Z]=SRC_HOST vel_src[DOF_X]=SRC_DOPPLER_BT vel_src[DOF_Y]=SRC_DOPPLER_BT vel_src[DOF_Z]=SRC_HOST  
VNS 2001/06/10 15:23:25.701 DVN UTM FSH 3.051417 -2.936968 470.924000 0.528391 0.149136 -6.597500 43 0 pos_src[DOF_X]=SRC_DOPPLER_BT pos_src[DOF_Y]=SRC_DOPPLER_BT pos_src[DOF_Z]=SRC_HOST vel_src[DOF_X]=SRC_DOPPLER_BT vel_src[DOF_Y]=SRC_DOPPLER_BT vel_src[DOF_Z]=SRC_HOST  
VNS 2001/06/10 15:23:26.702 DVN UTM FSH 3.495545 -2.712979 468.242000 0.414692 0.278367 -2.177500 43 0 pos_src[DOF_X]=SRC_DOPPLER_BT pos_src[DOF_Y]=SRC_DOPPLER_BT pos_src[DOF_Z]=SRC_HOST vel_src[DOF_X]=SRC_DOPPLER_BT vel_src[DOF_Y]=SRC_DOPPLER_BT vel_src[DOF_Z]=SRC_HOST  
VNS 2001/06/10 15:23:27.703 DVN UTM FSH 3.883430 -2.398588 471.512000 0.370344 0.335211 5.077500 43 0 pos_src[DOF_X]=SRC_DOPPLER_BT pos_src[DOF_Y]=SRC_DOPPLER_BT pos_src[DOF_Z]=SRC_HOST vel_src[DOF_X]=SRC_DOPPLER_BT vel_src[DOF_Y]=SRC_DOPPLER_BT vel_src[DOF_Z]=SRC_HOST  
VNS 2001/06/10 15:23:28.705 DVN UTM FSH 4.242716 -2.051478 477.768000 0.353762 0.353121 8.587501 43 0 pos_src[DOF_X]=SRC_DOPPLER_BT pos_src[DOF_Y]=SRC_DOPPLER_BT pos_src[DOF_Z]=SRC_HOST vel_src[DOF_X]=SRC_DOPPLER_BT vel_src[DOF_Y]=SRC_DOPPLER_BT vel_src[DOF_Z]=SRC_HOST  



----------------------------------------------------------------------
I.3.8: $PWHCFG SITE CONFIGURATION DATA
----------------------------------------------------------------------

DATA DESCRIPTION:

Vehicle navigation string sent from DVLNAV  to HOST, presently via RS232 and
UDP.

This string contains the site data from the DVLNAV ini file

LOG DATA SOURCE:
dvlnav

DATA FREQUENCY:
Once a minute.

DATA FORMAT:

FORMAT: $PWHCFG,<dive number>,<XY Origin Latitude>,<XY Origin Longitude>,<XY Origin UTM X>,<XY Origin UTM Y>,
                <Expected Site Depth>,
                <local magnetic variation>,<salinity>,<temp>,<sound vel>,<utm zone>,<time zone>,
                <host online flag>,<octans online flag>,<doppler online flag>,<logging online flag>,
                <dvlnav version number>*<checksum><cr><lf> 

<dive number>               Vehicle dive number  
<XY Origin Latitude>        Latitude of LBL XY coordinate system ORIGIN in decimal degrees, +=North, -=South from dvlnav ini file. 
<XY Origin Longitude>       Longitude of LBL XY coordinate system  ORIGIN in decimal degrees,  +=East, -=West from dvlnav ini file.
<XY Origin UTM X>           UTM X of LBL coordinate system ORIGIN. 
<XY Origin UTM Y>           UTM Y of LBL coordinate system ORIGIN.
<utm zone>                  UTM zone from dvlnav ini file.
<Expected Site Depth>,      Extected site depth from dvlnav ini file.
<local magnetic variation>  Local magnetic variation from dvlnav (from dvlnav ini file or NOAA tables, 
                            user selectable in dvlnav)
<salinity>                  Salinity from dvlnav (from dvlnav ini file or CTD, user selectable in dvlnav)
<temp>                      Water temperature from Doppler temp sensor, Centigrade.
<sound vel>                 Sound velocity (from dvlnav ini file, SV probe, or CTD, user selectable in dvlnav)
<time zone>                 Time zone from from dvlnav ini file. Hours, +=East, -=West
<dvlnav version number>     Dvlnav program verison number.
<host online flag>          Integer. Status of host (Athena on Alvin).
                            0 if DVLNAV IS receiving data from this device OK.
                            1 if DVLNAV IS NOT receiving data from this device OK.
<octans online flag>        Integer. Status of octans.
                            0 if DVLNAV IS receiving data from this device OK AND the Octans status is good.
                            Nonzero if DVLNAV IS NOT receiving data from this device OR the Octans status is bad.
<doppler online flag>       Integer. Status of doppler.
                            0 if DVLNAV IS receiving data from this device OK.
                            1 if DVLNAV IS NOT receiving data from this device OK.
<logging online flag>       Integer. Status of dvlnav's own logging to disk.
                            0 if logging is ON and working.
                            1 if logging is OFF and not working.
<checksum>  is the two digit hexadecimal checksum

EXAMPLE:
$PWHCFG,1,45.75000000,-125.25000000,324995.435,5068733.378,10,+1680.000,+18.24,35,+2.660,1488.2,-7,160.63,1,1,1,1*12  

DATA SOURCE FILE:
/* ----------------------------------------------------------------------

   generate a $PWHCFG string

   This program copyright (c) 2001 Louis L. Whitcomb

   MODIFICATION HISTORY
   DATE         WHO             WHAT
   -----------  --------------  ----------------------------
   22 APR 2002 Louis Whitcomb  Created and Written


   ---------------------------------------------------------------------- */
int host_make_PWHCFG(void * dptr, char * str)
{
  int i;
  int    len = 0;
  dvlnav_t * dvlnav = ( dvlnav_t *) dptr;

  // create the string to send to the gyro
  len = sprintf(str, "%s",HOST_NMEA_CFG_STRING_HEADER);

  // dive number
  len += sprintf(&str[len],",%g", dvlnav->cfg_dive_number);

  // XY Origin in decimal lat/lon degrees
  len += sprintf(&str[len],",%.8f", dvlnav->cfg_lat * RTOD);
  len += sprintf(&str[len],",%.8f", dvlnav->cfg_lon * RTOD);

  // compute lat/lon from xy
  double x_utm, y_utm;
  xy2utm(0.0,
         0.0, 
	 dvlnav->cfg_utm_zone,
	 dvlnav->cfg_lat,
	 dvlnav->cfg_lon,
	 &x_utm,
	 &y_utm);

  len += sprintf(&str[len],",%.3f", x_utm);
  len += sprintf(&str[len],",%.3f", y_utm);

  // utm zone
  len += sprintf(&str[len],",%d", dvlnav->cfg_utm_zone);

  // site depth from config file
  len += sprintf(&str[len],",%+.3f", dvlnav->cfg_site_depth);

  // local var from config file, in deg
  len += sprintf(&str[len],",%+g", dvlnav->cfg_local_variation * RTOD);

  // salinity
  len += sprintf(&str[len],",%g", dvlnav->cfg_salinity);

  // dvl temp
  len += sprintf(&str[len],",%+.3f", dvlnav->dvl.temp);

  // c
  len += sprintf(&str[len],",%.1f", dvlnav->sv.val);

  // time zone
  len += sprintf(&str[len],",%d", dvlnav->cfg_time_zone);

  // dvlnav version number
  len += sprintf(&str[len],",%.2f", dvlnav->dvlnav_version);

  // status for host, octans, doppler, logging
  // online=1, offline=0
  rov_time_t time_now = rov_get_time();
  len += sprintf(&str[len],",%d", (rov_diff_time( time_now, dvlnav->host.most_recent_string_time[0]) < TMO_HST));
  len += sprintf(&str[len],",%d", (rov_diff_time( time_now, dvlnav->octans.raw_state.pos_time[0]) < TMO_OCT));
  len += sprintf(&str[len],",%d", (rov_diff_time( time_now, dvlnav->dvl.most_recent_string_time) < TMO_DOP));
  len += sprintf(&str[len],",%d", (log_get_log_status(LOG_FID_DSL_FORMAT) &&
                                   log_get_log_status(LOG_FID_CSV_FORMAT)));

  // add the NMEA checksum
  len += sprintf(&str[len],"*%02X\r\n",host_check_sum(&str[1]));

  // store a clean copy of the string
  strcpy(dvlnav->host.most_recent_string[HOST_NMEA_CFG_STRING_INDEX], str);
  octans_clean_string(dvlnav->host.most_recent_string[HOST_NMEA_CFG_STRING_INDEX]);
  dvlnav->host.most_recent_string_status[HOST_NMEA_CFG_STRING_INDEX] = HOST_TX_DATA;

  static int first_time = 1;
  if( first_time )
    {
      first_time = 0;
      host_stderr_analyze_nmea_string(HOST_NMEA_CFG_STRING_HEADER,
				      dvlnav->host.most_recent_string[HOST_NMEA_CFG_STRING_INDEX]);
    }


  // return the string length
  return len;

}




----------------------------------------------------------------------
I.3.9: DVX Doppler navigation string sent from dvlnav to host
----------------------------------------------------------------------

FORMAT:


DVX <date and time string> <X> <Y> <DEPTH> <heading> <pitch> <roll> 
                           <XVel> <Y Vel> <Z Vel> <h dot> <p dot> <r dot> 
                           <U acc> <V acc> <W acc>

The floating point fields may contain any number of digits before and
after the decimal point. X and Y will be prefixed with a + or - to
indicate sign

1.  DVX 
2.  <date and time string> 
3.  <X>         Vehicle Doppler X coordinate in local XY frame, meters, float.
4.  <Y>         Vehicle Doppler Y coordinate in local XY frame, meters, float.
5.  <DEPTH>     Vehicle Doppler Z coordinate in local XY frame, meters, float.
6.  <heading>   Vehicle heading in degrees TRUE.
7.  <pitch>     Vehicle pitch in degrees.
8.  <roll>      Vehicle roll in degrees.
9.  <X Vel>     Vehicle Doppler X velocity local XY frame, meters/sec, float.
10. <Y Vel>     vehicle Doppler Y velocity  local XY frame, meters/sec, float.
11. <Z Vel>     Vehicle Doppler Z velocity in local XY frame, meters/sec, float.
12. <h dot>     Vehicle heading rate in degrees/sec.
13. <p dot>     Vehicle pitch rate in degrees/sec.
14. <r dot>     Vehicle roll rate in degrees/sec.
15. <U acc>     Vehicle U acceleration (X in body coordinates).
16. <V acc>     Vehicle V acceleration (Y in body coordinates).
17. <W acc>     Vehicle W acceleration (Z in body coordinates).


SAMPLE DATA:
DVX 2002/07/22 18:04:06.690 9349.198811 8656.709991 343.118891 179.860000 -8.190000 2.250000 0.000000 0.000000 0.000000 -0.002707 -0.000570 -0.001019 -0.040679 -0.036740 0.013137
DVX 2002/07/22 18:04:06.801 9349.199531 8656.709689 343.118705 179.860000 -8.180000 2.220000 0.000000 0.000000 0.000000 -0.001775 -0.000307 -0.000980 -0.039786 -0.035045 0.013386
DVX 2002/07/22 18:04:06.881 9349.199364 8656.709831 343.118303 179.860000 -8.180000 2.210000 0.000000 0.000000 0.000000 -0.000735 -0.000094 -0.000931 -0.043938 -0.035374 0.007480
DVX 2002/07/22 18:04:07.001 9349.200167 8656.709800 343.118388 179.860000 -8.170000 2.220000 0.000000 0.000000 0.000000 0.000355 0.000209 -0.000773 -0.043109 -0.032657 0.005114

SOURCE CODE:
/* ----------------------------------------------------------------------

   generate DVX string

   This program copyright (c) 2001 Louis L. Whitcomb

   MODIFICATION HISTORY
   DATE         WHO             WHAT
   -----------  --------------  ----------------------------
   18 JUL 2002  Louis Whitcomb  Added host_make_DVX() and TX to host on every DVL ping

   ---------------------------------------------------------------------- */
int host_make_DVX(void * dptr, char * msg)
{
  int    msglen = 0;
  dvlnav_t * dvlnav = ( dvlnav_t *) dptr;

  msglen = sprintf(msg, "DVX ");

  msglen += rov_sprintf_dsl_time_string(&msg[msglen]);

  msglen += sprintf(&msg[msglen], " %f", dvlnav->world_vehicle_dvl.pos[DOF_X]);
  msglen += sprintf(&msg[msglen], " %f", dvlnav->world_vehicle_dvl.pos[DOF_Y]);
  msglen += sprintf(&msg[msglen], " %f", dvlnav->world_vehicle_dvl.pos[DOF_Z]);

  msglen += sprintf(&msg[msglen], " %f", dvlnav->world_vehicle.pos[DOF_HDG]   * RTOD);
  msglen += sprintf(&msg[msglen], " %f", dvlnav->world_vehicle.pos[DOF_PITCH] * RTOD);
  msglen += sprintf(&msg[msglen], " %f", dvlnav->world_vehicle.pos[DOF_ROLL]  * RTOD);

  msglen += sprintf(&msg[msglen], " %f", dvlnav->world_vehicle_dvl.vel[DOF_X]);
  msglen += sprintf(&msg[msglen], " %f", dvlnav->world_vehicle_dvl.vel[DOF_Y]);
  msglen += sprintf(&msg[msglen], " %f", dvlnav->world_vehicle_dvl.vel[DOF_Z]);

  msglen += sprintf(&msg[msglen], " %f", dvlnav->octans.raw_state.vel[DOF_HDG]);
  msglen += sprintf(&msg[msglen], " %f", dvlnav->octans.raw_state.vel[DOF_PITCH]);
  msglen += sprintf(&msg[msglen], " %f", dvlnav->octans.raw_state.vel[DOF_ROLL]);

  msglen += sprintf(&msg[msglen], " %f", dvlnav->octans.raw_state.acc[DOF_X]);
  msglen += sprintf(&msg[msglen], " %f", dvlnav->octans.raw_state.acc[DOF_Y]);
  msglen += sprintf(&msg[msglen], " %f", dvlnav->octans.raw_state.acc[DOF_Z]);

  msglen += sprintf(&msg[msglen], "\r\n");

  // store a clean copy of the string
  strcpy(dvlnav->host.most_recent_string[HOST_DSL_DVX_STRING_INDEX], msg);
  octans_clean_string(dvlnav->host.most_recent_string[HOST_DSL_DVX_STRING_INDEX]);
  dvlnav->host.most_recent_string_status[HOST_DSL_DVX_STRING_INDEX] = HOST_TX_DATA;

  static int first_time = 1;
  if( first_time )
    {
      first_time = 0;
      host_stderr_analyze_nmea_string("DVX",
				      dvlnav->host.most_recent_string[HOST_NMEA_TRB_STRING_INDEX]);
    }

  // return the string length
  return msglen;
}


----------------------------------------------------------------------
PART II: DSL DATA FORMAT LOG FILE LOG STRING SPECIFICATIONS
----------------------------------------------------------------------

----------------------------------------------------------------------
Part II Section 1: OVERVIEW OF DSL DATA FORMAT LOG FILES
----------------------------------------------------------------------

----------------------------------------------------------------------
DATA LOG FILES: 
----------------------------------------------------------------------

DVLNAV logs data locally on its own computer hard disk in ASCII
files in to two files.   All files are logged to the "data" 
subdirectory immediately below the directory in which the DVLNAV
program resides.  If no "data" subdirectory exists, then no
data is logged.  The status of logging is displayed on the
DVLNAV screen.

  1. COMMA-DELIMITED LOG FILES for SPREADSHEET LOADING:

   These files provide a simple comma-delimited ASCII data log of the
vehicle's basic navigation and scientific sensor data.  Data is logged
at one hertz. The ASCII format is designed to be easily imported into
standard spreadsheet programs.  The data column are labeled. 

  The COMMA-DELIMITED LOG FILE data format is documented in Part III
of this document.

  The comma-delimited ASCII log files are intended to provide science
users all of navigation and scientific sensor data most commonly
requested by scientific users, in a format that is easily loaded into
all common spreadsheet programs.  

  This log format is not exhaustive. For example: the vehicle gyro
reports heading ten times each second.  The DSL data format log file
contains comprehensively time-stamped and logs of each and every
heading sensor reading in real-time every 100 milliseconds.  The
comma-delimited format, in contrast, logs a "snapshot" of the entire
vehicle data once a second.

  The comma-delimited ASCII log files have a suffix ".CSV"

  The name of the .CSV  log file encodes the year, month, day, hour,
and minute that the log file was created, as described later in this
Section.

  A new .CSV log file is opened when the DVLNAV program starts.
Thereafter, DVLNAV will write into the same file until midnight GMT.
At midnight GMT, the current .CSV log file is closed and a new log
file is opened.

  Note: DVLNAV versions 140 and lower do not create this
comma-delimeted file.

  2. DSL DATA FORMAT LOGS: One file is standard DSL data format,
documented in this section, which contains a exhaustively
comprehensive log of all of DVLNAV's input, output, and other data.
This file contains time-stamped ASCII records in the formats specified
in this section.  

  The DSL data format is documented in Part II of this document.

  These DSL data format files are intended for use by techno-geek users
who are comfortable with parsing huge data sets with grep and awk, and
in loading and processing large data files, for example in MATLAB.
These files will support the ability (soon) to renavigate a dive with
DVLNAV in renav mode.

  The DSL data format files are far too large and complex to load
directly into a spreadsheet program.  A set of matlab program for
processing, manipulating, and plotting this data is freely available
to all NDSF/UNOLS users from the authors at JHU.

  The DSL data format files have a suffix ".DAT"

  The name of the .DAT  log file encodes the year, month, day, hour,
and minute that the log file was created, as described later in this
Section.

  A new .DAT log file is opened when the DVLNAV program starts.
At the top of every hour, the current log file is closed and
a new log file is opened. 

  Depending on how DVLNAV is configured, it typically logs 60-80MB
of data per hour to the .DAT files.  These data files compress 
well - WINZIP on maximum compression typically achieves 10:1 
compression on the .DAT files.  So about 10 days of Alvin dives
can be compressed onto a single 650MB CD-ROM.


----------------------------------------------------------------------
DATA LOG FILES NAMES: 
----------------------------------------------------------------------

  The name of the .CSV and .DAT log file encoded the year, month, day,
hour, and minute that the log file was opened. For example, the file

  2002_04_26_0112.CSV

  was opened on year 2002, month 4 (April), day 26, at 01:12 GMT.


  Note: DVLNAV versions 140 and lower omit the year from the
file name convention.  Don't worry, however, the year is
encoded directly in the file data itself.



----------------------------------------------------------------------
DSL DATA FORMAT LOG FILE FORMAT: 
----------------------------------------------------------------------

Standard DSL data strings are all logged as ASCII text strings that are
terminated with \n (10 decimal, 0x0A hex ). 

<STRING TYPE> <DATE/TIME RECORD> <DATA SOURCE> <DATA FIELDS> <\n>

where the individual fields are as follows:

<STRING TYPE> 
The first field of every standard DSL data string is the string-type
field - a 3-letter code indicating the TYPE of the data string.  The
types presently in use include:

  CODE  Description
  ----  --------------------------------- 
   PAS  PLATFORM ATTITUDE STATUS - containing vehicle heading, roll, 
        pitch, depth, and altitude data.
   PNS  PLATFORM NAVIGATION STATUS - containing vehicle position data.
   VIS  Vehicle Instrument String (octans, doppler, etc...)
   HST  Raw host data

   PGE  PLATFORM GYRO EVENT - containing gyro events such as 
        pilot initiated resets of gyro to current magnetic heading,
        and gyro power-on events.
   CVS  PLATFORM COMMAND STRING - containing vehicle desired position
        when in closed loop control.
   JTS  JASON THRUSTER STATUS - containing current Jason thruster
        command values.
   JSS  JASON SWITCH STATUS - containing current values of 
        various jason on-board switches such a lights and
        other power controls. 
   IMA  Imagenix scanning sonar
   RLG  Ring laser gyro (first used in April 1998)
  

<DATE/TIME RECORD> 
The second field of every standard DSL data string is a date/time field
that documents the Greenwich time at which the data was logged. 

   YYYY/MM/DD HH:MM:SS.SSS
   1.  YYYY  Year
   2.  MM  Month
   3.  DD  Day
   4.  HH  Hour
   5.  MM  Minute
   6.  SS  Seconds, in decimal notation to 0.001 second resolution


<DATA SOURCE> 
The third field of every standard DSL data string is the 
data source field - indicating that the data is
either sourced or about a particular vehicle.

  CODE  Description
  ----  --------------------------------- 
  FSH   DSL120 or Alvin
  JAS   Data was generated by Jason/Argo   
        Note that ARGO and JASON generate identical
        log strings. Both are referred to as "JAS"
        in the log files.  
  MED   Data was generated for Medea
  IMA   Imagenix scanning sonar
  RLG   Ring laser gyro (first used in April 1998)
  SHP   The surface ship position
  REF   The surface ship reference position
  GPS   The surface ship's position according to GPS
  WRN   The surface ship's position according to the WRN-S Military GPS
  LBL   The LBL navigation system
  HST   Host computer 
  OCT   Octans gyro
  DOP   Doppler


<DATA FIELDS> 
The remaining fields of every standard DSL data string 
contain numerical data delimited by white space.

<\cr> 
The last character of every standard DSL data string is the ASCII
string termination character \n (10 decimal, 0x0A hex). 

NOTE ON MAGNETIC HEADING:
All magnetic headings are logged in degrees of TRUE heading.  

Magnetic headings are corrected to true headings by applying the local
magnetic variation programmed that is programmed into the jason/argo
topside computer.  Sign convention of magnetic variation is
NEG=WEST,POS=EAST.  Raw magnetic heading is converted to true heading
with the formula:

TRUE_HEADING = RAW_HEADING + CURRENT_MAG_VARIATION;

NOTE ON GYRO HEADING:
Gyro heading is logged in degrees true.

NOTE ON ROLL AND PITCH: 
Note that roll and pitch are typically raw uncorrected sensor readings,
they not corrected for the "zero" offset due to the sensors' mounting in
the vehicle frame.  The head data logger will normally check the zero
offset values of these sensors before a deployment by measuring the
actual roll/pitch of the vehicle frame with an electronic protractor,
and noting corresponding the uncorrected sensor readings, and note all
this in the data log book.  These zero offsets are then normally applied
during post-processing. 



----------------------------------------------------------------------
Part II Section 2: PNS format for cooked host data
----------------------------------------------------------------------
LOG DATA DESCRIPTION:
The PNS string is a complete snapshot of host raw and cooked data

LOG DATA SOURCE:
This data string is generated periodically in the DVLNAV system.

LOG DATA FREQUENCY:
Once every time a new LBL travel time arrives.
and
Once periodically, usually this is once a second.

LOG DATA FIELDS:
1.  "PNS"
2.  Date/time string: YYYY/MM/DD HH:MM:SS.SSS
3.  "HST NEN FSH"

4.  "NTT" if the LBL travel times are new
    "OTT" if the LBL travel times are not new, i.e. have been
    previously logged

5.  "GFX" if the LBL fix is new and deemed good
    "BFX" if the LBL fix is deemed not good

    grep for "NFX" if you want only new travel times and
    their associated good or bad fixes
    grep for "NFX" if you want only good fixes
    grep for "NTT GFX" if you want only NEW GOOD fixes.

6-11.  Vehicle Position
       six-vector of vehicle "best estimate" vehicle position based
       on most recent data and dvlnav operating mode.
       order is X, Y, DEPTH, HDG, PITCH, and ROLL
       units are meters with respect to local level frame

12    Vehicle position timestamp
        Time when the PC logged the orginal vehicle position data from the sensor

13    Vehicle position source
        Sensor from which the orginal vehicle position data originated

14    Local xyz origin  (LAT, LON, DEPTH) 
        Origin of the world frame in Lat-Lon coordinates, with depth as
        the vertical measurement
    
15    UTM zone
        The UTM zone in which the vehicle was operating

16-21. Vehicle Velocity
       six-vector of vehicle "best estimate" vehicle velocity based
       on most recent data and dvlnav operating mode.
       order is X, Y, Z, HDG, PITCH, and ROLL
       units are local XY meters/second

22    Vehicle velocity timestamp
        Time when the PC logged the orginal vehicle velocity data from the sensor.

23    Vehicle velocity source
        Sensor from which the orginal vehicle velocity data originated

24-26  Vehicle LBL fix
       order is X, Y, DEPTH
       units are meters with respect to local level frame

27    Vehicle LBL fix timestamp
        Time when the PC logged the orginal LBL fix data from the sensor.

28    Vehicle LBL fix source
        Sensor from which the orginal LBL fix data originated

29-32. Vehicle doppler displacement
       order is X, Y, Z, ERROR with respect to location where
       doppler was powered on
       units are meters with respect to local level axes

33-36. Vehicle doppler velocity
       order is X, Y, Z, ERROR with respect to local level axes
       units are meters/sec

37    Vehicle doppler velocity timestamp
        Time when the PC logged the orginal vehicle doppler velocity data from the sensor.

38    Vehicle doppler velocity source
        Sensor from which the orginal vehicle doppler velocity data originated

39     Vehicle LBL ducer employed in this LBL FIX
       /* For 2-ducer-on vehicle LBL fix: 1 = top/forward ducer, 2 = bottom/aft ducer */

40     LBL Travel-time type: one-way /* 1 = one-way, 2 = two way */

41     LBL Heading computed upon receiving most recent top/forward ducer LBL FIX

42     LBL Heading computed upon receiving most recent bottom/aft ducer LBL FIX

// ------------------------------------------------------------
//  23 August 2003 LLW Complementary filter logging removed
//
//   39-41. Vehicle complementary filter fix
//          order is X, Y, DEPTH
//          units are meters with respect to local level frame
//   
//   42    Vehicle complementary filter fix timestamp
//           Time when the PC logged the orginal complementary filter fix data from the sensor.
// ------------------------------------------------------------

43    Vehicle complementary filter fix source
        Sensor from which the orginal vehicle complementary filter fix data originated

44-46. Vehicle attitude, from the gyro, in degrees.
       order is HEADING, PITCH, ROLL
       Note that this heading is TRUE.

47-49. Vehicle attitude velocity, from the gyro, in degrees/sec.
       order is HEADING, PITCH, ROLL

50    Vehicle attitude timestamp
        Time when the PC logged the orginal vehicle attitude data from the sensor.

51    Vehicle attitude source
        Sensor from which the orginal vehicle attitude data originated

52-54. Vehicle attitude, from the Doppler, in degrees.
       order is HEADING, PITCH, ROLL
       Note that this heading is TRUE, but from a mag compass.
       It has been corrected for local variation.

55.    Local magnetic variation in decimal degrees. -=WEST, +=EAST

56.    Depth from depth sensor 1 in meters.

57.    Depth from depth sensor 2 in meters.

58.    Altitude from altimeter in meters.

59.    Sound velocity from sound vel probe in meters/second.

60.    Temp from temp sensor in C.

61-63. CTD reading from CTD. Order is:
       Conductivity, Temp C, depth meters.

64.    LBL fix status:
       NAV_OFF       = 0
       NAV_GOOD      = 1
       NAV_STALE     = 2
       NAV_TIMED_OUT = 3

65-68. lbl transponder index of the currently selected four transponders
       as an index into the full transponder array as specified in config file

69     Index (0-3) of first transponder on baseline in terms of the four selected transponders
70.    Index (0-3) of second transponder on baseline in terms of the four selected transponders

71.    Index (0-many) of first transponder on baseline in terms of
       configuration file transponder index.
72.    Index (0-many) of second transponder on baseline in terms of
       configuration file transponder index.

73.    Baseline side of fix:
       CW           = 0
       CCW          = 1
       ON_BASELINE  = 2
       SIDE_UNKNOWN = 3

74.    LBL solution method:
       LBL_XPNDR2 = 0
       LBL_AUTO   = 1

75-78. LBL travel times for the four LBL ranges, in seconds.
       Always updated if new LBL travel times have arrived.

79-82: LBL SLANT range for the four LBL ranges, in meters
       Always updated if new LBL travel times have arrived.

83-86: LBL Range Status Flags for the four LBL ranges
       RANGE_UNKNOWN       = 0
       RANGE_GOOD          = 1
       RANGE_OLD           = 2
       RANGE_TOO_LONG      = 3
       RANGE_TOO_SHORT     = 4
       RANGE_FAILED_MEDIAN = 5
       RANGE_HIGH_ERROR    = 6

87-90: XYZ location of transponder 0 (of 0,1,2,3)

91-94: XYZ location of transponder 1 (of 0,1,2,3)

95-98: XYZ location of transponder 2 (of 0,1,2,3)

99-102: XYZ location of transponder 3 (of 0,1,2,3)

// Aug 19 2003 LLW

103.    Sound velocity employed in Doppler processing in decimal meters/sec for most recent Doppler ping processing.

104.    Sound velocity computation method for above sound velocity (integer) for most recent Doppler ping processing.

105.    Sound velocity employed in LBL processing in decimal meters/sec for most recent LBL tt processing.

106.    Sound velocity computation method for above sound velocity (integer) for most recent LBL tt processing.

107-109.  LBL Ducer 1 Pos (Top Ducer) in World Coordinates from most recent LBL fix for this ducer

110-112.  LBL Ducer 2 Pos (Bottom Ducer) in World Coordinates from most recent LBL fix for this ducer


LOG DATA STRING SAMPLE:
PNS 2003/08/19 14:48:24.288 HST NEN FSH NTT BFX 1.407438 -1.065337 998.122491 21.080000 -35.560000 8.270000 1061304504.128 1061304504.128 1061304504.288 1061304504.128 1061304504.128 1061304504.128 24 24 2 31 31 31 -2.1860248881 0.7984881328 0.000 10 0.486836 -0.064292 -0.059609 0.700000 -2.199999 1.100000 1061304504.128 1061304504.128 1061304504.288 1061304504.128 1061304504.128 1061304504.128 24 24 2 31 31 31 -0.583018 -1.087945 -1.954089 0.000000 1.407438 -1.065337 -1001.815279 0.000000 0.000000 0.000000 0.000000 1.234000 1061304504.128000 0.000000 0.000000 0.000000 0.000000 21.080000 -35.780000 8.370000 0.000000 0.000000 0.000000 0.000000 21.069366 -35.781100 8.363423 18.240000 999.596000 997.469000 678.901462 1598.942000 1.240312 31.2016 1.24031 999.596 2 0 1 1 0 0 1 0 1 0 0 15.518300 17.259500 17.259500 15.518300 -1.000000 -1.000000 -1.000000 -1.000000 2 2 2 2 8417.500000 7631.200000 1572.800000 8304.500000 9529.100000 1559.800000 8304.500000 9529.100000 1559.800000 8417.500000 7631.200000 1572.800000 1465.443 36 1465.442 36 0.000 0.000 0.000 0.000 0.000 0.000

PNS 2003/08/19 14:48:20.222 HST NEN FSH NTT BFX 0.672505 6.972192 998.402488 17.450000 -26.340000 4.920000 1061304500.122 1061304500.122 1061304500.222 1061304500.122 1061304500.122 1061304500.122 24 24 2 31 31 31 -2.1860248881 0.7984881328 0.000 10 0.516691 -0.063368 -0.079282 1.100000 -2.299999 0.700000 1061304500.122 1061304500.122 1061304500.222 1061304500.122 1061304500.122 1061304500.122 24 24 2 31 31 31 -0.286422 -0.851421 -2.129565 0.000000 0.672505 6.972192 -1001.542081 0.000000 0.000000 0.000000 0.000000 1.234000 1061304500.122000 0.000000 0.000000 0.000000 0.000000 17.450000 -26.580000 4.990000 0.000000 0.000000 0.000000 0.000000 17.444509 -26.573063 4.982863 18.240000 999.773000 999.396000 679.196989 1592.212000 2.004426 35.0221 2.00443 999.773 2 0 1 1 0 0 1 0 1 0 0 15.520500 17.261400 17.261400 15.520500 -1.000000 -1.000000 -1.000000 -1.000000 2 2 2 2 8417.500000 7631.200000 1572.800000 8304.500000 9529.100000 1559.800000 8304.500000 9529.100000 1559.800000 8417.500000 7631.200000 1572.800000 1465.448 36 1465.447 36 0.000 0.000 0.000 0.000 0.000 0.000


LOG DATA SOURCE FILE:
dvlnav.cpp
dvlnav.h



LOG DATA STRING SOURCE CODE:
/* ----------------------------------------------------------------------

   Function for printing standard DSL log string

   MODIFICATION HISTORY
   DATE         WHO             WHAT
   -----------  --------------  ----------------------------
   01 JUN 2001  Louis Whitcomb  Created and Written
   06 JUN 2001  LLW & JCK       Updated numerous fields
   09 JUN 2001  LLW & JCK       Added timesptamp and data source fields
   19 Aug 2002 LLW  Added SV data and ducer world pos

   ---------------------------------------------------------------------- */

int dvlnav_sprintf_lbl_log_ascii(dvlnav_t * dvlnav, char * msg, int header, int new_tt, int good_fix)
{
  int dof;
  int msglen = 0;

  char dsl_time_string[256];

  if(header != 0)
    {

      /* read the system clock and print a GMT date/time string */
      rov_sprintf_dsl_time_string(dsl_time_string);

      /* construct the ds log string */
      msglen += sprintf(&msg[msglen],"PNS %s",dsl_time_string);
    }

  msglen += sprintf(&msg[msglen],"HST NEN FSH",dsl_time_string);

  msglen += sprintf(&msg[msglen], new_tt ? " NTT" : " OTT");

  msglen += sprintf(&msg[msglen], good_fix ? " GFX" : " BFX");

#define rad_to_deg  ((dof>=DOF_HDG) ? RTOD : 1.0)

  // log cooked vehicle 6-dof pos
  for(dof=0; dof<NUM_DOF; dof++)
    msglen += sprintf(&msg[msglen]," %lf", dvlnav->world_vehicle.pos[dof] * rad_to_deg);

  // added 9 June 2001 LLW & JCK
  // log cooked vehicle 6-dof pos timestamp
  for(dof=0; dof<NUM_DOF; dof++)
    msglen += sprintf(&msg[msglen]," %.3lf", dvlnav->world_vehicle.pos_time[dof]);

  // added 9 June 2001 LLW & JCK
  // log cooked vehicle 6-dof pos source codes
  for(dof=0; dof<NUM_DOF; dof++)
    msglen += sprintf(&msg[msglen]," %d", dvlnav->world_vehicle.pos_source[dof]);

  // added 9 June 2001 LLW & JCK
  // local XYZ origin
  // msglen += sprintf(&msg[msglen], " %.10f",dvlnav->cfg_xyz_origin[DOF_X] );
  // msglen += sprintf(&msg[msglen], " %.10f",dvlnav->cfg_xyz_origin[DOF_Y] );
  // msglen += sprintf(&msg[msglen], " %.3f" ,dvlnav->cfg_xyz_origin[DOF_Z] );
  msglen += sprintf(&msg[msglen], " %.10f",dvlnav->cfg_lon );
  msglen += sprintf(&msg[msglen], " %.10f",dvlnav->cfg_lat );
  msglen += sprintf(&msg[msglen], " %.3f" ,0.0 );

  // added 9 June 2001 LLW & JCK
  // utm zone
  msglen += sprintf(&msg[msglen], " %d",dvlnav->cfg_utm_zone );

  // log cooked vehicle 6-dof vel
  for(dof=0; dof<NUM_DOF; dof++)
    msglen += sprintf(&msg[msglen]," %lf", dvlnav->world_vehicle.vel[dof] * rad_to_deg);

  // added 9 June 2001 LLW & JCK
  // log cooked vehicle 6-dof vel timestamp
  for(dof=0; dof<NUM_DOF; dof++)
    msglen += sprintf(&msg[msglen]," %.3lf", dvlnav->world_vehicle.vel_time[dof]);

  // added 9 June 2001 LLW & JCK
  // log cooked vehicle 6-dof vel source codes
  for(dof=0; dof<NUM_DOF; dof++)
    msglen += sprintf(&msg[msglen]," %d", dvlnav->world_vehicle.vel_source[dof]);

  // log lbl XYZ
  for(dof=0; dof<3; dof++)
    msglen += sprintf(&msg[msglen]," %lf", dvlnav->world_vehicle_lbl.pos[dof]);

  // added 9 June 2001 LLW & JCK
  // log lbl fix time
  msglen += sprintf(&msg[msglen]," %lf", dvlnav->world_vehicle_lbl.pos_time[0]);

  // log dvl XYZ and Error position
  for(dof=0; dof<3; dof++)
    msglen += sprintf(&msg[msglen]," %lf", dvlnav->world_vehicle_dvl.pos[dof]);
  msglen += sprintf(&msg[msglen]," %lf", dvlnav->dvl.bt[3]);

  // log dvl XYZ and Error velocity
  for(dof=0; dof<3; dof++)
    msglen += sprintf(&msg[msglen]," %lf", dvlnav->world_vehicle_dvl.vel[dof]);
  msglen += sprintf(&msg[msglen]," %lf", dvlnav->dvl.btv[3]);

  // added 9 June 2001 LLW & JCK
  // log dvl fix time
  msglen += sprintf(&msg[msglen]," %lf", dvlnav->world_vehicle_dvl.pos_time[0]);

  // log comp filt XYZ
  for(dof=0; dof<3; dof++)
    msglen += sprintf(&msg[msglen]," %lf", dvlnav->world_vehicle_comp_filt.pos[dof]);

  // added 9 June 2001 LLW & JCK
  // log comp filt fix time stamp
  msglen += sprintf(&msg[msglen]," %lf", dvlnav->world_vehicle_comp_filt.pos_time[0]);

  // gyro heading, pitch, roll POSITION
  msglen += sprintf(&msg[msglen]," %lf", dvlnav->world_vehicle_attitude_octans.pos[DOF_HDG] * RTOD);
  msglen += sprintf(&msg[msglen]," %lf", dvlnav->world_vehicle_attitude_octans.pos[DOF_PITCH] * RTOD);
  msglen += sprintf(&msg[msglen]," %lf", dvlnav->world_vehicle_attitude_octans.pos[DOF_ROLL] * RTOD);

  // gyro heading, pitch, roll VELOCITY
  msglen += sprintf(&msg[msglen]," %lf", dvlnav->world_vehicle_attitude_octans.vel[DOF_HDG] * RTOD);
  msglen += sprintf(&msg[msglen]," %lf", dvlnav->world_vehicle_attitude_octans.vel[DOF_PITCH] * RTOD);
  msglen += sprintf(&msg[msglen]," %lf", dvlnav->world_vehicle_attitude_octans.vel[DOF_ROLL] * RTOD);

  // added 9 June 2001 LLW & JCK
  // log octans timestamp
  msglen += sprintf(&msg[msglen]," %lf", dvlnav->world_vehicle_attitude_octans.pos_time[0]);

  // dvl mag heading and attitide
  msglen += sprintf(&msg[msglen]," %lf", dvlnav->world_vehicle_attitude_dvl.pos[DOF_HDG] * RTOD);
  msglen += sprintf(&msg[msglen]," %lf", dvlnav->world_vehicle_attitude_dvl.pos[DOF_PITCH] * RTOD);
  msglen += sprintf(&msg[msglen]," %lf", dvlnav->world_vehicle_attitude_dvl.pos[DOF_ROLL] * RTOD);

  // local mag variation
  msglen += sprintf(&msg[msglen]," %lf", dvlnav->cfg_local_variation * RTOD);

  // depth for paro 1 and 2
  msglen += sprintf(&msg[msglen]," %lf", dvlnav->paro[0].val);
  msglen += sprintf(&msg[msglen]," %lf", dvlnav->paro[1].val);

  // altimeter altitude
  // 28 JUL 2002 JCK log vehicle frame altitude instead of altimeter altitude
  msglen += sprintf(&msg[msglen]," %lf", dvlnav->altitude.val);

  // sound vel
  msglen += sprintf(&msg[msglen]," %lf", dvlnav->sv_sensor.val);

  // temp
  msglen += sprintf(&msg[msglen]," %lf", dvlnav->temp_lo.val);

  // CTD sensor (zero of sensor not present)
  msglen += sprintf(&msg[msglen]," %g",dvlnav->ctd.val);   // conductivity
  msglen += sprintf(&msg[msglen]," %g",dvlnav->ctd.val2);  // temp C
  msglen += sprintf(&msg[msglen]," %g",dvlnav->ctd.val3);  // depth in meters

  // log lbl fix status flag
  msglen += sprintf(&msg[msglen]," %d", dvlnav->lbl_fix.fix_status);

  // log lbl transponder index of the currently selected four transponders
  // as an index into the full transponder array as specified in config file
  for(dof=0; dof<NXP; dof++)
    msglen += sprintf(&msg[msglen]," %d", dvlnav->lbl_xponder_abcd[dof]);

  // log lbl baseline in terms of the four selected transponders
  msglen += sprintf(&msg[msglen]," %d", dvlnav->lbl_fix.baseline.i0);
  msglen += sprintf(&msg[msglen]," %d", dvlnav->lbl_fix.baseline.i1);

  // log lbl baseline  as an index into the full transponder array as specified in config file
  msglen += sprintf(&msg[msglen]," %d", dvlnav->lbl_xponder_abcd[dvlnav->lbl_fix.baseline.i0]);
  msglen += sprintf(&msg[msglen]," %d", dvlnav->lbl_xponder_abcd[dvlnav->lbl_fix.baseline.i1]);

  // log lbl baseline side
  msglen += sprintf(&msg[msglen]," %d", dvlnav->lbl_fix.side);

  // log lbl solution method
  msglen += sprintf(&msg[msglen]," %d", dvlnav->lbl.method);

  // log lbl travel times in sec
  for(dof=0; dof<NXP; dof++)
    msglen += sprintf(&msg[msglen]," %lf", dvlnav->host.tt_secs[dof]);

  // log lbl ranges in meters
  for(dof=0; dof<NXP; dof++)
    msglen += sprintf(&msg[msglen]," %lf", dvlnav->lbl_fix.range[dof]);

  // log lbl range status flags
  for(dof=0; dof<NXP; dof++)
    msglen += sprintf(&msg[msglen]," %d", dvlnav->lbl_fix.good[dof]);

  // log locations of the four currently selected transpondrs
  for(dof=0; dof<NXP; dof++)
    {
      msglen += sprintf(&msg[msglen]," %lf", dvlnav->lbl.xp[dof].x);
      msglen += sprintf(&msg[msglen]," %lf", dvlnav->lbl.xp[dof].y);
      msglen += sprintf(&msg[msglen]," %lf", dvlnav->lbl.xp[dof].z);
    }

  // 19 Aug 2002 LLW  Added SV data and ducer world pos

  // DVL sv
  msglen += sprintf(&msg[msglen]," %.3lf", dvlnav->sv_for_most_recent_dvl_ping.val);

  // DVL sound velocity method
  msglen += sprintf(&msg[msglen]," %d", dvlnav->sv_for_most_recent_dvl_ping.source);

  // LBL sv
  msglen += sprintf(&msg[msglen]," %.3lf", dvlnav->sv_for_most_recent_lbl_fix.val);

  // LBL sound velocity method
  msglen += sprintf(&msg[msglen]," %d", dvlnav->sv_for_most_recent_lbl_fix.source);

  // LBL Ducer 1 Pos
  for(dof=0; dof<3; dof++)
    msglen += sprintf(&msg[msglen]," %.3lf", dvlnav->world_ducer_lbl_1.pos[dof]);

 // LBL Ducer 2 Pos
  for(dof=0; dof<3; dof++)
    msglen += sprintf(&msg[msglen]," %.3lf", dvlnav->world_ducer_lbl_1.pos[dof]);


  static int first_time = 1;
  if(first_time)
    {
      int fields = 1;
      char * s = msg;

      first_time = 0;

      while( *s != 0)
        {

          // detect fields by transition from space to non-space
          if((*s == ' ') && (*(s+1) != ' '))
            fields++;

          s++;

        }

      stderr_printf("DVLNAV PNS contains %d chars and %d space-delimited fields %s including the PNS and date/time fields.",
                    strlen(msg),
                    fields,
                    header ? "---" : "NOT"
                    );

      stderr_printf("DVLNAV PNS data is: %s",msg);
    }


  return msglen;
}




----------------------------------------------------------------------
Part II Section 3: VIS format for cooked octans gyro data
----------------------------------------------------------------------

LOG DATA DESCRIPTION:
This VIS string logs data from the octans fiber optic gyro.

Attitude conventions are per usual naval architecture conventions
for heading, roll, and pitch.

All values are for INSTRUMENT position, velocity, and acceleration, as
reported by the octans with no modification. These values and may
require transformation to compute corresponding quantities for VEHICLE
frame. 

Octans instrument accelerations are absolute, in local level coordinates
coordinates. 

Octans instrument rotational positions and velocities are absolute, in
local level coordinates.

Octans translational positions and velocities are NOT ABSOLUTE AND
SHOULD NOT BE USED UNLESS YOU KNOW WHAT TO DO WITH THEM.  They are
the low-passed output of accelerations, integrated in local level
earth coordinates.

Gyro heading is always TRUE north. 

Vehicle frame is +X forward, +Y starboard, +Z down in vehicle frame.

Latitude/Longitude are in decimal degrees, +=NORTH/EAST, -=SOUTH/WEST

Local level XYZ frame is +X east, +Y north, +Z up

LOG DATA SOURCE:

This data string is generated by the dvlnav program every time a new
ensemble of heading strings arrives from the octans.  

In the case that octans data is being received simultaneously on TWO
serial ports simultaneously, this string gets logged each time an OCTANS
STATUS information string is received.


LOG DATA FREQUENCY:
10 Hz.

We normally program DSL octans is normally programmed for 10HZ output.

LOG DATA FIELDS:
1.  "VIS"
2.  Date/time string: YYYY/MM/DD HH:MM:SS.SSS
3.  "OCT1 FSH" for the DSL120 and Alvin or
    "OCT1 JAS" for Jason or
    "OCT1 ARG" for Argo

4.  octans X postion in meters
5.  octans Y position in meters
6.  octans Z position in meters
7.  octans HEADING position in degrees
8.  octans PITCH position in degrees
9.  octans ROLL position in degrees

10. octans X velocity in meters/second
11. octans Y velocity in meters/second
12. octans Z velocity in meters/second
13. octans HEADING velocity in degrees/second
14. octans PITCH velocity in degrees/second
15. octans ROLL velocity in degrees/second

16. octans X acceleration in meters/(second^2)
17. octans Y acceleration in meters/(second^2)
18. octans Z acceleration in meters/(second^2)
19. octans HEADING acceleration in degrees/(second^2)
20. octans PITCH acceleration in degrees/(second^2)
21. octans ROLL acceleration in degrees/(second^2)

22. octans position dvlnav scalar timestamp (absolute seconds)
    when the last valid octans position data was receive
23. octans velocity dvlnav scalar timestamp (absolute seconds)
    when the last valid  octans velocity data was received
24. octans acceleration dvlnav scalar timestamp (absolute seconds)
    when the last valid  octans acceleration data was received

25. Latitude commanded to the octans from dvlnav, in decimal degrees
    convention is +=NORTH, -=South
26. Latitude reported from the octans to dvlnav, in decimal degrees
    convention is +=NORTH, -=South

27. Speed commanded to the octans from dvlnav, in meters/sec.
28. Speed reported from the octans to dvlnav, in meters/sec.

29. Octans protocol (an integer), convention TBA

30. Octans status, an unsigned 32 bit integer whose bits
    indicate octans internal status, see octans manual for decoding.
    Value of zero indicates no error, nonzero indicates error.

31. Time stamp (absolute seconds) of most recent octans string,
    even if the string were corrupted.

32. Delta time (seconds) between two most recent octans strings.

33. Parse status of most recent string (integer). Zero is no error.

    Error codes are defined in file octans.cpp as folows:

    OCTANS_STRING_OK                  0
    OCTANS_STRING_ERROR_BAD_FORMAT    1
    OCTANS_STRING_ERROR_CHECKSUM      2
    OCTANS_STRING_ERROR_BAD_PARSE     3
    OCTANS_STRING_UNKNOWN_STRING_TYPE 4
    OCTANS_STRING_NO_DATA_RECIEVED    5

   // Added 09 June 2001 LLW & JCK
34. DVLNAV timestamp of this octans data packet.

LOG DATA STRING SAMPLE:
VIS 2001/06/10 10:30:30.016 OCT1 FSH 0.014000 0.008000 0.004000 0.000000 0.000000 0.000000 -0.000000 -0.000000 -0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 992183429.996000 992183430.006000 0.000000 0.000000 2349.031467 0.000000 0.000000 0 0 992183430.016000 0.010000 0 992183430.016000
VIS 2001/06/10 10:30:30.066 OCT1 FSH 0.014000 0.008000 0.004000 76.520000 -1.970000 -0.350000 -0.000000 -0.000000 -0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 992183430.026000 992183430.066000 0.000000 0.000000 2349.031467 0.000000 0.000000 0 0 992183430.066000 0.000000 0 992183430.066000
VIS 2001/06/10 10:30:30.096 OCT1 FSH 0.014000 0.008000 0.004000 76.520000 -1.970000 -0.350000 -0.000000 -0.000000 -0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 992183430.086000 992183430.086000 0.000000 0.000000 2349.031467 0.000000 0.000000 0 0 992183430.096000 0.000000 0 992183430.096000
VIS 2001/06/10 10:30:30.106 OCT1 FSH 0.014000 0.008000 0.004000 76.520000 -1.970000 -0.350000 -0.000000 -0.000000 -0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 992183430.106000 992183430.106000 0.000000 0.000000 2349.031467 0.000000 0.000000 0 0 992183430.106000 0.000000 0 992183430.106000
VIS 2001/06/10 10:30:30.136 OCT1 FSH 0.014000 0.008000 0.004000 76.520000 -1.970000 -0.350000 -0.000000 -0.000000 -0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 992183430.126000 992183430.126000 0.000000 0.000000 2349.031467 0.000000 0.000000 0 0 992183430.136000 0.000000 0 992183430.136000
VIS 2001/06/10 10:30:30.247 OCT1 FSH 0.014000 0.008000 0.004000 76.520000 -1.970000 -0.350000 -0.000000 -0.000000 -0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 992183430.226000 992183430.237000 0.000000 0.000000 2349.031467 0.000000 0.000000 0 0 992183430.247000 0.010000 0 992183430.247000
VIS 2001/06/10 10:30:30.347 OCT1 FSH 0.014000 0.008000 0.004000 76.510000 -1.970000 -0.350000 -0.000000 -0.000000 -0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 992183430.337000 992183430.337000 0.000000 0.000000 2349.031467 0.000000 0.000000 0 0 992183430.347000 0.010000 0 992183430.347000
VIS 2001/06/10 10:30:30.447 OCT1 FSH 0.014000 0.008000 0.004000 76.510000 -1.970000 -0.350000 -0.000000 -0.000000 -0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 992183430.437000 992183430.437000 0.000000 0.000000 2349.031467 0.000000 0.000000 0 0 992183430.447000 0.000000 0 992183430.447000
VIS 2001/06/10 10:30:30.557 OCT1 FSH 0.013000 0.007000 0.004000 76.510000 -1.970000 -0.350000 -0.000000 -0.000000 -0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 992183430.537000 992183430.547000 0.000000 0.000000 2349.031467 0.000000 0.000000 0 0 992183430.557000 0.010000 0 992183430.557000
VIS 2001/06/10 10:30:30.657 OCT1 FSH 0.013000 0.007000 0.004000 76.520000 -1.970000 -0.350000 -0.000000 -0.000000 -0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 992183430.637000 992183430.647000 0.000000 0.000000 2349.031467 0.000000 0.000000 0 0 992183430.657000 0.010000 0 992183430.657000
VIS 2001/06/10 10:30:30.757 OCT1 FSH 0.013000 0.007000 0.004000 76.520000 -1.970000 -0.350000 -0.000000 -0.000000 -0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 992183430.747000 992183430.747000 0.000000 41.000000 2349.031467 0.000000 0.000000 0 0 992183430.757000 0.000000 0 992183430.757000

LOG DATA SOURCE FILE:
octans.cpp
octans.h

LOG DATA STRING SOURCE CODE:


/* ----------------------------------------------------------------------

   Function for printing standard DSL log string

   MODIFICATION HISTORY
   DATE         WHO             WHAT
   -----------  --------------  ----------------------------
   22 APR 2001  Louis Whitcomb  Created and Written
   09 JUN 2001  Louis Whitcomb  Added octans data timestamp as last field

   ---------------------------------------------------------------------- */

int octans_log_ascii_sprintf(char * msg, octans_t * octans, int header)
{
   int dof;
   int msglen = 0;

   char dsl_time_string[256];

   if(header != 0)
   {

     /* read the system clock and print a GMT date/time string */
     rov_sprintf_dsl_time_string(dsl_time_string);

     /* construct the ds log string */
     msglen += sprintf(&msg[msglen],"VIS %s ",dsl_time_string);
   }

   msglen += sprintf(&msg[msglen],"OCT1 FSH",dsl_time_string);

   #define rad_to_deg  ((dof>=DOF_HDG) ? RTOD : 1.0)

   for(dof=0; dof<NUM_DOF; dof++)
     msglen += sprintf(&msg[msglen]," %lf", octans->raw_state.pos[dof] * rad_to_deg);

   for(dof=0; dof<NUM_DOF; dof++)
     msglen += sprintf(&msg[msglen]," %lf", octans->raw_state.vel[dof] * rad_to_deg);

   for(dof=0; dof<NUM_DOF; dof++)
     msglen += sprintf(&msg[msglen]," %lf", octans->raw_state.acc[dof] * rad_to_deg);

   msglen += sprintf(&msg[msglen]," %lf", octans->raw_state.pos_time[DOF_X]);

   msglen += sprintf(&msg[msglen]," %lf", octans->raw_state.vel_time[DOF_X]);

   msglen += sprintf(&msg[msglen]," %lf", octans->raw_state.acc_time[DOF_X]);

   msglen += sprintf(&msg[msglen]," %lf", octans->cmd_lat * RTOD);

   msglen += sprintf(&msg[msglen]," %lf", octans->lat * RTOD);

   msglen += sprintf(&msg[msglen]," %lf", octans->cmd_speed);

   msglen += sprintf(&msg[msglen]," %lf", octans->speed);

   msglen += sprintf(&msg[msglen]," %d", octans->octans_protocol);

   msglen += sprintf(&msg[msglen]," %d", octans->octans_status);

   msglen += sprintf(&msg[msglen]," %lf", octans->most_recent_string_time);

   msglen += sprintf(&msg[msglen]," %lf", octans->most_recent_string_delta_time);

   msglen += sprintf(&msg[msglen]," %d", octans->most_recent_string_status[0]);

   // Added 09 June 2001 LLW & JCK
   msglen += sprintf(&msg[msglen]," %lf", octans->most_recent_string_time);


   // ------------------------------------------------------------
   // print out newsy stuff to stderr on first time
   // ------------------------------------------------------------
   static int first_time = 1;
   if(first_time)
      {
         int fields = 1;
         char * s = msg;

         first_time = 0;

         while( *s != 0)
           {

             // detect fields by transition from space to non-space
             if((*s == ' ') && (*(s+1) != ' '))
                fields++;

             s++;

           }

         stderr_printf("OCTANS VIS contains %d space-delimited fields %s including the VIS and date/time fields.",
                        fields,
                        header ? "---" : "NOT"
                        );

         stderr_printf("OCTANS VIS data is: %s",msg);
      }



   return msglen;
}





----------------------------------------------------------------------
Part II Section 4.1: OCT format for raw octans ASCII strings
----------------------------------------------------------------------

LOG DATA DESCRIPTION:
This string logs the raw ascii NMEA strings verbatim as they are
received from the OCTANS gyro.

LOG DATA SOURCE:
Octans gyro.

LOG DATA FREQUENCY: 

LOG DATA FORMAT:
OCT <DATE AND TIME> <NMEA string received from octans>

LOG DATA FIELDS:
1.  "OCT"
2.  Date/time string: YYYY/MM/DD HH:MM:SS.SSS
3.  Octans NMEA string.


LOG DATA STRING SAMPLE:
OCT 2002/07/22 18:04:06.680 $HEHDT,179.86,T*1E  
OCT 2002/07/22 18:04:06.680 $PHTRO,8.19,P,2.23,T*56  
OCT 2002/07/22 18:04:06.791 $HEHDT,179.86,T*1E  
OCT 2002/07/22 18:04:06.791 $PHCMP,4544.80,N,0.00,N*7F  
OCT 2002/07/22 18:04:06.791 $PHINF,00000000*75  
OCT 2002/07/22 18:04:06.791 $PHLIN,-0.027,0.023,0.001*79  
OCT 2002/07/22 18:04:06.791 $PHSPD,0.003,0.004,-0.002*75  
OCT 2002/07/22 18:04:06.801 $PHCMP,4544.80,N,0.00,N*7F  
OCT 2002/07/22 18:04:06.801 $PHINF,00000000*75  
OCT 2002/07/22 18:04:06.801 $PHLIN,-0.027,0.023,0.001*79  
OCT 2002/07/22 18:04:06.801 $PHSPD,0.003,0.004,-0.002*75  
OCT 2002/07/22 18:04:06.801 $PHTRO,8.18,P,2.22,T*56  
OCT
OCT 2002/07/22 18:04:06.831 $HEHDT,179.86,T*1E  
OCT 2002/07/22 18:04:06.831 $PHTRO,8.18,P,2.21,T*55  
OCT 2002/07/22 18:04:06.841 $PHLIN,-0.027,0.024,0.000*7F  
OCT 2002/07/22 18:04:06.851 $PHSPD,0.002,0.004,-0.001*77  
OCT 2002/07/22 18:04:06.861 $PHCMP,4544.80,N,0.00,N*7F  
OCT 2002/07/22 18:04:06.861 $PHINF,00000000*75  
OCT 2002/07/22 18:04:06.921 $HEHDT,179.86,T*1E  
OCT 2002/07/22 18:04:06.931 $PHTRO,8.17,P,2.22,T*59  
OCT 2002/07/22 18:04:06.941 $PHLIN,-0.026,0.024,0.000*7E  
OCT 2002/07/22 18:04:06.951 $PHSPD,0.002,0.003,-0.000*71  
OCT 2002/07/22 18:04:06.961 $PHCMP,4544.80,N,0.00,N*7F  
OCT 2002/07/22 18:04:06.961 $PHINF,00000000*75  
OCT 2002/07/22 18:04:07.021 $HEHDT,179.86,T*1E  
OCT 2002/07/22 18:04:07.031 $PHTRO,8.17,P,2.22,T*59  

----------------------------------------------------------------------
Part II Section 4.2: OCB format for raw octans BINARY strings
----------------------------------------------------------------------

LOG DATA DESCRIPTION:
This string logs the raw binary IFREMER format strings verbatim as they 
are received from the OCTANS gyro via a binary serial line.
The binary data is HEX encoded.
This is normally used only on J2 and the JHUROV.

LOG DATA SOURCE:
Octans gyro.

LOG DATA FREQUENCY: 

LOG DATA FORMAT:
OCT <DATE AND TIME> <BINARY string received from octans, hex encoded>

LOG DATA FIELDS:
1.  "OCT"
2.  Date/time string: YYYY/MM/DD HH:MM:SS.SSS
3.  BINARY string received from octans, hex encoded.

LOG DATA STRING SAMPLE:
OCB 2002/07/22 18:04:06.680 51290C3D1FC5033E1271394048E9E4BA8583ABBA156B2EBB316ECD3C573AF3BD167C51BD269F1500000000EC
OCB 2002/07/22 18:04:06.791 51290C3D1F00443E1257E34048EA64BA806560B9A0E740BAE8B6013C5B4FF6BD0F8B6BBD22F6B20000000083
OCB 2002/07/22 18:04:06.831 51290C3D1EABDC3E123F9A4048EA88BA740270B8C47CF3BA40C2723BF51E07BD10E42FBD33F7DD000000003D
OCB 2002/07/22 18:04:06.931 51290C3D1ECE713E122B1F4048EA29BA4AB0EB395AD5A039BA61213BA7964ABD05C2FABD30937E00000000AF
OCB 2002/07/22 18:04:07.031 51290C3D1F648C3E1216D04048E9A3BA485662399ECB473ABD36463BB52DA1BD0F2837BD32773700000000B8



----------------------------------------------------------------------
Part II Section 5: VIS format for cooked doppler data
----------------------------------------------------------------------

LOG DATA DESCRIPTION:
The VIS string logs for raw doppler data

LOG DATA SOURCE:
This data string is generated by DVLNAV every time a valid doppler data
packet arrives 

LOG DATA FREQUENCY: 
Once each doppler ping.  Ping frequency is up to 10 hertz at low
with a 1200 KHZ dvl, 1-2 hertz at high (175m) with a 300KHZ dvl.

Note 1: The DVL can be configured to report in beam coordinates,
        ship coordinates, instrument coordinates, and earth coordinates.

        DVLNAV expects and requires that the DVL be configured
        to report velocities in INSTRUMENT COORDINATES.
        In this configuration, the DVL's reported bottom   
        track displacements are not meaningful.
        Bottom track displacement must be computed by
        first rotating instrument velocities into world
        coordinates and then integrating.

        See RDI publication "ADCP Coordinate Transformations" for 
        a detailed explanation.

Note 2: The DVL beam range is not the true range, it is the
        range multiplied by cos(30 degrees), i.e. it has been
        converted to a sort of "altitude"  

        The Altitude field is the average of the good beam ranges.

Note 3: DVLNAV expects and requires that the DVL be configured
        with no internal local variation or heading offset.

        In this case:
        The heading is the magnetic heading of beam 3.   
        The pitch, Tilt 1, is pendulum pitch, not naval architecture pitch.
        To convert dvl Tilt 1 pitch to naval architecture pitch.
        Naval Arch Pitch = arctan[tan(Tilt1)*cos(Tilt2)].       
        The roll, Tilt 2, is naval architecture roll.

        See RDI publication "ADCP Coordinate Transformations" for 
        a detailed explanation.

Note 4: Bottom track course over ground and speed over may not be
        computed correctly when the DVL is configured in
        INSTRUMENT coordinates, to compute them the instrument
        velocities should be converted to earth coordinates, then
        computed form the horizontal velocities. 


LOG DATA FIELDS:
1.  "VIS"
2.  Date/time string: YYYY/MM/DD HH:MM:SS.SSS
3.  "RDI1 FSH" for Alvin and the DSL120
    "RDI1 JAS" for Jason
    "RDI1 ARG" for Argo 

4.  bottom track X displacement  - see Note 1
5.  bottom track Y displacement
6.  bottom track Z displacement
7.  bottom track ERROR displacement

8.  bottom track X velocity  - see Note 1
9.  bottom track Y velocity
10. bottom track Z velocity
11. bottom track ERROR velocity

12. bottom track ping status integer whose bits indicate bottom
    track beam status. All zeros means no errors.
    Bits as follows per RDI manual Appendix page D-24:

    Bit 0 (lsb) Beam 1 Low Correlation
    Bit 1       Beam 1 Low Amplitude
    Bit 2       Beam 2 Low Correlation
    Bit 3       Beam 2 Low Amplitude
    Bit 4       Beam 3 Low Correlation
    Bit 5       Beam 3 Low Amplitude
    Bit 6       Beam 4 Low Correlation
    Bit 7 (msb) Beam 4 Low Amplitude


13. water track X displacement  - see Note 1
14. water track Y displacement
15. water track Z displacement
16. water track ERROR displacement

17. water track X velocity  - see Note 1
18. water track Y velocity
19. water track Z velocity
20. water track ERROR velocity

21. water track ping status integer whose bits indicate water
    track beam status. All zeros means no errors.
    Bits as follows per RDI manual Appendix page D-24:

    Bit 0 (lsb) Beam 1 Low Correlation
    Bit 1       Beam 1 Low Amplitude
    Bit 2       Beam 2 Low Correlation
    Bit 3       Beam 2 Low Amplitude
    Bit 4       Beam 3 Low Correlation
    Bit 5       Beam 3 Low Amplitude
    Bit 6       Beam 4 Low Correlation
    Bit 7 (msb) Beam 4 Low Amplitude


22. Beam 1 range in meters - see note 2.
23. Beam 2 range in meters 
24. Beam 3 range in meters 
25. Beam 4 range in meters 
26. Altitude in meters - average altitude of good beams.

27. Magnetic Heading of DVL instrument in degrees - see Note 3
28. Tilt 1, Pendulum Pitch of DVL instrument in degrees - see Note 3
29. Tilt 2, Pendulum Roll of DVL instrument in degrees - see Note 3

30. Sound Velocity reported by DVL in meters/second.
    This is sound velocity the DVL used for this ping.
31. Salinity reported by DVL in parts per thousand.
32. Temperature reported by DVL in Centigrade.
    This is temp sensor value from the dvl.
33. Depth reported by DVL in meters.
    This is depth reported by the DVL.

34. Total integer count since DVLNAV program start of bad BOTTOM pings - i.e. 
    pings having 0, 1, or 2 good beams.  
    Timebase is PC clock.
35. Total integer count since DVLNAV program start of good 3-beam bottom pings. 
36. Total integer count since DVLNAV program start of good 4-beam bottom pings.
37. Integer number (0,1,2,3,4) of good bottom track beams in this ping.
38. Time in seconds since PREVIOUS good bottom track ping,
    i.e. the time between the last GOOD ping and this ping.
    This ping could be bad or good.
    Timebase is PC clock.
39. Bottom track course over ground in degrees. - See note 4.
40. Bottom track speed over ground in m/s.

41. Total integer count since DVLNAV program start of bad WATER pings - i.e. 
    pings having 0, 1, or 2 good beams.  
    Timebase is PC clock.
42. Total integer count since DVLNAV program start of good 3-beam water pings.
43. Total integer count since DVLNAV program start of good 4-beam water pings.
44. Integer number (0,1,2,3,4) of good water track beams in this ping.
45. Time in seconds since PREVIOUS good water track ping,
    i.e. the time between the last GOOD ping and this ping.
    This ping could be bad or good.
    Timebase is PC clock.
46. Water track course over ground in degrees. - See note 4. 
47. Water track speed over ground in m/s.

48. DVL configuration integer code - see DVL manual for details.
    BIT 76543210
        00xxxxxx BEAM-COORDINATE VELOCITIES
        01xxxxxx INSTRUMENT-COORDINATE VELOCITIES
        10xxxxxx SHIP-COORDINATE VELOCITIES
        11xxxxxx EARTH-COORDINATE VELOCITIES
        xx0xxxxx TILT INFORMATION NOT USED IN CALCULATIONS
        xx1xxxxx TILT INFORMATION USED IN CALCULATIONS
        xxx0xxxx 3-BEAM SOLUTIONS NOT COMPUTED
        xxx1xxxx 3-BEAM SOLUTIONS COMPUTED
        xxxxx010 300-kHz DVL
        xxxxx011 600-kHz DVL
        xxxxx100 1200-kHz DVL

49. DVL BIT integer code - see DVL manual for details.
    Results These fields contain the results of the ADCP's 
    Built-in Test function. A zero code indi-cates a successful 
    BIT result.

    BYTE 40 BYTE 41 (BYTE 41 RESERVED FOR FUTURE USE)
    1xxxxxxx xxxxxxxx = RESERVED
    x1xxxxxx xxxxxxxx = RESERVED
    xx1xxxxx xxxxxxxx = RESERVED
    xxx1xxxx xxxxxxxx = DEMOD 1 ERROR
    xxxx1xxx xxxxxxxx = DEMOD 0 ERROR
    xxxxx1xx xxxxxxxx = RESERVED
    xxxxxx1x xxxxxxxx = DSP ERROR
    xxxxxxx1 xxxxxxxx = RESERVED

50. DVL water layer near threshhold - see DVL manual for details.
51. DVL water layer far threshold - see DVL manual for details.
52. Integer number of valid ping data records received by dvlnav.
    This indicates the number of valid dvl data packets parsed with no error,
    it does not indicate that the pings were bad or good, just
    that the data was received with no telemetry errors. 
53. Integer number of INVALID data records received by dvlnav.
    This indicates the number of corrupted dvl data packets not parsed
    successfully - i.e. the checksums did not match.
54. Time in seconds between the PREVIOUS valid data packet and this
    data packet.
    Either or both pings could be bad or good.
    Timebase is PC clock.
55. Time in seconds between two most recent ping records.
    Timebase is DVL internal clock which is not synced to PC clock.
56. Seconds since midnight of internal DVL clock
    Timebase is DVL internal clock which is not synced to PC clock.

57. DVLNAV timestamp (scalar seconds) of this ping data.

// Added 9 June 2001 LLW & JCK
58-60. Vehicle attitude based on cooked OCTANDS attitude and INI file offsets
       order is heading, pitch, roll, float.
61-63. Most recent octans attitude vel in deg/sec,
       order is heading, pitch, roll, float.
64.    Octans data timestamp, float.               

// Added 9 June 2001 LLW & JCK
65-67. Vehicle attitude based on cooked XBOW attitude, INI file offsets, and local variation, pos in deg,  
       order is heading, pitch, roll, float. 
68-70. Vehicle attitude velocity based on cooked XBOW attitude, INI file offsets, and local variation, in deg/sec, 
       order is heading_dot, pitch_dot, roll_dot, float. 
71.    crossbow vehicle attitude data timestamp, float.               

// Added 19 Aug 2001 LLW & JCK
72-74. Vehicle attitude based on cooked DVL attitude, INI file offsets, and local variation, pos in deg,  
       order is heading, pitch, roll, float. 
75.    doppler vehicle attitude data timestamp, float.               


// Added 19 Aug 2003 LLW & JCK
76.    Sound velocity employed in Doppler processing in decimal meters/sec.

77.    Sound velocity computation method for above sound velocity (integer).

78-83. Vehicle frame position based on Doppler displacement, in world coordinates: XYZHPR
       Note: this is XYZ, with +Z is UP, not X Y Depth.
 

LOG DATA STRING SAMPLE:
VIS 2003/08/21 10:27:36.217 RDI1 FSH 0.000 0.000 0.000 0.000 0.717 -0.730 0.006 1.234 0 0.000 0.000 0.000 0.000 -0.717 0.730 0.006 0.000 0 6.10 5.90 6.20 5.80 6 27.26 0.34 0.17 1500 35 0.01 994 0 0 17 4 0.000 135.515 1.02322 0 0 17 4 0.000 -44.4853 1.02322 83 0 0.00 10.00 17 0 0.100 0.100 70056.210 1061494056.217 0.509117 0.360623 -0.120212 0 0 0 1061494056.217 0 0 0 0 0 0 0.000 0.499117 0.360622 -0.12021 1061494056.217 1465.374 36 1.960 -1.355 -994.014 0.000 0.000 0.000
VIS 2003/08/21 10:27:36.317 RDI1 FSH 0.000 0.000 0.000 0.000 0.716 -0.730 0.006 1.234 0 0.000 0.000 0.000 0.000 -0.716 0.730 0.006 0.000 0 6.10 5.90 6.20 5.80 6 27.3 0.36 0.18 1500 35 0.01 994 0 0 18 4 0.000 135.555 1.02252 0 0 18 4 0.000 -44.4453 1.02252 83 0 0.00 10.00 18 0 0.100 0.100 70056.310 1061494056.317 0.53901 0.381836 -0.127283 0 0 0 1061494056.317 0 0 0 0 0 0 0.000 0.53901 0.381835 -0.127282 1061494056.317 1465.374 36 1.958 -1.259 -994.015 0.000 0.000 0.000
VIS 2003/08/21 10:27:36.418 RDI1 FSH 0.000 0.000 0.000 0.000 0.716 -0.730 0.007 1.234 0 0.000 0.000 0.000 0.000 -0.716 0.730 0.007 0.000 0 6.10 5.90 6.20 5.80 6 27.32 0.38 0.19 1500 35 0.01 994 0 0 19 4 0.000 135.555 1.02252 0 0 19 4 0.000 -44.4453 1.02252 83 0 0.00 10.00 19 0 0.101 0.100 70056.410 1061494056.418 0.568897 0.403049 -0.134355 0 0 0 1061494056.418 0 0 0 0 0 0 0.000 0.558897 0.403048 -0.134353 1061494056.418 1465.374 36 1.956 -1.162 -994.016 0.000 0.000 0.000
VIS 2003/08/21 10:27:36.518 RDI1 FSH 0.000 0.000 0.000 0.000 0.716 -0.731 0.007 1.234 0 0.000 0.000 0.000 0.000 -0.716 0.731 0.007 0.000 0 6.10 5.90 6.20 5.80 6 27.35 0.4 0.2 1500 35 0.01 994 0 0 20 4 0.000 135.594 1.02324 0 0 20 4 0.000 -44.4061 1.02324 83 0 0.00 10.00 20 0 0.100 0.100 70056.510 1061494056.518 0.598778 0.424262 -0.141427 0 0 0 1061494056.518 0 0 0 0 0 0 0.000 0.588778 0.42426 -0.141425 1061494056.518 1465.374 36 1.953 -1.065 -994.017 0.000 0.000 0.000
VIS 2003/08/21 10:27:36.618 RDI1 FSH 0.000 0.000 0.000 0.000 0.715 -0.731 0.007 1.234 0 0.000 0.000 0.000 0.000 -0.715 0.731 0.007 0.000 0 6.10 5.90 6.20 5.80 6 27.39 0.42 0.21 1500 35 0.01 994 0 0 21 4 0.000 135.634 1.02254 0 0 21 4 0.000 -44.366 1.02254 83 0 0.00 10.00 21 0 0.100 0.100 70056.610 1061494056.618 0.628653 0.445475 -0.148499 0 0 0 1061494056.618 0 0 0 0 0 0 0.000 0.628653 0.445473 -0.148497 1061494056.618 1465.374 36 1.951 -0.969 -994.017 0.000 0.000 0.000
VIS 2003/08/21 10:27:36.718 RDI1 FSH 0.000 0.000 0.000 0.000 0.715 -0.732 0.008 1.234 0 0.000 0.000 0.000 0.000 -0.715 0.732 0.008 0.000 0 6.10 5.90 6.20 5.80 6 27.41 0.44 0.22 1500 35 0.01 994 0 0 22 4 0.000 135.673 1.02325 0 0 22 4 0.000 -44.3269 1.02325 83 0 0.00 10.00 22 0 0.100 0.100 70056.710 1061494056.718 0.658522 0.466688 -0.155571 0 0 0 1061494056.718 0 0 0 0 0 0 0.000 0.648522 0.466685 -0.155568 1061494056.718 1465.374 36 1.949 -0.872 -994.018 0.000 0.000 0.000


LOG DATA SOURCE FILE: 
dvl.cpp

LOG DATA STRING SOURCE CODE:

/* =====================================================================

   Function for printing standard DSL data structure of DVL string.

   MODIFICATION HISTORY
   DATE         WHO             WHAT
   -----------  --------------  ----------------------------
   19 JUL 1998  Louis Whitcomb  Created and Written
   06 JUN 2001  LLW & JCK       Updated numerous fields
   09 JUN 2001  LLW & JCK       Added octans and crossvow attitude
   19 AUG 2003  LLW             Added additional data fields to VIS data string 
                                logged on every DVL ping:
                                - Sound velocity and sound velocity source for
                                  Doppler fix computation
                                - World Vehicle Position XYZHPR

   ====================================================================== */
static unsigned dvl_log_kount =0;

int dvl_log_ascii_sprintf(char * msg, dvl_t * dvl, int header)
{
   int msglen = 0;
   int DEBUG_DVL_LOGGING = 0;

   char dsl_time_string[256];

   if(DEBUG_DVL_LOGGING)
    {
     msglen += sprintf(&msg[msglen],"\r\nnew   ");
     msglen += sprintf(&msg[msglen],"%d %g",
            dvl_log_kount,
             dvl->t);
    }

   if(header != 0)
   {

     /* read the system clock and print a GMT date/time string */
     rov_sprintf_dsl_time_string(dsl_time_string);

     /* construct the ds log string */
     msglen += sprintf(&msg[msglen],"VIS %s ",dsl_time_string);
   }

   msglen += sprintf(&msg[msglen],"RDI1 FSH",dsl_time_string);

   if(DEBUG_DVL_LOGGING)
      msglen += sprintf(&msg[msglen],"\r\nbt    ");
   msglen += sprintf(&msg[msglen]," %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %d",
             dvl->bt[DVL_X],
             dvl->bt[DVL_Y],
             dvl->bt[DVL_Z],
             dvl->bt[DVL_ERR],
             dvl->btv[DVL_X],
             dvl->btv[DVL_Y],
             dvl->btv[DVL_Z],
             dvl->btv[DVL_ERR],
             dvl->bt_status);

   if(DEBUG_DVL_LOGGING)
      msglen += sprintf(&msg[msglen],"\r\nwt    ");
   msglen += sprintf(&msg[msglen]," %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %d",
             dvl->wt[DVL_X],
             dvl->wt[DVL_Y],
             dvl->wt[DVL_Z],
             dvl->wt[DVL_ERR],
             dvl->wtv[DVL_X],
             dvl->wtv[DVL_Y],
             dvl->wtv[DVL_Z],
             dvl->wtv[DVL_ERR],
             dvl->wt_status);

   if(DEBUG_DVL_LOGGING)
      msglen += sprintf(&msg[msglen],"\r\nrng   ");
   msglen += sprintf(&msg[msglen]," %.2f %.2f %.2f %.2f %g",
             dvl->range[0],
             dvl->range[1],
             dvl->range[2],
             dvl->range[3],
             dvl->altitude);

   msglen += sprintf(&msg[msglen]," %g %g %g %g %g %g %g",
             dvl->heading * RTOD,
             dvl->pitch * RTOD,
             dvl->roll * RTOD,
             dvl->sv,
             dvl->salinity,
             dvl->temp,
             dvl->depth);

   rov_time_t time_now;
   time_now = rov_get_time();

   // if (( dvl->heading > TWO_PI ) || ( dvl->heading < 0.0 ))
   //    time_now = rov_get_time();

   if(DEBUG_DVL_LOGGING)
      msglen += sprintf(&msg[msglen],"\r\nbstat  ");

   msglen += sprintf(&msg[msglen]," %d %d %d %d %.3f %g %g",
             dvl->bt_count_012_beam,
             dvl->bt_count_3_beam,
             dvl->bt_count_4_beam,
             dvl->bt_beams_this_solution,
             rov_diff_time( time_now, dvl->bt_last_good_vel_time),
             dvl->bt_cog*RTOD,
             dvl->bt_sog
             );

   if(DEBUG_DVL_LOGGING)
      msglen += sprintf(&msg[msglen],"\r\nwstat ");
   msglen += sprintf(&msg[msglen]," %d %d %d %d %.3f %g %g",
             dvl->wt_count_012_beam,
             dvl->wt_count_3_beam,
             dvl->wt_count_4_beam,
             dvl->wt_beams_this_solution,
                 rov_diff_time( time_now, dvl->wt_last_good_vel_time),
             dvl->wt_cow*RTOD,
             dvl->wt_sow
             );

  if(DEBUG_DVL_LOGGING)
     msglen += sprintf(&msg[msglen],"\r\nstat  ");

  msglen += sprintf(&msg[msglen]," %d %d %.2f %.2f %d %d %.3f %.3f %.3f",
             dvl->config,
             dvl->BIT,
             dvl->wln,
             dvl->wlf,
             dvl->nrecords,
             dvl->nbadrecords,
             dvl->most_recent_string_delta_time,
             dvl->wh_delta_t,
             dvl->wh_sec_since_midnight);

  if(DEBUG_DVL_LOGGING)
     msglen += sprintf(&msg[msglen],"\r\n");

//  msglen += sprintf(&msg[msglen],"\n");

  // time of most recent string (could be bad or good ping)
  msglen += sprintf(&msg[msglen]," %.3f",dvl->most_recent_string_time );


  // -------------------------------------------------------------------------
  //
  // The following fields added 9 June 2001 specifically for dvlnav application
  // In standalone applications, you will probably want to disable this section
  //
  // 9 June 2001 LLW & JCK
  //
  // 19 Aug 2003 Commented out, replaced below
  //
  // -------------------------------------------------------------------------
  //    #include "dvlnav.h"
  //  
  //    msglen += sprintf(&msg[msglen]," %lg", dvlnav.octans.raw_state.pos[DOF_HDG] * RTOD);
  //    msglen += sprintf(&msg[msglen]," %lg", dvlnav.octans.raw_state.pos[DOF_PITCH] * RTOD);
  //    msglen += sprintf(&msg[msglen]," %lg", dvlnav.octans.raw_state.pos[DOF_ROLL] * RTOD);
  //  
  //    msglen += sprintf(&msg[msglen]," %lg", dvlnav.octans.raw_state.vel[DOF_HDG] * RTOD);
  //    msglen += sprintf(&msg[msglen]," %lg", dvlnav.octans.raw_state.vel[DOF_PITCH] * RTOD);
  //    msglen += sprintf(&msg[msglen]," %lg", dvlnav.octans.raw_state.vel[DOF_ROLL] * RTOD);
  //  
  //    msglen += sprintf(&msg[msglen]," %.3lf", dvlnav.octans.raw_state.pos_time[DOF_HDG]);
  //  
  //    msglen += sprintf(&msg[msglen]," %lg", dvlnav.xbow.raw_state.pos[DOF_HDG] * RTOD);
  //    msglen += sprintf(&msg[msglen]," %lg", dvlnav.xbow.raw_state.pos[DOF_PITCH] * RTOD);
  //    msglen += sprintf(&msg[msglen]," %lg", dvlnav.xbow.raw_state.pos[DOF_ROLL] * RTOD);
  //  
  //    msglen += sprintf(&msg[msglen]," %lg", dvlnav.xbow.raw_state.vel[DOF_HDG] * RTOD);
  //    msglen += sprintf(&msg[msglen]," %lg", dvlnav.xbow.raw_state.vel[DOF_PITCH] * RTOD);
  //    msglen += sprintf(&msg[msglen]," %lg", dvlnav.xbow.raw_state.vel[DOF_ROLL] * RTOD);
  //  
  //    msglen += sprintf(&msg[msglen]," %.3lf", dvlnav.xbow.raw_state.pos_time[DOF_HDG]);

  // -------------------------------------------------------------------------
  //
  // 19 Aug 2003  JCK&LLW Doppler VNS string modified to log cookec attitude data, not raw
  //
  // Modified to log the COOKED state, not the raw state, i.e. to log the values
  // of the VEHICLE attitude, not the RAW INSTRUMENT attitude.
  //
  // -------------------------------------------------------------------------
  #include "dvlnav.h"

  // 19 Aug 2003  JCK&LLW Doppler VNS string modified to log cookec attitude data, not raw
  // Vehicle attitude based on cooked OCTANS attitude and INI file offsets
  msglen += sprintf(&msg[msglen]," %lg", dvlnav.world_vehicle_attitude_octans.pos[DOF_HDG] * RTOD);
  msglen += sprintf(&msg[msglen]," %lg", dvlnav.world_vehicle_attitude_octans.pos[DOF_PITCH] * RTOD);
  msglen += sprintf(&msg[msglen]," %lg", dvlnav.world_vehicle_attitude_octans.pos[DOF_ROLL] * RTOD);

  msglen += sprintf(&msg[msglen]," %lg", dvlnav.world_vehicle_attitude_octans.vel[DOF_HDG] * RTOD);
  msglen += sprintf(&msg[msglen]," %lg", dvlnav.world_vehicle_attitude_octans.vel[DOF_PITCH] * RTOD);
  msglen += sprintf(&msg[msglen]," %lg", dvlnav.world_vehicle_attitude_octans.vel[DOF_ROLL] * RTOD);

  msglen += sprintf(&msg[msglen]," %.3lf", dvlnav.world_vehicle_attitude_octans.pos_time[DOF_HDG]);

  // 19 Aug 2003  JCK&LLW Doppler VNS string modified to log cookec attitude data, not raw
  // Vehicle attitude based on cooked XBOW attitude, INI file offsets, and local variation
  msglen += sprintf(&msg[msglen]," %lg", dvlnav.world_vehicle_attitude_xbow.pos[DOF_HDG] * RTOD);
  msglen += sprintf(&msg[msglen]," %lg", dvlnav.world_vehicle_attitude_xbow.pos[DOF_PITCH] * RTOD);
  msglen += sprintf(&msg[msglen]," %lg", dvlnav.world_vehicle_attitude_xbow.pos[DOF_ROLL] * RTOD);

  msglen += sprintf(&msg[msglen]," %lg", dvlnav.world_vehicle_attitude_xbow.vel[DOF_HDG] * RTOD);
  msglen += sprintf(&msg[msglen]," %lg", dvlnav.world_vehicle_attitude_xbow.vel[DOF_PITCH] * RTOD);
  msglen += sprintf(&msg[msglen]," %lg", dvlnav.world_vehicle_attitude_xbow.vel[DOF_ROLL] * RTOD);

  msglen += sprintf(&msg[msglen]," %.3lf", dvlnav.world_vehicle_attitude_xbow.pos_time[DOF_HDG]);

  // 19 Aug 2003  JCK&LLW Doppler VNS string modified to log cookec attitude data, not raw
  // Vehicle attitude based on cooked DOPPLER attitude, INI file offsets, and local variation
  msglen += sprintf(&msg[msglen]," %lg", dvlnav.world_vehicle_attitude_dvl.pos[DOF_HDG] * RTOD);
  msglen += sprintf(&msg[msglen]," %lg", dvlnav.world_vehicle_attitude_dvl.pos[DOF_PITCH] * RTOD);
  msglen += sprintf(&msg[msglen]," %lg", dvlnav.world_vehicle_attitude_dvl.pos[DOF_ROLL] * RTOD);

  msglen += sprintf(&msg[msglen]," %.3lf", dvlnav.world_vehicle_attitude_dvl.pos_time[DOF_HDG]);


  // 19 AUG 2003 LLW
  // sound velocity value in m/s
  msglen += sprintf(&msg[msglen]," %.3lf", dvlnav.sv_for_most_recent_dvl_ping.val);

  // sound velocity method
  msglen += sprintf(&msg[msglen]," %d", dvlnav.sv_for_most_recent_dvl_ping.source);

  // log the WORLD position and orientation of the VEHICLE as computed from the DVL fix
  #define rad_to_deg  ((dof>=DOF_HDG) ? RTOD : 1.0)
  int dof;
  for(dof=0; dof<6; dof++)
    msglen += sprintf(&msg[msglen]," %.3lf", dvlnav.world_vehicle_dvl.pos[dof] * rad_to_deg);

   static int first_time = 1;
   if(first_time)
      {
         int fields = 1;
         char * s = msg;

         first_time = 0;

         while( *s != 0)
           {

             // detect fields by transition from space to non-space
             if((*s == ' ') && (*(s+1) != ' '))
                fields++;

             s++;

           }

         stderr_printf("DVL VIS contains %d space-delimited fields %s including the VIS and date/time fields.",
                        fields,
                        header ? "---" : "NOT"
                        );

         stderr_printf("DVL VIS data is: %s",msg);
      }



  return(msglen);


}


----------------------------------------------------------------------
Part II Section 6: RDB format for raw doppler data
----------------------------------------------------------------------

LOG DATA DESCRIPTION:
This string logs the raw binary data received from the Doppler.
The binary data is HEX encoded.

LOG DATA SOURCE:
RDI Doppler

LOG DATA FREQUENCY: 
Normally 1-10 Hz.

LOG DATA FORMAT:
RDB <DATE AND TIME> <BINARY Doppler ensemble data, hex encoded>

LOG DATA FIELDS:
1.  "RDB"
2.  Date/time string: YYYY/MM/DD HH:MM:SS.SSS
3.  BINARY Doppler ensemble data, hex encoded.

LOG DATA STRING SAMPLE:
RDB 2002/07/22 18:04:06.680 7D0156005406000300FDFF0080D4010000EB01B0010800800080008000803C0064001014392B0F0000DC050901230A0096022701E0089C1F0000F36CFFFFAAB5FFFFD30A00005E52FFFFB2FA01005B4CDAFF0D620800C21B
RDB 2002/07/22 18:04:06.801 7D0156005408000500FCFF0080D4010000EB01B0010800800080008000803C0064001014392B1A0000DC050A01230A0091022901F3089D1F0000F36CFFFFAAB5FFFFD30A00005D52FFFFB2FA0100364CDAFF1D620800CC1B
RDB 2002/07/22 18:04:06.881 7D01560054FFFF0000FDFF0080D4010000EB01B0010800800080008000803C0064001014392B260000DC050C01230A0093022801FA089D1F0000F36CFFFFA9B5FFFFD30A00005C52FFFFB3FA01000E4CDAFF2E620800BC1D
RDB 2002/07/22 18:04:07.001 7D0156005404000500FCFF0080D4010000EB01B0010800800080008000803C0064001014392B310000DC050901230A008E022B01F4089D1F0000F46CFFFFA9B5FFFFD40A00005B52FFFFB3FA0100E94BDAFF3D620800B01C




----------------------------------------------------------------------
Part II Section 7: HST format for raw host strings received
----------------------------------------------------------------------

LOG DATA DESCRIPTION:
This string logs the raw ascii strings verbatim as they are received
from the host to DVLNAV via UDP or Serial.

All strings received from the host are timestamped and logged, even
if the string itself is corrupted or unused. 

This data string is useful in debugging - you can see exactly what
data was sent to DVLNAV from the host via UDP and Serial.

LOG DATA SOURCE:
Host computer.  On Alvin, the host is Athena.
On Jason 2, the host is the topside computer.

LOG DATA FREQUENCY: 

LOG DATA FORMAT:
HST <DATE AND TIME> <Raw string received from the HOST computer>

LOG DATA FIELDS:
1.  "HST"
2.  Date/time string: YYYY/MM/DD HH:MM:SS.SSS
3.  Raw string received from the HOST computer.

LOG DATA STRING SAMPLE:
HST 2002/07/22 18:04:06.680 MPS 2002/07/22 18:04:06.538 MED 251.044 29.100 1617.540 18.244 1000  
HST 2002/07/22 18:04:06.680 XBW 2002/07/22 18:04:06.608 AHRS  JAS2  126.77273 -0.16204834 6.7126465 -0.668335 -1.3549806 0.054931644 -0.018493651 0.11682128 0.96029658 -0.03793686 -0.00846856 0.6846373 22.22 18.24 1000
HST 2002/07/22 18:04:06.791 PAS 02/07/22 18:04:05.62 SHP 352.2   0.0   0.0   0.0   0.0   0.0
HST 2002/07/22 18:04:06.811 PNS 02/07/22 18:04:05.62 REF UTM SHP 334556.34 5077152.15    0.00   0.0 00  
HST 2002/07/22 18:04:06.821 XBW 2002/07/22 18:04:06.759 AHRS  JAS2  126.72879 -0.184021 6.6906738 0.36621096 -1.1947633 -1.2588502 -0.017852782 0.11654663 0.98437495 -0.03982512 -0.02414684 0.703806 22.22 18.24 1000
HST 2002/07/22 18:04:06.951 XBW 2002/07/22 18:04:06.891 AHRS  JAS2  126.66287 -0.17578125 6.6851807 0.032043459 -1.2680054 0.004577637 -0.017120361 0.11672973 0.96029658 -0.05939436 -0.00926964 0.68360734 22.27 18.24 1000




----------------------------------------------------------------------
Part II Section 8: HTX format for strings transmitted to host
----------------------------------------------------------------------
LOG DATA DESCRIPTION:
This string logs the raw ascii strings verbatim as they are TRANSMITTED
to the host from DVLNAV via UDP or Serial.

All strings transmitted to the host are timestamped and logged.

This data string is useful in debugging - you can see exactly what
data was sent from DVLNAV to the host via UDP and Serial.

LOG DATA SOURCE:
DVLNAV.

LOG DATA FREQUENCY: 
Various.

LOG DATA FORMAT:
HTX <DATE AND TIME> <Raw string transmitted from DVLNAV to the HOST>

LOG DATA FIELDS:
1.  "HTX"
2.  Date/time string: YYYY/MM/DD HH:MM:SS.SSS
3.  Raw string transmitted from DVLNAV to the HOST.

LOG DATA STRING SAMPLE:
HTX 2002/07/22 18:04:06.570 $PWHCFG,1,45.75000000,-125.25000000,324995.435,5068733.378,10,+1680.000,+18.24,35,+2.660,1488.2,-7,160.63,1,1,1,1*12  
HTX 2002/07/22 18:04:06.570 $PWHDOP,+9349.199,+8656.710,+1651.016,+45.827886,-125.129852,+4.637,+0.082,17:18,00:00,1,3,3,0.040,3116.998,+0.002,-0.001,-0.000,+170.676,+0.120,+345.500,+0.000,+108.414,+0.132,2.660,1488.161*0A  
HTX 2002/07/22 18:04:06.570 $PWHGYRO,+179.860,-8.190,+2.250,0.010,00000000*48  
HTX 2002/07/22 18:04:06.570 $PWHLBX,+9352.513,+8664.962,+1651.016,+45.827960,-125.129809,+4.637,+0.082,17:18,00:00,3,0,A,B,0,1488.161,-1.000,-1.000,-1.000,-1.000,2,2,2,2,2.553*1A  
HTX 2002/07/22 18:04:06.570 $PWHMAGD,+175.493,-6.758,+2.676,0.040,18.240,0*4C  
HTX 2002/07/22 18:04:06.570 $PWHTRB,1,DOP,0,+333.742,+9.843,+0.000,+0.000,+0.000,+1307.904,+0.000,+0.000,+1307.941,+9349.199,+8656.710,+343.119,+9344.844,+8665.538,+1651.023,16,Jason II DOP Fix,13,MEDEA LBL Fix*4F  




----------------------------------------------------------------------
Part II Section 9: STD format for stderr log 
----------------------------------------------------------------------
LOG DATA DESCRIPTION:
This string logs actions and events that occur as dvlnav operates.

This data string is useful in debugging - you can see exactly what
data was sent from DVLNAV to the host via UDP and Serial.

LOG DATA SOURCE:
DVLNAV.

LOG DATA FREQUENCY: 
Various.

LOG DATA FORMAT:
SDE <DATE AND TIME> <standard error event description>

LOG DATA FIELDS:
1.  "STD"
2.  Date/time string: YYYY/MM/DD HH:MM:SS.SSS
3.  standard error event description.

LOG DATA STRING SAMPLE:
SDE 2003/09/22 11:56:20.953 Magnetic variation = +18.24 from INI file
SDE 2003/09/22 11:56:20.953 UTM ZONE = 10  Computed for Longitude=-125.2500  (+=East, -=West)
SDE 2002/07/22 18:00:00.020 LOG: Closed system     log file D:\data\2002_07_22_17_00.DAT OK.
SDE 2002/07/22 18:00:00.020 LOG: Opened system     log file D:\data\2002_07_22_18_00.DAT OK.
SDE 2002/07/22 18:31:58.753 RESET Doppler to CURSOR position
SDE 2002/07/22 18:03:10.450 Saved DVLNAV image to file D:\data\2002_07_22_18_03_09.jpeg
SDE 2002/07/22 18:00:00.390 Wrote "D:\data\2002_07_22_18_00_DVLNAV_INI.M" [comm           ] "local_udp_port_num  " = 10502
SDE 2002/07/22 18:00:00.390 Wrote "D:\data\2002_07_22_18_00_DVLNAV_INI.M" [comm           ] "local_udp_port_num_s" = 20101
SDE 2002/07/22 18:00:00.390 Wrote "D:\data\2002_07_22_18_00_DVLNAV_INI.M" [data           ] "dat_log_dir         " = D:\data
SDE 2002/07/22 18:00:00.390 Wrote "D:\data\2002_07_22_18_00_DVLNAV_INI.M" [data           ] "screen_shot_image_ty" = 1



----------------------------------------------------------------------
Part II Section 10: CPU format for CPU and DISK usage
----------------------------------------------------------------------

LOG DATA DESCRIPTION:
Logs CPU and DISK usage.

LOG DATA SOURCE:
DVLNAV.

LOG DATA FREQUENCY: 
1 Hz

LOG DATA FORMAT:
CPU <DATE AND TIME> <CPU usage in Percent> <DISK used in Percent>

LOG DATA FIELDS:
1.  "CPU"
2.  Date/time string: YYYY/MM/DD HH:MM:SS.SSS
3.  CPU usage in Percent
4.  DISK used in Percent.


LOG DATA STRING SAMPLE:

LOG DATA SOURCE FILE: 
dvlnav_main_form.cpp

LOG DATA STRING SOURCE CODE:

  // ----------------------------------------------------------------------
  // log CPU and DISK usage
  // ----------------------------------------------------------------------
  len = 0;
  // cpu usage
  len += sprintf(&str[len]," %.1f", cpupercent);

  // disk usage
  len += sprintf(&str[len]," %.1f", percentfull);

  //log it
  log_this_now_dsl_format(LOG_FID_DSL_FORMAT,"CPU", str);



----------------------------------------------------------------------
Part II Section 11: MSC format for miscellaneous derived realtime nav info
----------------------------------------------------------------------
LOG DATA DESCRIPTION:
Logs misc derived nav data.

LOG DATA SOURCE:
DVLNAV.

LOG DATA FREQUENCY: 
1 Hz

LOG DATA FORMAT:
MSC <DATE AND TIME> <vehicle cog> <vehicle sog> <vehicle cow> <vehicle sow>
                    <water cog> <water sog> <water cow> <water sow>
                    <depth> <depth source> 
		    <alt> <alt source>
		    <z vel> <z vel source>
		    <ttb> <ttb source>
		    <tts> <tts source>
		    <sv> <sv source>
LOG DATA FIELDS:
1.  "MSC"
2.  Date/time string: YYYY/MM/DD HH:MM:SS.SSS
3.  Vehicle course over ground in degrees true
4.  Vehicle speed  over ground in degrees true
5.  Vehicle course over water  in degrees true
6.  Vehicle speed  over water  in degrees true
7.  Water   course over ground in degrees true
8.  Water   speed  over ground in degrees true
9.  Water   course over water  in degrees true
10. Water   speed  over water  in degrees true
11. depth in meters.
12. depth source
13. alitude in meters
14. altitude source
15. vertical velocity
16. vertical velocity source
17. time to surface
18. time to surface source
19. time to bottom
20. time to bottom source
21. sound velocity
22. sound velcoity source

LOG DATA STRING SAMPLE:
MSC 2002/07/22 18:04:06.580  171 0.00201 346 0 108 0.0022 171 0.00201 1.65e+03 2 4.64 23 -0.00137 2 0 2 1.03e+09 2 1.49e+03 35
MSC 2002/07/22 18:00:01.322  360 0.00134 346 0 302 0 360 0.00134 1.65e+03 2 4.62 23 0.000466 2 0 2 0 2 1.49e+03 35
MSC 2002/07/22 18:00:02.323  315 0.00896 346 0 311 0.00664 315 0.00896 1.65e+03 2 4.62 23 0.00206 2 1.03e+09 2 0 2 1.49e+03 35

LOG DATA SOURCE FILE: 
dvlnav_main_form.cpp

LOG DATA STRING SOURCE CODE:

  // ----------------------------------------------------------------------
  // log misc derived values
  // ----------------------------------------------------------------------
  len = 0;
  len += sprintf(&str[len]," %.3g", dvlnav.world_vehicle_cog.val * RTOD);

  len += sprintf(&str[len]," %.3g", dvlnav.world_vehicle_sog.val);

  len += sprintf(&str[len]," %.3g", dvlnav.world_vehicle_cow.val * RTOD);

  len += sprintf(&str[len]," %.3g", dvlnav.world_vehicle_sow.val);

  len += sprintf(&str[len]," %.3g", dvlnav.world_water_cog.val * RTOD);

  len += sprintf(&str[len]," %.3g", dvlnav.world_water_sog.val);

  len += sprintf(&str[len]," %.3g", dvlnav.world_vehicle_cog.val * RTOD);

  len += sprintf(&str[len]," %.3g", dvlnav.world_vehicle_sog.val);

  len += sprintf(&str[len]," %.3g", dvlnav.depth.val);

  len += sprintf(&str[len]," %d", dvlnav.depth.source);

  len += sprintf(&str[len]," %.3g", dvlnav.altitude.val);

  len += sprintf(&str[len]," %d", dvlnav.altitude.source);

  len += sprintf(&str[len]," %.3g", dvlnav.z_vel.val);

  len += sprintf(&str[len]," %d", dvlnav.z_vel.source);

  len += sprintf(&str[len]," %.3g", dvlnav.time_to_bottom.val);

  len += sprintf(&str[len]," %d", dvlnav.time_to_bottom.source);

  len += sprintf(&str[len]," %.3g", dvlnav.time_to_surface.val);

  len += sprintf(&str[len]," %d", dvlnav.time_to_surface.source);

  len += sprintf(&str[len]," %.3g", dvlnav.sv.val);

  len += sprintf(&str[len]," %d", dvlnav.sv.source);

  //log it
  log_this_now_dsl_format(LOG_FID_DSL_FORMAT,"MSC", str);



----------------------------------------------------------------------
Part II Section 12: SIM format for simulation data
----------------------------------------------------------------------

LOG DATA DESCRIPTION:
This string is logged when DVLNAV is in simulation mode. In simulation
mode, an embedded simulation is activated which computes a simulated
trajectory of a moving vehicle.  It generates the sensor strings normally
generated by on-board sensors including Doppler, Octans, Xbow, Depth sensor
Altimeter, Alvin LBL, etc.  These data strings are processed by DVLNAV
as though the vehicle was in action.  

Note that the simulation computes computes sonsor values WITH attention
to the location of the sensor on the vehicle as specified in the
DVLNAV INI file.

LOG DATA SOURCE:
The simulation module of dvlnav - dvlnav_sim.cpp

LOG DATA FREQUENCY: 
10 Hz - this is the rate at which the simulation updates internally.

LOG DATA FIELDS:
1.     "SIM"

2.     Date/time string: YYYY/MM/DD HH:MM:SS.SSS

3.     Time since start of simulation in seconds

4.     Time since last simulation update in seconds

5-16.  Simulated Vehicle Position and Velocity in WORLD coordinates,
       XYZHPR in meters and degrees,
       d/dt XYZHPR in meters/sec and degrees/sec. 

17-28. Simulated Doppler Position and velocity in WORLD coordinates
       XYZHPR in meters and degrees,
       d/dt XYZHPR in meters/sec and degrees/sec. 

29-40. Simulated Octans Position and Velocity in WORLD coordinates,
       XYZHPR in meters and degrees,
       d/dt XYZHPR in meters/sec and degrees/sec. 

41-52. Simulated XBOW Position and Velocity in WORLD coordinates,
       XYZHPR in meters and degrees,
       d/dt XYZHPR in meters/sec and degrees/sec. 

53-55. Simulated Paro 1 Position in WORLD coordinates,
       XYZ in meters and degrees.

56-58. Simulated Paro 2 Position in WORLD coordinates,
       XYZ in meters and degrees.

59-61. Simulated LBL Ducer 1 (Top Ducer) Position in WORLD coordinates,
       XYZ in meters and degrees.

62-64. Simulated LBL Ducer 2 (Bottom Ducer) Position in WORLD coordinates,
       XYZ in meters and degrees.

65-67. Simulated Altimeter Position in WORLD coordinates,
       XYZ in meters and degrees.

68-71. Doppler Bottom-Track Instrument Velocities (X,Y,Z,Error)

72-75. Doppler Water-Track Instrument Velocities (X,Y,Z,Error)

LOG DATA STRING SAMPLE:

LOG DATA SOURCE FILE: 

LOG DATA STRING SOURCE CODE:



----------------------------------------------------------------------
Part II Section : 
----------------------------------------------------------------------

LOG DATA DESCRIPTION:

LOG DATA SOURCE:

LOG DATA FREQUENCY: 

LOG DATA FIELDS:
1.  "VIS"
2.  Date/time string: YYYY/MM/DD HH:MM:SS.SSS
3.  "RDI1 FSH" for Alvin and the DSL120
    "RDI1 JAS" for Jason
    "RDI1 ARG" for Argo 

LOG DATA STRING SAMPLE:

LOG DATA SOURCE FILE: 

LOG DATA STRING SOURCE CODE:




----------------------------------------------------------------------
Part III: COMMA-DELIMITED LOG FILES SPECIFICATIONS (for SPREADSHEETS)
----------------------------------------------------------------------


----------------------------------------------------------------------
Part III Section 1: OVERVIEW OF COMMA-DELIMITED LOG FILES for SPREADSHEETS
----------------------------------------------------------------------

----------------------------------------------------------------------
DATA LOG FILES: 
----------------------------------------------------------------------

DVLNAV logs data locally on its own computer hard disk in ASCII
files in to two files.   All files are logged to the "data" 
subdirectory immediately below the directory in which the DVLNAV
program resides.  If no "data" subdirectory exists, then no
data is logged.  The status of logging is displayed on the
DVLNAV screen.

  1. COMMA-DELIMITED LOG FILES for SPREADSHEET LOADING:

   These files provide a simple comma-delimited ASCII data log of the
vehicle's basic navigation and scientific sensor data.  Data is logged
at one hertz. The ASCII format is designed to be easily imported into
standard spreadsheet programs.  The data column are labeled. 

  The COMMA-DELIMITED LOG FILE data format is documented in Part III
of this document.

  The comma-delimited ASCII log files are intended to provide science
users all of navigation and scientific sensor data most commonly
requested by scientific users, in a format that is easily loaded into
all common spreadsheet programs.  

  The comma-delimited ASCII log files contain repeated entries once a
second for sensor and nav data, and also for information such as local
XY origin, sound velocity, and the like.  This is not an accident, it
is intentional.  The parameters such as local XY origin can be changed
by the DVLNAV user on-the-fly, thus it is important to log the values
continuously. 

  The comma-delimited ASCII log is not exhaustive. For example: the
vehicle gyro reports heading ten times each second.  The DSL data
format log file contains comprehensively time-stamped and logs of each
and every heading sensor reading in real-time every 100 milliseconds.
The comma-delimited format, in contrast, logs a "snapshot" of the
entire vehicle data once a second.

  The comma-delimited ASCII log files have a suffix ".CSV"

  The name of the .CSV  log file encodes the year, month, day, hour,
and minute that the log file was created, as described later in this
Section.

  A new .CSV log file is opened when the DVLNAV program starts.
Thereafter, DVLNAV will write into the same file until midnight GMT.
At midnight GMT, the current .CSV log file is closed and a new log
file is opened.

  Note: DVLNAV versions 140 and lower do not create this
comma-delimeted file.

  2. DSL DATA FORMAT LOGS: The standard DSL data format, documented in
Section II, contains a exhaustively comprehensive log of all of
DVLNAV's input, output, and other data.  This file contains time-stamped
ASCII records in the formats specified in this section. 

  The DSL data format is documented in Part II of this document.

  These DSL data format files are intended for use by techno-geek users
who are comfortable with parsing huge data sets with grep and awk, and
in loading and processing large data files, for example in MATLAB.
These files will support the ability (soon) to renavigate a dive with
DVLNAV in renav mode.

  The DSL data format files are far too large and complex to load
directly into a spreadsheet program.  A set of matlab program for
processing, manipulating, and plotting this data is freely available
to all NDSF/UNOLS users from the authors at JHU.

  The DSL data format files have a suffix ".DAT"

  The name of the .DAT  log file encodes the year, month, day, hour,
and minute that the log file was created, as described later in this
Section.

  A new .DAT log file is opened when the DVLNAV program starts.
At the top of every hour, the current log file is closed and
a new log file is opened. 

  Depending on how DVLNAV is configured, it typically logs 60-80MB
of data per hour to the .DAT files.  These data files compress 
well - WINZIP on maximum compression typically achieves 10:1 
compression on the .DAT files.  So about 10 days of Alvin dives
can be compressed onto a single 650MB CD-ROM.


----------------------------------------------------------------------
DATA LOG FILES NAMES: 
----------------------------------------------------------------------

  The name of the .CSV and .DAT log file encoded the year, month, day,
hour, and minute that the log file was opened. For example, the file

  2002_04_26_0112.CSV 

  was opened on year 2002, month 4 (April), day 26, at 01:12 GMT.

  Note: DVLNAV versions 140 and lower omit the year from the
file name convention.  Don't worry, however, the year is
encoded directly in the file data itself.





----------------------------------------------------------------------
Part III Section 2: Comma-Delimited Log File Format
----------------------------------------------------------------------


LOG DATA DESCRIPTION:

  The comma-delimited ASCII log files are intended to provide science
users all of navigation and scientific sensor data most commonly
requested by scientific users, in a format that is easily loaded into
all common spreadsheet programs.  

LOG DATA SOURCE:
This data string is generated once a second by the DVLNAV system.
It contains values from all vehicle sensors including: paro depth,
datasonics altimeter, octans gyro, LBL, and RDI doppler.  When
available, it also includes data from magnetometers, CTD, and 
temperature probes. 

LOG DATA FREQUENCY:
One hertz

LOG DATA FIELDS:

DATA                            Units
--------------------------      ----------------------------------------
Alvin Dive Number               Integer
Year                            Integer GMT
Month                           Integer 1-12 GMT
Day                             Integer 1-31 GMT
Hour                            Integer 0-23 GMT
Minute                          Integer 0-59 GMT
Second                          Decimal, 0.000 - 0.999 GMT
Second Since Midnight           Decimal, 0.000 - 86399.999 GMT
   
Depth                           Meters, decimal
Altimeter                       Altitude from Paroscientific Altimeter. Meters, decimal
                                Paroscientific should return 300.0 when altitude is bad
                                due to loss of bottom-lock,  but in practice it often 
                                returns incorrect values between 0 and 300 when bottom lock
                                is lost.  Use carefully.
Gyro Heading                    Degrees, decimal, 0.00-359.99.
Gyro Heading Tag                String, "T" for True, "M" for Magnetic.
                                The gyro will normally be an OCTANS unit
                                that can only return TRUE heading.
Gyro Status                     Integer.
                                A value of zero indicates normal gyro
                                operation.  Nonzero values indicate
                                various errors.  When the octans is
                                first powered up, the status word is
                                non-zero for 2-5 minutes while the
                                unit finds north.

                                A full description of the octans status 
                                is contained in Part 1, Section 3.1 of
                                this document, entitled "OCTANS HEADING 
                                AND ATTITUDE STRING sent from dvlnav to host."

                                If the OCTANS status is persists with
                                a non-zero value more than 5-minutes
                                after power-on, with any of the bits
                                bit 0 through bit 5 set, check that
                                you have correctly configured DVLNAV
                                with the site origin latitude.  DVLNAV
                                sends this latitude to the OCTANS.  If
                                the configured latitude is not within
                                a degree or so of the true latitude,
                                the octans staus bits will remain set
                                (non-zero) indicating the error.

Doppler Heading                 Doppler Mag Compass Heading, Corrected To True, Degrees, decimal.
Doppler Heading Tag             String, "T" For True, "M" For Magnetic.
Pitch                           Degrees, signed decimal   
                                Positive is bow up.
                                Negative is bow down.
                                Attitude source is selectable. Normally it is the Octans.
Roll                            Degrees, signed decimal.  
                                Positive is starbord side down.
                                Negative is starbord side up.
                                Attitude source is selectable. Normally it is the Octans.

Lbl X                           Meters, decimal.  Local XY coords, Pos=East,  Neg=West.
Lbl Y                           Meters, decimal.  Local XY coords, Pos=North, Neg=South.
Lbl Depth                       Meters, decimal.  Depth used in LBL solution computation.
Lbl X UTM                       Meters, decimal.  Note: UTM is not parallel to XY or Lat/Lon.
Lbl Y UTM                       Meters, decimal.  Note: UTM is not parallel to XY or Lat/Lon.
Lbl Lat                         Degrees, decimal. Pos=North, Neg=South.
Lbl Lon                         Degrees, decimal. Pos=East,  Neg=West.
Lbl Mode                        0=two transponder mode, 1=full auto mode
Lbl Baseline                    String: "AB", "AC", etc...  Unused in "full auto" mode.
Lbl Side                        String: "CW", "CCW", "ON_BASELINE", "SIDE_UNKNOWN".      
                                Unused in "full auto" mode.  
Lbl Status                      Status of this LBL fix, integer:
                                RANGE_UNKNOWN       = 0  <- bad
                                RANGE_GOOD          = 1  <- this means a good fix
                                RANGE_OLD           = 2  <- bad
                                RANGE_TOO_LONG      = 3  <- bad
                                RANGE_TOO_SHORT     = 4  <- bad
                                RANGE_FAILED_MEDIAN = 5  <- bad
                                RANGE_HIGH_ERROR    = 6  <- bad
Lbl Fix Time                    Decimal, second of day.

Dop X                           Meters, decimal.  Local XY coords, Pos=East,  Neg=West.
Dop Y                           Meters, decimal.  Local XY coords, Pos=North, Neg=South.
Dop X UTM                       Meters, decimal.  Note: UTM is not parallel to XY or Lat/Lon.
Dop Y UTM                       Meters, decimal.  Note: UTM is not parallel to XY or Lat/Lon.
Dop Lat                         Degrees, decimal. 
                                Pos=North, Neg=South.
Dop Lon                         Degrees, decimal. 
                                Pos=East,  Neg=West.
Dop Altitude                    Doppler altitude.  Average of up to four good beams. May be 
                                inaccurate on slopes.                           
Dop Temperature                 Doppler's ambient temperature sensor. Centigrade.
Dop Status                      Method of this Doppler fix, integer:
                                NONE (bad)   = 0
                                BOTTOM TRACK = 1
                                WATER TRACK  = 2
Dop Fix Time (Second Of Day)    Decimal, second of day.
Dop Reset Time (Second Of Day)  Decimal, second of day.

Low  Temp                       Decimal, Degrees C.
High Temp                       Decimal, Degrees C.
ICL  Temp                       Decimal, Degrees C.

Maggie X                        Decimal, Gauss.
Maggie Y                        Decimal, Gauss.
Maggie Z1                       Decimal, Gauss.
Maggie Z2                       Decimal, Gauss.
Maggie time (second of day)     Decimal, second of day.

CTD C                           Decimal, Seimens per meter.
CTD T                           Decimal, Degrees C.
CTD D                           Decimal, meters.

Sound velocity                  Decimal, meters per second.

Local XY origin Lat             Decimal, Degrees.
                                Pos=North, Neg=South.
Local XY origin Lon             Decimal, Degrees.
                                Pos=East,  Neg=West.
UTM Zone                        Integer.
Time zone                       Integer, Neg=West of GMT, Pos=East of GMT.
                                This is for curiosity only, all times
                                appearing in log file are GMT. 
                                No local times appear in the log files
Local magnetic variation        Decimal, Degrees. Pos=East, Neg=West.
                                True Hdg = Mag Hdg + Local Mag Var
Salinity                        Decimal, parts per thousand.

Target #                        Numerical number of target
Target Label                    Text label of target, from INI file or "New Target #" for
                                newly dropped targets .
Target Time String              From ini file, or YYYY/MM/DD HH:MM:SS.SSS for
                                newly dropped targets .
Target X                        Meters, decimal.  Local XY coords, Pos=East,  Neg=West.
Target Y                        Meters, decimal.  Local XY coords, Pos=North, Neg=South.
Target Depth                    Meters, decimal.  Depth used in LBL solution computation.
Target X UTM                    Meters, decimal.  Note: UTM is not parallel to XY or Lat/Lon.
Target Y UTM                    Meters, decimal.  Note: UTM is not parallel to XY or Lat/Lon.
Target Lat                      Degrees, decimal. Pos=North, Neg=South.
Target Lon                      Degrees, decimal. Pos=East,  Neg=West.



----------------------------------------------------------------------
Part IV: Coordinate Frame Convention Specification
----------------------------------------------------------------------

Attitude Conventions are a right handed, naval architecture standard.
Vehicle axes, fixed rigidly in the vehicle are defined as:
              X forward
              Y starboard
              Z  down.

Heading is TRUE compass heading.
Positive roll is starboard side down.
Positive pitch is bow up.

Heading is positive rotation about the Z axis.
Roll    is positive rotation about the X axis.
Pitch   is positive rotation about the Y axis.

The rotation matrix from vehicle frame to the
ZERO frame defined as: 
  ZERO frame: X North
              Y East
              Z Down, normal to earh surface.

is computed as follows:

  /* rotation about X azis by ROLL radians */
  n_mat_t rx = {{    1.0,     0.0,      0.0, 0.0 },
                {    0.0,  cos(r),  -sin(r), 0.0 },
                {    0.0,  sin(r),   cos(r), 0.0 },
                {    0.0,     0.0,      0.0, 1.0 }};

  /* rotation about Y axis by PITCH radians */
  n_mat_t ry = {{ cos(p),     0.0,   sin(p), 0.0 },
                {    0.0,     1.0,      0.0, 0.0 },
                {-sin(p),     0.0,   cos(p), 0.0 },
                {    0.0,     0.0,      0.0, 1.0 }};

  /* rotation about Z axis by HDG radians */
  n_mat_t rz = {{ cos(h), -sin(h),      0.0, 0.0 },
                { sin(h),  cos(h),      0.0, 0.0 },
                {    0.0,     0.0,      1.0, 0.0 },
                {    0.0,     0.0,      0.0, 1.0 }};


  vehicle_to_zero = rx * ry * rx;


To compute the transformation from vehicle frame to
world local leve frame defined as:

  LL frame:  X East
             Y North
             Z Up, normal to earh surface.

is computed as follows:

   n_mat_t ll_zero_to_world_xform = {{0.0, 1.0, 0.0, 0.0},
                                     {1.0, 0.0, 0.0, 0.0},
                                     {0.0, 0.0,-1.0, 0.0},
                                     {0.0, 0.0, 0.0, 1.0}};  

   vehicle_to_world =  ll_zero_to_world_xform * vehicle_to_zero; 

   Note that ll_zero_to_world_xform is orthogonal, symmetric, 
 and is its own inverse, i.e. A = A^-1 .

----------------------------------------------------------------------
TODO:
----------------------------------------------------------------------

Add description of logging directories and filename conventions

Add description of available matlab tools for parsing and processing
log data.

Add description of dvlnav.ini file

Octans config

DVL config

Wiring diagram

Need to add UDP address and port number description here

NEED TO ADD UDP ADDRESS AND PORT NUMBER DESCRIPTION.


