INTRODUCTION

The Wayfinder DVL driver is an easy to use programming interface to communicate directly to the DVL using the serial port. The driver is written in Python and the source code can be found he​re. The source code also includes example applications that cover some common uses of the driver.

QUICK START

First create an instance of the DVL class. Then connect to the serial port by calling the DVL.connect() function.

To get the system information from the DVL use the Dvl.get_system() function. Use Dvl.system_info property to access an instance of the SystemInfo class.

To get the system configurable settings call the Dvl.get_setup() function. Use Dvl.system_setup property to access an instance of the SystemSetup class. The SystemSetup can then be modified and sent back to Wayfinder by using the Dvl.set_s​etup() function.

MAIN MODULE

dvl.dvl

Contains the main Dvl class used to connect to the Wayfinder DVL.

SUB-MODULES

dvl.commands

Contains several classes related to sending commands to the Wayfinder DVL.

dvl.packets

Contains several classes that implement the binary packet interface.

dvl.system

Contains several classes that are used for storing information from Wayfinder DVL, including hardware and user configurable settings.

dvl.util

Contains several useful utilities classes.​​​​



MODULE​ DVL​.DVL​​​

Contains main Dvl class to connect to Wayfinder.

CLASSES

class Dvl(com=None, baudrate=115200)

Main class to connect to Wayfinder.

INSTANCE VARIABLES

var system_info : Syst​emInfo

After successful call to get_system results are stored in here.

var system_components : SystemComponents

After successful call to get_components results are stored in here.

var system_setup : SystemSetup

After successful call to get_setup results are stored in here.

var system_tests : System​Tests

After successful call to get_tests results are stored in here.

var system_features : SystemFeatures

After successful call to get_features results are stored in here.

var fft_data : FftData

After successful call to get_fft_test results are stored in here.

var last_err

Last response from the system as dvl.commands.ResponseStatusType.

var working_folder

Path to working folder where data will be stored.

var log_file_name

Automatically generated file name when data logging starts.

var log_all_data

Flag to turn on logging of all data for debugging purposes.

var time_diff

Time different between system time and PC time.

METHODS

def connect(self, com: str, baud_rate: int = 115200) -> bool

Connects to Wayfinder DVL.

PARAMETERS

com : str
String that represents COM port to be opened, for example "COM1".
baud_rate : int
Baud rate to use when opening the port.

RETURNS

bool
True if port is opened, False otherwise.
def disconnect(self)

Disconnects from Wayfinder DVL.

def is_connected(self) -> bool

Checks if system is connected.

RETURNS

bool
True if system is connected, False otherwise.
def get_time(self) -> 

Gets system time.

RETURNS

datetime
Time of the system if successful, None otherwise.
def set_time(self, date_time: ) -> bool

Sets system time.

PARAMETERS

date_time : datetime
Current time to be set.

RETURNS

bool
True if successful, False otherwise.
def enter_command_mode(self) -> bool

Enters command mode (stops pinging).

RETURNS

bool
True if successful, False otherwise.
def exit_command_mode(self) -> bool

Exits command mode (starts pinging).

RETURNS

bool
True if successful, False otherwise.
def send_software_trigger(self) -> bool

Sends software trigger if software trigger is on.

RETURNS

bool
True if successful, False otherwise.
def reset_to_defaults(self) -> bool

Resets to factory defaults.

RETURNS

bool
True if successful, False otherwise.
def set_speed_of_sound(self, value: float) -> bool

Sets speed of sound value.

RETURNS

bool
True if successful, False otherwise.
def get_tests(self) -> bool

Performs and gets system tests results. The results are in system_tests. It is required to send enter_command_mode() before using this command.

RETURNS

bool
True if successful, False otherwise.
def start_tests(self)

Starts system tests without waiting for results.

def get_features(self) -> bool

Gets system features. The results are in system_features.

RETURNS

bool
True if successful, False otherwise.
def set_system_features(self, feature_code: bytearray) -> bool

Set system features.

RETURNS

bool
True if successful, False otherwise.
def get_setup(self) -> bool

Gets user setup. The results are in system_setup.

RETURNS

bool
True if successful, False otherwise.
def set_setup(self, setup: SystemSetup) -> bool

Sets user setup.

RETURNS

bool
True if successful, False otherwise.
def get_system(self) -> bool

