Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | List of all members
mtdevice.MTDevice Class Reference

MTDevice class. More...

Inheritance diagram for mtdevice.MTDevice:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self, port, baudrate=115200, timeout=0.002, autoconf=True, config_mode=False, verbose=False, initial_wait=0.1)
 
def AdjustUTCTime (self, ticks)
 
def auto_config_legacy (self)
 
def ChangeBaudrate (self, baudrate)
 
def configure_legacy (self, mode, settings, period=None, skipfactor=None)
 High-level utility functions. More...
 
def GetAlignmentRotation (self, parameter)
 
def GetAvailableScenarios (self)
 
def GetBaudrate (self)
 
def GetConfiguration (self)
 
def GetCurrentScenario (self)
 
def GetDeviceID (self)
 
def GetErrorMode (self)
 
def GetExtOutputMode (self)
 
def GetFirmwareRev (self)
 
def GetGnssPlatform (self)
 
def GetHardwareVersion (self)
 
def GetLatLonAlt (self)
 
def GetLocationID (self)
 
def GetOptionFlags (self)
 
def GetOutputConfiguration (self)
 
def GetOutputMode (self)
 
def GetOutputSettings (self)
 
def GetPeriod (self)
 
def GetProductCode (self)
 
def GetStringOutputType (self)
 
def GetSyncSettings (self)
 
def GetTransmitDelay (self)
 
def GetUTCTime (self)
 
def GoToConfig (self)
 
def GoToMeasurement (self)
 
def IccCommand (self, command)
 
def parse_MTData (self, data, mode=None, settings=None)
 
def parse_MTData2 (self, data)
 
def read_data_msg (self, buf=bytearray())
 
def read_measurement (self, mode=None, settings=None)
 
def read_msg (self)
 
def ReqDataLength (self)
 
def Reset (self, go_to_config=False)
 High-level functions. More...
 
def ResetOrientation (self, code)
 
def RestoreFactoryDefaults (self)
 
def RunSelfTest (self)
 
def SetAlignmentRotation (self, parameter, quaternion)
 
def SetBaudrate (self, brid)
 
def SetCurrentScenario (self, scenario_id)
 
def SetErrorMode (self, error_mode)
 
def SetExtOutputMode (self, ext_mode)
 
def SetGnssPlatform (self, platform)
 
def SetLatLonAlt (self, lat, lon, alt)
 
def SetLocationID (self, location_id)
 
def SetNoRotation (self, duration)
 
def SetOptionFlags (self, set_flags, clear_flags)
 
def SetOutputConfiguration (self, output_configuration)
 
def SetOutputMode (self, mode)
 
def SetOutputSettings (self, settings)
 
def SetOutputSkipFactor (self, skipfactor)
 
def SetPeriod (self, period)
 
def SetStringOutputType (self, string_output_type)
 
def SetSyncSettings (self, sync_settings)
 
def SetTransmitDelay (self, transmit_delay)
 
def SetUTCTime (self, ns, year, month, day, hour, minute, second, flag)
 
def waitfor (self, size=1)
 
def write_ack (self, mid, data=b'', n_resend=30, n_read=25)
 
def write_msg (self, mid, data=b'')
 Low-level communication. More...
 

Public Attributes

 device
 
 header
 
 length
 
 mode
 
 scenario_id
 
 scenarios
 
 settings
 
 state
 
 timeout
 
 verbose
 

Static Public Attributes

def GetAvailableFilterProfiles = GetAvailableScenarios
 
def GetFilterProfile = GetCurrentScenario
 
def SetFilterProfile = SetCurrentScenario
 

Private Member Functions

def _ensure_config_state (self)
 
def _ensure_measurement_state (self)
 

Detailed Description

MTDevice class.

XSens MT device communication object.

Definition at line 20 of file mtdevice.py.

Constructor & Destructor Documentation

◆ __init__()

def mtdevice.MTDevice.__init__ (   self,
  port,
  baudrate = 115200,
  timeout = 0.002,
  autoconf = True,
  config_mode = False,
  verbose = False,
  initial_wait = 0.1 
)
Open device.

Definition at line 24 of file mtdevice.py.

Member Function Documentation

◆ _ensure_config_state()

def mtdevice.MTDevice._ensure_config_state (   self)
private
Switch device to config state if necessary.

Definition at line 186 of file mtdevice.py.

◆ _ensure_measurement_state()

def mtdevice.MTDevice._ensure_measurement_state (   self)
private
Switch device to measurement state if necessary.

Definition at line 191 of file mtdevice.py.

◆ AdjustUTCTime()

def mtdevice.MTDevice.AdjustUTCTime (   self,
  ticks 
)
Adjust UTC Time of device using correction ticks (0.1 ms).

Definition at line 633 of file mtdevice.py.

◆ auto_config_legacy()

