Ejemplo n.º 1
0
  def __init__(self, *args, **kwargs):
    try:
      update = kwargs.pop('update')
    except KeyError:
      update = True

    self.console_output = OutputStream()
    sys.stdout = self.console_output
    sys.stderr = self.console_output

    try:
      self.link = serial_link.SerialLink(*args, **kwargs)
      self.link.add_callback(ids.PRINT, self.print_message_callback)

      self.link.add_callback(ids.DEBUG_VAR, self.debug_var_callback)

      settings_read_finished_functions = []

      self.tracking_view = TrackingView(self.link)
      self.almanac_view = AlmanacView(self.link)
      self.solution_view = SolutionView(self.link)
      self.baseline_view = BaselineView(self.link)
      self.observation_view = ObservationView(self.link,
                                              name='Rover', relay=False)
      self.observation_view_base = ObservationView(self.link,
                                                   name='Base', relay=True)
      self.system_monitor_view = SystemMonitorView(self.link)
      self.simulator_view = SimulatorView(self.link)
      self.settings_view = SettingsView(self.link)

      if update:
        self.ocu = OneClickUpdate(self.link, self.console_output)
        settings_read_finished_functions.append(self.ocu.start)

      self.settings_view = \
          SettingsView(self.link, settings_read_finished_functions)

      if update:
        self.ocu.point_to_settings(self.settings_view.settings)

      self.python_console_env = {
          'send_message': self.link.send_message,
          'link': self.link,
      }
      self.python_console_env.update(self.tracking_view.python_console_cmds)
      self.python_console_env.update(self.almanac_view.python_console_cmds)
      self.python_console_env.update(self.solution_view.python_console_cmds)
      self.python_console_env.update(self.baseline_view.python_console_cmds)
      self.python_console_env.update(self.observation_view.python_console_cmds)
      self.python_console_env.update(self.system_monitor_view.python_console_cmds)
    except:
      import traceback
      traceback.print_exc()
Ejemplo n.º 2
0
class SwiftConsole(HasTraits):
  link = Instance(serial_link.SerialLink)
  console_output = Instance(OutputStream)
  python_console_env = Dict
  a = Int
  b = Int
  tracking_view = Instance(TrackingView)
  almanac_view = Instance(AlmanacView)
  solution_view = Instance(SolutionView)
  baseline_view = Instance(BaselineView)
  observation_view = Instance(ObservationView)
  observation_view_base = Instance(ObservationView)
  system_monitor_view = Instance(SystemMonitorView)
  simulator_view = Instance(SimulatorView)
  settings_view = Instance(SettingsView)

  view = View(
    VSplit(
      Tabbed(
        Item('tracking_view', style='custom', label='Tracking'),
        Item('almanac_view', style='custom', label='Almanac'),
        Item('solution_view', style='custom', label='Solution'),
        Item('baseline_view', style='custom', label='Baseline'),
        VSplit(
          Item('observation_view', style='custom', show_label=False),
          Item('observation_view_base', style='custom', show_label=False),
          label='Observations',
        ),
        Item('simulator_view', style='custom', label='Simulator'),
        Item('settings_view', style='custom', label='Settings'),
        Item('system_monitor_view', style='custom', label='System Monitor'),
        Item(
          'python_console_env', style='custom',
          label='Python Console', editor=ShellEditor()
        ),
        show_labels=False
      ),
      Item(
        'console_output',
        style='custom',
        editor=InstanceEditor(),
        height=0.3,
        show_label=False,
      ),
    ),
    icon = icon,
    resizable = True,
    width = 900,
    height = 600,
    title = 'Piksi Console, Version: ' + CONSOLE_VERSION
  )

  def print_message_callback(self, data):
    try:
      self.console_output.write(data.encode('ascii', 'ignore'))
    except UnicodeDecodeError:
      print "Oh crap!"

  def debug_var_callback(self, data):
    x = struct.unpack('<d', data[:8])[0]
    name = data[8:]
    print "VAR: %s = %d" % (name, x)

  def __init__(self, *args, **kwargs):
    try:
      update = kwargs.pop('update')
    except KeyError:
      update = True

    self.console_output = OutputStream()
    sys.stdout = self.console_output
    sys.stderr = self.console_output

    try:
      self.link = serial_link.SerialLink(*args, **kwargs)
      self.link.add_callback(ids.PRINT, self.print_message_callback)

      self.link.add_callback(ids.DEBUG_VAR, self.debug_var_callback)

      settings_read_finished_functions = []

      self.tracking_view = TrackingView(self.link)
      self.almanac_view = AlmanacView(self.link)
      self.solution_view = SolutionView(self.link)
      self.baseline_view = BaselineView(self.link)
      self.observation_view = ObservationView(self.link,
                                              name='Rover', relay=False)
      self.observation_view_base = ObservationView(self.link,
                                                   name='Base', relay=True)
      self.system_monitor_view = SystemMonitorView(self.link)
      self.simulator_view = SimulatorView(self.link)
      self.settings_view = SettingsView(self.link)

      if update:
        self.ocu = OneClickUpdate(self.link, self.console_output)
        settings_read_finished_functions.append(self.ocu.start)

      self.settings_view = \
          SettingsView(self.link, settings_read_finished_functions)

      if update:
        self.ocu.point_to_settings(self.settings_view.settings)

      self.python_console_env = {
          'send_message': self.link.send_message,
          'link': self.link,
      }
      self.python_console_env.update(self.tracking_view.python_console_cmds)
      self.python_console_env.update(self.almanac_view.python_console_cmds)
      self.python_console_env.update(self.solution_view.python_console_cmds)
      self.python_console_env.update(self.baseline_view.python_console_cmds)
      self.python_console_env.update(self.observation_view.python_console_cmds)
      self.python_console_env.update(self.system_monitor_view.python_console_cmds)
    except:
      import traceback
      traceback.print_exc()

  def stop(self):
    self.link.close()