Gets system information. The results are in system_info.

RETURNS

bool
True if successful, False otherwise.
def get_components(self) -> bool

Gets hardware components information. The results are in system_components.

RETURNS

bool
True if successful, False otherwise.
def get_fft_test(self) -> bool

Gets FFT test. The results are in fft_data.

RETURNS

bool
True if successful, False otherwise.
def reset_fft(self)

Resets FFT queue.

def get_status_count(self) -> int

Gets count of status packets.

def get_status_packet(self) -> AppLayerPacket

Gets status from queue. This function should be used after starting tests and waiting for status.

RETURNS

AppLayerPacket
Status packet if successful, None otherwise.
def get_test_response(self) -> bool

Gets command response for system test. Use this function after start_system_tests and checking test status.

def set_working_folder(self, working_folder: str)

Sets working folder for data logging.

PARAMETERS

working_folder : str
A full path name of the folder where data will be logged. Note: Do not use shell extensions.
def start_logging(self, working_folder: str, prefix: str) -> bool

Starts logging data to working folder.

PARAMETERS

working_folder : str
A full path name of the folder where data will be logged. Note: Do not use shell extensions.
prefix : str
Prefix to use for automatically generated file name.

RETURNS

bool
True if successful, False otherwise.
def get_log_file_name(self)

Returns name of log file.

RETURNS

str
Full file name of the logging file if on, None otherwise.
def stop_logging(self)

Stops data logging.

def is_logging(self)

Checks if data are logged.

RETURNS

bool
True if data logging is on, False otherwise.
def register_ondata_callback(self, func, obj=None)

Registers on data received callback function.

The callback function should be define as follows: def func(output_data: dvl.system.OutputData, obj): where output_data are received by driver, and obj is any object.

def unregister_all_callbacks(self)

Unregisters all callback functions.

def reset(self)

Resets queues and decoder.

def change_baud_rate(self, baud_index: int) -> bool

Changes baud rate on open port.






MODULE DVL.COMMANDS

Contains several classes related to sending commands to Wayfinder.

GLOBAL VARIABLES

var COMMAND_TIMEOUT_SEC

Timeout for most commands (5 sec)

var LONG_COMMAND_TIMEOUT

Timeout for commands taking longer (15 sec)

CLASSES

class CommandIdType(value, names=None, *, module=None, qualname=None, type=None, start=1)

Enumerated type class that defines command IDs.

ANCESTORS

  • enum.Enum

CLASS VARIABLES

var ENTER_CMD_MODE

Enter command mode (stop pinging) command ID.

var EXIT_CMD_MODE

Exit command mode (start pinging) command ID.

var SOFTWARE_TRIGGER

Software trigger command ID.

var GET_TIME

Get system time command ID.

var SET_TIME

Set system time command ID.

var GET_SYSTEM

Get system information command ID.

var SET_SYSTEM

Set system information command ID.

var GET_SETUP

Get system setup command ID.

var SET_SETUP

Set system setup command ID.

var GET_TESTS

Get test results command ID.

var GET_FEATURES

Get features command ID.

var SET_FEATURES

Set features command ID.

var GET_FFT

Get FFT test command ID.

var RESET_TO_DEFAULTS

Reset to factory defaults command ID.

var SET_SPEED_OF_SOUND

Set speed of sound command ID.

var FIRMWARE_UPDATE

Start firmware update command ID.

var UPLOAD_FILE

Upload firmware file command ID.

var GET_COMPONENTS

Get hardware components information command ID.

var SET_COMPONENTS

Set hardware components information (internal only) command ID.

class ResponseStatusType(value, names=None, *, module=None, qualname=None, type=None, start=1)

Enumerated type class that defines command response status.

ANCESTORS

  • enum.Enum

CLASS VARIABLES

var NO_RESPONSE

No response from the system.

var SUCCESS

Successful execution.

var UNKNOWN_CMD

Unknown command.

var PARAM_INVALID

One or more parameters are invalid.

var CMD_EXEC_ERR

Error in command execution.

var CMD_SET_ERR

Set command error.

var CMD_GET_ERR

Get command error.

var NORUN_WITH_PING

Cannot execute command while pinging.

var CANNOT_OPEN_PORT

Cannot open COM port.

