rtk_status.py
Go to the documentation of this file.
1 from .utils.widgets import MicrostrainWidget, MicrostrainPlugin
2 from .utils.subscribers import RTKMonitor, RTKMonitorV1
3 
4 _WIDGET_NAME = 'RTKStatus'
5 
7 
8  def __init__(self, node):
9  # Initialize the parent class
10  super(RTKStatusWidget, self).__init__(node, _WIDGET_NAME)
11 
12  def _configure(self):
13  # Set up the subscriber status monitors
14  self._rtk_status_monitor_v1 = RTKMonitorV1(self._node, self._node_name, "rtk/status_v1")
15  self._rtk_status_monitor = RTKMonitor(self._node, self._node_name, "rtk/status")
16 
17  # Hide the warning label
18  self.rtk_not_available_label.hide()
19 
20  def run(self):
21  # If the device is connected and not a GQ7, display a warning
22  if self._device_report_monitor.connected and not self._device_report_monitor.is_gq7:
23  self.rtk_widget.hide()
24  self.rtk_not_available_label.setText('RTK status only available for GQ7 devices. Not available for device %s' % self._device_report_monitor.model_name_string)
25  self.rtk_not_available_label.show()
26  return
27  else:
28  self.rtk_not_available_label.hide()
29  self.rtk_widget.show()
30 
31  # Update device specific data
32  # If v1 dongle is connected, _rtk_status_monitor.version will be 0 or None and _rtk_status_monitor_v1.version will be 0
33  if self._rtk_status_monitor.version != 1 and self._rtk_status_monitor_v1.version == 0:
34  self.rtk_v1_widget.show()
35  self.rtk_v2_widget.hide()
36 
37  self._update_rtk_data_v1()
38  # Default to v2
39  else:
40  self.rtk_v2_widget.show()
41  self.rtk_v1_widget.hide()
42 
43  self._update_rtk_data_v2()
44 
46  # V1 Status Flags
47  self.rtk_status_flags_mode_label.setText(self._rtk_status_monitor_v1.controller_state_string)
48  self.rtk_status_flags_controller_status_label.setText(self._rtk_status_monitor_v1.controller_status_string)
49  self.rtk_status_flags_device_state_label.setText(self._rtk_status_monitor_v1.platform_state_string)
50  self.rtk_status_flags_connection_status_label.setText(self._rtk_status_monitor_v1.platform_status_string)
51  self.rtk_status_flags_reset_reason_label.setText(self._rtk_status_monitor_v1.reset_reason_string)
52 
53  # V1 Controller state icon label
54  self.rtk_led_status_label.setText(self._rtk_status_monitor_v1.controller_status_string)
55 
56  # Update common flags
58 
60  # V2 Status Flags
61  self.rtk_status_flags_modem_state_label.setText(self._rtk_status_monitor.modem_state_string)
62  self.rtk_status_flags_connection_type_label.setText(self._rtk_status_monitor.connection_type_string)
63  self.rtk_status_flags_rssi_label.setText(self._rtk_status_monitor.rssi_string)
64  self.rtk_status_flags_tower_change_indicator_label.setText(self._rtk_status_monitor.tower_change_indicator_string)
65  self.rtk_status_flags_nmea_timeout_label.setText(self._rtk_status_monitor.nmea_timeout_string)
66  self.rtk_status_flags_server_timeout_label.setText(self._rtk_status_monitor.server_timeout_string)
67  self.rtk_status_flags_rtcm_timeout_label.setText(self._rtk_status_monitor.rtcm_timeout_string)
68  self.rtk_status_flags_out_of_range_label.setText(self._rtk_status_monitor.out_of_range_string)
69  self.rtk_status_flags_corrections_unavailable_label.setText(self._rtk_status_monitor.corrections_unavailable_string)
70 
71  # V1 Modem state icon label
72  self.rtk_led_status_label.setText(self._rtk_status_monitor.modem_state_string)
73 
74  # Update common flags
76 
77  def _update_rtk_data(self, rtk_monitor):
78  # Epoch Status flags
79  self.rtk_corrections_received_gps_label.setText(rtk_monitor.gps_received_string)
80  self.rtk_corrections_received_glonass_label.setText(rtk_monitor.glonass_received_string)
81  self.rtk_corrections_received_galileo_label.setText(rtk_monitor.galileo_received_string)
82  self.rtk_corrections_received_beidou_label.setText(rtk_monitor.beidou_received_string)
83 
84  # Icon and label
85  self.rtk_led_icon_label.setText(rtk_monitor.rtk_led_string)
86 
87  # Other flags
88  self.rtk_raw_status_flag_label.setText(rtk_monitor.raw_status_flags_string)
89  self.rtk_status_flags_signal_quality_label.setText(rtk_monitor.signal_quality_string)
90 
92 
93  def __init__(self, context):
94  # Initialize the parent class
95  super(RTKStatusPlugin, self).__init__(context, _WIDGET_NAME, RTKStatusWidget)


microstrain_inertial_rqt
Author(s): Parker Hannifin Corp
autogenerated on Wed Mar 22 2023 02:35:20