openc3-cosmos-demo 6.0.2 → 6.2.0

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 (30) hide show
  1. checksums.yaml +4 -4
  2. data/plugin.txt +1 -0
  3. data/requirements.txt +1 -1
  4. data/targets/INST/cmd_tlm/inst_cmds.txt +3 -0
  5. data/targets/INST/cmd_tlm/inst_tlm.txt +15 -5
  6. data/targets/INST/lib/inst_cmd_validator.rb +1 -0
  7. data/targets/INST/lib/sim_inst.rb +11 -6
  8. data/targets/INST/procedures/calendar.rb +52 -27
  9. data/targets/INST/procedures/checks.rb +1 -1
  10. data/targets/INST/procedures/disconnect.rb +1 -1
  11. data/targets/INST/procedures/scripting.rb +88 -0
  12. data/targets/INST/screens/graphs.txt +28 -23
  13. data/targets/INST/screens/limits.txt +5 -2
  14. data/targets/INST2/cmd_tlm/inst_cmds.txt +6 -1
  15. data/targets/INST2/cmd_tlm/inst_tlm.txt +15 -6
  16. data/targets/INST2/lib/sim_inst.py +11 -6
  17. data/targets/INST2/procedures/calendar.py +53 -38
  18. data/targets/INST2/procedures/disconnect.py +1 -1
  19. data/targets/INST2/procedures/scripting.py +84 -0
  20. data/targets/INST2/screens/graphs.txt +28 -23
  21. data/targets/INST2/screens/limits.txt +5 -2
  22. data/tools/widgets/BigWidget/BigWidget.umd.min.js +99 -98
  23. data/tools/widgets/BigWidget/BigWidget.umd.min.js.map +1 -1
  24. data/tools/widgets/DataviewerquaternionWidget/DataviewerquaternionWidget.umd.min.js +115 -114
  25. data/tools/widgets/DataviewerquaternionWidget/DataviewerquaternionWidget.umd.min.js.map +1 -1
  26. data/tools/widgets/DataviewertimeWidget/DataviewertimeWidget.umd.min.js +99 -98
  27. data/tools/widgets/DataviewertimeWidget/DataviewertimeWidget.umd.min.js.map +1 -1
  28. data/tools/widgets/HelloworldWidget/HelloworldWidget.umd.min.js +99 -98
  29. data/tools/widgets/HelloworldWidget/HelloworldWidget.umd.min.js.map +1 -1
  30. metadata +4 -2
@@ -1,57 +1,72 @@
1
1
  from datetime import datetime, timezone, timedelta
2
2
 
3
- tl = create_timeline("Mine")
4
- print(
5
- tl
6
- ) # => {"name":"Mine", "color":"#ae2d1b", "scope":"DEFAULT", "updated_at":1698763720728596964}
3
+ tl = create_timeline("PythonTL", color="#FF0000")
4
+ print(tl) #=> {'name': 'PythonTL', 'color': '#FF0000', 'execute': True, 'shard': 0, 'scope': 'DEFAULT', 'updated_at': 1737129062249843763}
7
5
  tls = list_timelines()
8
- print(tls)
9
- print(type(tls))
10
- check_expression(f"{len(tls)} == 1")
11
- print(
12
- tls[0]
13
- ) # => {"name":"Mine", "color":"#ae2d1b", "scope":"DEFAULT", "updated_at":1698763720728596964}
14
- delete_timeline("Mine")
15
- check_expression(f"{len(list_timelines())} == 0")
6
+ print(tls) #=> [{'name': 'PythonTL', 'color': '#FF0000', 'execute': True, 'shard': 0, 'scope': 'DEFAULT', 'updated_at': 1737129062249843763}]
7
+ names = [tl["name"] for tl in tls]
8
+ check_expression(f"{'PythonTL' in names} == True")
9
+ print(tls[0]) #=> {'name': 'PythonTL', 'color': '#FF0000', 'execute': True, 'shard': 0, 'scope': 'DEFAULT', 'updated_at': 1737129436186473255}
16
10
 