class ResponseErrorType(value, names=None, *, module=None, qualname=None, type=None, start=1)

Enumerated type class that defines command response error.

ANCESTORS

  • enum.Enum

CLASS VARIABLES

var INVALID_NONE

No error - All parameters are valid.

var INVALID_BAUD

Invalid baud rate.

var INVALID_TRIGGER

Invalid trigger enable/disable value.

var INVALID_SOS

Invalid speed of sound.

var INVALID_MAXDEPTH

Invalid maximum depth.

var INVALID_DATETIME

Invalid date/time.

class Communicator(port=None)

Class that implements binary communication layer.

SUBCLASSES

METHODS

def decode_packets(self, arr)

Decodes binary packets and puts them into queues.

def send_packet(self, packet: PhysicalLayerPacket)

Sends physical layer packet to DVL.

def flush_fft_queue(self)

Flushes FFT data queue.

def flush_cmd_queue(self)

Flushes command queue.

def flush_status_queue(self)

Flushes status queue.

def get_cmd_packet(self, time_out: int = 0) -> AppLayerPacket

Gets command response packet.

def get_fft_count(self)

Returns number of available FFT packets.

def get_fft_packet(self, time_out)

Gets the FFT packet from queue.

def get_status_count(self)

Returns number of available status packets.

def get_status_packet(self, time_out)

Gets the data packet from queue.

def send_and_wait_for_response(self, packet: AppLayerPacket, timeout: int = 0, debug: bool = False) -> AppLayerPacket

Sends packet and waits for response.

def register_ondata_callback(self, func, obj)

Registers receive callback function.

def unregister_all_callbacks(self)

Unregisters all callback functions.

def reset(self)

Resets queues and decoder.

class BinaryCommands(port=None)

Binary commands interface.

ANCESTORS

METHODS

def enter_command_mode(self) -> ResponseStatusType

Enters command mode (stops pinging).

def exit_command_mode(self) -> ResponseStatusType

Exits command mode (start pinging).

def reset_to_defaults(self) -> ResponseStatusType

Resets to factory defaults.

def get_time(self)

Gets system time.

def set_time(self, date_time: )

Sets system time.

def set_speed_of_sound(self, value: float)

Sets speed of sound.

def get_system(self)

Gets DVL system information.

def get_components(self)

Gets DVL hardware components information.

def get_tests(self)

Gets DVL system tests.

def get_setup(self)

Gets user setup.

def set_setup(self, setup: SystemSetup)

Sets user setup.

def get_features(self)

Gets DVL system features.

def set_system_features(self, feature_code: bytearray)

Sets DVL features.​

def send_software_trigger(self)

Sends software trigger to ping

def send_cmd(self, cmd: CommandIdType, timeout=5) -> (ResponseStatusType'>, AppLayerPacket'>)

Sends command and waits for response.


def get_fft_test(self)

Gets FFT samples.

def start_system_update(self, file_size: int, chunk_size: int)

Starts firmware update.
def upload_file(self, arr: bytearray, chunk_size: int)

Uploads chunk of the file.

def send_cmd_without_wait(self, cmd: CommandIdType) -> (ResponseStatusType'>, AppLayerPacket'>)

Sends command without waiting for response.

INHERITED MEMBERS

FUNCTIONS

def check_response(packet: AppLayerPacket, expected_cmd: CommandIdType) -> ResponseStatusType

Checks command response.




MODULE DVL.PACKET​S

Contains several classes that implement binary packet interface.

CLASSES

class AppLayerIdType(value, names=None, *, module=None, qualname=None, type=None, start=1)

Enumerated type class that defines IDs for application layer packets.

ANCESTORS

  • enum.Enum

CLASS VARIABLES

var UNKNOWN

Unknown command.

var CMD_2LETTER

Two letter command.

var RSP_2LETTER

Two letter response.

var CMD_BIN

Binary command.

var RSP_BIN

Binary response.

var DATA_PD

Binary data.

var DATA_NMEA

NMEA data.

var STATUS

Status response.

var FFT_DATA

FFT data.

class AppLayerPacket(arr=None)

Application layer communications interface.

METHODS

def get_payload(self)

Returns payload of application layer packet

def get_bytes(self)

Returns byte array that corresponds to application layer packet

def create_empty(self)

Creates empty packet

