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
Binary file
|
@@ -0,0 +1,36 @@
|
|
1
|
+
TABLE "MC_Configuration" BIG_ENDIAN KEY_VALUE "Memory Control Configuration Table"
|
2
|
+
APPEND_PARAMETER "Scrub_Region_1_Start_Addr" 32 UINT 0 0x03FFFFFB 0
|
3
|
+
FORMAT_STRING "0x%0X"
|
4
|
+
APPEND_PARAMETER "Scrub_Region_1_End_Addr" 32 UINT 0 0x03FFFFFF 0x03FFFFFF
|
5
|
+
FORMAT_STRING "0x%0X"
|
6
|
+
APPEND_PARAMETER "Scrub_Region_2_Start_Addr" 32 UINT 0 0x03FFFFB 0
|
7
|
+
FORMAT_STRING "0x%0X"
|
8
|
+
APPEND_PARAMETER "Scrub_Region_2_End_Addr" 32 UINT 0 0x03FFFFF 0x03FFFFF
|
9
|
+
FORMAT_STRING "0x%0X"
|
10
|
+
APPEND_PARAMETER "Dump_Packet_Throttle_(sec)" 32 UINT 0 0x0FFFFFFFF 2 "Number of seconds to wait between dumping large packets"
|
11
|
+
APPEND_PARAMETER "Memory_Scrubbing" 8 UINT 0 1 1
|
12
|
+
STATE DISABLE 0
|
13
|
+
STATE ENABLE 1
|
14
|
+
APPEND_PARAMETER "SIOC_Memory_Config" 8 UINT 1 3 3
|
15
|
+
GENERIC_WRITE_CONVERSION_START
|
16
|
+
if packet.read("Memory_Scrubbing") == 'DISABLE'
|
17
|
+
packet.get_item("SIOC_Memory_Config").range = (10..20)
|
18
|
+
else
|
19
|
+
packet.get_item("SIOC_Memory_Config").range = (1..3)
|
20
|
+
end
|
21
|
+
value
|
22
|
+
GENERIC_WRITE_CONVERSION_END
|
23
|
+
APPEND_PARAMETER "Uneditable_Text" 32 UINT MIN MAX 0xDEADBEEF "Uneditable field"
|
24
|
+
FORMAT_STRING "0x%0X"
|
25
|
+
UNEDITABLE
|
26
|
+
APPEND_PARAMETER "Uneditable_State" 16 UINT MIN MAX 0 "Uneditable field"
|
27
|
+
STATE DISABLE 0
|
28
|
+
STATE ENABLE 1
|
29
|
+
UNEDITABLE
|
30
|
+
APPEND_PARAMETER "Uneditable_Check" 16 UINT MIN MAX 1 "Uneditable field"
|
31
|
+
STATE UNCHECKED 0
|
32
|
+
STATE CHECKED 1
|
33
|
+
UNEDITABLE
|
34
|
+
APPEND_PARAMETER "Binary" 32 STRING 0xDEADBEEF "Binary string"
|
35
|
+
APPEND_PARAMETER "Pad" 16 UINT 0 0 0
|
36
|
+
HIDDEN
|
@@ -0,0 +1,7 @@
|
|
1
|
+
TABLE "PPS_Selection" BIG_ENDIAN KEY_VALUE "Payload Clock Control Pulse Per Second Selection Table"
|
2
|
+
APPEND_PARAMETER "Primary_PPS" 8 UINT 0 1 1
|
3
|
+
STATE CHECKED 1
|
4
|
+
STATE UNCHECKED 0
|
5
|
+
APPEND_PARAMETER "Redundant_PPS" 8 UINT 0 1 0
|
6
|
+
STATE UNCHECKED 0
|
7
|
+
STATE CHECKED 1
|
@@ -0,0 +1,31 @@
|
|
1
|
+
TABLE "TLM_Monitoring" BIG_ENDIAN ROW_COLUMN 100 "Telemetry Monitoring Table"
|
2
|
+
APPEND_PARAMETER "Threshold" 32 UINT MIN MAX 0 "Telemetry item threshold at which point persistance is incremented"
|
3
|
+
APPEND_PARAMETER "Offset" 32 UINT MIN MAX 0 "Offset into the telemetry packet to monitor"
|
4
|
+
APPEND_PARAMETER "Data_Size" 32 UINT 0 3 0 "Amount of data to monitor (bytes)"
|
5
|
+
STATE BITS 0
|
6
|
+
STATE BYTE 1
|
7
|
+
STATE WORD 2
|
8
|
+
STATE LONGWORD 3
|
9
|
+
APPEND_PARAMETER "Bit_Mask" 32 UINT MIN MAX 0 "Bit Mask to apply to the Data Size before the value is compared ot the Threshold"
|
10
|
+
APPEND_PARAMETER "Persistence" 32 UINT MIN MAX 0 "Number of times the Threshold must be exceeded before Action is triggered"
|
11
|
+
APPEND_PARAMETER "Type" 32 UINT 0 3 0 "How the Threshold is compared against"
|
12
|
+
STATE LESS_THAN 0
|
13
|
+
STATE GREATER_THAN 1
|
14
|
+
STATE EQUAL_TO 2
|
15
|
+
STATE NOT_EQUAL_TO 3
|
16
|
+
APPEND_PARAMETER "Action" 32 UINT 0 4 0 "Action to take when Persistance is met"
|
17
|
+
STATE NO_ACTION_REQUIRED 0
|
18
|
+
STATE INITIATE_RESET 1
|
19
|
+
STATE CHANGE_MODE_SAFE 2
|
20
|
+
APPEND_PARAMETER "Group" 32 UINT 1 4 1 "Telemetry group this monitor item belongs to. Groups are automatically enabled due to payload events."
|
21
|
+
STATE ALL_MODES 1
|
22
|
+
STATE SAFE_MODE 2
|
23
|
+
APPEND_PARAMETER "Signed" 8 UINT 0 2 0 "Whether to treat the Data Size data as signed or unsigned when comparing to the Threshold"
|
24
|
+
STATE NOT_APPLICABLE 0
|
25
|
+
STATE UNSIGNED 1
|
26
|
+
STATE SIGNED 2
|
27
|
+
|
28
|
+
# Note we're creating 100 DEFAULT rows to match our 100 row table
|
29
|
+
<% 100.times do %>
|
30
|
+
DEFAULT 0x0 0 BITS 0x0 0 LESS_THAN NO_ACTION_REQUIRED ALL_MODES UNSIGNED
|
31
|
+
<% end %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# TBL_FILENAME is set to the name of the table file to overwrite
|
2
|
+
puts "file:#{ENV['TBL_FILENAME']}"
|
3
|
+
# Download the file
|
4
|
+
# Implement custom commanding logic to download the table
|
5
|
+
# You probably want to do something like:
|
6
|
+
buffer = ''
|
7
|
+
# i = 1
|
8
|
+
# num_segments = 5 # calculate based on TBL_FILENAME
|
9
|
+
# table_id = 1 # calculate based on TBL_FILENAME
|
10
|
+
# while i < num_segments
|
11
|
+
# # Request a part of the table buffer
|
12
|
+
# cmd("TGT DUMP with TABLE_ID #{table_id}, SEGMENT #{i}")
|
13
|
+
# buffer += tlm("TGT DUMP_PKT DATA")
|
14
|
+
# i += 1
|
15
|
+
# end
|
16
|
+
put_target_file(ENV['TBL_FILENAME'], buffer)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# TBL_FILENAME is set to the name of the table file
|
2
|
+
puts "file:#{ENV['TBL_FILENAME']}"
|
3
|
+
# Open the file
|
4
|
+
file = get_target_file(ENV['TBL_FILENAME'])
|
5
|
+
buffer = file.read
|
6
|
+
# puts buffer.formatted
|
7
|
+
# Implement custom commanding logic to upload the table
|
8
|
+
# Note that buffer is a Ruby string of bytes
|
9
|
+
# You probably want to do something like:
|
10
|
+
# buf_size = 512 # Size of a buffer in the upload command
|
11
|
+
# i = 0
|
12
|
+
# while i < buffer.length
|
13
|
+
# # Send a part of the buffer
|
14
|
+
# # NOTE: triple dots means start index, up to but not including, end index
|
15
|
+
# # while double dots means start index, up to AND including, end index
|
16
|
+
# cmd("TGT", "UPLOAD", "DATA" => buffer[i...(i + buf_size)])
|
17
|
+
# i += buf_size
|
18
|
+
# end
|
19
|
+
file.delete
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Requires for limits responses and custom conversion classes
|
2
|
+
REQUIRE example_limits_response.rb
|
3
|
+
REQUIRE sim_inst.rb
|
4
|
+
|
5
|
+
# Ignored Parameters
|
6
|
+
# IGNORE_PARAMETER parameter_name
|
7
|
+
IGNORE_PARAMETER CCSDSVER
|
8
|
+
IGNORE_PARAMETER CCSDSTYPE
|
9
|
+
IGNORE_PARAMETER CCSDSSHF
|
10
|
+
IGNORE_PARAMETER CCSDSAPID
|
11
|
+
IGNORE_PARAMETER CCSDSSEQFLAGS
|
12
|
+
IGNORE_PARAMETER CCSDSSEQCNT
|
13
|
+
IGNORE_PARAMETER CCSDSLENGTH
|
14
|
+
IGNORE_PARAMETER PKTID
|
15
|
+
|
16
|
+
# Ignored Items
|
17
|
+
# IGNORE_ITEM item_name
|
18
|
+
IGNORE_ITEM CCSDSVER
|
19
|
+
IGNORE_ITEM CCSDSTYPE
|
20
|
+
IGNORE_ITEM CCSDSSHF
|
21
|
+
IGNORE_ITEM CCSDSAPID
|
22
|
+
IGNORE_ITEM CCSDSSEQFLAGS
|
23
|
+
IGNORE_ITEM CCSDSSEQCNT
|
24
|
+
IGNORE_ITEM CCSDSLENGTH
|
25
|
+
|
26
|
+
# Explicitly define command and telemetry files
|
27
|
+
# If not given then all the files in cmd/tlm will be processed in
|
28
|
+
# alphabetical order
|
29
|
+
COMMANDS inst_cmds.txt
|
30
|
+
TELEMETRY inst_tlm.txt
|
31
|
+
TELEMETRY inst_tlm_override.txt
|
@@ -0,0 +1,10 @@
|
|
1
|
+
TELEMETRY SYSTEM META BIG_ENDIAN "System Meta Data Telemetry Packet"
|
2
|
+
APPEND_ID_ITEM PKTID 8 UINT 1 "Packet Id"
|
3
|
+
APPEND_ITEM CONFIG 256 STRING "Configuration Name"
|
4
|
+
APPEND_ITEM OPENC3_VERSION 240 STRING "OpenC3 Version"
|
5
|
+
META READ_ONLY
|
6
|
+
APPEND_ITEM USER_VERSION 240 STRING "User Project Version"
|
7
|
+
META READ_ONLY
|
8
|
+
APPEND_ITEM RUBY_VERSION 240 STRING "Ruby Version"
|
9
|
+
META READ_ONLY
|
10
|
+
APPEND_ITEM OPERATOR_NAME 512 STRING "Operator Name"
|
@@ -0,0 +1,41 @@
|
|
1
|
+
COMMAND SYSTEM STARTLOGGING BIG_ENDIAN "Starts logging both commands and telemetry for an interface"
|
2
|
+
APPEND_PARAMETER SYNC 32 UINT 0x1ACFFC1D 0x1ACFFC1D 0x1ACFFC1D "OpenC3 Command Sync Pattern"
|
3
|
+
APPEND_ID_PARAMETER OPCODE 32 UINT 2 2 2 "OpenC3 Command Opcode"
|
4
|
+
APPEND_PARAMETER LENGTH 32 UINT 0 65536 3 "OpenC3 Command Length of Command Data in Bytes"
|
5
|
+
APPEND_PARAMETER INTERFACE 256 STRING "ALL" "Interface to start logging on - ALL starts logging on all interfaces"
|
6
|
+
APPEND_PARAMETER LABEL 0 STRING "" "Optional label to place on log files"
|
7
|
+
|
8
|
+
COMMAND SYSTEM STARTCMDLOG BIG_ENDIAN "Starts logging commands for an interface"
|
9
|
+
APPEND_PARAMETER SYNC 32 UINT 0x1ACFFC1D 0x1ACFFC1D 0x1ACFFC1D "OpenC3 Command Sync Pattern"
|
10
|
+
APPEND_ID_PARAMETER OPCODE 32 UINT 3 3 3 "OpenC3 Command Opcode"
|
11
|
+
APPEND_PARAMETER LENGTH 32 UINT 0 65536 3 "OpenC3 Command Length of Command Data in Bytes"
|
12
|
+
APPEND_PARAMETER INTERFACE 256 STRING "ALL" "Interface to start logging on - ALL starts logging on all interfaces"
|
13
|
+
APPEND_PARAMETER LABEL 0 STRING "" "Optional label to place on log files"
|
14
|
+
|
15
|
+
COMMAND SYSTEM STARTTLMLOG BIG_ENDIAN "Starts logging telemetry for an interface"
|
16
|
+
APPEND_PARAMETER SYNC 32 UINT 0x1ACFFC1D 0x1ACFFC1D 0x1ACFFC1D "OpenC3 Command Sync Pattern"
|
17
|
+
APPEND_ID_PARAMETER OPCODE 32 UINT 4 4 4 "OpenC3 Command Opcode"
|
18
|
+
APPEND_PARAMETER LENGTH 32 UINT 0 65536 3 "OpenC3 Command Length of Command Data in Bytes"
|
19
|
+
APPEND_PARAMETER INTERFACE 256 STRING "ALL" "Interface to start logging on - ALL starts logging on all interfaces"
|
20
|
+
APPEND_PARAMETER LABEL 0 STRING "" "Optional label to place on log files"
|
21
|
+
|
22
|
+
COMMAND SYSTEM STOPLOGGING BIG_ENDIAN "Stops logging both commands and telemetry for an interface"
|
23
|
+
APPEND_PARAMETER SYNC 32 UINT 0x1ACFFC1D 0x1ACFFC1D 0x1ACFFC1D "OpenC3 Command Sync Pattern"
|
24
|
+
APPEND_ID_PARAMETER OPCODE 32 UINT 5 5 5 "OpenC3 Command Opcode"
|
25
|
+
APPEND_PARAMETER LENGTH 32 UINT 0 65536 3 "OpenC3 Command Length of Command Data in Bytes"
|
26
|
+
APPEND_PARAMETER INTERFACE 256 STRING "ALL" "Interface to stop logging on - ALL stops logging on all interfaces"
|
27
|
+
APPEND_PARAMETER LABEL 0 STRING "" "Optional label to place on log files"
|
28
|
+
|
29
|
+
COMMAND SYSTEM STOPCMDLOG BIG_ENDIAN "Stops logging commands for an interface"
|
30
|
+
APPEND_PARAMETER SYNC 32 UINT 0x1ACFFC1D 0x1ACFFC1D 0x1ACFFC1D "OpenC3 Command Sync Pattern"
|
31
|
+
APPEND_ID_PARAMETER OPCODE 32 UINT 6 6 6 "OpenC3 Command Opcode"
|
32
|
+
APPEND_PARAMETER LENGTH 32 UINT 0 65536 3 "OpenC3 Command Length of Command Data in Bytes"
|
33
|
+
APPEND_PARAMETER INTERFACE 256 STRING "ALL" "Interface to stop logging on - ALL stops logging on all interfaces"
|
34
|
+
APPEND_PARAMETER LABEL 0 STRING "" "Optional label to place on log files"
|
35
|
+
|
36
|
+
COMMAND SYSTEM STOPTLMLOG BIG_ENDIAN "Stops logging telemetry for an interface"
|
37
|
+
APPEND_PARAMETER SYNC 32 UINT 0x1ACFFC1D 0x1ACFFC1D 0x1ACFFC1D "OpenC3 Command Sync Pattern"
|
38
|
+
APPEND_ID_PARAMETER OPCODE 32 UINT 7 7 7 "OpenC3 Command Opcode"
|
39
|
+
APPEND_PARAMETER LENGTH 32 UINT 0 65536 3 "OpenC3 Command Length of Command Data in Bytes"
|
40
|
+
APPEND_PARAMETER INTERFACE 256 STRING "ALL" "Interface to stop logging on - ALL stops logging on all interfaces"
|
41
|
+
APPEND_PARAMETER LABEL 0 STRING "" "Optional label to place on log files"
|
@@ -0,0 +1,7 @@
|
|
1
|
+
TELEMETRY SYSTEM LIMITS_CHANGE BIG_ENDIAN "OpenC3 limits change"
|
2
|
+
APPEND_ID_ITEM PKT_ID 8 UINT 2 "Packet Id"
|
3
|
+
APPEND_ITEM TARGET 240 STRING "Target name"
|
4
|
+
APPEND_ITEM PACKET 240 STRING "Packet name"
|
5
|
+
APPEND_ITEM ITEM 240 STRING "Item that changed limits state"
|
6
|
+
APPEND_ITEM OLD_STATE 240 STRING "The old limit state"
|
7
|
+
APPEND_ITEM NEW_STATE 240 STRING "The new limit state"
|
@@ -0,0 +1,66 @@
|
|
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
|
+
# This file implements an example background task
|
21
|
+
|
22
|
+
require 'openc3/tools/cmd_tlm_server/background_task'
|
23
|
+
|
24
|
+
module OpenC3
|
25
|
+
# Starts by sleeping 5 seconds then sends up to three collect commands
|
26
|
+
class ExampleBackgroundTask < BackgroundTask
|
27
|
+
def initialize
|
28
|
+
super()
|
29
|
+
@name = 'Example Background Task'
|
30
|
+
# Create Sleeper here in case the task is stopped before call is executed
|
31
|
+
@sleeper = Sleeper.new
|
32
|
+
end
|
33
|
+
|
34
|
+
def call
|
35
|
+
sent_count = 0
|
36
|
+
@sleeper = Sleeper.new
|
37
|
+
@status = "Sleeping for 5 seconds"
|
38
|
+
return if @sleeper.sleep(5) # allow interfaces time to start
|
39
|
+
initial_count = tlm('INST', 'HEALTH_STATUS', 'COLLECTS')
|
40
|
+
loop do
|
41
|
+
# Start up with at least 3 collects
|
42
|
+
count = tlm('INST', 'HEALTH_STATUS', 'COLLECTS')
|
43
|
+
if count < (initial_count + 3)
|
44
|
+
begin
|
45
|
+
cmd('INST', 'COLLECT', 'TYPE' => 'NORMAL', 'DURATION' => 1)
|
46
|
+
sent_count += 1
|
47
|
+
@status = "Sent COLLECT ##{sent_count} at #{Time.now.sys.formatted}"
|
48
|
+
wait("INST HEALTH_STATUS COLLECTS > #{count}", 5)
|
49
|
+
@status = "Tlm Updated at #{Time.now.sys.formatted}"
|
50
|
+
rescue
|
51
|
+
# Oh well - probably disconnected
|
52
|
+
end
|
53
|
+
else
|
54
|
+
break
|
55
|
+
end
|
56
|
+
return if @sleeper.sleep(1)
|
57
|
+
end
|
58
|
+
@status = "Finished at #{Time.now.sys.formatted}"
|
59
|
+
end
|
60
|
+
|
61
|
+
def stop
|
62
|
+
@sleeper.cancel
|
63
|
+
@status = "Stopped at #{Time.now.sys.formatted}"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,112 @@
|
|
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
|
+
require 'openc3/interfaces'
|
22
|
+
require 'openc3/tools/cmd_tlm_server/interface_thread'
|
23
|
+
|
24
|
+
module OpenC3
|
25
|
+
class ExampleTarget
|
26
|
+
class ExampleServerInterface < TcpipServerInterface
|
27
|
+
PORT = 9999
|
28
|
+
|
29
|
+
def initialize
|
30
|
+
super(PORT, PORT, 5.0, nil, 'LENGTH', 0, 32, 4, 1, 'BIG_ENDIAN', 4, nil, nil, true)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class ExampleInterfaceThread < InterfaceThread
|
35
|
+
protected
|
36
|
+
def handle_packet(packet)
|
37
|
+
identified_packet = System.commands.identify(packet.buffer, ['EXAMPLE'])
|
38
|
+
if identified_packet
|
39
|
+
Logger.info "Received command: #{identified_packet.target_name} #{identified_packet.packet_name}"
|
40
|
+
else
|
41
|
+
Logger.info "Received UNKNOWN command"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class ExampleTelemetryThread
|
47
|
+
attr_reader :thread
|
48
|
+
|
49
|
+
def initialize(interface)
|
50
|
+
@interface = interface
|
51
|
+
@sleeper = Sleeper.new
|
52
|
+
end
|
53
|
+
|
54
|
+
def start
|
55
|
+
packet = System.telemetry.packet('EXAMPLE', 'STATUS')
|
56
|
+
@thread = Thread.new do
|
57
|
+
@stop_thread = false
|
58
|
+
begin
|
59
|
+
loop do
|
60
|
+
packet.write('PACKET_ID', 1)
|
61
|
+
packet.write('STRING', "The time is now: #{Time.now.sys.formatted}")
|
62
|
+
@interface.write(packet)
|
63
|
+
break if @sleeper.sleep(1)
|
64
|
+
end
|
65
|
+
rescue Exception => err
|
66
|
+
Logger.error "ExampleTelemetryThread unexpectedly died\n#{err.formatted}"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def stop
|
72
|
+
OpenC3.kill_thread(self, @thread)
|
73
|
+
end
|
74
|
+
|
75
|
+
def graceful_kill
|
76
|
+
@sleeper.cancel
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def initialize
|
81
|
+
# Create interface to receive commands and send telemetry
|
82
|
+
@interface = ExampleServerInterface.new
|
83
|
+
@interface_thread = nil
|
84
|
+
@telemetry_thread = nil
|
85
|
+
end
|
86
|
+
|
87
|
+
def start
|
88
|
+
@interface_thread = ExampleInterfaceThread.new(@interface)
|
89
|
+
@interface_thread.start
|
90
|
+
@telemetry_thread = ExampleTelemetryThread.new(@interface)
|
91
|
+
@telemetry_thread.start
|
92
|
+
end
|
93
|
+
|
94
|
+
def stop
|
95
|
+
@telemetry_thread.stop if @telemetry_thread
|
96
|
+
@interface_thread.stop if @interface_thread
|
97
|
+
end
|
98
|
+
|
99
|
+
def self.run
|
100
|
+
Logger.level = Logger::INFO
|
101
|
+
target = self.new
|
102
|
+
begin
|
103
|
+
target.start
|
104
|
+
while true
|
105
|
+
sleep 1
|
106
|
+
end
|
107
|
+
rescue SystemExit, Interrupt
|
108
|
+
target.stop
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,64 @@
|
|
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/tools/cmd_tlm_server/limits_groups_background_task'
|
21
|
+
|
22
|
+
module OpenC3
|
23
|
+
# Inheriting from the LimitsGroupsBackgroundTask provides a framework for
|
24
|
+
# automatically enabling and disabling limits groups based on telemetry.
|
25
|
+
class LimitsGroups < LimitsGroupsBackgroundTask
|
26
|
+
def initialize(initial_delay = 0, task_delay = 0.5)
|
27
|
+
# Initial delay upon starting the server before staring the group checks
|
28
|
+
# followed by the background task delay between check iterations
|
29
|
+
super(initial_delay, task_delay)
|
30
|
+
# Creating a Proc allows for arbitrary code to be executed when a group
|
31
|
+
# is enabled or disabled.
|
32
|
+
@temp2_enable_code = Proc.new do
|
33
|
+
enable_limits_group('INST2_GROUND') # Enable the INST2_GROUND group
|
34
|
+
end
|
35
|
+
@temp2_disable_code = Proc.new do
|
36
|
+
disable_limits_group('INST2_GROUND') # Disable the INST2_GROUND group
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# This method name is important. It must begin with 'check_' and end with
|
41
|
+
# the name of a Limits Group defined by the LIMITS_GROUP keyword. In the
|
42
|
+
# demo this is defined in config/targets/SYSTEM/cmd_tlm/limits_groups.txt.
|
43
|
+
# Note that there is a LIMITS_GROUP INST2_TEMP2 so we have a match.
|
44
|
+
def check_inst2_temp2
|
45
|
+
# Inside this method you must call process_group. The first parameter is
|
46
|
+
# the number of seconds to delay before enabling the group when the telemetry
|
47
|
+
# check is true. When the telemetry check is false the group is instantly
|
48
|
+
# disabled. The next two parameters are Proc objects which are called with
|
49
|
+
# the group is enabled and disabled respectively. We defined our Proc objects
|
50
|
+
# in the constructor to enable and disable the GROUND group.
|
51
|
+
process_group(0, @temp2_enable_code, @temp2_disable_code) do
|
52
|
+
val = tlm("INST2 HEALTH_STATUS TEMP2")
|
53
|
+
# The expression returns TRUE (to enable the group) when the value is
|
54
|
+
# not NAN and not Infinite. If the value is NAN or Infinite the group
|
55
|
+
# is disabled. Note that this can't prevent false positives because the
|
56
|
+
# value has to change to something invalid before we can turn off the group
|
57
|
+
# at which point it is too late. Typically you enable or disable a group
|
58
|
+
# based on some external telemetry point such as a power supply output
|
59
|
+
# to enable a group of items powered by the supply.
|
60
|
+
!val.nan? && !val.infinite?
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,76 @@
|
|
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
|
+
require 'openc3/interfaces'
|
22
|
+
require 'openc3/tools/cmd_tlm_server/interface_thread'
|
23
|
+
|
24
|
+
module OpenC3
|
25
|
+
class ScpiTarget
|
26
|
+
class ScpiServerInterface < TcpipServerInterface
|
27
|
+
PORT = 5025
|
28
|
+
|
29
|
+
def initialize
|
30
|
+
super(PORT, PORT, 5.0, nil, 'TERMINATED', '0xA', '0xA')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class ScpiInterfaceThread < InterfaceThread
|
35
|
+
def initialize(interface)
|
36
|
+
super(interface)
|
37
|
+
@index = 0
|
38
|
+
end
|
39
|
+
|
40
|
+
protected
|
41
|
+
def handle_packet(packet)
|
42
|
+
Logger.info "Received command: #{packet.buffer}"
|
43
|
+
if packet.buffer.include?('?')
|
44
|
+
@interface.write_raw(@index.to_s + "\x0A")
|
45
|
+
end
|
46
|
+
@index += 1
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def initialize
|
51
|
+
# Create interface to receive commands and send telemetry
|
52
|
+
@target_interface = ScpiServerInterface.new
|
53
|
+
@interface_thread = nil
|
54
|
+
end
|
55
|
+
|
56
|
+
def start
|
57
|
+
@interface_thread = ScpiInterfaceThread.new(@target_interface)
|
58
|
+
@interface_thread.start
|
59
|
+
end
|
60
|
+
|
61
|
+
def stop
|
62
|
+
@interface_thread.stop if @interface_thread
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.run
|
66
|
+
Logger.level = Logger::INFO
|
67
|
+
target = self.new
|
68
|
+
begin
|
69
|
+
target.start
|
70
|
+
loop { sleep 1 }
|
71
|
+
rescue SystemExit, Interrupt
|
72
|
+
target.stop
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|