17
- create_timeline("Mine")
18
- set_timeline_color("Mine", "#4287f5")
19
- print(
20
- get_timeline("Mine")
21
- ) # => {"name":"Mine", "color":"#4287f5", "scope":"DEFAULT", "updated_at":1698763720728596964}
11
+ set_timeline_color("PythonTL", "#4287f5")
12
+ print(get_timeline("PythonTL")) #=> {'name': 'PythonTL', 'color': '#4287f5', 'execute': True, 'shard': 0, 'scope': 'DEFAULT', 'updated_at': 1737129508391137136}
22
13
 
23
14
  now = datetime.now(timezone.utc)
24
15
  start = now + timedelta(hours=1)
25
- stop = start + timedelta(hours=1) # Stop plus 1hr
26
- act = create_timeline_activity("Mine", kind="reserve", start=start, stop=stop)
27
- print(act) # =>
28
- # { "name"=>"Mine", "updated_at"=>1698763721927799173, "fulfillment"=>false, "duration"=>3600,
29
- # "start"=>1698764400, "stop"=>1698768000, "kind"=>"reserve",
30
- # "events"=>[{"time"=>1698763721, "event"=>"created"}], "data"=>{"username"=>""} }
16
+ stop = start + timedelta(hours=1)
17
+ act1 = create_timeline_activity("PythonTL", kind="reserve", start=start, stop=stop)
18
+ print(act1) # =>
19
+ # {'name': 'PythonTL', 'updated_at': 1737129305507111708, 'start': 1737132902, 'stop': 1737136502,
20
+ # 'kind': 'reserve', 'data': {'username': 'operator'},
21
+ # 'scope': 'DEFAULT', 'fulfillment': False, 'uuid': '46328378-ed78-4719-ad70-e84951a196fd',
22
+ # 'events': [{'time': 1737129305, 'event': 'created'}], 'recurring': {}}
23
+ act2 = create_timeline_activity("PythonTL", kind="COMMAND", start=start, stop=stop,
24
+ data={'command': "INST COLLECT with TYPE NORMAL, DURATION 5, TEMP 10"})
25
+ print(act2) #=>
26
+ # {'name': 'PythonTL', 'updated_at': 1737129508886643928, 'start': 1737133108, 'stop': 1737136708,
27
+ # 'kind': 'command', 'data': {'command': 'INST COLLECT with TYPE NORMAL, DURATION 5, TEMP 10', 'username': 'operator'},
28
+ # 'scope': 'DEFAULT', 'fulfillment': False, 'uuid': 'cddbf034-ccdd-4c36-91c2-2653a39b06a5',
29
+ # 'events': [{'time': 1737129508, 'event': 'created'}], 'recurring': {}}
30
+ start = now + timedelta(hours=2)
31
+ stop = start + timedelta(hours=1)
32
+ act3 = create_timeline_activity("PythonTL", kind="SCRIPT", start=start, stop=stop,
33
+ data={'environment': [{'key': "USER", 'value': "JASON"}], 'script': "INST2/procedures/checks.py"})
34
+ print(act3) #=>
35
+ # {'name': 'PythonTL', 'updated_at': 1737129509288571345, 'start': 1737136708, 'stop': 1737140308,
36
+ # 'kind': 'script', 'data': {'environment': [{'key': 'USER', 'value': 'JASON'}], 'script': 'INST2/procedures/checks.py', 'username': 'operator'},
37
+ # 'scope': 'DEFAULT', 'fulfillment': False, 'uuid': '4f8d791b-b138-4383-b5ec-85c28b2bea20',
38
+ # 'events': [{'time': 1737129509, 'event': 'created'}], 'recurring': {}}
39
+
40
+ act = get_timeline_activity("PythonTL", act2['start'], act2['uuid'])
41
+ print(act) #=>
42
+ # { "name"=>"RubyTL", "updated_at"=>1737128761316084471, "start"=>1737132303, "stop"=>1737135903,
43
+ # "kind"=>"command", "data"=>{"command"=>"INST COLLECT with TYPE NORMAL, DURATION 5, TEMP 10", "username"=>"operator"},
44
+ # "scope"=>"DEFAULT", "fulfillment"=>false, "uuid"=>"cdb661b4-a65b-44e7-95e2-5e1dba80c782",
45
+ # "events"=>[{"time"=>1737128761, "event"=>"created"}], "recurring"=>{}}
46
+
31
47
  # Get activities in the past ... should be none