def create_from_array(self, arr: bytearray) -> bytearray

Creates application layer packet from byte array

def create_from_payload(self, packet_id: int, payload: bytearray)

Creates application layer packet from payload

class PhysicalLayerPacket(payload: AppLayerPacket = None, packet_id: int = 1, version: int = 16)

Physical layer communications interface

CLASS VARIABLES

var PACKET_VER

Packet version number.

var PACKET_ID

Packet ID number.

var MIN_PACKET_LEN

Minimum packet length.

var CHECKSUM_LENGTH

Checksum length.

INSTANCE VARIABLES

var version : int

Physical layer packet version.

RETURNS

int
The version of the communication protocol being used.
var packet_id : int

Physical layer packet ID.

RETURNS

int
Physical layer packet ID.
var length : int

The length of the physical layer packet minus the checksum.

RETURNS

int
The packet length.
var payload : AppLayerPacket

The application layer packet encoded into a bytearray.

RETURNS

bytearray
The application layer packet encoded into a bytearray.
var checksum : int

The checksum of the physical layer packet.

RETURNS

int
The checksum of the physical layer packet.

METHODS

def encode(self) -> bytearray

Converts the packet into its bytearray representation.

RETURNS

bytearray
The bytearray that represents the physical layer packet.
class DecoderState(value, names=None, *, module=None, qualname=None, type=None, start=1)

Enumerated type class that defines state of the decoder.

ANCESTORS

  • enum.Enum

CLASS VARIABLES

var START_BYTE

Searching for packet start byte.

var VER_BYTE

Searching for packet version number.

var PKT_ID

Searching for packet ID.

var PKT_LEN

Searching for packet length.

var PAYLOAD

Searching for payload.

var CHECKSUM

Searching for checksum.

class PacketDecoder

Finds and decodes physical layer packets.

METHODS

def parse_bytes(self, arr)

Parses bytes array.

def clear(self)

Clears decoder state.

def on_start(self, byte)

Searches for start of the packet.

def on_ver(self, byte)

Decodes version.

def on_id(self, byte)

Decodes packet ID.

def on_len(self, byte)

Decodes packet length.

def on_payload(self, byte)

Decodes payload.

def on_checksum(self, byte)

Decodes and checks checksum.

def restart(self)

Restarts search.

def parse_byte(self, byte)

Parses one byte.

FUNCTIONS

def decode(packet: bytearray) -> PhysicalLayerPacket

Convert a bytearray that represents a physical layer packet into a PhysicalLayerPacket object.

PARAMETERS

packet : bytearray
A bytearray that represents a physical layer packet.

RETURNS

PhysicalLayerPacket
A object that represents the original bytearray.
def calc_checksum(arr: bytearray) -> int

Calculates a 2 byte sum of the byte array ignoring rollover.

PARAMETERS

arr : bytearray
The full range of bytes that the checksum should be calculated on.

RETURNS

int
The checksum of the bytes.





​​

MODULE DVL.SYSTEM

Contains several classes that hold information from Wayfinder.

CLASSES

class DateTime

Date and time helper class for getting/setting system time.

STATIC METHODS

def decode(packet: AppLayerPacket)

Decodes date and time from application layer packet.

def encode(date_time: <module 'datetime' from 'c:\\users\\apulawska\\.conda\\envs\\wayfinder_tools\\lib\\datetime.py'>, cmd_id: int) -> AppLayerPacket

Encodes date and time into application layer packet.

PARAMETERS

date_time : datetime
Date and time to set system clock.
cmd_id : int
Command ID for setting the system time.

RETURNS

AppLayerPacket
Application layer packet class.
class SystemInfo

Class that contains system information.

INSTANCE VARIABLES

var is_valid

Defines if data in the class are valid (i.e. they are decoded properly)

var struct_id

Structure ID number.

var version

Structure version number.

var size

Structure size.

var frequency

System frequency in Hz.

var fw_major_version

Firmware major number.

var fw_minor_version

Firmware minor number.

var fw_patch_version

Firmware patch number.

var fw_build_version

Firmware build number.

var fpga_version

FPGA firmware number.

var system_id

System ID number.

var xducer_type

Transducer type.

var beam_angle

Beam angle in degrees (for Wayfinder 30 deg).

var has_vertical_beam