Ejemplo n.º 3
0
    def __init__(self, *args, **kwargs):
        try:
            update = kwargs.pop('update')
        except KeyError:
            update = True

        self.console_output = OutputStream()
        sys.stdout = self.console_output
        sys.stderr = self.console_output

        try:
            self.link = serial_link.SerialLink(*args, **kwargs)
            self.link.add_callback(ids.PRINT, self.print_message_callback)

            self.link.add_callback(ids.DEBUG_VAR, self.debug_var_callback)

            settings_read_finished_functions = []

            self.tracking_view = TrackingView(self.link)
            self.almanac_view = AlmanacView(self.link)
            self.solution_view = SolutionView(self.link)
            self.baseline_view = BaselineView(self.link)
            self.observation_view = ObservationView(self.link,
                                                    name='Rover',
                                                    relay=False)
            self.observation_view_base = ObservationView(self.link,
                                                         name='Base',
                                                         relay=True)
            self.system_monitor_view = SystemMonitorView(self.link)
            self.simulator_view = SimulatorView(self.link)
            self.settings_view = SettingsView(self.link)

            if update:
                self.ocu = OneClickUpdate(self.link, self.console_output)
                settings_read_finished_functions.append(self.ocu.start)

            self.settings_view = \
                SettingsView(self.link, settings_read_finished_functions)

            if update:
                self.ocu.point_to_settings(self.settings_view.settings)

            self.python_console_env = {
                'send_message': self.link.send_message,
                'link': self.link,
            }
            self.python_console_env.update(
                self.tracking_view.python_console_cmds)
            self.python_console_env.update(
                self.almanac_view.python_console_cmds)
            self.python_console_env.update(
                self.solution_view.python_console_cmds)
            self.python_console_env.update(
                self.baseline_view.python_console_cmds)
            self.python_console_env.update(
                self.observation_view.python_console_cmds)
            self.python_console_env.update(
                self.system_monitor_view.python_console_cmds)
        except:
            import traceback
            traceback.print_exc()