32
- tlas = get_timeline_activities("Mine", start=start - timedelta(hours=2), stop=now)
48
+ tlas = get_timeline_activities("PythonTL", start=now - timedelta(hours=2), stop=now)
33
49
  print(tlas)
34
50
  print(type(tlas))
35
51
  check_expression(f"{len(tlas)} == 0")
36
- # Get all activities
37
- tlas = get_timeline_activities("Mine")
38
- check_expression(f"{len(tlas)} == 1")
52
+ # Get all activities at plus and minus 1 week
53
+ tlas = get_timeline_activities("PythonTL")
54
+ check_expression(f"{len(tlas)} == 3")
39
55
 
40
56
  # Create and delete a new activity
41
57
  start = start + timedelta(hours=2)
42
58
  stop = start + timedelta(minutes=30)
43
- act = create_timeline_activity("Mine", kind="reserve", start=start, stop=stop)
44
- tlas = get_timeline_activities("Mine")
45
- check_expression(f"{len(tlas)} == 2")
46
- delete_timeline_activity("Mine", act["start"], act["uuid"])
47
- tlas = get_timeline_activities("Mine")
48
- check_expression(f"{len(tlas)} == 1")
59
+ act = create_timeline_activity("PythonTL", kind="reserve", start=start, stop=stop)
60
+ tlas = get_timeline_activities("PythonTL")
61
+ check_expression(f"{len(tlas)} == 4")
62
+ delete_timeline_activity("PythonTL", act["start"], act["uuid"])
63
+ tlas = get_timeline_activities("PythonTL")
64
+ check_expression(f"{len(tlas)} == 3")
49
65
 
50
66
  # delete fails since the timeline has activities
51
- delete_timeline(
52
- "Mine"
53
- ) #: RuntimeError : Failed to delete timeline due to timeline contains activities, must force remove
67
+ delete_timeline("PythonTL")
54
68
  # Force delete since the timeline has activities
55
- delete_timeline("Mine", force=True)
69
+ delete_timeline("PythonTL", force=True)
56
70
  tls = list_timelines()
57
- check_expression(f"{len(tls)} == 0")
71
+ names = [tl["name"] for tl in tls]
72
+ check_expression(f"{'PythonTL' in names} == False")
@@ -17,5 +17,5 @@ wait_expression("True == False", 5)
17
17
  wait_packet("<%= target_name %>", "ADCS", 2, 5)
18
18
  wait_check("<%= target_name %> ADCS BIASX == 100", 5)
19
19
  wait_check_tolerance("<%= target_name %> ADCS BIASX", 5, 0.5, 5)
20
- wait_check_expression("True == False", 5)
20
+ wait_check_expression(f"tlm('<%= target_name %> HEALTH_STATUS TEMP1') < 101", 5, 0.25, globals())
21
21
  wait_check_packet("<%= target_name %>", "ADCS", 2, 5)