Defines if vertical beam is present.

var system_type

System type (for Wayfinder 76).

var system_subtype

System sub-type (for Wayfinder 0).

METHODS

def to_string(self)

Outputs information to string for logging

def decode(self, packet: AppLayerPacket)

Decodes system info from application layer packet.

def decode_from_array(self, arr: bytearray)

Decodes system info from byte array.

def get_fw_version(self)

Returns firmware version string in format 'x.xx.xx.xx'.

def get_settings(self)

Returns system info in form of settings.

class SystemComponents

Class that contains system hardware components information.

INSTANCE VARIABLES

var is_valid

Defines if data in the class are valid (i.e. they are decoded properly)

var struct_id

Structure ID number.

var version

Structure version number.

var size

Structure size.

var num_hardware

Number of hardware boards.

var hardware_pn

List of part numbers for hardware.

var hardware_rev

List of revision numbers for hardware.

var hardware_sn

List of serial numbers for hardware.

METHODS

def to_string(self)

Outputs information to string for logging

def decode(self, packet: AppLayerPacket)

Decodes system info from application layer packet.

def decode_from_array(self, arr: bytearray)

Decodes system info from byte array.

def get_index(self, string)

Returns index of string in part number.

def get_settings(self)

Returns system info in form of settings.

class SystemFeatures

Class that contains system features results.

STATIC METHODS

def encode(feature_code: bytearray, cmd_id: int)

Encodes arr of feature codes to AppLayerPacket.

INSTANCE VARIABLES

var is_valid

Defines if data in the class are valid (i.e. they are decoded properly)

var struct_id

Structure ID number.

var version

Structure version number.

var size

Structure size.

var features

List of features status: (1 installed, 0 not).

METHODS

def to_string(self)

Outputs information to string for logging

def decode_from_array(self, arr: bytearray)

Decodes system features from byte array.

def decode(self, packet: AppLayerPacket)

Decodes system features from application layer packet.

def get_settings(self)

Returns array of settings for features.

class SystemSetup

Class that contains user system setup.

STATIC METHODS

def encode(setup, cmd_id: int)

Encodes system setup to application layer packet.

INSTANCE VARIABLES

var is_valid

Defines if data in the class are valid (i.e. they are decoded properly)

var struct_id

Structure ID number.

var version

Structure version number.

var size

Structure size.

var software_trigger

Software trigger flag (0 - disabled, 1 - enabled).

var baud_rate_type

Baud rate type (3 - 9600, 7 - 115200).

var speed_of_sound

Speed of sound in m/s.

var max_depth

Maximum tracking depth in meters.

var max_vb_range

Maximum vertical beam range in meters.

METHODS

def to_string(self)

Outputs information to string for logging

def decode_from_array(self, arr: bytearray)

Decodes system setup from byte array.

def decode(self, packet: AppLayerPacket)

Decodes system setup from application layer packet.

def get_settings(self)

Returns system setup in form of settings.

def set_from_settings(self, settings)

Sets system setup from settings.

class SystemTests

Class that contains system tests results.

INSTANCE VARIABLES

var is_valid

Defines if data in the class are valid (i.e. they are decoded properly)

var struct_id

Structure ID number.

var version

Structure version number.

var size

Structure size.

var tests

List of test results.

METHODS

def to_string(self)

Outputs information to string for logging

def decode(self, pkt: AppLayerPacket)

Decodes system tests from application layer packet.

def decode_from_array(self, arr: bytearray)

Decodes system tests from byte array.

def get_settings(self)

Returns arrays of settings for tests.

class SystemUpdate

Class that contains system firmware update logic.

STATIC METHODS

def encode(file_size: int, chunk_size: int, cmd_id: int)

Encodes request to start firmware update to AppLayerPacket.

def encode_data(data: bytearray, cmd_id: int, chunk_size: int)

Encodes request to start firmware update to AppLayerPacket.

INSTANCE VARIABLES

var struct_id

Structure ID number.

var version

Structure version number.

var size

Structure size.

class SystemUpdateStatus

Class that contains system firmware update status.

INSTANCE VARIABLES

var is_valid

Defines if data in the class are valid (i.e. they are decoded properly)

var struct_id

Structure ID number.

var version

Structure version number.

var size

Structure size

var monolith

Monolith status.

var fpga_image