Ejemplo n.º 4
0
class SwiftConsole(HasTraits):
    link = Instance(serial_link.SerialLink)
    console_output = Instance(OutputStream)
    python_console_env = Dict
    a = Int
    b = Int
    tracking_view = Instance(TrackingView)
    almanac_view = Instance(AlmanacView)
    solution_view = Instance(SolutionView)
    baseline_view = Instance(BaselineView)
    observation_view = Instance(ObservationView)
    observation_view_base = Instance(ObservationView)
    system_monitor_view = Instance(SystemMonitorView)
    simulator_view = Instance(SimulatorView)
    settings_view = Instance(SettingsView)

    view = View(VSplit(
        Tabbed(Item('tracking_view', style='custom', label='Tracking'),
               Item('almanac_view', style='custom', label='Almanac'),
               Item('solution_view', style='custom', label='Solution'),
               Item('baseline_view', style='custom', label='Baseline'),
               VSplit(
                   Item('observation_view', style='custom', show_label=False),
                   Item('observation_view_base',
                        style='custom',
                        show_label=False),
                   label='Observations',
               ),
               Item('simulator_view', style='custom', label='Simulator'),
               Item('settings_view', style='custom', label='Settings'),
               Item('system_monitor_view',
                    style='custom',
                    label='System Monitor'),
               Item('python_console_env',
                    style='custom',
                    label='Python Console',
                    editor=ShellEditor()),
               show_labels=False),
        Item(
            'console_output',
            style='custom',
            editor=InstanceEditor(),
            height=0.3,
            show_label=False,
        ),
    ),
                icon=icon,
                resizable=True,
                width=900,
                height=600,
                title='Piksi Console, Version: ' + CONSOLE_VERSION)

    def print_message_callback(self, data):
        try:
            self.console_output.write(data.encode('ascii', 'ignore'))
        except UnicodeDecodeError:
            print "Oh crap!"

    def debug_var_callback(self, data):
        x = struct.unpack('<d', data[:8])[0]
        name = data[8:]
        print "VAR: %s = %d" % (name, x)

    def __init__(self, *args, **kwargs):
        try:
            update = kwargs.pop('update')
        except KeyError:
            update = True

        self.console_output = OutputStream()
        sys.stdout = self.console_output
        sys.stderr = self.console_output

        try:
            self.link = serial_link.SerialLink(*args, **kwargs)
            self.link.add_callback(ids.PRINT, self.print_message_callback)

            self.link.add_callback(ids.DEBUG_VAR, self.debug_var_callback)

            settings_read_finished_functions = []

            self.tracking_view = TrackingView(self.link)
            self.almanac_view = AlmanacView(self.link)
            self.solution_view = SolutionView(self.link)
            self.baseline_view = BaselineView(self.link)
            self.observation_view = ObservationView(self.link,
                                                    name='Rover',
                                                    relay=False)
            self.observation_view_base = ObservationView(self.link,
                                                         name='Base',
                                                         relay=True)
            self.system_monitor_view = SystemMonitorView(self.link)
            self.simulator_view = SimulatorView(self.link)
            self.settings_view = SettingsView(self.link)

            if update:
                self.ocu = OneClickUpdate(self.link, self.console_output)
                settings_read_finished_functions.append(self.ocu.start)

            self.settings_view = \
                SettingsView(self.link, settings_read_finished_functions)

            if update:
                self.ocu.point_to_settings(self.settings_view.settings)

            self.python_console_env = {
                'send_message': self.link.send_message,
                'link': self.link,
            }
            self.python_console_env.update(
                self.tracking_view.python_console_cmds)
            self.python_console_env.update(
                self.almanac_view.python_console_cmds)
            self.python_console_env.update(
                self.solution_view.python_console_cmds)
            self.python_console_env.update(
                self.baseline_view.python_console_cmds)
            self.python_console_env.update(
                self.observation_view.python_console_cmds)
            self.python_console_env.update(
                self.system_monitor_view.python_console_cmds)
        except:
            import traceback
            traceback.print_exc()

    def stop(self):
        self.link.close()