@@ -0,0 +1,84 @@
1
+ # Helper method to check for a script to change state
2
+ def wait_for_action(id, state):
3
+ i = 0
4
+ while i < 100:
5
+ script = running_script_get(id)
6
+ if script['state'] == state:
7
+ check_expression(f"'{script['state']}' == '{state}'")
8
+ break
9
+ wait(0.1)
10
+ check_expression(f"'{script['state']}' == '{state}'")
11
+
12
+ SCRIPT_NAME = "INST2/procedures/new_script.py"
13
+
14
+ # Ensure it's not already there
15
+ step_mode()
16
+ script_delete(SCRIPT_NAME)
17
+ scripts = script_list()
18
+ check_expression(f"{len(scripts)} > 100")
19
+ run_mode()
20
+
21
+ contents = "print('bad"
22
+ script_create(SCRIPT_NAME, contents)
23
+ body = script_body(SCRIPT_NAME)
24
+ result = script_syntax_check(body)
25
+ check_expression(f"{result['success']} == False")
26
+
27
+ contents = 'set_line_delay(1)\nprint("Hello from Python")\nprint(".")\nprint(".")\nwhile True:\n print(".")\n wait(0.5)\n wait(0.5)\n'
28
+ result = script_create(SCRIPT_NAME, contents)
29
+ scripts = script_list()
30
+ check_expression(f"{SCRIPT_NAME in scripts} == True")
31
+
32
+ script = script_instrumented(contents)
33
+ check_expression(f"{'RunningScript.instance' in script} == True")
34
+
35
+ id = script_run(SCRIPT_NAME)
36
+ check_expression(f"{int(id)} > 0")
37
+ wait_for_action(id, 'running')
38
+
39
+ list = running_script_list()
40
+ started = [script for script in list if script["id"] == id][0]
41
+ check_expression(f"'{started['name']}' == '{SCRIPT_NAME}'")
42
+ script = running_script_get(id)
43
+ check_expression(f"'{script['name']}' == '{SCRIPT_NAME}'")
44
+
45
+ running_script_pause(id)
46
+ wait_for_action(id, 'paused')
47
+ running_script_step(id)
48
+ wait_for_action(id, 'paused')
49
+ running_script_retry(id)
50
+ wait_for_action(id, 'paused')
51
+ running_script_go(id)
52
+ wait_for_action(id, 'running')
53
+ running_script_stop(id)
54
+ wait(1)
55
+
56
+ list = running_script_list()
57
+ script = [script for script in list if script["id"] == id]
58
+ # Script is stopped so it should NOT be in the running list
59
+ check_expression(f"{len(script)} == 0")
60
+
61
+ list = completed_script_list()
62
+ script = [script for script in list if script["id"] == id]
63
+ # Script is completed so it should be in the completed list
64
+ check_expression(f"{len(script)} == 1")
65
+
66
+ id = script_run(SCRIPT_NAME)
67
+ wait_for_action(id, 'running')
68
+ running_script_delete(id) # Stop and completely remove the script
69
+ wait(1)
70
+
71
+ list = running_script_list()
72
+ script = [script for script in list if script["id"] == id]
73
+ # Script is deleted, so it should NOT be in the running list
74
+ check_expression(f"{len(script)} == 0")
75
+ list = completed_script_list()
76
+ # Script is deleted so it should be in the completed list
77
+ script = [script for script in list if script["id"] == id]
78
+ check_expression(f"{len(script)} == 1")
79
+
80
+ script_lock(SCRIPT_NAME)
81
+ script_unlock(SCRIPT_NAME)
82
+ script_delete(SCRIPT_NAME)
83
+ scripts = script_list()
84
+ check_expression(f"{SCRIPT_NAME not in scripts} == True")
@@ -1,27 +1,32 @@
1
1
  SCREEN AUTO AUTO 1.0
2
2
 
3
- VERTICAL
4
- TITLE "<%= target_name %> Instrument Graphs"
3
+ TITLE "<%= target_name %> Instrument Graphs"
5
4
 
