openc3-demo 5.0.6
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.
- checksums.yaml +7 -0
- data/LICENSE.txt +727 -0
- data/README.md +30 -0
- data/Rakefile +42 -0
- data/microservices/EXAMPLE/example_target.rb +123 -0
- data/microservices/TEMPLATED/scpi_target.rb +79 -0
- data/plugin.txt +112 -0
- data/targets/EXAMPLE/cmd_tlm/example_cmds.txt +2 -0
- data/targets/EXAMPLE/cmd_tlm/example_tlm.txt +5 -0
- data/targets/EXAMPLE/lib/example_interface.rb +27 -0
- data/targets/EXAMPLE/target.txt +9 -0
- data/targets/INST/cmd_tlm/_ccsds_cmd.txt +9 -0
- data/targets/INST/cmd_tlm/_ccsds_tlm.txt +19 -0
- data/targets/INST/cmd_tlm/inst_cmds.txt +57 -0
- data/targets/INST/cmd_tlm/inst_tlm.txt +162 -0
- data/targets/INST/cmd_tlm/inst_tlm_override.txt +12 -0
- data/targets/INST/data/attitude.bin +0 -0
- data/targets/INST/data/position.bin +0 -0
- data/targets/INST/lib/example_limits_response.rb +39 -0
- data/targets/INST/lib/sim_inst.rb +354 -0
- data/targets/INST/procedures/checks.rb +11 -0
- data/targets/INST/procedures/collect.rb +18 -0
- data/targets/INST/procedures/disconnect.rb +29 -0
- data/targets/INST/procedures/file_dialog.rb +13 -0
- data/targets/INST/procedures/my_script_suite.rb +46 -0
- data/targets/INST/procedures/my_test_suite.rb +45 -0
- data/targets/INST/procedures/target_file.rb +21 -0
- data/targets/INST/procedures/utilities/clear.rb +7 -0
- data/targets/INST/procedures/utilities/collect.rb +14 -0
- data/targets/INST/public/ground_error.png +0 -0
- data/targets/INST/public/ground_off.png +0 -0
- data/targets/INST/public/ground_on.png +0 -0
- data/targets/INST/public/satellite.png +0 -0
- data/targets/INST/screens/_footer.txt +3 -0
- data/targets/INST/screens/adcs.txt +71 -0
- data/targets/INST/screens/array.txt +15 -0
- data/targets/INST/screens/block.txt +6 -0
- data/targets/INST/screens/commanding.txt +44 -0
- data/targets/INST/screens/graphs.txt +17 -0
- data/targets/INST/screens/ground.txt +46 -0
- data/targets/INST/screens/hs.txt +42 -0
- data/targets/INST/screens/latest.txt +21 -0
- data/targets/INST/screens/limits.txt +82 -0
- data/targets/INST/screens/other.txt +37 -0
- data/targets/INST/screens/params.txt +54 -0
- data/targets/INST/screens/simple.txt +6 -0
- data/targets/INST/screens/tabs.txt +66 -0
- data/targets/INST/screens/web.txt +5 -0
- data/targets/INST/tables/bin/ConfigTables.bin +0 -0
- data/targets/INST/tables/config/ConfigTables_def.txt +7 -0
- data/targets/INST/tables/config/MCConfigurationTable_def.txt +36 -0
- data/targets/INST/tables/config/PPSSelectionTable_def.txt +7 -0
- data/targets/INST/tables/config/TLMMonitoringTable_def.txt +31 -0
- data/targets/INST/tables/procedures/download.rb +16 -0
- data/targets/INST/tables/procedures/upload.rb +19 -0
- data/targets/INST/target.txt +31 -0
- data/targets/SYSTEM/cmd_tlm/limits_groups.txt +6 -0
- data/targets/SYSTEM/cmd_tlm/meta_tlm.txt +10 -0
- data/targets/SYSTEM/cmd_tlm/system_cmds.txt +41 -0
- data/targets/SYSTEM/cmd_tlm/system_tlm.txt +7 -0
- data/targets/SYSTEM/lib/example_background_task.rb +66 -0
- data/targets/SYSTEM/lib/example_target.rb +112 -0
- data/targets/SYSTEM/lib/limits_groups.rb +64 -0
- data/targets/SYSTEM/lib/scpi_target.rb +76 -0
- data/targets/SYSTEM/procedures/example_test.rb +191 -0
- data/targets/SYSTEM/procedures/interactive.rb +38 -0
- data/targets/SYSTEM/procedures/openc3_api_test.rb +286 -0
- data/targets/SYSTEM/procedures/run_example_test.rb +3 -0
- data/targets/SYSTEM/procedures/test.rb +49 -0
- data/targets/SYSTEM/screens/status.txt +12 -0
- data/targets/SYSTEM/target.txt +12 -0
- data/targets/TEMPLATED/cmd_tlm/templated_cmds.txt +13 -0
- data/targets/TEMPLATED/cmd_tlm/templated_tlm.txt +3 -0
- data/targets/TEMPLATED/lib/templated_interface.rb +69 -0
- data/targets/TEMPLATED/target.txt +8 -0
- data/tools/widgets/BigWidget/BigWidget.umd.min.js +4 -0
- data/tools/widgets/BigWidget/BigWidget.umd.min.js.map +1 -0
- data/tools/widgets/HelloworldWidget/HelloworldWidget.umd.min.js +2 -0
- data/tools/widgets/HelloworldWidget/HelloworldWidget.umd.min.js.map +1 -0
- metadata +126 -0
@@ -0,0 +1,191 @@
|
|
1
|
+
load 'openc3/tools/test_runner/test.rb'
|
2
|
+
|
3
|
+
# This Test demonstrates the usage of the setup and teardown methods
|
4
|
+
# as well as defining two tests. Notice that the setup and teardown
|
5
|
+
# methods must be called exactly that. Other test methods must start
|
6
|
+
# with 'test_' to be processed.
|
7
|
+
class ExampleTest < OpenC3::Test
|
8
|
+
def initialize
|
9
|
+
super()
|
10
|
+
end
|
11
|
+
|
12
|
+
# Setup the test case by doing stuff
|
13
|
+
def setup
|
14
|
+
status_bar("setup")
|
15
|
+
puts "Running #{OpenC3::Test.current_test_suite}:#{OpenC3::Test.current_test}:#{OpenC3::Test.current_test_case}"
|
16
|
+
wait(2)
|
17
|
+
end
|
18
|
+
|
19
|
+
# test_1 verifies requirement 1
|
20
|
+
def test_case_with_long_name_1
|
21
|
+
status_bar("test_case_with_long_name_1")
|
22
|
+
puts "Running #{OpenC3::Test.current_test_suite}:#{OpenC3::Test.current_test}:#{OpenC3::Test.current_test_case}"
|
23
|
+
OpenC3::Test.puts "This test verifies requirement 1"
|
24
|
+
wait(2)
|
25
|
+
end
|
26
|
+
|
27
|
+
# test_2 verifies requirement 2
|
28
|
+
def test_2
|
29
|
+
status_bar("test_2")
|
30
|
+
puts "Running #{OpenC3::Test.current_test_suite}:#{OpenC3::Test.current_test}:#{OpenC3::Test.current_test_case}"
|
31
|
+
OpenC3::Test.puts "This test verifies requirement 2"
|
32
|
+
if $manual
|
33
|
+
answer = ask "Are you sure?"
|
34
|
+
else
|
35
|
+
answer = 'y'
|
36
|
+
end
|
37
|
+
wait(2)
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_3xx
|
41
|
+
status_bar("test_3xx")
|
42
|
+
puts "Running #{OpenC3::Test.current_test_suite}:#{OpenC3::Test.current_test}:#{OpenC3::Test.current_test_case}"
|
43
|
+
wait 1
|
44
|
+
end
|
45
|
+
|
46
|
+
# Teardown the test case by doing other stuff
|
47
|
+
def teardown
|
48
|
+
status_bar("teardown")
|
49
|
+
puts "Running #{OpenC3::Test.current_test_suite}:#{OpenC3::Test.current_test}:#{OpenC3::Test.current_test_case}"
|
50
|
+
wait(2)
|
51
|
+
end
|
52
|
+
|
53
|
+
def helper_method
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# This is an ExampleTestSuite which only runs ExampleTest
|
58
|
+
class ExampleTestSuite < OpenC3::TestSuite
|
59
|
+
def initialize
|
60
|
+
super()
|
61
|
+
add_test('ExampleTest')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# ExampleTest2 runs test_3 and test_4.
|
66
|
+
class ExampleTest2 < OpenC3::Test
|
67
|
+
def setup
|
68
|
+
puts "Running #{OpenC3::Test.current_test_suite}:#{OpenC3::Test.current_test}:#{OpenC3::Test.current_test_case}"
|
69
|
+
wait(2)
|
70
|
+
end
|
71
|
+
|
72
|
+
# ExampleTest2::test_2 is different from ExampleTest::test_2
|
73
|
+
def test_2
|
74
|
+
puts "Running #{OpenC3::Test.current_test_suite}:#{OpenC3::Test.current_test}:#{OpenC3::Test.current_test_case}"
|
75
|
+
raise "BAD"
|
76
|
+
puts "continuing past the exception"
|
77
|
+
wait 2
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_3
|
81
|
+
puts "Running #{OpenC3::Test.current_test_suite}:#{OpenC3::Test.current_test}:#{OpenC3::Test.current_test_case}"
|
82
|
+
raise SkipTestCase, "test_3 unimplemented"
|
83
|
+
wait(2)
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_4
|
87
|
+
puts "Running #{OpenC3::Test.current_test_suite}:#{OpenC3::Test.current_test}:#{OpenC3::Test.current_test_case}"
|
88
|
+
if non_existent
|
89
|
+
puts "can't get here"
|
90
|
+
else
|
91
|
+
puts "can't get here either"
|
92
|
+
end
|
93
|
+
wait(2)
|
94
|
+
end
|
95
|
+
|
96
|
+
def teardown
|
97
|
+
puts "Running #{OpenC3::Test.current_test_suite}:#{OpenC3::Test.current_test}:#{OpenC3::Test.current_test_case}"
|
98
|
+
wait(2)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
class ExampleTestSuite2 < OpenC3::TestSuite
|
103
|
+
def initialize
|
104
|
+
super()
|
105
|
+
add_test('ExampleTest2')
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
class ExampleTestSuite3 < OpenC3::TestSuite
|
110
|
+
# This setup applies to the entire test suite
|
111
|
+
def setup
|
112
|
+
puts "Running #{OpenC3::Test.current_test_suite}:#{OpenC3::Test.current_test}:#{OpenC3::Test.current_test_case}"
|
113
|
+
wait(2)
|
114
|
+
end
|
115
|
+
|
116
|
+
def initialize
|
117
|
+
super()
|
118
|
+
add_test_setup('ExampleTest')
|
119
|
+
# This line raises a runtime error because ExampleTest3 has no setup method
|
120
|
+
# add_test_setup('ExampleTest3')
|
121
|
+
# This line raises a runtime error because ExampleTest3 has no test_50 method
|
122
|
+
# add_test_case('ExampleTest3', 'test_50')
|
123
|
+
add_test('ExampleTest')
|
124
|
+
add_test('ExampleTest2')
|
125
|
+
add_test_teardown('ExampleTest')
|
126
|
+
end
|
127
|
+
|
128
|
+
# This teardown applies to the entire test suite
|
129
|
+
def teardown
|
130
|
+
puts "Running #{OpenC3::Test.current_test_suite}:#{OpenC3::Test.current_test}:#{OpenC3::Test.current_test_case}"
|
131
|
+
wait(2)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
class ExampleTest3 < OpenC3::Test
|
136
|
+
def test_5
|
137
|
+
puts "Running #{OpenC3::Test.current_test_suite}:#{OpenC3::Test.current_test}:#{OpenC3::Test.current_test_case}"
|
138
|
+
puts "\000\001\002"
|
139
|
+
check_expression("false == true")
|
140
|
+
wait(2)
|
141
|
+
end
|
142
|
+
|
143
|
+
def test_6
|
144
|
+
puts "Running #{OpenC3::Test.current_test_suite}:#{OpenC3::Test.current_test}:#{OpenC3::Test.current_test_case}"
|
145
|
+
wait(2)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
class ExampleTestSuite4 < OpenC3::TestSuite
|
150
|
+
# This setup applies to the entire test suite
|
151
|
+
def setup
|
152
|
+
puts "Running #{OpenC3::Test.current_test_suite}:#{OpenC3::Test.current_test}:#{OpenC3::Test.current_test_case}"
|
153
|
+
wait(2)
|
154
|
+
end
|
155
|
+
|
156
|
+
def initialize
|
157
|
+
super()
|
158
|
+
add_test_setup('ExampleTest')
|
159
|
+
add_test_case('ExampleTest', 'test_2')
|
160
|
+
add_test_case('ExampleTest', 'test_3xx')
|
161
|
+
add_test_teardown('ExampleTest')
|
162
|
+
end
|
163
|
+
|
164
|
+
# This teardown applies to the entire test suite
|
165
|
+
def teardown
|
166
|
+
puts "Running #{OpenC3::Test.current_test_suite}:#{OpenC3::Test.current_test}:#{OpenC3::Test.current_test_case}"
|
167
|
+
wait(2)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
class ExampleTestSuite5 < OpenC3::TestSuite
|
172
|
+
def initialize
|
173
|
+
super()
|
174
|
+
add_test_teardown('ExampleTest')
|
175
|
+
end
|
176
|
+
|
177
|
+
# This teardown applies to the entire test suite
|
178
|
+
def teardown
|
179
|
+
puts "Running #{OpenC3::Test.current_test_suite}:#{OpenC3::Test.current_test}:#{OpenC3::Test.current_test_case}"
|
180
|
+
wait(2)
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
class EmptyTestSuite < OpenC3::TestSuite
|
185
|
+
def initialize
|
186
|
+
super()
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
class EmptyTest < OpenC3::Test
|
191
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# This script checks all the interactive APIs
|
2
|
+
prompt("Would you like to continue?")
|
3
|
+
answer = combo_box("This is a plain combo box", 'one', 'two', 'three', informative: nil)
|
4
|
+
puts "answer:#{answer}"
|
5
|
+
answer = combo_box("This is a combo box with info", 'one', 'two', 'three', informative: 'This is informative')
|
6
|
+
puts "answer:#{answer}"
|
7
|
+
answer = combo_box("This is a combo box with details", 'one', 'two', 'three', informative: nil, details: 'This is some details')
|
8
|
+
puts "answer:#{answer}"
|
9
|
+
answer = combo_box("This is a combo box with info & details", 'one', 'two', 'three', informative: 'This is informative', details: 'Details details details!')
|
10
|
+
puts "answer:#{answer}"
|
11
|
+
answer = combo_box("This is a combo box", 'one', 'two', 'three', text_color: 'blue', background_color: 'grey', font_size: 20, font_family: 'courier', details: "Some more stuff")
|
12
|
+
puts "answer:#{answer}"
|
13
|
+
answer = prompt("This is a test", text_color: 'blue', background_color: 'grey', font_size: 20, font_family: 'courier', informative: "Informative text", details: "Some more stuff")
|
14
|
+
puts "answer:#{answer}"
|
15
|
+
answer = prompt("This is a test", font_size: 30, details: "Some more stuff", informative: nil)
|
16
|
+
puts "answer:#{answer}"
|
17
|
+
answer = message_box('This is a message box', 'one', 'two', 'three', text_color: 'blue', background_color: 'grey', font_size: 20, font_family: 'courier', informative: "Informative stuff", details: "Some more stuff")
|
18
|
+
puts "answer:#{answer}"
|
19
|
+
answer = vertical_message_box('This is a message box', 'one', 'two', 'three', text_color: 'blue', background_color: 'grey', font_size: 20, font_family: 'courier', informative: "Informative stuff", details: "Some more stuff")
|
20
|
+
puts "answer:#{answer}"
|
21
|
+
answer = ask("Let me ask you a question", "default")
|
22
|
+
puts "answer:#{answer} class:#{answer.class}"
|
23
|
+
raise "Not a string" unless answer.is_a? String
|
24
|
+
answer = ask("Let me ask you a question", 10)
|
25
|
+
puts "answer:#{answer} class:#{answer.class}"
|
26
|
+
raise "Not an integer" unless answer.is_a? Integer
|
27
|
+
answer = ask("Let me ask you a question", 10.5)
|
28
|
+
puts "answer:#{answer} class:#{answer.class}"
|
29
|
+
raise "Not a float" unless answer.is_a? Float
|
30
|
+
answer = ask_string("Let me ask you a question", "default")
|
31
|
+
puts "answer:#{answer} class:#{answer.class}"
|
32
|
+
answer = ask_string("Let me ask you a question", 10)
|
33
|
+
puts "answer:#{answer} class:#{answer.class}"
|
34
|
+
raise "Not a string" unless answer.is_a? String
|
35
|
+
answer = ask("Enter a blank (return)", true) # allow blank
|
36
|
+
puts "answer:#{answer}"
|
37
|
+
answer = ask("Password", false, true) # password required
|
38
|
+
puts "answer:#{answer}"
|
@@ -0,0 +1,286 @@
|
|
1
|
+
# cmd
|
2
|
+
cmd("INST ABORT")
|
3
|
+
cmd("INST ARYCMD with ARRAY []")
|
4
|
+
cmd("INST CLEAR")
|
5
|
+
cmd("INST COLLECT with DURATION 1.0, TEMP 0.0, TYPE 'NORMAL'")
|
6
|
+
cmd("INST FLTCMD with FLOAT32 0.0, FLOAT64 0.0")
|
7
|
+
cmd("INST SETPARAMS with VALUE1 0, VALUE2 0, VALUE3 0, VALUE4 0, VALUE5 0")
|
8
|
+
cmd("INST SLRPNLDEPLOY")
|
9
|
+
cmd("INST SLRPNLRESET")
|
10
|
+
cmd("INST ASCIICMD with STRING 'ARM LASER'")
|
11
|
+
|
12
|
+
cmd("INST", "ABORT")
|
13
|
+
cmd("INST", "ARYCMD", "ARRAY" => [])
|
14
|
+
cmd("INST", "CLEAR")
|
15
|
+
cmd("INST", "COLLECT", "DURATION" => 1.0, "TEMP" => 0.0, "TYPE" => 'NORMAL')
|
16
|
+
cmd("INST", "FLTCMD", "FLOAT32" => 0.0, "FLOAT64" => 0.0)
|
17
|
+
cmd("INST", "SETPARAMS", "VALUE1" => 0, "VALUE2" => 0, "VALUE3" => 0, "VALUE4" => 0, "VALUE5" => 0)
|
18
|
+
cmd("INST", "SLRPNLDEPLOY")
|
19
|
+
cmd("INST", "SLRPNLRESET")
|
20
|
+
cmd("INST", "ASCIICMD", "STRING" => 'ARM LASER')
|
21
|
+
|
22
|
+
# cmd should fail
|
23
|
+
begin
|
24
|
+
cmd("INST COLLECT with DURATION 11, TYPE 'NORMAL'")
|
25
|
+
rescue RuntimeError => e
|
26
|
+
raise "Fail" if e.message != "Command parameter 'INST COLLECT DURATION' = 11 not in valid range of 0.0 to 10.0"
|
27
|
+
rescue
|
28
|
+
raise "Fail"
|
29
|
+
end
|
30
|
+
|
31
|
+
cmd()
|
32
|
+
cmd("BOB")
|
33
|
+
cmd("BOB", "ABORT")
|
34
|
+
cmd("INST", "BOB")
|
35
|
+
cmd("INST", "ABORT", "BOB" => "BOB")
|
36
|
+
cmd("INST", "ABORT", "TED", "BOB" => "BOB")
|
37
|
+
cmd("BOB")
|
38
|
+
cmd("BOB ABORT")
|
39
|
+
cmd("INST BOB")
|
40
|
+
|
41
|
+
# cmd_no_range_check
|
42
|
+
cmd_no_range_check("INST ABORT")
|
43
|
+
cmd_no_range_check("INST ARYCMD with ARRAY []")
|
44
|
+
cmd_no_range_check("INST CLEAR")
|
45
|
+
cmd_no_range_check("INST COLLECT with DURATION 1.0, TEMP 0.0, TYPE 'NORMAL'")
|
46
|
+
cmd_no_range_check("INST FLTCMD with FLOAT32 0.0, FLOAT64 0.0")
|
47
|
+
cmd_no_range_check("INST SETPARAMS with VALUE1 0, VALUE2 0, VALUE3 0, VALUE4 0, VALUE5 0")
|
48
|
+
cmd_no_range_check("INST SLRPNLDEPLOY")
|
49
|
+
cmd_no_range_check("INST SLRPNLRESET")
|
50
|
+
cmd_no_range_check("INST ASCIICMD with STRING 'ARM LASER'")
|
51
|
+
cmd_no_range_check("INST COLLECT with DURATION 11, TYPE 'NORMAL'")
|
52
|
+
|
53
|
+
cmd_no_range_check("INST", "ABORT")
|
54
|
+
cmd_no_range_check("INST", "ARYCMD", "ARRAY" => [])
|
55
|
+
cmd_no_range_check("INST", "CLEAR")
|
56
|
+
cmd_no_range_check("INST", "COLLECT", "DURATION" => 1.0, "TEMP" => 0.0, "TYPE" => 'NORMAL')
|
57
|
+
cmd_no_range_check("INST", "FLTCMD", "FLOAT32" => 0.0, "FLOAT64" => 0.0)
|
58
|
+
cmd_no_range_check("INST", "SETPARAMS", "VALUE1" => 0, "VALUE2" => 0, "VALUE3" => 0, "VALUE4" => 0, "VALUE5" => 0)
|
59
|
+
cmd_no_range_check("INST", "SLRPNLDEPLOY")
|
60
|
+
cmd_no_range_check("INST", "SLRPNLRESET")
|
61
|
+
cmd_no_range_check("INST", "ASCIICMD", "STRING" => 'ARM LASER')
|
62
|
+
cmd_no_range_check("INST", "COLLECT", "DURATION" => 11, "TYPE" => 'NORMAL')
|
63
|
+
|
64
|
+
# cmd_no_range_check should fail
|
65
|
+
cmd_no_range_check()
|
66
|
+
cmd_no_range_check("BOB")
|
67
|
+
cmd_no_range_check("BOB", "ABORT")
|
68
|
+
cmd_no_range_check("INST", "BOB")
|
69
|
+
cmd_no_range_check("INST", "ABORT", "BOB" => "BOB")
|
70
|
+
cmd_no_range_check("INST", "ABORT", "TED", "BOB" => "BOB")
|
71
|
+
cmd_no_range_check("BOB")
|
72
|
+
cmd_no_range_check("BOB ABORT")
|
73
|
+
cmd_no_range_check("INST BOB")
|
74
|
+
|
75
|
+
# cmd_no_hazardous_check
|
76
|
+
cmd_no_hazardous_check("INST ABORT")
|
77
|
+
cmd_no_hazardous_check("INST ARYCMD with ARRAY []")
|
78
|
+
cmd_no_hazardous_check("INST CLEAR")
|
79
|
+
cmd_no_hazardous_check("INST COLLECT with DURATION 1.0, TEMP 0.0, TYPE 'NORMAL'")
|
80
|
+
cmd_no_hazardous_check("INST FLTCMD with FLOAT32 0.0, FLOAT64 0.0")
|
81
|
+
cmd_no_hazardous_check("INST SETPARAMS with VALUE1 0, VALUE2 0, VALUE3 0, VALUE4 0, VALUE5 0")
|
82
|
+
cmd_no_hazardous_check("INST SLRPNLDEPLOY")
|
83
|
+
cmd_no_hazardous_check("INST SLRPNLRESET")
|
84
|
+
cmd_no_hazardous_check("INST ASCIICMD with STRING 'ARM LASER'")
|
85
|
+
|
86
|
+
cmd_no_hazardous_check("INST", "ABORT")
|
87
|
+
cmd_no_hazardous_check("INST", "ARYCMD", "ARRAY" => [])
|
88
|
+
cmd_no_hazardous_check("INST", "CLEAR")
|
89
|
+
cmd_no_hazardous_check("INST", "COLLECT", "DURATION" => 1.0, "TEMP" => 0.0, "TYPE" => 'NORMAL')
|
90
|
+
cmd_no_hazardous_check("INST", "FLTCMD", "FLOAT32" => 0.0, "FLOAT64" => 0.0)
|
91
|
+
cmd_no_hazardous_check("INST", "SETPARAMS", "VALUE1" => 0, "VALUE2" => 0, "VALUE3" => 0, "VALUE4" => 0, "VALUE5" => 0)
|
92
|
+
cmd_no_hazardous_check("INST", "SLRPNLDEPLOY")
|
93
|
+
cmd_no_hazardous_check("INST", "SLRPNLRESET")
|
94
|
+
cmd_no_hazardous_check("INST", "ASCIICMD", "STRING" => 'ARM LASER')
|
95
|
+
|
96
|
+
# cmd_no_hazardous_check should fail
|
97
|
+
cmd_no_hazardous_check("INST COLLECT with DURATION 11, TYPE 'NORMAL'")
|
98
|
+
cmd_no_hazardous_check()
|
99
|
+
cmd_no_hazardous_check("BOB")
|
100
|
+
cmd_no_hazardous_check("BOB", "ABORT")
|
101
|
+
cmd_no_hazardous_check("INST", "BOB")
|
102
|
+
cmd_no_hazardous_check("INST", "ABORT", "BOB" => "BOB")
|
103
|
+
cmd_no_hazardous_check("INST", "ABORT", "TED", "BOB" => "BOB")
|
104
|
+
cmd_no_hazardous_check("BOB")
|
105
|
+
cmd_no_hazardous_check("BOB ABORT")
|
106
|
+
cmd_no_hazardous_check("INST BOB")
|
107
|
+
|
108
|
+
# cmd_no_checks
|
109
|
+
cmd_no_checks("INST ABORT")
|
110
|
+
cmd_no_checks("INST ARYCMD with ARRAY []")
|
111
|
+
cmd_no_checks("INST CLEAR")
|
112
|
+
cmd_no_checks("INST COLLECT with DURATION 1.0, TEMP 0.0, TYPE 'NORMAL'")
|
113
|
+
cmd_no_checks("INST FLTCMD with FLOAT32 0.0, FLOAT64 0.0")
|
114
|
+
cmd_no_checks("INST SETPARAMS with VALUE1 0, VALUE2 0, VALUE3 0, VALUE4 0, VALUE5 0")
|
115
|
+
cmd_no_checks("INST SLRPNLDEPLOY")
|
116
|
+
cmd_no_checks("INST SLRPNLRESET")
|
117
|
+
cmd_no_checks("INST ASCIICMD with STRING 'ARM LASER'")
|
118
|
+
cmd_no_checks("INST COLLECT with DURATION 11, TYPE 'NORMAL'")
|
119
|
+
|
120
|
+
cmd_no_checks("INST", "ABORT")
|
121
|
+
cmd_no_checks("INST", "ARYCMD", "ARRAY" => [])
|
122
|
+
cmd_no_checks("INST", "CLEAR")
|
123
|
+
cmd_no_checks("INST", "COLLECT", "DURATION" => 1.0, "TEMP" => 0.0, "TYPE" => 'NORMAL')
|
124
|
+
cmd_no_checks("INST", "FLTCMD", "FLOAT32" => 0.0, "FLOAT64" => 0.0)
|
125
|
+
cmd_no_checks("INST", "SETPARAMS", "VALUE1" => 0, "VALUE2" => 0, "VALUE3" => 0, "VALUE4" => 0, "VALUE5" => 0)
|
126
|
+
cmd_no_checks("INST", "SLRPNLDEPLOY")
|
127
|
+
cmd_no_checks("INST", "SLRPNLRESET")
|
128
|
+
cmd_no_checks("INST", "ASCIICMD", "STRING" => 'ARM LASER')
|
129
|
+
cmd_no_checks("INST", "COLLECT", "DURATION" => 11, "TYPE" => 'NORMAL')
|
130
|
+
|
131
|
+
# cmd_no_checks should fail
|
132
|
+
cmd_no_checks()
|
133
|
+
cmd_no_checks("BOB")
|
134
|
+
cmd_no_checks("BOB", "ABORT")
|
135
|
+
cmd_no_checks("INST", "BOB")
|
136
|
+
cmd_no_checks("INST", "ABORT", "BOB" => "BOB")
|
137
|
+
cmd_no_checks("INST", "ABORT", "TED", "BOB" => "BOB")
|
138
|
+
cmd_no_checks("BOB")
|
139
|
+
cmd_no_checks("BOB ABORT")
|
140
|
+
cmd_no_checks("INST BOB")
|
141
|
+
|
142
|
+
# send_raw should fail (on demo cmd/tlm server)
|
143
|
+
send_raw()
|
144
|
+
send_raw("INT1")
|
145
|
+
send_raw("INT1", "\x00\x00")
|
146
|
+
send_raw("INT1", "\x00\x00", "\x00\x00")
|
147
|
+
|
148
|
+
# get_all_commands
|
149
|
+
expected_cmds = %w(ABORT ARYCMD ASCIICMD CLEAR COLLECT FLTCMD SETPARAMS SLRPNLDEPLOY SLRPNLRESET)
|
150
|
+
commands = get_all_commands("INST")
|
151
|
+
puts commands.inspect
|
152
|
+
|
153
|
+
# get_all_commands should fail
|
154
|
+
get_all_commands()
|
155
|
+
get_all_commands("BOB")
|
156
|
+
get_all_commands("BOB", "TED")
|
157
|
+
|
158
|
+
# get_cmd_hazardous
|
159
|
+
hazardous = get_cmd_hazardous("INST", "COLLECT", "TYPE" => "SPECIAL")
|
160
|
+
puts hazardous
|
161
|
+
hazardous = get_cmd_hazardous("INST", "COLLECT", "TYPE" => "NORMAL")
|
162
|
+
puts hazardous
|
163
|
+
hazardous = get_cmd_hazardous("INST", "ABORT")
|
164
|
+
puts hazardous
|
165
|
+
hazardous = get_cmd_hazardous("INST", "CLEAR")
|
166
|
+
puts hazardous
|
167
|
+
|
168
|
+
# get_cmd_hazardous should fail
|
169
|
+
get_cmd_hazardous()
|
170
|
+
get_cmd_hazardous("INST")
|
171
|
+
get_cmd_hazardous("INST", "COLLECT", "BOB" => 5)
|
172
|
+
get_cmd_hazardous("INST", "COLLECT", 5)
|
173
|
+
|
174
|
+
# tlm
|
175
|
+
tlm("INST HEALTH_STATUS ARY")
|
176
|
+
tlm("INST HEALTH_STATUS ASCIICMD")
|
177
|
+
tlm("INST HEALTH_STATUS CCSDSAPID")
|
178
|
+
tlm("INST HEALTH_STATUS TEMP1")
|
179
|
+
|
180
|
+
tlm("INST", "HEALTH_STATUS", "ARY")
|
181
|
+
tlm("INST", "HEALTH_STATUS", "ASCIICMD")
|
182
|
+
tlm("INST", "HEALTH_STATUS", "CCSDSAPID")
|
183
|
+
tlm("INST", "HEALTH_STATUS", "TEMP1")
|
184
|
+
|
185
|
+
# tlm should fail
|
186
|
+
tlm()
|
187
|
+
tlm("BOB")
|
188
|
+
tlm("INST")
|
189
|
+
tlm("INST BOB")
|
190
|
+
tlm("INST HEALTH_STATUS")
|
191
|
+
tlm("INST HEALTH_STATUS BOB")
|
192
|
+
tlm("INST HEALTH_STATUS ARY BOB")
|
193
|
+
tlm("INST", "BOB")
|
194
|
+
tlm("INST", "HEALTH_STATUS")
|
195
|
+
tlm("INST", "HEALTH_STATUS", "BOB")
|
196
|
+
tlm("INST", "HEALTH_STATUS", "ARY", "BOB")
|
197
|
+
|
198
|
+
# tlm_raw
|
199
|
+
tlm_raw("INST HEALTH_STATUS ARY")
|
200
|
+
tlm_raw("INST HEALTH_STATUS ASCIICMD")
|
201
|
+
tlm_raw("INST HEALTH_STATUS CCSDSAPID")
|
202
|
+
tlm_raw("INST HEALTH_STATUS TEMP1")
|
203
|
+
|
204
|
+
tlm_raw("INST", "HEALTH_STATUS", "ARY")
|
205
|
+
tlm_raw("INST", "HEALTH_STATUS", "ASCIICMD")
|
206
|
+
tlm_raw("INST", "HEALTH_STATUS", "CCSDSAPID")
|
207
|
+
tlm_raw("INST", "HEALTH_STATUS", "TEMP1")
|
208
|
+
|
209
|
+
# tlm_raw should fail
|
210
|
+
tlm_raw()
|
211
|
+
tlm_raw("BOB")
|
212
|
+
tlm_raw("INST")
|
213
|
+
tlm_raw("INST BOB")
|
214
|
+
tlm_raw("INST HEALTH_STATUS")
|
215
|
+
tlm_raw("INST HEALTH_STATUS BOB")
|
216
|
+
tlm_raw("INST HEALTH_STATUS ARY BOB")
|
217
|
+
tlm_raw("INST", "BOB")
|
218
|
+
tlm_raw("INST", "HEALTH_STATUS")
|
219
|
+
tlm_raw("INST", "HEALTH_STATUS", "BOB")
|
220
|
+
tlm_raw("INST", "HEALTH_STATUS", "ARY", "BOB")
|
221
|
+
|
222
|
+
# tlm_formatted
|
223
|
+
tlm_formatted("INST HEALTH_STATUS ARY")
|
224
|
+
tlm_formatted("INST HEALTH_STATUS ASCIICMD")
|
225
|
+
tlm_formatted("INST HEALTH_STATUS CCSDSAPID")
|
226
|
+
tlm_formatted("INST HEALTH_STATUS TEMP1")
|
227
|
+
|
228
|
+
tlm_formatted("INST", "HEALTH_STATUS", "ARY")
|
229
|
+
tlm_formatted("INST", "HEALTH_STATUS", "ASCIICMD")
|
230
|
+
tlm_formatted("INST", "HEALTH_STATUS", "CCSDSAPID")
|
231
|
+
tlm_formatted("INST", "HEALTH_STATUS", "TEMP1")
|
232
|
+
|
233
|
+
# tlm_formatted should fail
|
234
|
+
tlm_formatted()
|
235
|
+
tlm_formatted("BOB")
|
236
|
+
tlm_formatted("INST")
|
237
|
+
tlm_formatted("INST BOB")
|
238
|
+
tlm_formatted("INST HEALTH_STATUS")
|
239
|
+
tlm_formatted("INST HEALTH_STATUS BOB")
|
240
|
+
tlm_formatted("INST HEALTH_STATUS ARY BOB")
|
241
|
+
tlm_formatted("INST", "BOB")
|
242
|
+
tlm_formatted("INST", "HEALTH_STATUS")
|
243
|
+
tlm_formatted("INST", "HEALTH_STATUS", "BOB")
|
244
|
+
tlm_formatted("INST", "HEALTH_STATUS", "ARY", "BOB")
|
245
|
+
|
246
|
+
# tlm_with_units
|
247
|
+
tlm_with_units("INST HEALTH_STATUS ARY")
|
248
|
+
tlm_with_units("INST HEALTH_STATUS ASCIICMD")
|
249
|
+
tlm_with_units("INST HEALTH_STATUS CCSDSAPID")
|
250
|
+
tlm_with_units("INST HEALTH_STATUS TEMP1")
|
251
|
+
|
252
|
+
tlm_with_units("INST", "HEALTH_STATUS", "ARY")
|
253
|
+
tlm_with_units("INST", "HEALTH_STATUS", "ASCIICMD")
|
254
|
+
tlm_with_units("INST", "HEALTH_STATUS", "CCSDSAPID")
|
255
|
+
tlm_with_units("INST", "HEALTH_STATUS", "TEMP1")
|
256
|
+
|
257
|
+
# tlm_with_units should fail
|
258
|
+
tlm_with_units()
|
259
|
+
tlm_with_units("BOB")
|
260
|
+
tlm_with_units("INST")
|
261
|
+
tlm_with_units("INST BOB")
|
262
|
+
tlm_with_units("INST HEALTH_STATUS")
|
263
|
+
tlm_with_units("INST HEALTH_STATUS BOB")
|
264
|
+
tlm_with_units("INST HEALTH_STATUS ARY BOB")
|
265
|
+
tlm_with_units("INST", "BOB")
|
266
|
+
tlm_with_units("INST", "HEALTH_STATUS")
|
267
|
+
tlm_with_units("INST", "HEALTH_STATUS", "BOB")
|
268
|
+
tlm_with_units("INST", "HEALTH_STATUS", "ARY", "BOB")
|
269
|
+
|
270
|
+
# override_tlm
|
271
|
+
override_tlm("INST HEALTH_STATUS ARY = [0,0,0,0,0,0,0,0,0,0]")
|
272
|
+
override_tlm("INST HEALTH_STATUS ASCIICMD = 'HI'")
|
273
|
+
override_tlm("INST HEALTH_STATUS CCSDSAPID = 1000")
|
274
|
+
override_tlm("INST HEALTH_STATUS TEMP1 = 15")
|
275
|
+
|
276
|
+
# override_tlm_raw
|
277
|
+
override_tlm_raw("INST HEALTH_STATUS ARY = [0,0,0,0,0,0,0,0,0,0]")
|
278
|
+
override_tlm_raw("INST HEALTH_STATUS ASCIICMD = 'HI'")
|
279
|
+
override_tlm_raw("INST HEALTH_STATUS CCSDSAPID = 1000")
|
280
|
+
override_tlm_raw("INST HEALTH_STATUS TEMP1 = 10000")
|
281
|
+
|
282
|
+
# normalize_tlm
|
283
|
+
normalize_tlm("INST HEALTH_STATUS ARY")
|
284
|
+
normalize_tlm("INST HEALTH_STATUS ASCIICMD")
|
285
|
+
normalize_tlm("INST HEALTH_STATUS CCSDSAPID")
|
286
|
+
normalize_tlm("INST HEALTH_STATUS TEMP1")
|
@@ -0,0 +1,49 @@
|
|
1
|
+
puts "1"
|
2
|
+
puts "2"
|
3
|
+
puts "3"
|
4
|
+
puts "4"
|
5
|
+
puts "5"
|
6
|
+
puts "6"
|
7
|
+
puts "7"
|
8
|
+
puts "8"
|
9
|
+
puts "9"
|
10
|
+
puts "10"
|
11
|
+
|
12
|
+
value = ask('Enter the value')
|
13
|
+
|
14
|
+
cmd("INST CLEAR")
|
15
|
+
|
16
|
+
5.times do |index|
|
17
|
+
puts index
|
18
|
+
end
|
19
|
+
|
20
|
+
if false
|
21
|
+
puts false
|
22
|
+
else
|
23
|
+
puts true
|
24
|
+
end
|
25
|
+
|
26
|
+
wait_expression('false', 10)
|
27
|
+
wait(10)
|
28
|
+
|
29
|
+
a = [10,
|
30
|
+
11,
|
31
|
+
12,
|
32
|
+
13,
|
33
|
+
14,
|
34
|
+
15]
|
35
|
+
|
36
|
+
{ :X1 => 1,
|
37
|
+
:X2 => 2
|
38
|
+
}.each {|x, y| puts x}
|
39
|
+
|
40
|
+
|
41
|
+
puts "brown cow"
|
42
|
+
yep
|
43
|
+
puts "howdy"
|
44
|
+
|
45
|
+
if yep
|
46
|
+
puts "uh oh"
|
47
|
+
end
|
48
|
+
|
49
|
+
puts "done"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Ignored Parameters
|
2
|
+
IGNORE_PARAMETER PKTID
|
3
|
+
IGNORE_PARAMETER CONFIG
|
4
|
+
IGNORE_PARAMETER OPENC3_VERSION
|
5
|
+
IGNORE_PARAMETER USER_VERSION
|
6
|
+
IGNORE_PARAMETER RUBY_VERSION
|
7
|
+
|
8
|
+
# Ignored Items
|
9
|
+
IGNORE_ITEM PKTID
|
10
|
+
IGNORE_ITEM RECEIVED_COUNT
|
11
|
+
IGNORE_ITEM RECEIVED_TIMESECONDS
|
12
|
+
IGNORE_ITEM RECEIVED_TIMEFORMATTED
|
@@ -0,0 +1,13 @@
|
|
1
|
+
COMMAND <%= target_name %> SETPT_VOLTAGE BIG_ENDIAN "Templated string command"
|
2
|
+
APPEND_ID_PARAMETER CMD_ID 8 UINT 0 0 0 "Command Id"
|
3
|
+
APPEND_PARAMETER VOLTAGE 64 FLOAT MIN_FLOAT64 MAX_FLOAT64 3.14 "Voltage setting"
|
4
|
+
APPEND_PARAMETER CHANNEL 8 UINT 1 4 1 "Desired channel"
|
5
|
+
APPEND_PARAMETER CMD_TEMPLATE 1024 STRING "SOUR:VOLT <VOLTAGE>, (@<CHANNEL>)"
|
6
|
+
|
7
|
+
COMMAND <%= target_name %> GET_SETPT_VOLTAGE BIG_ENDIAN "Templated string command with response"
|
8
|
+
DISABLE_MESSAGES
|
9
|
+
APPEND_ID_PARAMETER CMD_ID 8 UINT 1 1 1 "Command Id"
|
10
|
+
APPEND_PARAMETER CHANNEL 8 UINT 1 4 1 "Desired channel"
|
11
|
+
APPEND_PARAMETER CMD_TEMPLATE 512 STRING "SOUR:VOLT?, (@<CHANNEL>)"
|
12
|
+
APPEND_PARAMETER RSP_TEMPLATE 512 STRING "<VOLTAGE>"
|
13
|
+
APPEND_PARAMETER RSP_PACKET 512 STRING "READ_VOLTAGE"
|
@@ -0,0 +1,69 @@
|
|
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
|
+
# Modified by OpenC3, Inc.
|
17
|
+
# All changes Copyright 2022, OpenC3, Inc.
|
18
|
+
# All Rights Reserved
|
19
|
+
|
20
|
+
require 'openc3'
|
21
|
+
|
22
|
+
module OpenC3
|
23
|
+
|
24
|
+
class TemplatedInterface < TcpipClientInterface
|
25
|
+
def initialize(*args)
|
26
|
+
super(*args)
|
27
|
+
@polling_thread = nil
|
28
|
+
@sleeper = Sleeper.new
|
29
|
+
end
|
30
|
+
|
31
|
+
def connect
|
32
|
+
super()
|
33
|
+
|
34
|
+
# Start a thread to poll telemetry
|
35
|
+
Thread.new do |thread|
|
36
|
+
OpenC3.kill_thread(self, @polling_thread)
|
37
|
+
@sleeper = Sleeper.new
|
38
|
+
@polling_thread = Thread.current
|
39
|
+
begin
|
40
|
+
# Wait for the connection to actually occur
|
41
|
+
while !connected?
|
42
|
+
@sleeper.sleep(1)
|
43
|
+
end
|
44
|
+
loop do
|
45
|
+
cmd("#{@target_names[0]} GET_SETPT_VOLTAGE", scope: ENV['OPENC3_SCOPE'])
|
46
|
+
break if @sleeper.sleep(1)
|
47
|
+
end
|
48
|
+
rescue Errno::ECONNRESET
|
49
|
+
# This typically means the target disconnected
|
50
|
+
rescue Exception => err
|
51
|
+
Logger.error "Polling Thread Unexpectedly Died.\n#{err.formatted}"
|
52
|
+
raise err
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def disconnect
|
58
|
+
super()
|
59
|
+
# Note: This must be after super or the disconnect process
|
60
|
+
# will be interrupted by killing the thread
|
61
|
+
OpenC3.kill_thread(self, @polling_thread) if Thread.current != @polling_thread
|
62
|
+
@polling_thread = nil
|
63
|
+
end
|
64
|
+
|
65
|
+
def graceful_kill
|
66
|
+
@sleeper.cancel
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|