def mtdevice.MTDevice.auto_config_legacy (   self)
Read configuration from device in legacy mode.

Definition at line 687 of file mtdevice.py.

◆ ChangeBaudrate()

def mtdevice.MTDevice.ChangeBaudrate (   self,
  baudrate 
)
Change the baudrate, reset the device and reopen communication.

Definition at line 1160 of file mtdevice.py.

◆ configure_legacy()

def mtdevice.MTDevice.configure_legacy (   self,
  mode,
  settings,
  period = None,
  skipfactor = None 
)

High-level utility functions.

Configure the mode and settings of the MT device in legacy mode.

Definition at line 664 of file mtdevice.py.

◆ GetAlignmentRotation()

def mtdevice.MTDevice.GetAlignmentRotation (   self,
  parameter 
)
Get the object alignment.

parameter indicates the desired alignment quaternion:
    0 for sensor alignment (RotSensor),
    1 for local alignment (RotLocal).

Definition at line 434 of file mtdevice.py.

◆ GetAvailableScenarios()

def mtdevice.MTDevice.GetAvailableScenarios (   self)
Get the available XKF scenarios on the device.

Definition at line 554 of file mtdevice.py.

◆ GetBaudrate()

def mtdevice.MTDevice.GetBaudrate (   self)
Get the current baudrate id of the device.

Definition at line 269 of file mtdevice.py.

◆ GetConfiguration()

def mtdevice.MTDevice.GetConfiguration (   self)
Ask for the current configuration of the MT device.

Definition at line 364 of file mtdevice.py.

◆ GetCurrentScenario()

def mtdevice.MTDevice.GetCurrentScenario (   self)
Get the ID of the currently used XKF scenario.

Definition at line 570 of file mtdevice.py.

◆ GetDeviceID()

def mtdevice.MTDevice.GetDeviceID (   self)
Get the device identifier.

Definition at line 226 of file mtdevice.py.

◆ GetErrorMode()

def mtdevice.MTDevice.GetErrorMode (   self)
Get the current error mode of the device.

Definition at line 280 of file mtdevice.py.

◆ GetExtOutputMode()

def mtdevice.MTDevice.GetExtOutputMode (   self)
Get current extended output mode (for alternative UART).

Definition at line 480 of file mtdevice.py.

◆ GetFirmwareRev()

def mtdevice.MTDevice.GetFirmwareRev (   self)
Get the firmware version.

Definition at line 246 of file mtdevice.py.

◆ GetGnssPlatform()

def mtdevice.MTDevice.GetGnssPlatform (   self)
Get the current GNSS navigation filter settings.

Definition at line 588 of file mtdevice.py.

◆ GetHardwareVersion()

def mtdevice.MTDevice.GetHardwareVersion (   self)
Get the hardware version.

Definition at line 239 of file mtdevice.py.

◆ GetLatLonAlt()

def mtdevice.MTDevice.GetLatLonAlt (   self)
Get the stored position of the device.
It is used internally for local magnetic declination and local gravity.

Definition at line 531 of file mtdevice.py.

◆ GetLocationID()

def mtdevice.MTDevice.GetLocationID (   self)
Get the location ID of the device.

Definition at line 317 of file mtdevice.py.

◆ GetOptionFlags()

def mtdevice.MTDevice.GetOptionFlags (   self)
Get the option flags (MTi-1 series).

Definition at line 304 of file mtdevice.py.

◆ GetOutputConfiguration()

def mtdevice.MTDevice.GetOutputConfiguration (   self)
Get the output configuration of the device (mark IV).

Definition at line 393 of file mtdevice.py.

◆ GetOutputMode()

def mtdevice.MTDevice.GetOutputMode (   self)
Get current output mode.

Definition at line 466 of file mtdevice.py.

◆ GetOutputSettings()

def mtdevice.MTDevice.GetOutputSettings (   self)
Get current output mode.

Definition at line 493 of file mtdevice.py.

◆ GetPeriod()

def mtdevice.MTDevice.GetPeriod (   self)
Get the sampling period.

Definition at line 421 of file mtdevice.py.

◆ GetProductCode()

def mtdevice.MTDevice.GetProductCode (   self)
Get the product code.

Definition at line 233 of file mtdevice.py.

◆ GetStringOutputType()

def mtdevice.MTDevice.GetStringOutputType (   self)
Get the NMEA data output configuration.

Definition at line 408 of file mtdevice.py.

◆ GetSyncSettings()

def mtdevice.MTDevice.GetSyncSettings (   self)
Get the synchronisation settings.

Definition at line 349 of file mtdevice.py.

◆ GetTransmitDelay()

def mtdevice.MTDevice.GetTransmitDelay (   self)
Get the transmission delay (only RS485).

Definition at line 336 of file mtdevice.py.

◆ GetUTCTime()