FPGA image status.

var fpga_update

FPGA update status.

var apps_image

Firmware image status.

var apps_update

Firmware update status.

METHODS

def decode_from_array(self, arr: bytearray)

Decodes system firmware update status from byte array.

def decode(self, packet: AppLayerPacket)

Decodes system update from application layer packet.

class OutputData(arr: bytearray)

Class that contains output ping data.

CLASS VARIABLES

var COORDINATES

List of coordinate systems ("Beam", "XYZ", "Ship", "Earth").

INSTANCE VARIABLES

var is_valid

Defines if data in the class are valid.

var count

Count used externally to count number of data packets.

var struct_id

Structure ID number.

var version

Structure version number.

var system_type

System type (76 for Wayfinder).

var system_subtype

System sub-type (0 for Wayfinder).

var fw_major_version

Firmware major number.

var fw_minor_version

Firmware minor number.

var fw_patch_version

Firmware patch number.

var fw_build_version

Firmware build number.

var year

Part of ping time stamp - year.

var month

Part of ping time stamp - month.

var day

Part of ping time stamp - day.

var hour

Part of ping time stamp - hour.

var minute

Part of ping time stamp - minute.

var second

Part of ping time stamp - second.

var coordinate_system

Coordinate system (0 - 3).

var vel_x

Beam 1 or X velocity in m/s.

var vel_y

Beam 2 or Y velocity in m/s.

var vel_z

Beam 3 or Z velocity in m/s.

var vel_err

Beam 4 or error velocity in m/s.

var range_beam1

Beam 1 range to bottom in meters.

var range_beam2

Beam 2 range to bottom in meters.

var range_beam3

Beam 3 range to bottom in meters.

var range_beam4

Beam 4 range to bottom in meters.

var mean_range

Mean range to bottom in meters.

var speed_of_sound

Speed of sound used in m/s.

var status

Status word.

var bit_count

Number built in test errors.

var bit_code

Built in test error code. For more information please refer to Wayfinder DVL guide.

var voltage

Input voltage in Volts.

var transmit_voltage

Transmit voltage in Volts.

var current

Current in Amps.

var serial_number

Serial number of the system.

METHODS

def is_range_valid(self, beam=None)

Returns if range to bottom is valid

PARAMETERS

beam : int
Beam number (1-4). If None range corresponds to mean range.

RETURNS

bool
True if value is valid, False otherwise.
def is_velocity_valid(self, component=None)

Returns if velocity is valid

PARAMETERS

component : int
Component number (1-4). If None velocity validity corresponds to magnitude.

RETURNS

bool
True if value is valid, False otherwise.
def get_fw_version(self) -> str

Gets firmware version as string

def get_date_time(self)

Gets date time

def get_settings(self)

Returns data in form of settings

class FftTest

Class that contains FFT (interference) test

STATIC METHODS

def encode(setup, cmd_id: int)

Encodes system setup to byte array

INSTANCE VARIABLES

var is_valid

Defines if data in the class are valid (i.e. they are decoded properly)

var struct_id

Structure ID number.

var version

Structure version.

var size

Structure size.

var samples_to_collect

Samples to collect.

var fft_len

FFT length.

var sample_offset

Sample offset.

var gain

Gain.

var beam_mask

Beam mask.

var bandwidth

Bandwidth.

var system_freq

System frequency.

class FftData(arr: bytearray)

Class that contains FFT (interference) test data

CLASS VARIABLES

var NUM_BEAMS

INSTANCE VARIABLES

var is_valid

Defines if data in the class are valid (i.e. they are decoded properly)

METHODS

def decode_from_array(self, arr: bytearray)

Decodes system tests from byte array

def decode(self, packet: AppLa​yerPacket)

Decodes system tests from application layer packet

def process(self)

Processes FFT data

def average(self, fft)

Averages FFT

class FftBeamData(beam_no: int, fft_len: int)

Class that stores FFT beam data

INSTANCE VARIABLES

var beam

Beam number (0-3)

var fft_len

FFT length.

var signal

Original signal.

var spectrum

Power spectrum.

var power_ratio

Power ratio in dB.

var peak_index

Peak index.

var frequency_peak

Frequency peak in kHz.

var power_peak

Power peak in dB.

var processed

Flag to indicate if data were processed.

METHODS

