cosmos 3.6.2 → 3.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/crc.txt +19 -19
- data/lib/cosmos/core_ext/array.rb +4 -1
- data/lib/cosmos/core_ext/matrix.rb +3 -0
- data/lib/cosmos/gui/dialogs/find_replace_dialog.rb +42 -35
- data/lib/cosmos/gui/line_graph/line_graph.rb +3 -0
- data/lib/cosmos/gui/line_graph/line_graph_drawing.rb +3 -1
- data/lib/cosmos/gui/opengl/gl_viewer.rb +115 -127
- data/lib/cosmos/gui/utilities/script_module_gui.rb +2 -5
- data/lib/cosmos/interfaces/linc_interface.rb +207 -147
- data/lib/cosmos/io/win32_serial_driver.rb +1 -1
- data/lib/cosmos/script/scripting.rb +2 -2
- data/lib/cosmos/script/tools.rb +8 -1
- data/lib/cosmos/tools/data_viewer/data_viewer.rb +12 -17
- data/lib/cosmos/tools/launcher/launcher_config.rb +1 -1
- data/lib/cosmos/tools/script_runner/script_runner.rb +9 -4
- data/lib/cosmos/tools/table_manager/table_manager.rb +3 -1
- data/lib/cosmos/tools/tlm_grapher/plot_editors/linegraph_plot_editor.rb +11 -1
- data/lib/cosmos/tools/tlm_grapher/plot_gui_objects/linegraph_plot_gui_object.rb +1 -0
- data/lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb +8 -0
- data/lib/cosmos/version.rb +4 -4
- data/spec/core_ext/array_spec.rb +62 -1
- data/spec/core_ext/matrix_spec.rb +61 -0
- data/spec/interfaces/linc_interface_spec.rb +0 -9
- data/spec/script/script_spec.rb +7 -3
- data/spec/script/scripting_spec.rb +2 -2
- data/spec/script/tools_spec.rb +2 -0
- data/spec/spec_helper.rb +10 -1
- data/spec/tools/launcher/launcher_config_spec.rb +21 -11
- data/spec/top_level/top_level_spec.rb +1 -1
- metadata +2 -2
@@ -457,7 +457,7 @@ module Cosmos
|
|
457
457
|
path = procedure_name if !path and File.exist?(procedure_name)
|
458
458
|
path = procedure_name_with_extension if !path and procedure_name_with_extension and File.exist?(procedure_name_with_extension)
|
459
459
|
|
460
|
-
raise "Procedure not found
|
460
|
+
raise LoadError, "Procedure not found -- #{procedure_name}" unless path
|
461
461
|
path
|
462
462
|
end
|
463
463
|
|
@@ -544,7 +544,7 @@ module Cosmos
|
|
544
544
|
begin
|
545
545
|
Kernel::load(path)
|
546
546
|
rescue LoadError => error
|
547
|
-
raise
|
547
|
+
raise LoadError, "Error loading -- #{procedure_name}\n#{error.message}"
|
548
548
|
end
|
549
549
|
end
|
550
550
|
# Return whether we had to load and instrument this file, i.e. it was not cached
|
data/lib/cosmos/script/tools.rb
CHANGED
@@ -37,10 +37,17 @@ module Cosmos
|
|
37
37
|
rescue DRb::DRbConnError
|
38
38
|
# No Listening Tlm Viewer - So Start One
|
39
39
|
start_tlm_viewer
|
40
|
+
max_retries = 60
|
41
|
+
retry_count = 0
|
40
42
|
begin
|
41
43
|
yield tlm_viewer
|
42
44
|
tlm_viewer.disconnect
|
43
45
|
rescue DRb::DRbConnError
|
46
|
+
retry_count += 1
|
47
|
+
if retry_count < max_retries
|
48
|
+
canceled = cosmos_script_sleep(1)
|
49
|
+
retry unless canceled
|
50
|
+
end
|
44
51
|
raise "Unable to Successfully Start Listening Telemetry Viewer: #{display_name} could not be #{action}"
|
45
52
|
rescue Errno::ENOENT
|
46
53
|
raise "Display Screen File: #{display_name}.txt does not exist"
|
@@ -61,7 +68,7 @@ module Cosmos
|
|
61
68
|
cmd << 'w' if Kernel.is_windows? # Windows uses rubyw to avoid creating a DOS shell
|
62
69
|
Cosmos.run_process("#{cmd} '#{File.join(Cosmos::USERPATH, 'tools', 'TlmViewer')}' --system #{system_file}")
|
63
70
|
end
|
64
|
-
|
71
|
+
cosmos_script_sleep(1)
|
65
72
|
end
|
66
73
|
|
67
74
|
#######################################
|
@@ -104,19 +104,25 @@ module Cosmos
|
|
104
104
|
@search_find_keyseq = Qt::KeySequence.new(tr('Ctrl+F'))
|
105
105
|
@search_find.shortcut = @search_find_keyseq
|
106
106
|
@search_find.statusTip = tr('Find text')
|
107
|
-
@search_find.connect(SIGNAL('triggered()'))
|
107
|
+
@search_find.connect(SIGNAL('triggered()')) do
|
108
|
+
FindReplaceDialog.show_find(self)
|
109
|
+
end
|
108
110
|
|
109
111
|
@search_find_next = Qt::Action.new(tr('Find &Next'), self)
|
110
112
|
@search_find_next_keyseq = Qt::KeySequence.new(tr('F3'))
|
111
113
|
@search_find_next.shortcut = @search_find_next_keyseq
|
112
114
|
@search_find_next.statusTip = tr('Find next instance')
|
113
|
-
@search_find_next.connect(SIGNAL('triggered()'))
|
115
|
+
@search_find_next.connect(SIGNAL('triggered()')) do
|
116
|
+
FindReplaceDialog.find_next(self)
|
117
|
+
end
|
114
118
|
|
115
119
|
@search_find_previous = Qt::Action.new(tr('Find &Previous'), self)
|
116
120
|
@search_find_previous_keyseq = Qt::KeySequence.new(tr('Shift+F3'))
|
117
121
|
@search_find_previous.shortcut = @search_find_previous_keyseq
|
118
122
|
@search_find_previous.statusTip = tr('Find previous instance')
|
119
|
-
@search_find_previous.connect(SIGNAL('triggered()'))
|
123
|
+
@search_find_previous.connect(SIGNAL('triggered()')) do
|
124
|
+
FindReplaceDialog.find_previous(self)
|
125
|
+
end
|
120
126
|
|
121
127
|
# Tab Menu Actions
|
122
128
|
@delete_tab = Qt::Action.new(Cosmos.get_icon('delete_tab.png'), tr('&Delete Tab'), self)
|
@@ -179,21 +185,10 @@ module Cosmos
|
|
179
185
|
end
|
180
186
|
end
|
181
187
|
|
182
|
-
|
183
|
-
|
184
|
-
FindReplaceDialog.show_find(component.text)
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
def find_next
|
189
|
-
current_component do |component|
|
190
|
-
FindReplaceDialog.find_next(component.text)
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
def find_previous
|
188
|
+
# Called by the FindReplaceDialog to get the text to search
|
189
|
+
def search_text
|
195
190
|
current_component do |component|
|
196
|
-
|
191
|
+
component.text
|
197
192
|
end
|
198
193
|
end
|
199
194
|
|
@@ -151,7 +151,7 @@ module Cosmos
|
|
151
151
|
if spec_name_split.length > 1 and spec_name_split[0] == 'cosmos'
|
152
152
|
# Filter to just tools and not targets
|
153
153
|
if File.exist?(File.join(spec.gem_dir, 'tools'))
|
154
|
-
Dir[File.join(spec.gem_dir, 'tools', '*')].each do |filename|
|
154
|
+
Dir[File.join(spec.gem_dir, 'tools', '*')].sort.each do |filename|
|
155
155
|
if File.extname(filename) == ''
|
156
156
|
@items << [:TOOL, File.basename(filename), format_shell_command(parser, "LAUNCH_GEM #{File.basename(filename)}"), true, File.basename(filename).class_name_to_filename(false) + '.png', nil]
|
157
157
|
end
|
@@ -160,7 +160,7 @@ module Cosmos
|
|
160
160
|
@search_find.shortcut = @search_find_keyseq
|
161
161
|
@search_find.statusTip = tr('Find text')
|
162
162
|
@search_find.connect(SIGNAL('triggered()')) do
|
163
|
-
FindReplaceDialog.show_find(
|
163
|
+
FindReplaceDialog.show_find(self)
|
164
164
|
end
|
165
165
|
|
166
166
|
@search_find_next = Qt::Action.new(tr('Find &Next'), self)
|
@@ -168,7 +168,7 @@ module Cosmos
|
|
168
168
|
@search_find_next.shortcut = @search_find_next_keyseq
|
169
169
|
@search_find_next.statusTip = tr('Find next instance')
|
170
170
|
@search_find_next.connect(SIGNAL('triggered()')) do
|
171
|
-
FindReplaceDialog.find_next(
|
171
|
+
FindReplaceDialog.find_next(self)
|
172
172
|
end
|
173
173
|
|
174
174
|
@search_find_previous = Qt::Action.new(tr('Find &Previous'), self)
|
@@ -176,7 +176,7 @@ module Cosmos
|
|
176
176
|
@search_find_previous.shortcut = @search_find_previous_keyseq
|
177
177
|
@search_find_previous.statusTip = tr('Find previous instance')
|
178
178
|
@search_find_previous.connect(SIGNAL('triggered()')) do
|
179
|
-
FindReplaceDialog.find_previous(
|
179
|
+
FindReplaceDialog.find_previous(self)
|
180
180
|
end
|
181
181
|
|
182
182
|
@search_replace = Qt::Action.new(tr('&Replace'), self)
|
@@ -184,7 +184,7 @@ module Cosmos
|
|
184
184
|
@search_replace.shortcut = @search_replace_keyseq
|
185
185
|
@search_replace.statusTip = tr('Replace')
|
186
186
|
@search_replace.connect(SIGNAL('triggered()')) do
|
187
|
-
FindReplaceDialog.show_replace(
|
187
|
+
FindReplaceDialog.show_replace(self)
|
188
188
|
end
|
189
189
|
|
190
190
|
# Script Actions
|
@@ -614,6 +614,11 @@ module Cosmos
|
|
614
614
|
# Callbacks
|
615
615
|
###########################################
|
616
616
|
|
617
|
+
# Called by the FindReplaceDialog to get the text to search
|
618
|
+
def search_text
|
619
|
+
active_script_runner_frame().script
|
620
|
+
end
|
621
|
+
|
617
622
|
def undo_available(bool)
|
618
623
|
update_title()
|
619
624
|
end
|
@@ -890,7 +890,9 @@ module Cosmos
|
|
890
890
|
|
891
891
|
case item_def.display_type
|
892
892
|
when :STATE
|
893
|
-
|
893
|
+
item = Qt::TableWidgetItem.new
|
894
|
+
item.setData(Qt::DisplayRole, Qt::Variant.new(table_def.read(item_def.name)))
|
895
|
+
gui_table.setItem(table_row, table_column, item)
|
894
896
|
if item_def.editable
|
895
897
|
gui_table.item(table_row, table_column).setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable)
|
896
898
|
else
|
@@ -20,6 +20,7 @@ module Cosmos
|
|
20
20
|
|
21
21
|
# Widget which lays out the options for editing a plot
|
22
22
|
class LinegraphPlotEditor < PlotEditor
|
23
|
+
UTC = 'UTC' # Used in combobox and matcher logic
|
23
24
|
|
24
25
|
def initialize(parent, plot = nil)
|
25
26
|
super(parent, plot)
|
@@ -92,13 +93,21 @@ module Cosmos
|
|
92
93
|
@manual_y_grid_line_scale = FloatChooser.new(self, 'Manual Y Grid Line Scale:', manual_y_grid_line_scale.to_s)
|
93
94
|
@layout.addWidget(@manual_y_grid_line_scale)
|
94
95
|
|
95
|
-
# Combobox Chooser
|
96
96
|
choices = ['TRUE', 'FALSE']
|
97
97
|
choices.delete(@plot.unix_epoch_x_values.to_s.upcase)
|
98
98
|
choices.unshift(@plot.unix_epoch_x_values.to_s.upcase)
|
99
99
|
@unix_epoch_x_values = ComboboxChooser.new(self, 'Unix Epoch X Values:', choices)
|
100
100
|
@layout.addWidget(@unix_epoch_x_values)
|
101
101
|
|
102
|
+
# If utc_time is already selected show it first
|
103
|
+
if @plot.utc_time
|
104
|
+
choices = [UTC, 'Local']
|
105
|
+
else
|
106
|
+
choices = ['Local', UTC]
|
107
|
+
end
|
108
|
+
@time_format_chooser = ComboboxChooser.new(self, 'Time Format:', choices)
|
109
|
+
@layout.addWidget(@time_format_chooser)
|
110
|
+
|
102
111
|
setLayout(@layout)
|
103
112
|
end # def initialize
|
104
113
|
|
@@ -173,6 +182,7 @@ module Cosmos
|
|
173
182
|
plot.manual_y_grid_line_scale = nil
|
174
183
|
end
|
175
184
|
plot.unix_epoch_x_values = ConfigParser.handle_true_false(@unix_epoch_x_values.string)
|
185
|
+
plot.utc_time = (@time_format_chooser.string == UTC)
|
176
186
|
plot
|
177
187
|
end
|
178
188
|
|
@@ -77,6 +77,7 @@ module Cosmos
|
|
77
77
|
self.manual_x_grid_line_scale = @plot.manual_x_grid_line_scale
|
78
78
|
self.manual_y_grid_line_scale = @plot.manual_y_grid_line_scale
|
79
79
|
self.unix_epoch_x_values = @plot.unix_epoch_x_values
|
80
|
+
self.utc_time = @plot.utc_time
|
80
81
|
|
81
82
|
# Update horizontal lines
|
82
83
|
self.clear_horizontal_lines
|
@@ -61,6 +61,9 @@ module Cosmos
|
|
61
61
|
# Interpret x values as unix epoch timestamps
|
62
62
|
attr_accessor :unix_epoch_x_values
|
63
63
|
|
64
|
+
# Display x values as UTC time
|
65
|
+
attr_accessor :utc_time
|
66
|
+
|
64
67
|
def initialize
|
65
68
|
super()
|
66
69
|
@title = nil
|
@@ -78,6 +81,7 @@ module Cosmos
|
|
78
81
|
@manual_x_grid_line_scale = nil
|
79
82
|
@manual_y_grid_line_scale = nil
|
80
83
|
@unix_epoch_x_values = true
|
84
|
+
@utc_time = false
|
81
85
|
end # def initialize
|
82
86
|
|
83
87
|
# Handles plot specific keywords
|
@@ -165,6 +169,9 @@ module Cosmos
|
|
165
169
|
parser.verify_num_parameters(1, 1, "UNIX_EPOCH_X_VALUES <TRUE or FALSE>")
|
166
170
|
@unix_epoch_x_values = ConfigParser.handle_true_false(parameters[0])
|
167
171
|
|
172
|
+
when 'UTC_TIME'
|
173
|
+
@utc_time = true
|
174
|
+
|
168
175
|
else
|
169
176
|
# Unknown keywords are passed to parent data object
|
170
177
|
super(parser, keyword, parameters)
|
@@ -193,6 +200,7 @@ module Cosmos
|
|
193
200
|
string << " MANUAL_X_GRID_LINE_SCALE #{@manual_x_grid_line_scale}\n" if @manual_x_grid_line_scale
|
194
201
|
string << " MANUAL_Y_GRID_LINE_SCALE #{@manual_y_grid_line_scale}\n" if @manual_y_grid_line_scale
|
195
202
|
string << " UNIX_EPOCH_X_VALUES #{@unix_epoch_x_values.to_s.upcase}\n"
|
203
|
+
string << " UTC_TIME\n" if @utc_time
|
196
204
|
string
|
197
205
|
end # def plot_configuration_string
|
198
206
|
|
data/lib/cosmos/version.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# encoding: ascii-8bit
|
2
2
|
|
3
|
-
COSMOS_VERSION = '3.6.
|
3
|
+
COSMOS_VERSION = '3.6.3'
|
4
4
|
module Cosmos
|
5
5
|
module Version
|
6
6
|
MAJOR = '3'
|
7
7
|
MINOR = '6'
|
8
|
-
PATCH = '
|
9
|
-
BUILD = '
|
8
|
+
PATCH = '3'
|
9
|
+
BUILD = '94a14746a45a58b2382cb17b0984f2ec5fd265af'
|
10
10
|
end
|
11
|
-
VERSION = '3.6.
|
11
|
+
VERSION = '3.6.3'
|
12
12
|
end
|
data/spec/core_ext/array_spec.rb
CHANGED
@@ -120,6 +120,35 @@ describe Array do
|
|
120
120
|
it "finds the range of values containing both" do
|
121
121
|
expect(Array.new([0,1,1,2,2,3]).range_containing(1,2)).to eql (1..4)
|
122
122
|
expect(Array.new([0,1,1,2,2,3]).range_containing(1,1)).to eql (1..2)
|
123
|
+
expect(Array.new([0,1,2,3,4,5]).range_containing(1,4)).to eql (1..4)
|
124
|
+
end
|
125
|
+
|
126
|
+
it "creates an empty range at the beginning of the array if the values both too small" do
|
127
|
+
expect(Array.new([0,1,1,2,2,3]).range_containing(-2,-1)).to eql (0..0)
|
128
|
+
end
|
129
|
+
|
130
|
+
it "creates an empty range at the end of the array if the values are both too large" do
|
131
|
+
expect(Array.new([0,1,1,2,2,3]).range_containing(4,5)).to eql (5..5)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
describe "range_within" do
|
136
|
+
it "complains if start < end" do
|
137
|
+
expect { Array.new().range_within(2,1) }.to raise_error(RuntimeError, "end_value: 1 must be greater than start_value: 2")
|
138
|
+
end
|
139
|
+
|
140
|
+
it "finds the range of values within both" do
|
141
|
+
expect(Array.new([0,1,1,2,2,3]).range_within(1,2)).to eql (2..3)
|
142
|
+
expect(Array.new([0,1,1,2,2,3]).range_within(1,1)).to eql (1..2)
|
143
|
+
expect(Array.new([0,1,2,3,4,5]).range_within(1,4)).to eql (1..4)
|
144
|
+
end
|
145
|
+
|
146
|
+
it "creates an empty range at the beginning of the array if the values both too small" do
|
147
|
+
expect(Array.new([0,1,1,2,2,3]).range_within(-2,-1)).to eql (0..0)
|
148
|
+
end
|
149
|
+
|
150
|
+
it "creates an empty range at the end of the array if the values are both too large" do
|
151
|
+
expect(Array.new([0,1,1,2,2,3]).range_within(4,5)).to eql (5..5)
|
123
152
|
end
|
124
153
|
end
|
125
154
|
|
@@ -163,7 +192,7 @@ describe Array do
|
|
163
192
|
end
|
164
193
|
|
165
194
|
describe "histogram" do
|
166
|
-
it "groups elements" do
|
195
|
+
it "groups numeric elements" do
|
167
196
|
myData1 = [1, 7, 4, 3, 4, 2, 7, 0, 8, 3, 4]
|
168
197
|
myData2 = [1, 2, 3]
|
169
198
|
myData3 = [2, 4, 8]
|
@@ -181,6 +210,38 @@ describe Array do
|
|
181
210
|
expect(myData3.histogram(7, true)[2][2]).to eql 1
|
182
211
|
expect(myData3.histogram(25, true)[20][2]).to eql 0
|
183
212
|
end
|
213
|
+
|
214
|
+
it "sorts by a given block" do
|
215
|
+
myData1 = [1, 7, 4, 3, 4, 2, 7, 0, 8, 3, 4]
|
216
|
+
histogram = myData1.histogram(nil, true) do |val1, val2|
|
217
|
+
val2[0] <=> val1[0]
|
218
|
+
end
|
219
|
+
expect(myData1.histogram(nil, true)).to eql histogram.reverse
|
220
|
+
end
|
221
|
+
|
222
|
+
it "groups non-numeric elements" do
|
223
|
+
myData1 = ['b', 'h', 'e', 'd', 'e', 'c', 'h', 'a', 'i', 'd', 'e']
|
224
|
+
myData2 = ['b', 'c', 'd']
|
225
|
+
myData3 = ['c', 'e', 'i']
|
226
|
+
|
227
|
+
expect(myData1.histogram()).to eql [['a','a',1],['b','b',1],['c','c',1],['d','d',2],['e','e',3],['h','h',2],['i','i',1]]
|
228
|
+
expect(myData2.histogram()).to eql [["b", "b", 1], ["c", "c", 1], ["d", "d", 1]]
|
229
|
+
expect(myData3.histogram()).to eql [["c", "c", 1], ["e", "e", 1], ["i", "i", 1]]
|
230
|
+
|
231
|
+
# Even though we request 9 we only get 7 because that's all the unique values we have
|
232
|
+
expect(myData1.histogram(9, false).length).to eql 7
|
233
|
+
expect(myData1.histogram(1, false).length).to eql 1
|
234
|
+
expect(myData1.histogram(7, false)[0][2]).to eql 1
|
235
|
+
expect(myData1.histogram(7, false)[4][2]).to eql 3
|
236
|
+
expect(myData1.histogram(3, false)[0][2]).to eql 3
|
237
|
+
# Even though we request 5 we only get 3 because that's all the unique values we have
|
238
|
+
expect(myData2.histogram(5, false).length).to eql 3
|
239
|
+
expect(myData2.histogram(3, false)[2][2]).to eql 1
|
240
|
+
expect(myData2.histogram(3, false)[1][2]).to eql 1
|
241
|
+
# Even though we request 7 we only get 3 because that's all the unique values we have
|
242
|
+
expect(myData3.histogram(7, false).length).to eql 3
|
243
|
+
expect(myData3.histogram(3, false)[2][2]).to eql 1
|
244
|
+
end
|
184
245
|
end
|
185
246
|
end
|
186
247
|
|
@@ -10,6 +10,7 @@
|
|
10
10
|
|
11
11
|
require 'spec_helper'
|
12
12
|
require 'cosmos/core_ext/matrix'
|
13
|
+
require 'ostruct'
|
13
14
|
|
14
15
|
describe Matrix do
|
15
16
|
|
@@ -62,5 +63,65 @@ describe Matrix do
|
|
62
63
|
expect(Matrix[[1,2],[4,5],[7,8]].trace).to eql 6.0
|
63
64
|
end
|
64
65
|
end
|
66
|
+
|
67
|
+
describe "cfromq" do
|
68
|
+
it "calculates the rotational matrix from the quaternion" do
|
69
|
+
quaternion = OpenStruct.new
|
70
|
+
quaternion.w = 1
|
71
|
+
quaternion.x = 0
|
72
|
+
quaternion.y = 0
|
73
|
+
quaternion.z = 0
|
74
|
+
expect(Matrix.cfromq(quaternion)).to eql Matrix[[1.0,0.0,0.0],[0.0,1.0,0.0],[0.0,0.0,1.0]]
|
75
|
+
|
76
|
+
quaternion.w = Math.sqrt(0.5)
|
77
|
+
quaternion.x = Math.sqrt(0.5)
|
78
|
+
quaternion.y = 0
|
79
|
+
quaternion.z = 0
|
80
|
+
matrix = Matrix.cfromq(quaternion)
|
81
|
+
expect(matrix[0]).to eql [1.0, 0.0, 0.0]
|
82
|
+
expect(matrix[1][0]).to eql 0.0
|
83
|
+
expect(matrix[1][1]).to be_within(1e-10).of(0.0)
|
84
|
+
expect(matrix[1][2]).to be_within(1e-10).of(1.0)
|
85
|
+
expect(matrix[2][0]).to eql 0.0
|
86
|
+
expect(matrix[2][1]).to be_within(1e-10).of(-1.0)
|
87
|
+
expect(matrix[2][2]).to be_within(1e-10).of(0.0)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe "trans4" do
|
92
|
+
it "translates the matrix by x,y,z" do
|
93
|
+
matrix = Matrix[[4,4,4,4],[3,3,3,3],[2,2,2,2],[1,1,1,1]]
|
94
|
+
expect(matrix.trans4(1,1,1)).to eql Matrix[[4,4,4,4],[3,3,3,3],[2,2,2,2],[10,10,10,10]]
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe "scale4" do
|
99
|
+
it "scales the matrix by x,y,z" do
|
100
|
+
matrix = Matrix[[5,5,5,5],[4,4,4,4],[3,3,3,3],[2,2,2,2]]
|
101
|
+
expect(matrix.scale4(2,4,6)).to eql Matrix[[10,10,10,10],[16,16,16,16],[18,18,18,18],[2,2,2,2]]
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
describe "rot4" do
|
106
|
+
it "rotates the matrix about the quaternion" do
|
107
|
+
matrix = Matrix[[4,4,4,4],[3,3,3,3],[2,2,2,2],[1,1,1,1]]
|
108
|
+
quaternion = OpenStruct.new
|
109
|
+
quaternion.w = Math.sqrt(0.5)
|
110
|
+
quaternion.x = Math.sqrt(0.5)
|
111
|
+
quaternion.y = 0
|
112
|
+
quaternion.z = 0
|
113
|
+
matrix = matrix.rot4(quaternion)
|
114
|
+
expect(matrix[0]).to eql [4.0, 4.0, 4.0, 4.0]
|
115
|
+
expect(matrix[1][0]).to be_within(1e-10).of(2.0)
|
116
|
+
expect(matrix[1][1]).to be_within(1e-10).of(2.0)
|
117
|
+
expect(matrix[1][2]).to be_within(1e-10).of(2.0)
|
118
|
+
expect(matrix[1][3]).to be_within(1e-10).of(2.0)
|
119
|
+
expect(matrix[2][0]).to be_within(1e-10).of(-3.0)
|
120
|
+
expect(matrix[2][1]).to be_within(1e-10).of(-3.0)
|
121
|
+
expect(matrix[2][2]).to be_within(1e-10).of(-3.0)
|
122
|
+
expect(matrix[2][3]).to be_within(1e-10).of(-3.0)
|
123
|
+
expect(matrix[3]).to eql [1.0, 1.0, 1.0, 1.0]
|
124
|
+
end
|
125
|
+
end
|
65
126
|
end
|
66
127
|
|
@@ -243,15 +243,6 @@ module Cosmos
|
|
243
243
|
|
244
244
|
@i.read
|
245
245
|
end
|
246
|
-
|
247
|
-
it "handles response overflows" do
|
248
|
-
@handshake = System.telemetry.packet("INST","HANDSHAKE")
|
249
|
-
@handshake.write("GSE_HDR_ID", 1001)
|
250
|
-
@handshake.write("ORIGIN", 0)
|
251
|
-
allow_any_instance_of(LengthStreamProtocol).to receive(:read).and_return(@handshake)
|
252
|
-
100.times { @i.read }
|
253
|
-
expect { @i.read }.to raise_error
|
254
|
-
end
|
255
246
|
end
|
256
247
|
|
257
248
|
end
|
data/spec/script/script_spec.rb
CHANGED
@@ -9,7 +9,6 @@
|
|
9
9
|
# attribution addendums as found in the LICENSE.txt
|
10
10
|
|
11
11
|
require 'spec_helper'
|
12
|
-
require 'cosmos'
|
13
12
|
require 'cosmos/script'
|
14
13
|
require 'tempfile'
|
15
14
|
|
@@ -25,8 +24,6 @@ module Cosmos
|
|
25
24
|
file.puts 'TARGET INST'
|
26
25
|
end
|
27
26
|
System.class_eval('@@instance = nil')
|
28
|
-
|
29
|
-
require 'cosmos/script'
|
30
27
|
end
|
31
28
|
|
32
29
|
after(:all) do
|
@@ -35,6 +32,13 @@ module Cosmos
|
|
35
32
|
end
|
36
33
|
|
37
34
|
describe "require cosmos/script.rb" do
|
35
|
+
it "should require cosmos/script/script" do
|
36
|
+
save = $0
|
37
|
+
$0 = "Test"
|
38
|
+
expect { load 'cosmos/script.rb' }.to_not raise_error()
|
39
|
+
$0 = save
|
40
|
+
end
|
41
|
+
|
38
42
|
it "should raise when inside CmdTlmServer" do
|
39
43
|
save = $0
|
40
44
|
$0 = "CmdTlmServer"
|