def mtdevice.MTDevice.GetUTCTime (   self)
Get UTC time from device.

Definition at line 618 of file mtdevice.py.

◆ GoToConfig()

def mtdevice.MTDevice.GoToConfig (   self)
Place MT device in configuration mode.

Definition at line 215 of file mtdevice.py.

◆ GoToMeasurement()

def mtdevice.MTDevice.GoToMeasurement (   self)
Place MT device in measurement mode.

Definition at line 220 of file mtdevice.py.

◆ IccCommand()

def mtdevice.MTDevice.IccCommand (   self,
  command 
)
Command of In-run Compass Calibration (ICC).

Definition at line 639 of file mtdevice.py.

◆ parse_MTData()

def mtdevice.MTDevice.parse_MTData (   self,
  data,
  mode = None,
  settings = None 
)
Read and parse a legacy measurement packet.

Definition at line 1035 of file mtdevice.py.

◆ parse_MTData2()

def mtdevice.MTDevice.parse_MTData2 (   self,
  data 
)

Definition at line 705 of file mtdevice.py.

◆ read_data_msg()

def mtdevice.MTDevice.read_data_msg (   self,
  buf = bytearray() 
)
Low-level MTData receiving function.
Take advantage of known message length.

Definition at line 94 of file mtdevice.py.

◆ read_measurement()

def mtdevice.MTDevice.read_measurement (   self,
  mode = None,
  settings = None 
)

Definition at line 692 of file mtdevice.py.

◆ read_msg()

def mtdevice.MTDevice.read_msg (   self)
Low-level message receiving function.

Definition at line 131 of file mtdevice.py.

◆ ReqDataLength()

def mtdevice.MTDevice.ReqDataLength (   self)
Get data length for mark III devices.

Definition at line 513 of file mtdevice.py.

◆ Reset()

def mtdevice.MTDevice.Reset (   self,
  go_to_config = False 
)

High-level functions.

Reset MT device.

If go_to_config then send WakeUpAck in order to leave the device in
config mode.

Definition at line 199 of file mtdevice.py.

◆ ResetOrientation()

def mtdevice.MTDevice.ResetOrientation (   self,
  code 
)
Reset the orientation.

Code can take several values:
    0x0000: store current settings (only in config mode),
    0x0001: heading reset (NOT supported by MTi-G),
    0x0003: object reset.

Definition at line 601 of file mtdevice.py.

◆ RestoreFactoryDefaults()

def mtdevice.MTDevice.RestoreFactoryDefaults (   self)
Restore MT device configuration to factory defaults (soft version).

Definition at line 330 of file mtdevice.py.

◆ RunSelfTest()

def mtdevice.MTDevice.RunSelfTest (   self)
Run the built-in self test.

Definition at line 258 of file mtdevice.py.

◆ SetAlignmentRotation()

def mtdevice.MTDevice.SetAlignmentRotation (   self,
  parameter,
  quaternion 
)
Set the object alignment.

parameter indicates the desired alignment quaternion:
    0 for sensor alignment (RotSensor),
    1 for local alignment (RotLocal).

Definition at line 455 of file mtdevice.py.

◆ SetBaudrate()

def mtdevice.MTDevice.SetBaudrate (   self,
  brid 
)
Set the baudrate of the device using the baudrate id.

Definition at line 275 of file mtdevice.py.

◆ SetCurrentScenario()

def mtdevice.MTDevice.SetCurrentScenario (   self,
  scenario_id 
)
Set the XKF scenario to use.

Definition at line 577 of file mtdevice.py.

◆ SetErrorMode()

def mtdevice.MTDevice.SetErrorMode (   self,
  error_mode 
)
Set the error mode of the device.

The error mode defines the way the device deals with errors (expect
message errors):
    0x0000: ignore any errors except message handling errors,
    0x0001: in case of missing sampling instance: increase sample
counter and do not send error message,
    0x0002: in case of missing sampling instance: increase sample
counter and send error message,
    0x0003: in case of non-message handling error, an error message is
sent and the device will go into Config State.

Definition at line 287 of file mtdevice.py.

◆ SetExtOutputMode()

def mtdevice.MTDevice.SetExtOutputMode (   self,
  ext_mode 
)
Set extended output mode (for alternative UART).

Definition at line 487 of file mtdevice.py.

◆ SetGnssPlatform()

def mtdevice.MTDevice.SetGnssPlatform (   self,
  platform 
)
Set the GNSS navigation filter settings.

Definition at line 595 of file mtdevice.py.

◆ SetLatLonAlt()

def mtdevice.MTDevice.SetLatLonAlt (   self,
  lat,
  lon,
  alt 
)
Set the position of the device.
It is used internally for local magnetic declination and local gravity.

Definition at line 546 of file mtdevice.py.

◆ SetLocationID()

