cosmosc2-demo 5.0.2.pre.beta2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +693 -0
  3. data/README.md +31 -0
  4. data/Rakefile +35 -0
  5. data/microservices/EXAMPLE/example_target.rb +123 -0
  6. data/microservices/TEMPLATED/scpi_target.rb +79 -0
  7. data/plugin.txt +100 -0
  8. data/targets/EXAMPLE/cmd_tlm/example_cmds.txt +2 -0
  9. data/targets/EXAMPLE/cmd_tlm/example_tlm.txt +5 -0
  10. data/targets/EXAMPLE/lib/example_interface.rb +27 -0
  11. data/targets/EXAMPLE/target.txt +9 -0
  12. data/targets/INST/cmd_tlm/_ccsds_cmd.txt +9 -0
  13. data/targets/INST/cmd_tlm/_ccsds_tlm.txt +19 -0
  14. data/targets/INST/cmd_tlm/inst_cmds.txt +53 -0
  15. data/targets/INST/cmd_tlm/inst_tlm.txt +162 -0
  16. data/targets/INST/cmd_tlm/inst_tlm_override.txt +12 -0
  17. data/targets/INST/data/attitude.bin +0 -0
  18. data/targets/INST/data/position.bin +0 -0
  19. data/targets/INST/lib/example_limits_response.rb +39 -0
  20. data/targets/INST/lib/sim_inst.rb +343 -0
  21. data/targets/INST/procedures/checks.rb +11 -0
  22. data/targets/INST/procedures/collect.rb +18 -0
  23. data/targets/INST/procedures/disconnect.rb +29 -0
  24. data/targets/INST/procedures/my_script_suite.rb +46 -0
  25. data/targets/INST/procedures/my_test_suite.rb +45 -0
  26. data/targets/INST/procedures/target_file.rb +21 -0
  27. data/targets/INST/procedures/utilities/clear.rb +7 -0
  28. data/targets/INST/procedures/utilities/collect.rb +14 -0
  29. data/targets/INST/public/ground_error.png +0 -0
  30. data/targets/INST/public/ground_off.png +0 -0
  31. data/targets/INST/public/ground_on.png +0 -0
  32. data/targets/INST/public/satellite.png +0 -0
  33. data/targets/INST/screens/_footer.txt +3 -0
  34. data/targets/INST/screens/adcs.txt +71 -0
  35. data/targets/INST/screens/array.txt +15 -0
  36. data/targets/INST/screens/block.txt +6 -0
  37. data/targets/INST/screens/commanding.txt +34 -0
  38. data/targets/INST/screens/graphs.txt +17 -0
  39. data/targets/INST/screens/ground.txt +46 -0
  40. data/targets/INST/screens/hs.txt +42 -0
  41. data/targets/INST/screens/latest.txt +21 -0
  42. data/targets/INST/screens/limits.txt +82 -0
  43. data/targets/INST/screens/other.txt +37 -0
  44. data/targets/INST/screens/params.txt +54 -0
  45. data/targets/INST/screens/simple.txt +6 -0
  46. data/targets/INST/screens/tabs.txt +66 -0
  47. data/targets/INST/screens/web.txt +5 -0
  48. data/targets/INST/tables/bin/ConfigTables.bin +0 -0
  49. data/targets/INST/tables/config/ConfigTables_def.txt +8 -0
  50. data/targets/INST/tables/config/MCConfigurationTable_def.txt +36 -0
  51. data/targets/INST/tables/config/PPSSelectionTable_def.txt +7 -0
  52. data/targets/INST/tables/config/TLMMonitoringTable_def.txt +31 -0
  53. data/targets/INST/target.txt +31 -0
  54. data/targets/SYSTEM/cmd_tlm/limits_groups.txt +6 -0
  55. data/targets/SYSTEM/cmd_tlm/meta_tlm.txt +10 -0
  56. data/targets/SYSTEM/cmd_tlm/system_cmds.txt +41 -0
  57. data/targets/SYSTEM/cmd_tlm/system_tlm.txt +7 -0
  58. data/targets/SYSTEM/lib/example_background_task.rb +66 -0
  59. data/targets/SYSTEM/lib/example_target.rb +112 -0
  60. data/targets/SYSTEM/lib/limits_groups.rb +64 -0
  61. data/targets/SYSTEM/lib/scpi_target.rb +76 -0
  62. data/targets/SYSTEM/procedures/cosmos_api_test.rb +286 -0
  63. data/targets/SYSTEM/procedures/example_test.rb +191 -0
  64. data/targets/SYSTEM/procedures/interactive.rb +38 -0
  65. data/targets/SYSTEM/procedures/run_example_test.rb +3 -0
  66. data/targets/SYSTEM/procedures/test.rb +49 -0
  67. data/targets/SYSTEM/screens/status.txt +12 -0
  68. data/targets/SYSTEM/target.txt +12 -0
  69. data/targets/TEMPLATED/cmd_tlm/templated_cmds.txt +13 -0
  70. data/targets/TEMPLATED/cmd_tlm/templated_tlm.txt +3 -0
  71. data/targets/TEMPLATED/lib/templated_interface.rb +69 -0
  72. data/targets/TEMPLATED/target.txt +8 -0
  73. data/tools/widgets/BigWidget/BigWidget.umd.min.js +2 -0
  74. data/tools/widgets/BigWidget/BigWidget.umd.min.js.map +1 -0
  75. data/tools/widgets/HelloworldWidget/HelloworldWidget.umd.min.js +2 -0
  76. data/tools/widgets/HelloworldWidget/HelloworldWidget.umd.min.js.map +1 -0
  77. metadata +123 -0