def do_fft(self)

Performs FFT.

def average(self, beam_data, count: int)

Averages FFT data in a beam.

class SystemInfoIdType(value, names=None, *, module=None, qualname=None, type=None, start=1)

Enumerated type class that defines system info IDs. Used with list of settings for display.

ANCESTORS

  • enum.Enum

CLASS VARIABLES

var FREQUENCY

Frequency ID.

var FIRMWARE_VERSION

Firmware version.

var FPGA_VERSION

FPGA version.

var SYSTEM_ID

System ID.

class ComponentsIdType(value, names=None, *, module=None, qualname=None, type=None, start=1)

Enumerated type class that defines hardware components IDs. Used with list of settings for display.

ANCESTORS

  • enum.Enum

CLASS VARIABLES

var CPU_PN

CPU part number.

var XDR_PN

XDR part number.

var DSC_PN

DSC part number.

var SYS_PN

SYS part number.

var CPU_REV

CPU revision number.

var XDR_REV

XDR revision number.

var DSC_REV

DSC revision number.

var SYS_REV

SYS revision number.

var CPU_SN

CPU serial number.

var XDR_SN

XDR serial number.

var DSC_SN

DSC serial number.

var SYS_SN

SYS serial number.

var CPU_PN_SN

CPU part and serial number.

var XDR_PN_SN

XDR part and serial number.

var DSC_PN_SN

DSC part and serial number.

var SYS_PN_SN

SYS part and serial number.

class FeaturesIdType(value, names=None, *, module=None, qualname=None, type=None, start=1)

Enumerated type class that defines features IDs. Used with list of settings for display.

ANCESTORS

  • enum.Enum

CLASS VARIABLES

var BASE_ACC_FEATURE

Base accuracy feature.

var HIGH_ACC_FEATURE

High accuracy feature.

class BaudRateType(value, names=None, *, module=None, qualname=None, type=None, start=1)

Enumerated type class that defines baud rate types.

ANCESTORS

  • enum.Enum

CLASS VARIABLES

var BAUD_9600

9600 baud rate.

var BAUD_115200

115200 baud rate.

class SetupIdType(value, names=None, *, module=None, qualname=None, type=None, start=1)

Enumerated type class that defines system setup IDs. Used with list of settings for display.

ANCESTORS

  • enum.Enum

CLASS VARIABLES

var SOFTWARE_TRIGGER

Software trigger.

var BAUD_RATE_TYPE

Baud rate type

var SPEED_OF_SOUND

Speed of sound.

var MAX_RANGE

Maximum depth range.

var NUM_SETTINGS

Number of setup settings

class TestsIdType(value, names=None, *, module=None, qualname=None, type=None, start=1)

Enumerated type class that defines system tests IDs. Used with list of settings for display.

ANCESTORS

  • enum.Enum

CLASS VARIABLES

var SDRAM_TEST

SDRAM test.

var FRAM_TEST

FRAM test.

var RTC_TEST

Real-time clock test.

var EEPROM_TEST

EEPROM test.

var QSPI_DSC_TEST

QSPI/DSC test.

var ADC_TEST

ADC test.

class TestResultIdType(value, names=None, *, module=None, qualname=None, type=None, start=1)

Enumerated type class that defines system tests results IDs.

ANCESTORS

  • enum.Enum

CLASS VARIABLES

var NOT_RUN

Test was not executed yet.

var FAILED

Test failed.

var PASSED

Test passed.

var RUNNING

Test is running.

class DataIdType(value, names=None, *, module=None, qualname=None, type=None, start=1)

Enumerated type class that defines IDs for output data. Used with list of settings for display.

ANCESTORS

  • enum.Enum

CLASS VARIABLES

var COUNT

Count of packets.

var DATE

Date of the ping.

var TIME

Time of the ping.

var COORD_SYSTEM

Coordinate system.

var VEL_X

X velocity.

var VEL_Y

Y velocity.

var VEL_Z

Z velocity.

var VEL_ERR

Error velocity.

var RANGE1

Range to bottom beam 1.

var RANGE2

Range to bottom beam 2.

var RANGE3

Range to bottom beam 3.

var RANGE4

Range to bottom beam 4.

var MEAN_RANGE

Mean range to bottom.

var SPEED_OF_SOUND