6
- MATRIXBYCOLUMNS 2
7
- SPARKLINE <%= target_name %> HEALTH_STATUS TEMP1
8
- SETTING SIZE 400 50
9
- SETTING HISTORY 30s
10
- SPARKLINE <%= target_name %> HEALTH_STATUS TEMP2
11
- SETTING SIZE 400 50
12
- SETTING HISTORY 30s
13
- LABELSPARKLINE <%= target_name %> HEALTH_STATUS TEMP3
14
- LABELSPARKLINE <%= target_name %> HEALTH_STATUS TEMP4
15
- LINEGRAPH <%= target_name %> HEALTH_STATUS TEMP1
16
- SETTING ITEM <%= target_name %> ADCS Q1
17
- LINEGRAPH <%= target_name %> HEALTH_STATUS TEMP2 RAW
18
- SETTING SECONDSGRAPHED 60
19
- SETTING POINTSSAVED 600
20
- SETTING POINTSGRAPHED 60
21
- LINEGRAPH <%= target_name %> HEALTH_STATUS TEMP3 CONVERTED REDUCED_MINUTE MIN
22
- SETTING SIZE 600 500 # width height
23
- SETTING HISTORY 1h
24
- LINEGRAPH <%= target_name %> HEALTH_STATUS TEMP4
25
- SETTING HISTORY 30m
26
- END
5
+ MATRIXBYCOLUMNS 2
6
+ SPARKLINE <%= target_name %> HEALTH_STATUS TEMP1
7
+ SETTING SIZE 400 50
8
+ SETTING HISTORY 30s
9
+ SPARKLINE <%= target_name %> HEALTH_STATUS TEMP2
10
+ SETTING SIZE 400 50
11
+ SETTING HISTORY 30s
12
+ LABELSPARKLINE <%= target_name %> HEALTH_STATUS TEMP3
13
+ LABELSPARKLINE <%= target_name %> HEALTH_STATUS TEMP4
14
+ LINEGRAPH <%= target_name %> HEALTH_STATUS TEMP1
15
+ SETTING ITEM <%= target_name %> ADCS Q1
16
+ LINEGRAPH <%= target_name %> HEALTH_STATUS TEMP2 RAW
17
+ SETTING SECONDSGRAPHED 60
18
+ SETTING POINTSSAVED 600
19
+ SETTING POINTSGRAPHED 60
20
+ LINEGRAPH <%= target_name %> HEALTH_STATUS TEMP3 CONVERTED REDUCED_MINUTE MIN
21
+ SETTING SIZE 600 500 # width height
22
+ SETTING HISTORY 1h
23
+ LINEGRAPH <%= target_name %> HEALTH_STATUS TEMP4
24
+ SETTING HISTORY 30m
27
25
  END
26
+
27
+ ARRAYPLOT
28
+ SETTING TITLE "Array Data"
29
+ SETTING ITEM INST HEALTH_STATUS ARY
30
+ SETTING ITEM INST HEALTH_STATUS ARY2
31
+ SETTING SIZE 600 400
32
+ SETTING X_AXIS 10 10
@@ -41,9 +41,12 @@ HORIZONTAL
41
41
  LABELVALUERANGEBAR <%= target_name %> HEALTH_STATUS TEMP2 0 100
42
42
  END
43
43
  VERTICALBOX "Limits Colors"
44
- LIMITSCOLOR <%= target_name %> HEALTH_STATUS TEMP1 CONVERTED 10 NIL # No label
44
+ HORIZONTAL
45
+ LIMITSCOLOR <%= target_name %> HEALTH_STATUS TEMP1 CONVERTED 10 NIL # No label
46
+ LABEL '1st Temp'
47
+ END
45
48
  LIMITSCOLOR <%= target_name %> HEALTH_STATUS TEMP2 # Default is label with just item name
46
- LIMITSCOLOR <%= target_name %> HEALTH_STATUS GROUND1STATUS CONVERTED 20 TRUE # Full TGT/PKT/ITEM label
49
+ LIMITSCOLOR <%= target_name %> HEALTH_STATUS TEMP3 CONVERTED 20 TRUE # Full TGT/PKT/ITEM label
47
50
  END
48
51
  END
49
52
  END