Binary file
Binary file
@@ -0,0 +1,39 @@
1
+ # encoding: ascii-8bit
2
+
3
+ # Copyright 2022 Ball Aerospace & Technologies Corp.
4
+ # All Rights Reserved.
5
+ #
6
+ # This program is free software; you can modify and/or redistribute it
7
+ # under the terms of the GNU Affero General Public License
8
+ # as published by the Free Software Foundation; version 3 with
9
+ # attribution addendums as found in the LICENSE.txt
10
+ #
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU Affero General Public License for more details.
15
+ #
16
+ # This program may also be used under the terms of a commercial or
17
+ # enterprise edition license of COSMOS if purchased from the
18
+ # copyright holder
19
+
20
+ # This file implements a class to handle responses to limits state changes.
21
+
22
+ require 'cosmos/packets/limits_response'
23
+
24
+ # ExampleLimitsResponse class
25
+ #
26
+ # This class handles a limits response
27
+ #
28
+ class ExampleLimitsResponse < Cosmos::LimitsResponse
29
+
30
+ def call(packet, item, old_limits_state)
31
+ case item.limits.state
32
+ when :RED_HIGH
33
+ cmd('<%= target_name %>', 'COLLECT', 'TYPE' => 'NORMAL', 'DURATION' => 5, scope: 'DEFAULT')
34
+ when :RED_LOW
35
+ cmd_no_hazardous_check('<%= target_name %>', 'CLEAR', scope: 'DEFAULT')
36
+ end
37
+ end
38
+
39
+ end # class ExampleLimitsResponse
@@ -0,0 +1,343 @@
1
+ # encoding: ascii-8bit
2
+
3
+ # Copyright 2022 Ball Aerospace & Technologies Corp.
4
+ # All Rights Reserved.
5
+ #
6
+ # This program is free software; you can modify and/or redistribute it
7
+ # under the terms of the GNU Affero General Public License
8
+ # as published by the Free Software Foundation; version 3 with
9
+ # attribution addendums as found in the LICENSE.txt
10
+ #
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU Affero General Public License for more details.
15
+ #
16
+ # This program may also be used under the terms of a commercial or
17
+ # enterprise edition license of COSMOS if purchased from the
18
+ # copyright holder
19
+
20
+ # Provides a demonstration of a Simulated Target
21
+
22
+ require 'cosmos'
23
+
24
+ module Cosmos
25
+ # Simulated instrument for the demo. Populates several packets and cycles
26
+ # the telemetry to simulate an active target.
27
+ class SimInst < SimulatedTarget
28
+ SOLAR_PANEL_DFLTS = [-179.0, 179.0, -179.0, 179.0, -95.0] unless defined? SOLAR_PANEL_DFLTS
29
+
30
+ def initialize(target_name)
31
+ super(target_name)
32
+
33
+ @target = System.targets[target_name]
34
+ position_filename = File.join(@target.dir, 'data', 'position.bin')
35
+ attitude_filename = File.join(@target.dir, 'data', 'attitude.bin')
36
+ @position_file = File.open(position_filename, 'rb')
37
+ @attitude_file = File.open(attitude_filename, 'rb')
38
+ @position_file_size = File.size(position_filename)
39
+ @attitude_file_size = File.size(attitude_filename)
40
+ @position_file_bytes_read = 0
41
+ @attitude_file_bytes_read = 0
42
+
43
+ @pos_packet = Structure.new(:BIG_ENDIAN)
44
+ @pos_packet.append_item('DAY', 16, :UINT)
45
+ @pos_packet.append_item('MSOD', 32, :UINT)
46
+ @pos_packet.append_item('USOMS', 16, :UINT)
47
+ @pos_packet.append_item('POSX', 32, :FLOAT)
48
+ @pos_packet.append_item('POSY', 32, :FLOAT)
49
+ @pos_packet.append_item('POSZ', 32, :FLOAT)
50
+ @pos_packet.append_item('SPARE1', 16, :UINT)
51
+ @pos_packet.append_item('SPARE2', 32, :UINT)
52
+ @pos_packet.append_item('SPARE3', 16, :UINT)
53
+ @pos_packet.append_item('VELX', 32, :FLOAT)
54
+ @pos_packet.append_item('VELY', 32, :FLOAT)
55
+ @pos_packet.append_item('VELZ', 32, :FLOAT)
56
+ @pos_packet.append_item('SPARE4', 32, :UINT)
57
+ @pos_packet.enable_method_missing
58
+
59
+ @att_packet = Structure.new(:BIG_ENDIAN)
60
+ @att_packet.append_item('DAY', 16, :UINT)
61
+ @att_packet.append_item('MSOD', 32, :UINT)
62
+ @att_packet.append_item('USOMS', 16, :UINT)
63
+ @att_packet.append_item('Q1', 32, :FLOAT)
64
+ @att_packet.append_item('Q2', 32, :FLOAT)
65
+ @att_packet.append_item('Q3', 32, :FLOAT)
66
+ @att_packet.append_item('Q4', 32, :FLOAT)
67
+ @att_packet.append_item('BIASX', 32, :FLOAT)
68
+ @att_packet.append_item('BIASY', 32, :FLOAT)
69
+ @att_packet.append_item('BIASZ', 32, :FLOAT)
70
+ @att_packet.append_item('SPARE', 32, :FLOAT)
71
+ @att_packet.enable_method_missing
72
+
73
+ packet = @tlm_packets['HEALTH_STATUS']
74
+ packet.enable_method_missing
75
+ packet.CcsdsSeqFlags = 'NOGROUP'
76
+ packet.CcsdsLength = packet.buffer.length - 7
77
+ packet.temp1 = 50.0
78
+ packet.temp2 = -20.0
79
+ packet.temp3 = 85.0
80
+ packet.temp4 = 0.0
81
+ packet.duration = 10.0
82
+ packet.collect_type = 'NORMAL'
83
+
84
+ packet = @tlm_packets['ADCS']
85
+ packet.enable_method_missing
86
+ packet.CcsdsSeqFlags = 'NOGROUP'
87
+ packet.CcsdsLength = packet.buffer.length - 7
88
+
89
+ packet = @tlm_packets['PARAMS']
90
+ packet.enable_method_missing
91
+ packet.CcsdsSeqFlags = 'NOGROUP'
92
+ packet.CcsdsLength = packet.buffer.length - 7
93
+ packet.value1 = 0
94
+ packet.value2 = 1
95
+ packet.value3 = 2
96
+ packet.value4 = 1
97
+ packet.value5 = 0
98
+
99
+ packet = @tlm_packets['IMAGE']
100
+ packet.enable_method_missing
101
+ packet.CcsdsSeqFlags = 'NOGROUP'
102
+ packet.CcsdsLength = packet.buffer.length - 7
103
+
104
+ packet = @tlm_packets['MECH']
105
+ packet.enable_method_missing
106
+ packet.CcsdsSeqFlags = 'NOGROUP'
107
+ packet.CcsdsLength = packet.buffer.length - 7
108
+
109
+ @solar_panel_positions = SOLAR_PANEL_DFLTS.dup
110
+ @solar_panel_thread = nil
111
+ @solar_panel_thread_cancel = false
112
+
113
+ @trackStars = Array.new
114
+ @trackStars[0] = 1237
115
+ @trackStars[1] = 1329
116
+ @trackStars[2] = 1333
117
+ @trackStars[3] = 1139
118
+ @trackStars[4] = 1161
119
+ @trackStars[5] = 682
120
+ @trackStars[6] = 717
121
+ @trackStars[7] = 814
122
+ @trackStars[8] = 583
123
+ @trackStars[9] = 622
124
+
125
+ @get_count = 0
126
+ @bad_temp2 = false
127
+ @last_temp2 = 0
128
+ end
129
+
130
+ def set_rates
131
+ set_rate('ADCS', 10)
132
+ set_rate('HEALTH_STATUS', 100)
133
+ set_rate('PARAMS', 100)
134
+ set_rate('IMAGE', 100)
135
+ set_rate('MECH', 10)
136
+ end
137
+
138
+ def write(packet)
139
+ name = packet.packet_name.upcase
140
+
141
+ hs_packet = @tlm_packets['HEALTH_STATUS']
142
+ params_packet = @tlm_packets['PARAMS']
143
+
144
+ case name
145
+ when 'COLLECT'
146
+ hs_packet.collects += 1
147
+ hs_packet.duration = packet.read('duration')
148
+ hs_packet.collect_type = packet.read("type")
149
+ when 'CLEAR'
150
+ hs_packet.collects = 0
151
+ when 'SETPARAMS'
152
+ params_packet.value1 = packet.read('value1')
153
+ params_packet.value2 = packet.read('value2')
154
+ params_packet.value3 = packet.read('value3')
155
+ params_packet.value4 = packet.read('value4')
156
+ params_packet.value5 = packet.read('value5')
157
+ when 'ASCIICMD'
158
+ hs_packet.asciicmd = packet.read('string')
159
+ when 'SLRPNLDEPLOY'
160
+ return if @solar_panel_thread and @solar_panel_thread.alive?
161
+ @solar_panel_thread = Thread.new do
162
+ @solar_panel_thread_cancel = false
163
+ (0..@solar_panel_positions.size - 1).to_a.reverse_each do |i|
164
+ while (@solar_panel_positions[i] > 0.1) or (@solar_panel_positions[i] < - 0.1)
165
+ if @solar_panel_positions[i] > 3.0
166
+ @solar_panel_positions[i] -= 3.0
167
+ elsif @solar_panel_positions[i] < -3.0
168
+ @solar_panel_positions[i] += 3.0
169
+ else
170
+ @solar_panel_positions[i] = 0.0
171
+ end
172
+ sleep(0.10)
173
+ break if @solar_panel_thread_cancel
174
+ end
175
+ if @solar_panel_thread_cancel
176
+ @solar_panel_thread_cancel = false
177
+ break
178
+ end
179
+ end
180
+ end
181
+ when 'SLRPNLRESET'
182
+ Cosmos.kill_thread(self, @solar_panel_thread)
183
+ @solar_panel_positions = SOLAR_PANEL_DFLTS.dup
184
+ end
185
+ end
186
+
187
+ def graceful_kill
188
+ @solar_panel_thread_cancel = true
189
+ end
190
+
191
+ def read(count_100hz, time)
192
+ pending_packets = get_pending_packets(count_100hz)
193
+
194
+ pending_packets.each do |packet|
195
+ case packet.packet_name
196
+ when 'ADCS'
197
+ # Read 44 Bytes for Position Data
198
+ pos_data = nil
199
+ begin
200
+ pos_data = @position_file.read(44)
201
+ @position_file_bytes_read += 44
202
+ rescue
203
+ # Do Nothing
204
+ end
205
+
206
+ if pos_data.nil? or pos_data.length == 0
207
+ # Assume end of file - close and reopen
208
+ @position_file.close
209
+ @position_file = File.open(File.join(@target.dir, 'data', 'position.bin'), 'rb')
210
+ pos_data = @position_file.read(44)
211
+ @position_file_bytes_read = 44
212
+ end
213
+
214
+ @pos_packet.buffer = pos_data
215
+ packet.posx = @pos_packet.posx
216
+ packet.posy = @pos_packet.posy
217
+ packet.posz = @pos_packet.posz
218
+ packet.velx = @pos_packet.velx
219
+ packet.vely = @pos_packet.vely
220
+ packet.velz = @pos_packet.velz
221
+
222
+ # Read 40 Bytes for Attitude Data
223
+ att_data = nil
224
+ begin
225
+ att_data = @attitude_file.read(40)
226
+ @attitude_file_bytes_read += 40
227
+ rescue
228
+ # Do Nothing
229
+ end
230
+
231
+ if att_data.nil? or att_data.length == 0
232
+ @attitude_file.close
233
+ @attitude_file = File.open(File.join(@target.dir, 'data', 'attitude.bin'), 'rb')
234
+ att_data = @attitude_file.read(40)
235
+ @attitude_file_bytes_read = 40
236
+ end
237
+
238
+ @att_packet.buffer = att_data
239
+ packet.q1 = @att_packet.q1
240
+ packet.q2 = @att_packet.q2
241
+ packet.q3 = @att_packet.q3
242
+ packet.q4 = @att_packet.q4
243
+ packet.biasx = @att_packet.biasx
244
+ packet.biasy = @att_packet.biasy
245
+ packet.biasy = @att_packet.biasz
246
+
247
+ packet.star1id = @trackStars[((@get_count / 100) + 0) % 10]
248
+ packet.star2id = @trackStars[((@get_count / 100) + 1) % 10]
249
+ packet.star3id = @trackStars[((@get_count / 100) + 2) % 10]
250
+ packet.star4id = @trackStars[((@get_count / 100) + 3) % 10]
251
+ packet.star5id = @trackStars[((@get_count / 100) + 4) % 10]
252
+
253
+ packet.posprogress = (@position_file_bytes_read.to_f / @position_file_size.to_f) * 100.0
254
+ packet.attprogress = (@attitude_file_bytes_read.to_f / @attitude_file_size.to_f) * 100.0
255
+
256
+ packet.timesec = time.tv_sec
257
+ packet.timeus = time.tv_usec
258
+ packet.ccsdsseqcnt += 1
259
+
260
+ when 'HEALTH_STATUS'
261
+ cycle_tlm_item(packet, 'temp1', -95.0, 95.0, 5.0)
262
+ if @bad_temp2
263
+ packet.write('temp2', @last_temp2)
264
+ @bad_temp2 = false
265
+ end
266
+ @last_temp2 = cycle_tlm_item(packet, 'temp2', -50.0, 50.0, -1.0)
267
+ if (packet.temp2.abs - 30).abs < 2
268
+ packet.write('temp2', Float::NAN)
269
+ @bad_temp2 = true
270
+ elsif (packet.temp2.abs - 20).abs < 2
271
+ packet.write('temp2', -Float::INFINITY)
272
+ @bad_temp2 = true
273
+ elsif (packet.temp2.abs - 10).abs < 2
274
+ packet.write('temp2', Float::INFINITY)
275
+ @bad_temp2 = true
276
+ end
277
+ cycle_tlm_item(packet, 'temp3', -30.0, 80.0, 2.0)
278
+ cycle_tlm_item(packet, 'temp4', 0.0, 20.0, -0.1)
279
+
280
+ packet.timesec = time.tv_sec
281
+ packet.timeus = time.tv_usec
282
+ packet.ccsdsseqcnt += 1
283
+
284
+ ary = []
285
+ 10.times do |index|
286
+ ary << index
287
+ end
288
+ packet.ary = ary
289
+
290
+ if @get_count % 1000 == 0
291
+ if packet.ground1status == 'CONNECTED'
292
+ packet.ground1status = 'UNAVAILABLE'
293
+ else
294
+ packet.ground1status = 'CONNECTED'
295
+ end
296
+ end
297
+
298
+ if @get_count % 500 == 0
299
+ if packet.ground2status == 'CONNECTED'
300
+ packet.ground2status = 'UNAVAILABLE'
301
+ else
302
+ packet.ground2status = 'CONNECTED'
303
+ end
304
+ end
305
+
306
+ when 'PARAMS'
307
+ packet.timesec = time.tv_sec
308
+ packet.timeus = time.tv_usec
309
+ packet.ccsdsseqcnt += 1
310
+
311
+ when 'IMAGE'
312
+ packet.timesec = time.tv_sec
313
+ packet.timeus = time.tv_usec
314
+ # Create an Array the size of the packet and then initialize
315
+ # using a sample of all possible hex values (0..15)
316
+ # finally pack it into binary using the Character 'C' specifier
317
+ data = Array.new(packet.image.length) { Array(0..15).sample }.pack("C*")
318
+ packet.image = data
319
+ packet.ccsdsseqcnt += 1
320
+
321
+ when 'MECH'
322
+ packet.timesec = time.tv_sec
323
+ packet.timeus = time.tv_usec
324
+ packet.ccsdsseqcnt += 1
325
+ packet.slrpnl1 = @solar_panel_positions[0]
326
+ packet.slrpnl2 = @solar_panel_positions[1]
327
+ packet.slrpnl3 = @solar_panel_positions[2]
328
+ packet.slrpnl4 = @solar_panel_positions[3]
329
+ packet.slrpnl5 = @solar_panel_positions[4]
330
+ end
331
+ end
332
+
333
+ # Every 10s throw an unknown packet at the server just to demo that
334
+ data = Array.new(10) { rand(0..255) }.pack("C*")
335
+ if @get_count % 1000 == 999
336
+ pending_packets << Packet.new(nil, nil, :BIG_ENDIAN, nil, data)
337
+ end
338
+
339
+ @get_count += 1
340
+ pending_packets
341
+ end
342
+ end
343
+ end
@@ -0,0 +1,11 @@
1
+ collect_cnt = tlm("<%= target_name %> HEALTH_STATUS COLLECTS")
2
+ cmd("<%= target_name %> COLLECT with DURATION 11, TYPE NORMAL")
3
+ cmd_no_range_check("<%= target_name %> COLLECT with DURATION 11, TYPE NORMAL")
4
+ cmd_no_hazardous_check("<%= target_name %> COLLECT with DURATION 11, TYPE NORMAL")
5
+ cmd_no_checks("<%= target_name %> COLLECT with DURATION 11, TYPE NORMAL")
6
+ wait_check("<%= target_name %> HEALTH_STATUS COLLECTS == #{collect_cnt + 2}", 10)
7
+ cmd("<%= target_name %> CLEAR")
8
+ cmd_no_range_check("<%= target_name %> CLEAR")
9
+ cmd_no_hazardous_check("<%= target_name %> CLEAR")
10
+ cmd_no_checks("<%= target_name %> CLEAR")
11
+ puts tlm("<%= target_name %> HEALTH_STATUS COLLECTS")
@@ -0,0 +1,18 @@
1
+ load_utility '<%= target_name %>/procedures/utilities/collect.rb'
2
+ load_utility '<%= target_name %>/procedures/utilities/clear.rb'
3
+
4
+ number = ask("Enter a number.")
5
+ raise "Bad return" unless number.is_a? Numeric
6
+ number = ask_string("Enter a number.")
7
+ raise "Bad return" unless number.is_a? String
8
+
9
+ result = message_box("Click something.", "CHOICE1", "CHOICE2")
10
+ raise "Bad return" unless result == 'CHOICE1' or result == 'CHOICE2'
11
+
12
+ prompt("Press Ok to start NORMAL Collect")
13
+ collect('NORMAL', 1)
14
+ prompt("Press Ok to start SPECIAL Collect")
15
+ collect('SPECIAL', 2, true)
16
+ clear()
17
+
18
+ wait_check("<%= target_name %> HEALTH_STATUS COLLECTS == 0", 10)
@@ -0,0 +1,29 @@
1
+ cmd("<%= target_name %> ABORT")
2
+ cmd_no_range_check("<%= target_name %> COLLECT with TYPE NORMAL, TEMP 100")
3
+ cmd_no_hazardous_check("<%= target_name %> CLEAR")
4
+ cmd_no_checks("<%= target_name %> COLLECT with TYPE SPECIAL, TEMP 100.0")
5
+ cmd_raw("<%= target_name %> ABORT")
6
+ cmd_raw_no_range_check("<%= target_name %> COLLECT with TYPE 0, TEMP 100")
7
+ cmd_raw_no_hazardous_check("<%= target_name %> CLEAR")
8
+ cmd_raw_no_checks("<%= target_name %> COLLECT with TYPE 1, TEMP 100.0")
9
+ check("<%= target_name %> ADCS BIASX == 100")
10
+ check_formatted("<%= target_name %> ADCS BIASX == 100")
11
+ check_with_units("<%= target_name %> ADCS BIASX == 100")
12
+ check_raw("<%= target_name %> ADCS BIASX == 100")
13
+ check_tolerance("<%= target_name %> ADCS BIASX", 5, 0.5)
14
+ check_tolerance_raw("<%= target_name %> ADCS BIASX", 5, 0.5)
15
+ check_expression("true == false")
16
+ wait
17
+ wait 5
18
+ wait("<%= target_name %> ADCS BIASX > 100", 5)
19
+ wait_raw("<%= target_name %> ADCS BIASX > 100", 5)
20
+ wait_tolerance("<%= target_name %> ADCS BIASX", 5, 0.5, 5)
21
+ wait_tolerance_raw("<%= target_name %> ADCS BIASX", 5, 0.5, 5)
22
+ wait_expression("true == false", 5)
23
+ wait_packet("<%= target_name %>","ADCS", 2, 5)
24
+ wait_check("<%= target_name %> ADCS BIASX == 100", 5)
25
+ wait_check_raw("<%= target_name %> ADCS BIASX == 100", 5)
26
+ wait_check_tolerance("<%= target_name %> ADCS BIASX", 5, 0.5, 5)
27
+ wait_check_tolerance_raw("<%= target_name %> ADCS BIASX", 5, 0.5, 5)
28
+ wait_check_expression("true == false", 5)
29
+ wait_check_packet("<%= target_name %>","ADCS", 2, 5)
@@ -0,0 +1,46 @@
1
+ load 'cosmos/script/suite.rb'
2
+ require 'INST/procedures/utilities/collect' # Test requiring files from s3 in suite analysis
3
+
4
+ class ExampleGroup < Cosmos::Group
5
+ def setup
6
+ puts "Setup"
7
+ end
8
+
9
+ def script_run_method_with_long_name
10
+ puts "Running #{Cosmos::Group.current_suite}:#{Cosmos::Group.current_group}:#{Cosmos::Group.current_script}"
11
+ Cosmos::Group.puts "This test verifies requirement 1"
12
+ raise "error"
13
+ puts "continue past raise"
14
+ end
15
+
16
+ def script_2
17
+ puts "Running #{Cosmos::Group.current_suite}:#{Cosmos::Group.current_group}:#{Cosmos::Group.current_script}"
18
+ Cosmos::Group.puts "This test verifies requirement 2"
19
+ helper()
20
+ wait(2)
21
+ end
22
+
23
+ def script_3
24
+ puts "Running #{Cosmos::Group.current_suite}:#{Cosmos::Group.current_group}:#{Cosmos::Group.current_script}"
25
+ raise SkipScript
26
+ end
27
+
28
+ def helper
29
+ if $manual
30
+ answer = ask "Are you sure?"
31
+ else
32
+ answer = 'y'
33
+ end
34
+ end
35
+
36
+ def teardown
37
+ puts "teardown"
38
+ end
39
+ end
40
+
41
+ class MySuite < Cosmos::Suite
42
+ def initialize
43
+ super()
44
+ add_group('ExampleGroup')
45
+ end
46
+ end
@@ -0,0 +1,45 @@
1
+ load 'cosmos/tools/test_runner/test.rb'
2
+
3
+ class ExampleTest < Cosmos::Test
4
+ def setup
5
+ puts "Setup"
6
+ end
7
+
8
+ def test_case_with_long_name
9
+ puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
10
+ Cosmos::Test.puts "This test verifies requirement 1"
11
+ raise "error"
12
+ puts "continue past raise"
13
+ end
14
+
15
+ def test_2
16
+ puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
17
+ Cosmos::Test.puts "This test verifies requirement 2"
18
+ helper()
19
+ wait(2)
20
+ end
21
+
22
+ def test_3
23
+ puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
24
+ raise SkipTestCase
25
+ end
26
+
27
+ def helper
28
+ if $manual
29
+ answer = ask "Are you sure?"
30
+ else
31
+ answer = 'y'
32
+ end
33
+ end
34
+
35
+ def teardown
36
+ puts "teardown"
37
+ end
38
+ end
39
+
40
+ class MyTestSuite < Cosmos::TestSuite
41
+ def initialize
42
+ super()
43
+ add_test('ExampleTest')
44
+ end
45
+ end
@@ -0,0 +1,21 @@
1
+ put_target_file("INST/test.txt", "this is a string test")
2
+ file = get_target_file("INST/test.txt")
3
+ puts file.read
4
+ file.unlink
5
+ delete_target_file("INST/test.txt")
6
+
7
+ save_file = Tempfile.new('test')
8
+ save_file.write("this is a Io test")
9
+ save_file.rewind
10
+ put_target_file("INST/test.txt", save_file)
11
+ save_file.unlink
12
+ file = get_target_file("INST/test.txt")
13
+ puts file.read
14
+ file.unlink
15
+ delete_target_file("INST/test.txt")
16
+
17
+ put_target_file("INST/test.bin", "\x00\x01\x02\x03\xFF\xEE\xDD\xCC")
18
+ file = get_target_file("INST/test.bin")
19
+ puts file.read.formatted
20
+ file.unlink
21
+ delete_target_file("INST/test.bin")
@@ -0,0 +1,7 @@
1
+ def clear
2
+ # Command the collect
3
+ cmd("<%= target_name %> CLEAR")
4
+
5
+ # Wait for telemetry to update
6
+ wait_check("<%= target_name %> HEALTH_STATUS COLLECTS == 0", 10)
7
+ end
@@ -0,0 +1,14 @@
1
+ load_utility '<%= target_name %>/procedures/utilities/clear.rb'
2
+
3
+ def collect(type, duration, call_clear = false)
4
+ # Get the current collects telemetry point
5
+ collects = tlm('<%= target_name %> HEALTH_STATUS COLLECTS')
6
+
7
+ # Command the collect
8
+ cmd("<%= target_name %> COLLECT with TYPE #{type}, DURATION #{duration}")
9
+
10
+ # Wait for telemetry to update
11
+ wait_check("<%= target_name %> HEALTH_STATUS COLLECTS == #{collects + 1}", 10)
12
+
13
+ clear() if call_clear
14
+ end
Binary file
Binary file
Binary file
@@ -0,0 +1,3 @@
1
+ VERTICALBOX
2
+ LABELVALUE <%= target_name %> HEALTH_STATUS TIMEFORMATTED WITH_UNITS 30
3
+ END
@@ -0,0 +1,71 @@
1
+ SCREEN AUTO AUTO 1.0 FIXED
2
+
3
+ VERTICAL
4
+ TITLE "<%= target_name %> Instrument ADCS Information" Courier 20 NORMAL true
5
+ # Note @original_target_name is also available
6
+
7
+ HORIZONTAL
8
+ VERTICALBOX
9
+ SECTIONHEADER "Position and Velocity"
10
+
11
+ LABELVALUE <%= target_name %> ADCS POSX WITH_UNITS 20 CENTER
12
+ LABELVALUE <%= target_name %> ADCS POSY WITH_UNITS 22 CENTER
13
+ LABELVALUE <%= target_name %> ADCS POSZ WITH_UNITS 24 CENTER
14
+ LABELVALUE <%= target_name %> ADCS VELX WITH_UNITS 20
15
+ LABELVALUE <%= target_name %> ADCS VELY WITH_UNITS 22
16
+ LABELVALUE <%= target_name %> ADCS VELZ WITH_UNITS 24
17
+ END
18
+
19
+ VERTICALBOX
20
+ SECTIONHEADER "Attitude"
21
+
22
+ LABELVALUE <%= target_name %> ADCS Q1 WITH_UNITS 12 RIGHT
23
+ SETTING TEXTALIGN LEFT
24
+ SETTING TEXTCOLOR RED
25
+ LABELVALUE <%= target_name %> ADCS Q2 WITH_UNITS 12 RIGHT
26
+ SETTING TEXTALIGN LEFT
27
+ SUBSETTING 0 TEXTCOLOR BLUE
28
+ SUBSETTING 1 TEXTCOLOR GREEN
29
+ LABELVALUE <%= target_name %> ADCS Q3 WITH_UNITS 12 RIGHT
30
+ SETTING TEXTALIGN LEFT
31
+ SETTING BACKCOLOR PURPLE
32
+ LABELVALUE <%= target_name %> ADCS Q4 WITH_UNITS 12 RIGHT
33
+ SETTING TEXTALIGN LEFT
34
+ SUBSETTING 0 BACKCOLOR ORANGE
35
+ LABELVALUE <%= target_name %> ADCS BIASX WITH_UNITS 12 RIGHT
36
+ SETTING TEXTALIGN LEFT
37
+ LABELVALUE <%= target_name %> ADCS BIASY WITH_UNITS 12 RIGHT
38
+ SETTING TEXTALIGN LEFT
39
+ LABELVALUE <%= target_name %> ADCS BIASZ WITH_UNITS 12 RIGHT
40
+ SETTING TEXTALIGN LEFT
41
+ END
42
+
43
+ VERTICALBOX
44
+ SECTIONHEADER "File Progress"
45
+
46
+ LABELPROGRESSBAR <%= target_name %> ADCS POSPROGRESS
47
+ LABELPROGRESSBAR <%= target_name %> ADCS ATTPROGRESS
48
+ LABELPROGRESSBAR <%= target_name %> ADCS ATTPROGRESS 2 60 RAW # scale by 2
49
+
50
+ LABEL ""
51
+ LABEL "LEFT"
52
+ SETTING PADDING 5
53
+ SETTING TEXTALIGN LEFT
54
+ SETTING BACKCOLOR RED
55
+ LABEL "CENTER"
56
+ SETTING PADDING 5
57
+ SETTING TEXTALIGN CENTER
58
+ SETTING TEXTCOLOR BLACK
59
+ SETTING BACKCOLOR WHITE
60
+ LABEL "RIGHT"
61
+ SETTING PADDING 5
62
+ SETTING TEXTALIGN RIGHT
63
+ SETTING TEXTCOLOR WHITE
64
+ SETTING BACKCOLOR BLUE
65
+ END
66
+ END
67
+
68
+ VERTICALBOX
69
+ LABELVALUE <%= target_name %> ADCS TIMEFORMATTED WITH_UNITS 30
70
+ END
71
+ END