openc3-cosmos-script-engine-cstol 1.0.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6f1bc3e1c0f55e2a66fc5df1c1b156ef06f29a2b98132f1a9ca89d26562ba1fb
4
+ data.tar.gz: da77cd0df1e9908ca50654fb5b9a9cbad3b0359353e9009daab56504bab811d1
5
+ SHA512:
6
+ metadata.gz: b70bb6b13b4fac767e2bfb3407318c350029c94ba2535f7c4a33a615c2b4deb5491ebcf6f6fd2502f33a8be75d6bbf41a6a495602eb19e9f0d082e6261f48791
7
+ data.tar.gz: 2d5ba36b266566e4eda8e6cabe4ed67589411335d3b6c3d2545ab4fb28162ec0b64c7d544ec4b1a8fb2910ae36aa4dd5b80fd0e09263c12808b346dce4d0c9ed
data/LICENSE.txt ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2025 OpenC3, Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,200 @@
1
+ ## OpenC3 CSTOL Script Engine Plugin
2
+
3
+ CSTOL language originally developed by the University of Colorado / LASP.
4
+
5
+ This plugin provides a CSTOL script engine that allows COSMOS ScriptRunner to execute CSTOL scripts.
6
+
7
+ ### Expression Processing Notes and Differences from the CSTOL Spec
8
+
9
+ 1. Both single and double quotes are supported (original CSTOL only had double quotes)
10
+ 2. DN and EU Units are dropped and have no effect on anything
11
+ 3. Global variables (telemetry points) always use the LATEST packet name in COSMOS
12
+ 4. AVERAGED and SMOOTHED are not supported
13
+ 5. There are no line length limitations
14
+
15
+ ### Supported Special Variables
16
+
17
+ | Name | Discussion |
18
+ | ------------------ | ---------------------------------------------------------------------------------------------- |
19
+ | $$CURRENT_TIME | Supported. Returns a floating point seconds from epoch value to interpreted Python expressions |
20
+ | $$OWLT | Supported. Defaults to 0.0 |
21
+ | $$SC_TIME | Supported. Equals $$CURRENT_TIME + $$OWLT |
22
+ | $$ERROR | Supported. Defaults to "NO_ERROR" |
23
+ | $$CHECK_INTERVAL | Supported. Defaults to 1.0 |
24
+ | $$CLP_STP_INTERVAL | Supported. Note: Default value is COSMOS default of 0.1 instead of 1 |
25
+ | $$STEP_INTERVAL | Supported. Note: Default value is COSMOS default of 0.1 instead of 1 |
26
+ | $$CLP_STEP_MODE | Supported. Note: Default value in COSMOS is PAUSE instead of GO |
27
+ | $$STEP_MODE | Supported. Note: Default value in COSMOS is PAUSE instead of GO |
28
+ | $$LOOP_COUNT | Supported. Counts up from 1 for each loop iteration. Equals 0 outside of loops |
29
+
30
+ ### Not Supported Special Variables
31
+
32
+ | Name | Discussion |
33
+ | ------------------ | ------------------------------------------------------------------------------------------------- |
34
+ | $$GBL_COMMAND_MODE | Not supported. Could potentially make use of COSMOS "disconnect" mode |
35
+ | $$COMMAND_ECHO | Not supported. Commands are always printed out. Could potentially affect cmd(log_message) |
36
+ | $$LIMITS_WAIT | Not supported. Would require adding a thread to monitor limits events and pause the script. |
37
+ | $$LIMITS_MODE | Not supported. Will not be supported as disabling all limits monitoring is not a desired feature. |
38
+ | $$STATES_MODE | Not supported. Will not be supported as disabling all states monitoring is not a desired feature. |
39
+ | $$CEV_MODE | Not supported. Could potentially affect cmd(validate) |
40
+ | $$UED_MODE | Not supported. Probably will not be supported as this isn't a COSMOS feature |
41
+ | $$PRECHECK_MODE | Not supported. Could potentially affect cmd(validate) |
42
+ | $$POSTCHECK_MODE | Not supported. Could potentially affect cmd(validate) |
43
+ | $$STALE_CHECK | Not supported. Staleness is a client side concept in COSMOS |
44
+ | $$STALE_CHECK_INT | Not supported. Staleness is a client side concept in COSMOS |
45
+ | $$ALLOW_STALE | Not supported. Staleness is a client side concept in COSMOS |
46
+ | $$COMPILER_OUTPUT | Not supported. Doesn't make sense in COSMOS |
47
+ | $$COMMAND_MODE | Not supported. Could potentially make use of COSMOS "disconnect" mode |
48
+ | $$CLP_LOG_INPUT | Not supported. |
49
+ | $$LOG_INPUT | Not supported. |
50
+ | $$TIME_STAMP | Not supported. |
51
+ | $$CMD_STRING2STATE | Not supported. |
52
+
53
+ ### Supported CSTOL Keywords
54
+
55
+ | Keyword | Discussion |
56
+ | -------- | -------------------------------------------------------------------------------------------------------------------------------- |
57
+ | ASK | Fully supported |
58
+ | BEGIN | Has no effect |
59
+ | CHECK | Fully supported |
60
+ | CLEAR | Uses COSMOS screen names as quoted arguments like "INST ADCS". CLEAR ALL only clears screens, other page types are not supported |
61
+ | DECLARE | Declare is implemented to handle all types the same. Ranges and value lists are ignored |
62
+ | DISPLAY | Uses COSMOS screen names as quoted arguments like "INST ADCS". TO and AT are not supported |
63
+ | ELSE | Fully supported |
64
+ | ELSEIF | Fully supported |
65
+ | END | Fully supported |
66
+ | ENDIF | Fully supported |
67
+ | ENDLOOP | Fully supported |
68
+ | ENDMACRO | Ignored |
69
+ | ENDPROC | Ignored |
70
+ | ESCAPE | Fully supported |
71
+ | GOTO | Fully supported |
72
+ | IF | Fully supported |
73
+ | LET | Fully supported, but typing checks and ranges are not implemented |
74
+ | LOAD | Takes an interface name instead of a target name to load data to |
75
+ | LOOP | Fully supported |
76
+ | PROC | Fully supported |
77
+ | RETURN | Fully supported |
78
+ | RUN | Fully supported - shells out in the Script Runner container |
79
+ | SEND | Takes an interface name instead of a target name to send data to. SEND MESSAGE is not supported. |
80
+ | START | Fully supported. Procedures must be specified with COSMOS paths ie. TARGET/procedures/myproc.prc |
81
+ | SWITCH | Connect or disconnect COSMOS interfaces. Uses interface names. SWITCH RECORDING not supported |
82
+ | WAIT | Fully supported. WAIT AT (breakpoints) are handled through the ScriptRunner API and GUI. WAIT FOR is not supported |
83
+ | WRITE | Fully supported |
84
+
85
+ The following CSTOL command keywords are supported:
86
+
87
+ - ACTIVATE
88
+ - ARM
89
+ - BOOT
90
+ - CHANGE
91
+ - CLOSE
92
+ - CMD
93
+ - DISABLE
94
+ - DISARM
95
+ - DRIVE
96
+ - DUMP
97
+ - ENABLE
98
+ - FIRE
99
+ - FLYBACK
100
+ - FORCE
101
+ - GET
102
+ - HALT
103
+ - HOLD
104
+ - IGNORE
105
+ - INITIATE
106
+ - MOVE
107
+ - NOW
108
+ - OPEN
109
+ - PASS
110
+ - PERFORM
111
+ - RESET
112
+ - SELECT
113
+ - SET
114
+ - SLEW
115
+ - STEP
116
+ - TEST
117
+ - TOGGLE
118
+ - TURN
119
+ - USE
120
+
121
+ Commands use the command keyword as the expected name of the command. For example `TEST INST` become `cmd("INST TEST")` in COSMOS.
122
+
123
+ Commands with two words like `TURN ON` remove spaces in the expected command names. `TURN ON INST` becomes `cmd("INST TURNON")` in COSMOS.
124
+
125
+ The CMD keyword is special in that it expects an argument after the external element to be the command name. `CMD INST TEST with ARG1 1, ARG2 2` becomes `cmd("INST TEST with ARG1 1, ARG2 2")`.
126
+
127
+ Other command keywords assume a word after the external element is an argument name that should be given a value by a following clause. ` SET INST TEMP TO 10`` becomes `cmd("INST SET with TEMP 10")```.
128
+
129
+ If no argument name is given the argument name is assumed to be "VALUE". `SET INST BY 10` becomes `cmd("INST SET with VALUE 10")`.
130
+
131
+ NOW is supported and ignored.
132
+
133
+ The following CSTOL keywords are not supported and will simply print a warning:
134
+
135
+ | Keyword | Discussion |
136
+ | ---------- | ------------------------------------------------------------------------------------------------------ |
137
+ | CANCEL | Commands cannot be canceled in COSMOS |
138
+ | CHECKPOINT | CSTOL Database is not applicable to COSMOS |
139
+ | COMMIT | CSTOL Database is not applicable to COSMOS |
140
+ | COMPILE | CSTOL procedures in Script Runner are evaluated line by line and not compiled |
141
+ | CSTOL | Terminating an OASIS-CC session does not make sense in COSMOS. |
142
+ | DECOMPILE | CSTOL is not compiled in COSMOS |
143
+ | DEFINE | Macros are not supported |
144
+ | DELETE | CSTOL Database is not applicable to COSMOS |
145
+ | FLUSH | Commands aren't queued in COSMOS |
146
+ | GO | Handled through ScriptRunner APIs / Buttons, not through a keyword |
147
+ | INSERT | CSTOL Database is not applicable to COSMOS |
148
+ | LOCK | CSTOL Database is not applicable to COSMOS |
149
+ | MACRO | Macros are not supported |
150
+ | MESSAGE | Not Supported |
151
+ | RECORD | COSMOS is always logging and cannot be disabled |
152
+ | REPORT | CSTOL Database is not applicable to COSMOS |
153
+ | RESTORE | CSTOL Database is not applicable to COSMOS |
154
+ | RETRIEVE | Playback from files is not supported |
155
+ | RETRY | Command retry is not supported, through retrying failed lines is supported through the API and buttons |
156
+ | ROUTE | Not implemented, COSMOS does not have Sub-CLP. Could potentially do map_target_to_interface. |
157
+ | SHOW | COSMOS does not have CLPs |
158
+ | SNAP | Screenshots are not supported |
159
+ | STOP | Logging cannot be disabled. Replay is not supported. Sub-CLPs are not supported |
160
+ | UNDEFINE | Macros are not supported |
161
+ | UNLOCK | CSTOL Database is not applicable to COSMOS |
162
+ | UPDATE | CSTOL Database is not applicable to COSMOS |
163
+
164
+ ## Getting Started
165
+
166
+ 1. At the Administrator Console - Plugins, upload the openc3-cosmos-script-engine-cstol.gem file
167
+
168
+ ## Testing
169
+
170
+ ### Run tests with coverage
171
+
172
+ source test_env/bin/activate
173
+ python -m pytest
174
+
175
+ ### Generate detailed terminal report
176
+
177
+ python -m pytest --cov=lib --cov-report=term-missing
178
+
179
+ ### Generate HTML report
180
+
181
+ python -m pytest --cov=lib --cov-report=html
182
+
183
+ ## Contributing
184
+
185
+ We encourage you to contribute to OpenC3!
186
+
187
+ Contributing is easy.
188
+
189
+ 1. Fork the project
190
+ 2. Create a feature branch
191
+ 3. Make your changes
192
+ 4. Submit a pull request
193
+
194
+ YOU MUST AGREE TO THE FOLLOWING TO SUBMIT CODE TO THIS PROJECT:
195
+
196
+ FOR ALL CONTRIBUTIONS TO THE OPENC3 PROJECT, OPENC3, INC. MAINTAINS ALL RIGHTS TO ALL CODE CONTRIBUTED TO THE OPENC3 PROJECT INCLUDING THE RIGHT TO LICENSE IT UNDER OTHER TERMS.
197
+
198
+ ## License
199
+
200
+ The MIT License. See [LICENSE.txt](LICENSE.txt)
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ # encoding: ascii-8bit
2
+
3
+ # Copyright 2025 OpenC3, Inc.
4
+ # All Rights Reserved.
5
+ #
6
+ # This program is only licensed for use by the University of Colorado LASP
7
+
8
+ PLUGIN_NAME = Dir['*.gemspec'][0].split('.')[0..-2].join('.')
9
+
10
+ task :require_version do
11
+ unless ENV['VERSION']
12
+ puts "VERSION is required: rake <task> VERSION=X.X.X"
13
+ exit 1
14
+ end
15
+ end
16
+
17
+ task :build => [:require_version] do
18
+ _, platform, *_ = RUBY_PLATFORM.split("-")
19
+ if platform == 'mswin32' or platform == 'mingw32'
20
+ puts "Warning: Building gem on Windows will lose file permissions"
21
+ end
22
+ system("gem build #{PLUGIN_NAME}")
23
+ end