Client¶
-
class
ixcom.parser.
Client
(host, port=3000, timeout=10)¶ Bases:
ixcom.parser.MessageParser
XCOM TCP Client
Implements a TCP-socket based XCOM client and offers convenience methods to interact with the device. Other classes may subscribe to decoded messages.
-
join_comm_thread
()¶ Join the communication thread Blocks the calling location until the communications thread terminates. Can e.g. be used if callbacks have been set up, logs have been requested and we just want to leave the program running like this until the communications with the device stop. :param self:
-
open_channel
(channelNumber=0)¶ Opens an XCOM logical channel
Opens an XCOM logical channel on the associated socket and waits for an ‘OK’ response.
Parameters: chnannelNumber – XCOM channel to open. Default = 0
Raises: ClientTimeoutError
– Timeout while waiting for response from the XCOM serverResponseError
– The response from the system was not ‘OK’
-
open_last_free_channel
()¶ Opens an XCOM logical channel
Opens an XCOM logical channel on the associated socket and waits for an ‘OK’ response.
Raises: ClientTimeoutError
– Timeout while waiting for response from the XCOM serverResponseError
– The response from the system was not ‘OK’RuntimeError
– If no free channel is available on the system.
Returns: number of the opened channel
Return type: channelNumber
-
open_first_free_channel
()¶ Opens an XCOM logical channel
Opens an XCOM logical channel on the associated socket and waits for an ‘OK’ response.
Raises: ClientTimeoutError
– Timeout while waiting for response from the XCOM serverResponseError
– The response from the system was not ‘OK’RuntimeError
– If no free channel is available on the system.
Returns: number of the opened channel
Return type: channelNumber
-
close_channel
()¶ Closes XCOM logical channel
Closes XCOM channel on the associated socket and waits for an ‘OK’ response.
Raises: ClientTimeoutError
– Timeout while waiting for response from the XCOM serverResponseError
– The response from the system was not ‘OK’
-
reboot
()¶ Reboots the system
Sends an XCOM reboot command on the associated socket and waits for an ‘OK’ response.
Raises: ClientTimeoutError
– Timeout while waiting for response from the XCOM serverResponseError
– The response from the system was not ‘OK’
-
get_parameter
(parameterID: int)¶ Gets parameter from device with specified ID
Gets the specified parameter. Blocks until parameter is retrieved.
Parameters: parameterID – ID of the parameter to retrieve
Returns: An XcomMessage object containing the parameter
Raises: ClientTimeoutError
– Timeout while waiting for response or parameter from the XCOM serverResponseError
– The response from the system was not ‘OK’
-
set_aligncomplete
()¶ Completes the alignment
Completes system alignment by sending the EKF ALIGN_COMPLETE command. Blocks until system repsonse is received.
Raises: ClientTimeoutError
– Timeout while waiting for response from the XCOM serverResponseError
– The response from the system was not ‘OK’
-
realign
()¶ Initiates a new alignment
Initiates a new system alignment by sending the EKF ALIGN command. Blocks until system repsonse is received.
Raises: ClientTimeoutError
– Timeout while waiting for response from the XCOM serverResponseError
– The response from the system was not ‘OK’
-
save_pos
()¶ Saves the current position
Saves the current system position in ROM. Uses the EKF SAVE_POS command
Raises: ClientTimeoutError
– Timeout while waiting for response from the XCOM serverResponseError
– The response from the system was not ‘OK’
-
save_hdg
()¶ Saves the current heading
Saves the current heading value in ROM. Uses the EKF SAVE_HDG command
Raises: ClientTimeoutError
– Timeout while waiting for response from the XCOM serverResponseError
– The response from the system was not ‘OK’
-
forced_zupt
(enable: bool)¶ Enables or disables forced Zero Velocity updates
Enables or disables forced Zero Velocity updates using the EKF FORCED_ZUPT command.
Parameters: enable – boolean value to enable or disable ZUPTs.
Raises: ClientTimeoutError
– Timeout while waiting for response from the XCOM serverResponseError
– The response from the system was not ‘OK’
-
save_antoffset
(antenna: int)¶ Saves the currently estimated GNSS antenna offset
Saves the currently estimated GNSS antenna offset using the EKF SAVE_ANTOFFSET command.
Parameters: antenna – Antenna # to save the offset for.
Raises: ClientTimeoutError
– Timeout while waiting for response from the XCOM serverResponseError
– The response from the system was not ‘OK’
-
save_config
()¶ Saves the current configuration
Saves the current configuration to ROM using the CONF SAVE_CONFIG command.
Raises: ClientTimeoutError
– Timeout while waiting for response from the XCOM serverResponseError
– The response from the system was not ‘OK’
-
load_config
()¶ Loads the configuration from ROM
Loads the configuration from ROM using the CONF LOAD_CONFIG command.
Raises: ClientTimeoutError
– Timeout while waiting for response from the XCOM serverResponseError
– The response from the system was not ‘OK’
-
factory_reset
()¶ Performs a factory reset
Performs a factory reset using the CONF FACTORY_RESET command.
Raises: ClientTimeoutError
– Timeout while waiting for response from the XCOM serverResponseError
– The response from the system was not ‘OK’
-
add_log_with_rate
(msgID: int, rate: float)¶ Add a log with specified rate
Adds a log with a specific message ID with a specified rate. The divider is computed by taking into account the MAINTIMING and PRESCALER system parameters.
Parameters: - msgID – Mesage ID which should be requested.
- rate – Requested log rate in Hz
Raises: ClientTimeoutError
– Timeout while waiting for response from the XCOM serverResponseError
– The response from the system was not ‘OK’ or if rate too high.
-
get_divider_for_rate
(rate: float)¶ Determines the divider resulting in a certain log output rate for this system.
Parameters: rate – output rate in Hz
Returns: Divider which results in an output rate as close as possible to the requested rate.
Raises: ClientTimeoutError
– Timeout while waiting for response from the XCOM serverResponseError
– The response from the system was not ‘OK’ or if rate too high.ValueError
– If the selected rate os higher than the inertial sensor sampling rate.
-
add_log_sync
(msgID: int, divider: int)¶ Add a log with specified divider
Adds a log with a specific message ID with a divider.
Parameters: - msgID – Mesage ID which should be requested.
- divider – divider to use
Raises: ClientTimeoutError
– Timeout while waiting for response from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
add_log_event
(msgID: int)¶ Add an event-triggered log
Adds a log with a specific message ID to be sent at event. The triggering event depends on the specific log, e.g. for GNSSSOL, an event trigger will trigger the log with every new solution.
Parameters: msgID – Mesage ID which should be requested.
Raises: ClientTimeoutError
– Timeout while waiting for response from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
clear_all
()¶ Clears all logs
Sends a CLEAR_ALL command to the system.
Raises: ClientTimeoutError
– Timeout while waiting for response from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
clear_log
(msgID: int)¶ Clears a log with a specific message ID.
Clears a log with a specific message ID.
Parameters: msgID – Mesage ID which should be requested.
Raises: ClientTimeoutError
– Timeout while waiting for response from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
poll_log
(msgID)¶ Polls a log
Polls a log with a specified message ID. Blocks until the log is retrieved and returns the log.
Parameters: msgID – Message ID to poll
Returns: The polled log
Raises: ClientTimeoutError
– Timeout while waiting for response or log from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
wait_for_parameter
()¶ Waits for reception of parameter
Blocks until a parameterEvent is received.
Raises: ClientTimeoutError
– Timeout while waiting for parameter from the XCOM server
-
wait_for_polled_log
()¶ Waits for reception of log
Blocks until a messageEvent is received.
Raises: ClientTimeoutError
– Timeout while waiting for message from the XCOM server
-
wait_for_log
(msgID: int)¶ Waits for reception of log with specified message ID
Parameters: msgID – message ID of the log to be retrieved Raises: ClientTimeoutError
– Timeout while waiting for message from the XCOM server
-
enable_recorder
(channel: int, enable_autostart: bool)¶ Enable the system recorder on the specified channel
Parameters: - channel – XCOM channel to use for autostart
- enable_autostart – selects whether to start the recorder directly
Raises: ClientTimeoutError
– Timeout while waiting for response or log from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
disable_recorder
()¶ Disable the system recorder
Raises: ClientTimeoutError
– Timeout while waiting for response or log from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
start_recorder
(path: str)¶ Start the system recorder
Parameters: path – log directory to use
Raises: ClientTimeoutError
– Timeout while waiting for response or log from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
stop_recorder
()¶ Stop the system recorder
Raises: ClientTimeoutError
– Timeout while waiting for response or log from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
disable_udp_broadcast
()¶ Stop the UDP broadcast
Raises: ClientTimeoutError
– Timeout while waiting for response or log from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
set_recorder_suffix
(suffix: str)¶ Sets the suffix of the system recorder
The suffix will be the part between the GNSS time and before the idx, e.g. the log path will be 2019_08_07_1230_suffix, or suffix_001
Parameters: suffix – suffix to use
Raises: ClientTimeoutError
– Timeout while waiting for response or log from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
enable_full_sysstatus
()¶ Enables all available system status payloads
Raises: ClientTimeoutError
– Timeout while waiting for response or log from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
get_device_info
()¶ Get information about the connected device
Returns: A dictionary containing information about the device, e.g. part number, serial number, etc.
Raises: ClientTimeoutError
– Timeout while waiting for response or log from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
set_zupt_parameters
(thr_acc: float = 1, thr_omg: float = 1, thr_vel: float = 0, cut_off: float = 1, interval: float = 3, final_std_dev: float = 0.002, start_std_dev: float = 0.01, time_constant: float = 1, delay_samples: int = 300, activation_mask: int = 0, auto_zupt: bool = 1)¶ Sets the parameters for the motion detection engine
Parameters: - thr_acc – Acceleration threshold in m/s^2.
- thr_omg – Angular rate threshold in rad/s.
- thr_vel – Threshold in m/s for the ZUPT inhibitor, i.e. ZUPTs will be inhibited if GNSS detects a velocity higher than this threshold
- cut_off – Cutoff frequency in Hz for the low-pass filter filtering the accelerations and angular rates for the ZUPT detector
- interval – ZUPT interval in seconds
- final_std_dev – Final ZUPT standard deviation in m/s. For details, please refer to the protocol documentation
- start_std_dev – Initial ZUPT standard deviation in m/s. For details, please refer to the protocol documentation
- time_constant – Time constant for the exponential ZUPT standard deviation falloff. For details, please refer to the protocol documentation
- delay_samples – Number of samples for which a all detection conditions have to be met before a stationary condition is proclaimed.
- activation_mask – Selects which sensors to use in ZUPT detecion. Bit 0: Accelerometer, Bit 1: Angular rate, Bit 2: Odometer.
- auto_zupt – Selects whether to do zero velocity updates in the navigation filter if a stationary condition has been detected.
Raises: ClientTimeoutError
– Timeout while waiting for response or log from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
set_autozupt
(enable: bool)¶ Enable or disable automatic ZUPT execution if a stationary condition has been detected.
Raises: ClientTimeoutError
– Timeout while waiting for response or log from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
get_startup
()¶ Convenience getter for startup parameters of the device.
Raises: ClientTimeoutError
– Timeout while waiting for response or parameter from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
set_startup
(initPos=PositionTuple(Lon=0.1249596927, Lat=0.8599914412, Alt=311.9), initPosStdDev: Sequence[float] = [10, 10, 10], posMode: ixcom.protocol.StartupPositionMode = <StartupPositionMode.GNSSPOS: 0>, initHdg: float = 0, initHdgStdDev: float = 1, hdgMode: ixcom.protocol.StartupHeadingMode = <StartupHeadingMode.DEFAULT: 0>, realign: bool = False, inMotion: bool = False, leverArm: Sequence[float] = [0, 0, 0], leverArmStdDev: Sequence[float] = [1, 1, 1], autorestart: bool = False, gnssTimeout: int = 0)¶ Sets the startup parameters of the device.
Parameters: - initPos – Initial position to use. Type: PositionTuple(Lon, Lat, Alt) in (rad, rad, m)
- initPosStdDev – Standard deviation of initial position in m.
- posMode (ixcom.protocol.StartupPositionMode) – Source of initial position
- initHdg – Initial heading in rad
- initHdgStdDev – Initial heading standard deviation rad
- hdgMode (ixcom.protocol.StartupHeadingMode) – Source of initial heading
- realign – Select whether a realignment shall be performed with the reception of the parameter
- inMotion – If set, an in-motion alignment will be performed, regardless of the method selected in PAREKF_ALIGNMENT
- leverArm – Lever arm for the starting position in m
- leverArmStdDev – Standard deviation of the lever arm
- autorestart – Select whether the alignment shall be automatically restarted upon detected motion (during levelling) or finished (during stationary alignment)
- gnssTimeout – Timeout in seconds after which the system will resort to fallback positions after a realignment if the posMode is set to GNSS but no valid GNSS signal can be obtained. For details, please refer to the protocol documentation
Raises: ClientTimeoutError
– Timeout while waiting for response or log from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
set_alignment
(mode: ixcom.protocol.AlignmentMode = None, levelling_time: int = None, stationary_time: int = None, enable_gyro_avg: bool = None, enable_track_align: bool = None, track_align_thresh: float = None, track_align_direction: Sequence[float] = None, zupt_std_dev: float = None)¶ Change the configured alignment method
Changes only parameters which are not None.
Parameters: - mode (protocol.AlignmentMode) – Selected alignment mode
- levelling_time – Levelling duration in seconds.
- stationary_time – Stationary alignment duration in seconds. Automatic ZUPTs will be executed during this period.
- enable_gyro_avg – Selects whether an initial guess of the gyro bias shall be formed by averaging during levelling.
- enable_track_align – Selects whether the direction of the GNSS velocity vector shall be used for attitude initialization by matching it with the body vector given it in the track_align_direction argument.
- track_align_thresh – Velocity threshold in m/s which has to be exceeded to use the GNSS track for aiding.
- track_align_direction – Main motion direction in the INS enclosure coordinate frame.
Raises: ClientTimeoutError
– Timeout while waiting for response or log from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
set_aligntime
(levelling_time: int, zupt_time: int)¶ Sets the alignment duration to the commanded values
Parameters: - levelling_time – Duration of levelling in seconds
- zupt_time – Duration of stationary alignment in seconds
Raises: ClientTimeoutError
– Timeout while waiting for response or log from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
set_alignmode
(mode: ixcom.protocol.AlignmentMode)¶ Change the configured alignment mode
Parameters: mode (protocol.AlignmentMode) – Selected alignment mode
Raises: ClientTimeoutError
– Timeout while waiting for response or log from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
set_thresholds
(pos_medium: float = 1, pos_high: float = 0.1, heading_good: float = 1.7453292519943296e-05)¶ Sets the thresholds used for the position and heading accuracy status bits in the global status.
Parameters: - pos_medium – Threshold to fall below for POS_MEDIUM_ACCURACY in m
- pos_high – Threshold to fall below for POS_HIGH_ACCURACY in m
- heading_good – Threshold to fall below for HEADING_GOOD_ACCURACY in rad. Note: A stationary alignment will be ended if this value has been reached!
Raises: ClientTimeoutError
– Timeout while waiting for response or log from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
set_imu_misalign
(x: float, y: float, z: float)¶ Adjusts PARIMU_MISALIGN
Parameters: - x – rotation around the x axis in rad
- y – rotation around the y axis in rad
- z – rotation around the z axis in rad
Raises: ClientTimeoutError
– Timeout while waiting for response or log from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
enable_postproc
(channel: int)¶ Enables the logging of data used for analysis and postprocessing on the selected channel
Parameters: channel – Channel to use for the system recorder
Raises: ClientTimeoutError
– Timeout while waiting for response or log from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
disable_postproc
(channel: int = -1)¶ Disables the logging of data used for analysis and postprocessing for a specific channel
Raises: ClientTimeoutError
– Timeout while waiting for response or log from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
aid_pos
(lonLatAlt: Sequence[float], llhStdDev: Sequence[float], leverarmXYZ: Sequence[float], leverarmStdDev: Sequence[float], enableMSLaltitude=0, time: float = 0, timeMode: ixcom.protocol.ExtAidingTimeMode = <ExtAidingTimeMode.LATENCY: 1>)¶ External position aiding
Parameters: - lonLatAlt – (Lon, Lat, Alt) in (rad, rad, m)
- llhStdDev – Standard deviation in the directions of (Lon, Lat, Alt) in (m, m, m)
- leverarmXYZ – Leverarm in m
- leverarmStdDev – Standard deviation of the leverarm in m
- enableMSLaltitude – Set 1 if Altitude is meansealevel
- time – Timestamp or latency, depending on the timeMode argument
- timeMode (protocol.ExtAidingTimeMode) – Selects whether the timestamp is a GPS second of week or a latency.
Raises: ClientTimeoutError
– Timeout while waiting for response or log from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
aid_vel
(vNED: Sequence[float], vNEDStdDev: Sequence[float], time: float = 0, timeMode: ixcom.protocol.ExtAidingTimeMode = <ExtAidingTimeMode.LATENCY: 1>)¶ External velocity aiding
Parameters: - vNED – NED velocity in m/s
- vNEDStdDev – Standard deviation of vNED in m/s
- time – Timestamp or latency, depending on the timeMode argument
- timeMode (protocol.ExtAidingTimeMode) – Selects whether the timestamp is a GPS second of week or a latency.
Raises: ClientTimeoutError
– Timeout while waiting for response or log from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
aid_heading
(heading: float, standard_dev: float, time: float = 0, timeMode: ixcom.protocol.ExtAidingTimeMode = <ExtAidingTimeMode.LATENCY: 1>)¶ External heading aiding
Parameters: - heading – heading in rad
- standard_dev – Standard deviation of heading in rad
- time – Timestamp or latency, depending on the timeMode argument
- timeMode (protocol.ExtAidingTimeMode) – Selects whether the timestamp is a GPS second of week or a latency.
Raises: ClientTimeoutError
– Timeout while waiting for response or log from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
aid_height
(height: float, standard_dev: float, time: float = 0, timeMode: ixcom.protocol.ExtAidingTimeMode = <ExtAidingTimeMode.LATENCY: 1>)¶ External height aiding
Parameters: - heading – height in m
- standard_dev – Standard deviation of height in m
- time – Timestamp or latency, depending on the timeMode argument
- timeMode (protocol.ExtAidingTimeMode) – Selects whether the timestamp is a GPS second of week or a latency.
Raises: ClientTimeoutError
– Timeout while waiting for response or log from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
send_and_wait_for_okay
(inBytes)¶ Waits for reception of OK response
Send the bytes and waits for an OK response from the system
Parameters: inBytes – bytes to send
Raises: ClientTimeoutError
– Timeout while waiting for response from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
send_and_dont_wait_for_okay
(inBytes)¶ Waits for reception of OK response
Send the bytes and waits for an OK response from the system
Parameters: inBytes – bytes to send
Raises: ClientTimeoutError
– Timeout while waiting for response from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
get_antoffset
(antenna)¶ Convenience getter for antenna offset
Gets the antenna offset for the specified antenna #
Parameters: antenna – Antenna # to retrieve the antenna offset for.
Raises: ClientTimeoutError
– Timeout while waiting for response or parameter from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
set_antoffset
(antenna=0, offset=[0, 0, 0], stdDev=[0.1, 0.1, 0.1])¶ Convenience setter for antenna offset
Sets the antenna offset for the specified antenna #
Parameters: - antenna – Antenna # to retrieve the antenna offset for.
- offset – antenna offset in m.
- stdDev – standard deviation of antenna offset in m.
Raises: ClientTimeoutError
– Timeout while waiting for response or parameter from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
set_odooffset
(offset=[0, 0, 0])¶ Convenience setter for odometer offset
Sets the odometer offset
Parameters: offset – antenna offset in m.
Raises: ClientTimeoutError
– Timeout while waiting for response or parameter from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
get_virtual_meas_pt
()¶ Convenience getter for virtual measpoint offset
Gets the virtual measpoint offset for the output values defined with the mask #
Raises: ClientTimeoutError
– Timeout while waiting for response or parameter from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-
set_virtual_meas_pt
(offset=[0, 0, 0], activationMask=0, cutOffFreq=0)¶ Convenience setter for virtual measpoint offset
Sets the virtual measpoint offset #
Parameters: - offset – Distance between INS center of measurement and virtual measurement point [m, m, m].
- activationMask – Bit 0 -> INS/GNSS Position, Bit 1 -> INS/GNSS Velocity, Bit 2 -> Specific Force, Bit 3 -> Angular Rate
- cutOffFreq – The parameter CUTOFF-FREQ specifies the cut-off 1st frequency in [Hz] of the 1 order low pass. The low pass is used to filter ω for the transformation. Due to the noise, the derivation of ω will not be transformed.
Raises: ClientTimeoutError
– Timeout while waiting for response or parameter from the XCOM serverResponseError
– The response from the system was not ‘OK’.
-