Speed of sound.

var VOLTAGE

Input voltage.

var TRANSMIT_VOLTAGE

Transmit voltage.

var CURRENT

Transmit current.

var STATUS

Ping status.

var BIT_COUNT

Number of built in tests.

var BIT_CODE

Built in test code.






MODUL​E DVL.UTIL

Contains several utilities classes.​

CLASSES

class Setting(setting_id, name, value, fmt='', units='')

Helper class for data display.

CLASS VARIABLES

var INVALID

String for display when data are invalid.

var NO_DATA

String for display when there is no new data.

INSTANCE VARIABLES

var setting_id

Setting's ID.

var name

Name of the setting.

var format

Format string to convert value for display.

var units

Units for the setting.

var min_value

Minimum value used for validation.

var max_value

Maximum value used for validation.

var value

Value of the setting (float, int, str).

var value_string

Display string representing value.

METHODS

def set_min_max(self, min_value, max_value)

Sets minimum and maximum values.

def update(self, value)

Updates value and value_string.

class SerialPort(com='COM1', baud_rate=115200)

Class responsible for serial communications.

PARAMETERS

com : str
String that represents COM port to be opened, for example "COM1".
baud_rate : int
Baud-rate to use when opening the port.

INSTANCE VARIABLES

var com

String that represents COM port.

var baudrate

Serial port baud rate.

var serial_port

Serial port object.

METHODS

def open(self, com: str, baud_rate: int) -> bool

Opens serial port.

PARAMETERS

com : str
String that represents COM port to be opened, for example "COM1".
baud_rate : int
Baud-rate to use when opening the port.

RETURNS

bool
True if port is opened, False otherwise.
def is_open(self) -> bool

Checks if port is open.

RETURNS

bool
True if port is opened, False otherwise.
def close(self)

Closes serial port.

def write(self, array: bytearray)

Writes byte array to port.

PARAMETERS

array : byte array
The byte array to be written to serial port.
def register_receive_callback(self, function)

Registers receive callback function.

PARAMETERS

function
Callback function.
def unregister_all_callbacks(self)

Unregisters all callback functions.

def set_baudrate(self, baud_rate: int) -> bool

Changes baud-rate of the open port.

PARAMETERS

baud_rate : int
Changes the baud rate and re-opens the port.

RETURNS

bool
True if port is opened, False otherwise.
class DataLogger

Class responsible for data logging.

METHODS

def is_logging(self) -> bool

Checks if data are logged.

RETURNS

bool
True if file is opened for logging, False otherwise.
def open_file(self, working_folder: str, prefix: str, ext='.pd') -> str

Creates file for data logging - name is auto generated (includes time stamp).

PARAMETERS

working_folder : str
A name of the folder where file will be opened.
prefix : str
A string to appended to front of the file name.
ext : str
Extension of the log file name.

RETURNS

str
On successful creation of the file returns file path. If the operation fails it returns None.
def open_file_with_name(self, name: str, append=True) -> str

Creates file for logging with user specified name.

PARAMETERS

name : str
A name (including path) of the file where data will be logged.

RETURNS

str
On successful creation of the file returns file path. If the operation fails it returns None.
def close_file(self)

Closes log file.

def write(self, array: bytearray)

Writes byte array to log data file.

PARAMETERS

array : byte array
The byte array to be written to log file.
def write_text(self, text: str)

Writes text to log data file.

PARAMETERS

text : str
The string to be written to log file.

FUNCTIONS

def print_bytes(array: bytearray) -> str

Outputs byte array and formats for pretty print.

16 bytes are printed per line with additional space between 8 byte groups so that they are easier to distinguish. Example: AA 10 01 1B 00 02 03 14 00 02 00 00 1F 23 10 0C 00 00 00 14 03 1B 09 14 2E CC 01

PARAMETERS

array : byte array
The byte array to be pretty printed.

RETURNS

str
A pretty string representation of the byte array.
def print_bytearray(array: bytearray) -> str

Outputs string of all bytes in HEX without any formatting.

PARAMETERS

array : byte array
The byte array to be printed.

RETURNS

str
A string representation of the byte array in HEX format.
def indent_string(string: str) -> str

Indents string for printing.

PARAMETERS

string : str
Input string to be printed.

RETURNS

str
A string representation of lines with indentation.