Ejemplo n.º 1
0
    def __init__(self,
                 link,
                 read_finished_functions=[],
                 name_of_yaml_file="settings.yaml",
                 gui_mode=True):

        super(SettingsView, self).__init__()

        self.gui_mode = gui_mode
        self.enumindex = 0
        self.settings = {}
        self.link = link
        self.link.add_callback(self.settings_read_callback, SBP_MSG_SETTINGS)
        self.link.add_callback(self.piksi_startup_callback, SBP_MSG_STARTUP)
        self.link.add_callback(self.settings_read_by_index_callback,
                               SBP_MSG_SETTINGS_READ_BY_INDEX)

        # Read in yaml file for setting metadata
        self.settings_yaml = SettingsList(name_of_yaml_file)

        # List of functions to be executed after all settings are read.
        # No support for arguments currently.
        self.read_finished_functions = read_finished_functions

        self.setting_detail = SettingBase()

        self._settings_read_button_fired()

        self.python_console_cmds = {'settings': self}
Ejemplo n.º 2
0
 def __init__(self,
              link,
              read_finished_functions=[],
              name_of_yaml_file="settings.yaml",
              expert=False,
              gui_mode=True,
              skip=False):
     super(SettingsView, self).__init__()
     self.expert = expert
     self.show_auto_survey = False
     self.gui_mode = gui_mode
     self.enumindex = 0
     self.settings = {}
     self.link = link
     self.link.add_callback(self.piksi_startup_callback, SBP_MSG_STARTUP)
     self.link.add_callback(self.settings_read_by_index_callback,
                            SBP_MSG_SETTINGS_READ_BY_INDEX_REQ)
     self.link.add_callback(self.settings_read_by_index_callback,
                            SBP_MSG_SETTINGS_READ_BY_INDEX_RESP)
     self.link.add_callback(self.settings_read_by_index_done_callback,
                            SBP_MSG_SETTINGS_READ_BY_INDEX_DONE)
     # Read in yaml file for setting metadata
     self.settings_yaml = SettingsList(name_of_yaml_file)
     # List of functions to be executed after all settings are read.
     # No support for arguments currently.
     self.read_finished_functions = read_finished_functions
     self.called_read_finished = False
     self.setting_detail = SettingBase()
     if not skip:
         try:
             self._settings_read_button_fired()
         except IOError:
             print "IOError in settings_view startup call of _settings_read_button_fired."
             print "Verify that write permissions exist on the port."
     self.python_console_cmds = {'settings': self}
