openc3-cosmos-demo 5.9.0 → 5.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1af9f49c37fcf900282ef8bc096af738550524a795ff79fdbf23df8e406aa6b6
4
- data.tar.gz: 1147b60e93df32fb5a02a369e182dbf863423f3d99dc26a292c86c32d97638e9
3
+ metadata.gz: 49c8b08aed9217cc75cef91c81f6016e0be0e05e996c63c82a31fb831750501d
4
+ data.tar.gz: 1a1dd25d45312617988d05daa6b406b018c653544978bc23aeec28d47f30da5f
5
5
  SHA512:
6
- metadata.gz: dfd96514bf61d59e277ad3a50ccf5aca23121c77967cea7332f42f737ed04c006fc839c429d837a62ab97e809eac8a4763d4030db49a0a9a6dcd888a108ef72d
7
- data.tar.gz: be13b794e425aaa13d49dc7e73010ceea90a2be535615a730aa1d732cf0b4ad04a85ecc6af48a7a58e5fb6f2a3f25be292eea4f37d56b79fddbeeaba4f72d93e
6
+ metadata.gz: cf3da9e0a8071ffccc69da8b2f0a387c741669f29e240648fc357d4f3aaaf17d2b325f57811e7ad6892c03410c30910a570aaab46b453131b68b38c7a0375df6
7
+ data.tar.gz: 91ebb120aa9a014780fc4399457ce72f87c0ffdca0fb4d7f3bf7764f7d2f6ccd490c942b56920ce09fae62264e98b4643f1b3f0023904db4daa3a7f34f3fc730
@@ -0,0 +1,17 @@
1
+ import os
2
+ from openc3.script import *
3
+
4
+ # Display the environment variables
5
+ print(os.environ.items())
6
+
7
+ collect_cnt = tlm("<%= target_name %> HEALTH_STATUS COLLECTS")
8
+ cmd("<%= target_name %> COLLECT with DURATION 11, TYPE NORMAL")
9
+ cmd_no_range_check("<%= target_name %> COLLECT with DURATION 11, TYPE NORMAL")
10
+ cmd_no_hazardous_check("<%= target_name %> COLLECT with DURATION 11, TYPE NORMAL")
11
+ cmd_no_checks("<%= target_name %> COLLECT with DURATION 11, TYPE NORMAL")
12
+ wait_check(f"<%= target_name %> HEALTH_STATUS COLLECTS == {collect_cnt + 2}", 10)
13
+ cmd("<%= target_name %> CLEAR")
14
+ cmd_no_range_check("<%= target_name %> CLEAR")
15
+ cmd_no_hazardous_check("<%= target_name %> CLEAR")
16
+ cmd_no_checks("<%= target_name %> CLEAR")
17
+ print(tlm("<%= target_name %> HEALTH_STATUS COLLECTS"))
@@ -0,0 +1,21 @@
1
+ from openc3.script import *
2
+
3
+ load_utility("<%= target_name %>/procedures_py/utilities/collect.py")
4
+ load_utility("<%= target_name %>/procedures_py/utilities/clear.py")
5
+
6
+ number = ask("Enter a number.")
7
+ if not isinstance(number, (int, float)):
8
+ raise RuntimeError("Bad return")
9
+ number = ask_string("Enter a number.")
10
+ if not type(number) == str:
11
+ raise RuntimeError("Bad return")
12
+
13
+ result = message_box("Click something.", "CHOICE1", "CHOICE2")
14
+
15
+ prompt("Press Ok to start NORMAL Collect")
16
+ collect("NORMAL", 1)
17
+ prompt("Press Ok to start SPECIAL Collect")
18
+ collect("SPECIAL", 2, True)
19
+ clear()
20
+
21
+ wait_check("<%= target_name %> HEALTH_STATUS COLLECTS == 0", 10)
@@ -0,0 +1,23 @@
1
+ from openc3.script import *
2
+
3
+ cmd("<%= target_name %> ABORT")
4
+ cmd_no_range_check("<%= target_name %> COLLECT with TYPE NORMAL, TEMP 100")
5
+ cmd_no_hazardous_check("<%= target_name %> CLEAR")
6
+ cmd_no_checks("<%= target_name %> COLLECT with TYPE SPECIAL, TEMP 100.0")
7
+ cmd_raw("<%= target_name %> ABORT")
8
+ cmd_raw_no_range_check("<%= target_name %> COLLECT with TYPE 0, TEMP 100")
9
+ cmd_raw_no_hazardous_check("<%= target_name %> CLEAR")
10
+ cmd_raw_no_checks("<%= target_name %> COLLECT with TYPE 1, TEMP 100.0")
11
+ check("<%= target_name %> ADCS BIASX == 100")
12
+ check_tolerance("<%= target_name %> ADCS BIASX", 5, 0.5)
13
+ check_expression("True == False")
14
+ wait()
15
+ wait(5)
16
+ wait("<%= target_name %> ADCS BIASX > 100", 5)
17
+ wait_tolerance("<%= target_name %> ADCS BIASX", 5, 0.5, 5)
18
+ wait_expression("True == False", 5)
19
+ wait_packet("<%= target_name %>", "ADCS", 2, 5)
20
+ wait_check("<%= target_name %> ADCS BIASX == 100", 5)
21
+ wait_check_tolerance("<%= target_name %> ADCS BIASX", 5, 0.5, 5)
22
+ wait_check_expression("True == False", 5)
23
+ wait_check_packet("<%= target_name %>", "ADCS", 2, 5)
@@ -0,0 +1,18 @@
1
+ from openc3.script import *
2
+
3
+ # Specify the title and message and filter to txt files
4
+ file = open_file_dialog(
5
+ "Open a single file", "Choose something interesting", filter=".txt"
6
+ )
7
+ print(file) # Python File object
8
+ print(file.path) # Path of the tempfile (generally not used)
9
+ print(file.filename) # Filename that was selected in the dialog
10
+ print(file.read)
11
+ file.delete
12
+
13
+ files = open_files_dialog("Open multiple files") # message is optional
14
+ print(files) # Array of File objects (even if you select only one)
15
+ for file in files:
16
+ print(file.filename)
17
+ print(file.read)
18
+ file.delete
@@ -0,0 +1,25 @@
1
+ from openc3.script import *
2
+
3
+ # Example of using metadata. Note each call to metadata_set creates a new entry.
4
+ # metadata_update without a start time will update the latest metadata entry.
5
+ print(metadata_get())
6
+ print(metadata_set({"setkey": 1}))
7
+ check_expression(f"{len(metadata_all())} >= 1")
8
+ check_expression(f"{metadata_get()['metadata']} == {{'setkey':1}}")
9
+ print(metadata_get()["metadata"])
10
+ print(metadata_update({"setkey": 2, "updatekey": 3}))
11
+ check_expression(f"{metadata_get()['metadata']['setkey']} == 2")
12
+ check_expression(f"{metadata_get()['metadata']['updatekey']} == 3")
13
+ print(metadata_update({"setkey": 4})) # Ensure updatekey stays
14
+ check_expression(f"{metadata_get()['metadata']['setkey']} == 4")
15
+ check_expression(f"{metadata_get()['metadata']['updatekey']} == 3")
16
+ check_expression(f"{len(metadata_all())} >= 1")
17
+ # TODO: metadata_input() # Creates a new entry
18
+ metadata_set({"input": 5}) # Simulate metadat_input for now
19
+ check_expression(f"{len(metadata_all())} >= 2")
20
+ wait(2) # Allow time to advance or it's an error
21
+ metadata_set({"new": 5}) # Another new entry
22
+ check_expression(f"{len(metadata_all())} >= 3")
23
+ # The first entry is the newest one we created
24
+ print(metadata_all)
25
+ check_expression(f"{metadata_all()[0]['metadata']} == {{'new':5}}")
@@ -0,0 +1,35 @@
1
+ from openc3.script import *
2
+
3
+ all_screens = get_screen_list()
4
+ print(all_screens["INST"])
5
+ wait(1)
6
+ definition = get_screen_definition("INST", "ADCS")
7
+ print(definition)
8
+ wait(1)
9
+ display_screen("INST", "ADCS")
10
+ wait(3)
11
+ display_screen("INST", "HS", 400, 0)
12
+ wait(3)
13
+ clear_screen("INST", "ADCS")
14
+ wait(3)
15
+ display_screen("INST", "IMAGE")
16
+ wait(3)
17
+ clear_all_screens()
18
+ wait(3)
19
+ definition = """
20
+ SCREEN AUTO AUTO 1.0
21
+
22
+ VERTICALBOX "Test Screen"
23
+ LABELVALUE INST HEALTH_STATUS TEMP1
24
+ LABELVALUE INST HEALTH_STATUS RECEIVED_TIMEFORMATTED WITH_UNITS 30
25
+ END
26
+ """
27
+ local_screen("TEST", definition)
28
+ wait(3)
29
+ clear_all_screens()
30
+ create_screen("INST", "TEST", definition)
31
+ display_screen("INST", "TEST")
32
+ wait(3)
33
+ clear_all_screens()
34
+ delete_screen("INST", "TEST")
35
+ display_screen("INST", "TEST") # Expected to fail because new screen was deleted
@@ -0,0 +1,24 @@
1
+ from openc3.script import *
2
+
3
+ # Stash API is useful for storing simple key/value pairs
4
+ # to preserve state between script runs
5
+ stash_set("key1", "val1")
6
+ stash_set("key2", "val2")
7
+ check_expression(f"'{stash_get('key1')}' == 'val1'")
8
+ check_expression(f"'{stash_get('key2')}' == 'val2'")
9
+ check_expression(f"{stash_keys()} == ['key1', 'key2']")
10
+ stash_set("key1", 1)
11
+ stash_set("key2", 2)
12
+ check_expression(f"{stash_all()} == {{'key1':1, 'key2':2}}")
13
+ stash_delete("key2")
14
+ check_expression(f"{stash_get('key2')} == None")
15
+ stash_delete("key1")
16
+ data = [1, 2, [3, 4]]
17
+ stash_set("ary", data)
18
+ check_expression(f"{stash_get('ary')} == {data}")
19
+ stash_delete("ary")
20
+ # Note: hashes with symbol keys works but get converted to string keys on stash_get
21
+ hash = {"one": 1, "two": 2, "string": "string"}
22
+ stash_set("hash", hash)
23
+ check_expression(f"{stash_get('hash')} == {hash}")
24
+ stash_delete("hash")
@@ -0,0 +1,26 @@
1
+ from openc3.script import *
2
+
3
+ put_target_file("INST/test.txt", "this is a string test")
4
+ download_file("INST/test.txt") # download via path
5
+ file = get_target_file("INST/test.txt")
6
+ print(file.read)
7
+ file.rewind # rewind so download_file can read
8
+ download_file(file) # download using file
9
+ file.delete
10
+ delete_target_file("INST/test.txt")
11
+
12
+ save_file = Tempfile.new("test")
13
+ save_file.write("this is a Io test")
14
+ save_file.rewind
15
+ put_target_file("INST/test.txt", save_file)
16
+ save_file.delete
17
+ file = get_target_file("INST/test.txt")
18
+ print(file.read)
19
+ file.delete
20
+ delete_target_file("INST/test.txt")
21
+
22
+ put_target_file("INST/test.bin", "\x00\x01\x02\x03\xFF\xEE\xDD\xCC")
23
+ file = get_target_file("INST/test.bin")
24
+ print(file.read.formatted)
25
+ file.delete
26
+ delete_target_file("INST/test.bin")
@@ -0,0 +1,9 @@
1
+ from openc3.script import *
2
+
3
+
4
+ def clear():
5
+ # Command the collect
6
+ cmd("<%= target_name %> CLEAR")
7
+
8
+ # Wait for telemetry to update
9
+ wait_check("<%= target_name %> HEALTH_STATUS COLLECTS == 0", 10)
@@ -0,0 +1,17 @@
1
+ from openc3.script import *
2
+
3
+ load_utility("<%= target_name %>/procedures_py/utilities/clear.py")
4
+
5
+
6
+ def collect(type, duration, call_clear=False):
7
+ # Get the current collects telemetry point
8
+ collects = tlm("<%= target_name %> HEALTH_STATUS COLLECTS")
9
+
10
+ # Command the collect
11
+ cmd(f"<%= target_name %> COLLECT with TYPE {type}, DURATION {duration}")
12
+
13
+ # Wait for telemetry to update
14
+ wait_check(f"<%= target_name %> HEALTH_STATUS COLLECTS == {collects + 1}", 10)
15
+
16
+ if call_clear:
17
+ clear()