Class: Cosmos::TlmGrapher

Inherits:
TabbedPlotsTool show all
Defined in:
lib/cosmos/tools/tlm_grapher/tlm_grapher.rb

Overview

TlmGrapher class

This class implements the TlmGrapher Application. This application displays multiple line graphs that perform various analysis on housekeeping telemetry.

Constant Summary

Constants inherited from TabbedPlotsTool

Cosmos::TabbedPlotsTool::DEFAULT_LEFT_PANEL_WIDTH, Cosmos::TabbedPlotsTool::MINIMUM_LEFT_PANEL_WIDTH

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from TabbedPlotsTool

#initialize, #initialize_actions, #initialize_central_widget, #initialize_menus

Methods inherited from QtTool

#about, #complete_initialize, create_default_options, graceful_kill, #initialize, #initialize_actions, #initialize_help_menu, post_options_parsed_hook, pre_window_new_hook, redirect_io, restore_io

Constructor Details

This class inherits a constructor from Cosmos::TabbedPlotsTool

Class Method Details

.run(opts = nil, options = nil) ⇒ Object

Runs the application



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/cosmos/tools/tlm_grapher/tlm_grapher.rb', line 27

def self.run (opts = nil, options = nil)
  Cosmos.catch_fatal_exception do
    unless options
      opts, options = create_default_options()
      options.auto_size = false
      options.width = 1000
      options.height = 800
      options.title = "Telemetry Grapher"
      options.config_dir = 'tlm_grapher'
      options.config_file = 'tlm_grapher.txt'
      options.tool_short_name = 'tlmgrapher'
      options.tabbed_plots_type = 'overview'
      options.data_object_types = ['HOUSEKEEPING', 'XY','SINGLEXY']
      options.plot_types = ['LINEGRAPH', 'XY','SINGLEXY']
      options.plot_type_to_data_object_type_mapping = {'LINEGRAPH' => ['HOUSEKEEPING'], 'XY' => ['XY'], 'SINGLEXY' => ['SINGLEXY']}
      options.adder_types = ['HOUSEKEEPING']
      options.adder_orientation = Qt::Horizontal
      options.items = []
      options.start = false
      options.about_string = "TlmGrapher provides realtime and log file graphing abilities to the COSMOS system."

      opts.separator "Telemetry Grapher Specific Options:"
      opts.on("-c", "--config FILE", "Use the specified configuration file") do |arg|
        options.config_file = arg
      end
      opts.on("-s", "--start", "Start graphing immediately") do |arg|
        options.start = true
      end
      opts.on("-i", "--item 'TARGET_NAME PACKET_NAME ITEM_NAME'", "Start graphing the specified item (ignores config file)") do |arg|
        split = arg.split
        if split.length != 3
          puts "Items must be specified as 'TARGET_NAME PACKET_NAME ITEM_NAME' in quotes"
          exit
        end
        options.items << split
      end
    end

    super(opts, options)
  end
end

Instance Method Details

#closeEvent(event) ⇒ Object



69
70
71
# File 'lib/cosmos/tools/tlm_grapher/tlm_grapher.rb', line 69

def closeEvent(event)
  super(event)
end

#handle_itemsObject

Handles items being passed in as command line arguments



74
75
76
77
78
79
80
81
82
83
# File 'lib/cosmos/tools/tlm_grapher/tlm_grapher.rb', line 74

def handle_items
  plot_index = 0
  @items.each do |target_name, packet_name, item_name|
    # Default configuration has one plot so don't add plot for first item
    data_object = HousekeepingDataObject.new
    data_object.set_item(target_name, packet_name, item_name)
    @tabbed_plots_config.add_data_object(0, 0, data_object)
    plot_index += 1
  end
end