Ejemplo n.º 3
0
    def __init__(self, link, plot_history_max=1000):
        super(BaselineView, self).__init__()
        self.plot_data = ArrayPlotData(n_fixed=[0.0],
                                       e_fixed=[0.0],
                                       d_fixed=[0.0],
                                       n_float=[0.0],
                                       e_float=[0.0],
                                       d_float=[0.0],
                                       n_satisfied=[0.0],
                                       e_satisfied=[0.0],
                                       n_unsatisfied=[0.0],
                                       e_unsatisfied=[0.0],
                                       n_focused=[0.0],
                                       e_focused=[0.0],
                                       t=[0.0],
                                       e_preset=[],
                                       n_preset=[])
        self.plot_history_max = plot_history_max

        self.neds = np.empty((plot_history_max, 3))
        self.neds[:] = np.NAN
        self.fixeds = np.zeros(plot_history_max, dtype=bool)
        self.devs = np.zeros(plot_history_max)
        self.times = np.zeros(plot_history_max)

        self.plot = Plot(self.plot_data)
        color_float = (0.5, 0.5, 1.0)
        color_fixed = 'orange'
        color_satisfied = (0.3, 1.0, 0.0)
        pts_float = self.plot.plot(('e_float', 'n_float'),
                                   type='scatter',
                                   color=color_float,
                                   marker='plus',
                                   line_width=2.0,
                                   marker_size=8.0)
        pts_fixed = self.plot.plot(('e_fixed', 'n_fixed'),
                                   type='scatter',
                                   color=color_fixed,
                                   marker='plus',
                                   line_width=2.0,
                                   marker_size=8.0)
        threshold_satisfied = self.plot.plot(('e_satisfied', 'n_satisfied'),
                                             type='scatter',
                                             color=color_satisfied,
                                             marker='dot',
                                             line_width=0.0,
                                             marker_size=4.5)
        threshold_unsatisfied = self.plot.plot(
            ('e_unsatisfied', 'n_unsatisfied'),
            type='scatter',
            color='red',
            marker='dot',
            line_width=0.0,
            marker_size=4.5)
        preset = self.plot.plot(('e_preset', 'n_preset'),
                                type='scatter',
                                color='black',
                                marker='plus',
                                marker_size=1.5,
                                line_width=0.0)
        pts_focused = self.plot.plot(('e_focused', 'n_focused'),
                                     type='scatter',
                                     color='black',
                                     marker='dot',
                                     line_width=0.0,
                                     marker_size=0.0)
        #plot_labels = ['RTK Fixed','RTK Float']
        #plots_legend = dict(zip(plot_labels, [pts_fixed, pts_float]))
        #self.plot.legend.plots = plots_legend
        #self.plot.legend.visible = True
        self.plot.legend.visible = False

        self.plot.index_axis.tick_label_position = 'inside'
        self.plot.index_axis.tick_label_color = 'gray'
        self.plot.index_axis.tick_color = 'gray'
        self.plot.index_axis.title = 'E (meters)'
        self.plot.index_axis.title_spacing = 5
        self.plot.value_axis.tick_label_position = 'inside'
        self.plot.value_axis.tick_label_color = 'gray'
        self.plot.value_axis.tick_color = 'gray'
        self.plot.value_axis.title = 'N (meters)'
        self.plot.value_axis.title_spacing = 5
        self.plot.padding = (25, 25, 25, 25)

        self.plot.tools.append(PanTool(self.plot))
        zt = ZoomTool(self.plot,
                      zoom_factor=1.1,
                      tool_mode="box",
                      always_on=False)
        self.plot.overlays.append(zt)

        self.week = None
        self.nsec = 0

        self.link = link
        self.link.add_callback(self._baseline_callback_ned,
                               SBP_MSG_BASELINE_NED)

        self.cnt = 0
        self.dev_list = []
        self.data_dict = {}
        self.presets = self._read_preset_points()

        self.settings_yaml = SettingsList()
        self.position_threshold = str(
            self.settings_yaml.get_threshold_field('position'))
        self.depth_threshold = str(
            self.settings_yaml.get_threshold_field('depth'))
        self.time_threshold = str(
            self.settings_yaml.get_threshold_field('time'))

        self.zoom_once = False

        self.python_console_cmds = {'baseline': self}
Ejemplo n.º 4
0
import jinja2
import re
from settings_list import SettingsList
import os

swift_nav_style_path = "../libsbp/docs"
environment_variables_to_append = ["TEXINPUTS", "PATH"]
myenviron = os.environ
for each in environment_variables_to_append:
    try:
        texinputs = myenviron[each]
        print texinputs
        myenviron[each] = ".:" + swift_nav_style_path + ":" + texinputs
    except KeyError:
        myenviron[each] = ".:" + swift_nav_style_path
settings = SettingsList("settings.yaml")
groups = settings.return_groups()

#Note, these reg exps will not replace the '^' character to allow exponents in the units text field
LATEX_SUBS_ALLOW_EXPONENTS = ((re.compile(r'\\'), r'\\textbackslash'),
                              (re.compile(r'([{}_#%&$])'),
                               r'\\\1'), (re.compile(r'~'),
                                          r'\~{}'), (re.compile(r'_'), r'_'),
                              (re.compile(r'"'),
                               r"''"), (re.compile(r'\.\.\.+'), r'\\ldots'),
                              (re.compile(r'\n'), r'\\newline '))

NO_UNDERSCORE = re.compile(r'_')


# We sometimes need to remove underscores.