def mtdevice.MTDevice.SetLocationID (   self,
  location_id 
)
Set the location ID of the device (arbitrary).

Definition at line 324 of file mtdevice.py.

◆ SetNoRotation()

def mtdevice.MTDevice.SetNoRotation (   self,
  duration 
)
Initiate the "no rotation" procedure to estimate gyro biases.

Definition at line 612 of file mtdevice.py.

◆ SetOptionFlags()

def mtdevice.MTDevice.SetOptionFlags (   self,
  set_flags,
  clear_flags 
)
Set the option flags (MTi-1 series).

Definition at line 311 of file mtdevice.py.

◆ SetOutputConfiguration()

def mtdevice.MTDevice.SetOutputConfiguration (   self,
  output_configuration 
)
Set the output configuration of the device (mark IV).

Definition at line 401 of file mtdevice.py.

◆ SetOutputMode()

def mtdevice.MTDevice.SetOutputMode (   self,
  mode 
)
Select which information to output.

Definition at line 473 of file mtdevice.py.

◆ SetOutputSettings()

def mtdevice.MTDevice.SetOutputSettings (   self,
  settings 
)
Select how to output the information.

Definition at line 500 of file mtdevice.py.

◆ SetOutputSkipFactor()

def mtdevice.MTDevice.SetOutputSkipFactor (   self,
  skipfactor 
)
Set the output skip factor.

Definition at line 507 of file mtdevice.py.

◆ SetPeriod()

def mtdevice.MTDevice.SetPeriod (   self,
  period 
)
Set the sampling period.

Definition at line 428 of file mtdevice.py.

◆ SetStringOutputType()

def mtdevice.MTDevice.SetStringOutputType (   self,
  string_output_type 
)
Set the configuration of the NMEA data output.

Definition at line 415 of file mtdevice.py.

◆ SetSyncSettings()

def mtdevice.MTDevice.SetSyncSettings (   self,
  sync_settings 
)
Set the synchronisation settings (mark IV)

Definition at line 357 of file mtdevice.py.

◆ SetTransmitDelay()

def mtdevice.MTDevice.SetTransmitDelay (   self,
  transmit_delay 
)
Set the transmission delay (only RS485).

Definition at line 343 of file mtdevice.py.

◆ SetUTCTime()

def mtdevice.MTDevice.SetUTCTime (   self,
  ns,
  year,
  month,
  day,
  hour,
  minute,
  second,
  flag 
)
Set UTC time on the device.

Definition at line 626 of file mtdevice.py.

◆ waitfor()

def mtdevice.MTDevice.waitfor (   self,
  size = 1 
)
Get a given amount of data.

Definition at line 82 of file mtdevice.py.

◆ write_ack()

def mtdevice.MTDevice.write_ack (   self,
  mid,
  data = b'',
  n_resend = 30,
  n_read = 25 
)
Send a message and read confirmation.

Definition at line 165 of file mtdevice.py.

◆ write_msg()

def mtdevice.MTDevice.write_msg (   self,
  mid,
  data = b'' 
)

Low-level communication.

Low-level message sending function.

Definition at line 60 of file mtdevice.py.

Member Data Documentation

◆ device

mtdevice.MTDevice.device

Definition at line 29 of file mtdevice.py.

◆ GetAvailableFilterProfiles

def mtdevice.MTDevice.GetAvailableFilterProfiles = GetAvailableScenarios
static

Definition at line 584 of file mtdevice.py.

◆ GetFilterProfile

def mtdevice.MTDevice.GetFilterProfile = GetCurrentScenario
static

Definition at line 585 of file mtdevice.py.

◆ header

mtdevice.MTDevice.header

Definition at line 53 of file mtdevice.py.

◆ length

mtdevice.MTDevice.length

Definition at line 51 of file mtdevice.py.

◆ mode

mtdevice.MTDevice.mode

Definition at line 47 of file mtdevice.py.

◆ scenario_id

mtdevice.MTDevice.scenario_id

Definition at line 574 of file mtdevice.py.

◆ scenarios

mtdevice.MTDevice.scenarios

Definition at line 565 of file mtdevice.py.

◆ SetFilterProfile

def mtdevice.MTDevice.SetFilterProfile = SetCurrentScenario
static

Definition at line 586 of file mtdevice.py.

◆ settings

mtdevice.MTDevice.settings

Definition at line 49 of file mtdevice.py.

◆ state

mtdevice.MTDevice.state

Definition at line 42 of file mtdevice.py.

◆ timeout

mtdevice.MTDevice.timeout

Definition at line 40 of file mtdevice.py.

◆ verbose

mtdevice.MTDevice.verbose

Definition at line 26 of file mtdevice.py.


The documentation for this class was generated from the following file:


xsens_driver
Author(s):
autogenerated on Sun Sep 8 2019 03:15:59