openc3-cosmos-demo 5.1.0 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openc3-cosmos-demo
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Melton
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-11-18 00:00:00.000000000 Z
12
+ date: 2022-12-13 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: |2
15
15
  This plugin adds the OpenC3 COSMOS demo configuration to a base OpenC3 COSMOS installation.
@@ -44,8 +44,10 @@ files:
44
44
  - targets/INST/procedures/collect.rb
45
45
  - targets/INST/procedures/disconnect.rb
46
46
  - targets/INST/procedures/file_dialog.rb
47
+ - targets/INST/procedures/metadata.rb
47
48
  - targets/INST/procedures/my_script_suite.rb
48
49
  - targets/INST/procedures/my_test_suite.rb
50
+ - targets/INST/procedures/stash.rb
49
51
  - targets/INST/procedures/target_file.rb
50
52
  - targets/INST/procedures/utilities/clear.rb
51
53
  - targets/INST/procedures/utilities/collect.rb
@@ -78,13 +80,6 @@ files:
78
80
  - targets/INST/tables/procedures/upload.rb
79
81
  - targets/INST/target.txt
80
82
  - targets/SYSTEM/cmd_tlm/limits_groups.txt
81
- - targets/SYSTEM/cmd_tlm/meta_tlm.txt
82
- - targets/SYSTEM/cmd_tlm/system_cmds.txt
83
- - targets/SYSTEM/cmd_tlm/system_tlm.txt
84
- - targets/SYSTEM/lib/example_background_task.rb
85
- - targets/SYSTEM/lib/example_target.rb
86
- - targets/SYSTEM/lib/limits_groups.rb
87
- - targets/SYSTEM/lib/scpi_target.rb
88
83
  - targets/SYSTEM/procedures/example_test.rb
89
84
  - targets/SYSTEM/procedures/interactive.rb
90
85
  - targets/SYSTEM/procedures/limits_api_test.rb
@@ -1,10 +0,0 @@
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"
@@ -1,41 +0,0 @@
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"
@@ -1,7 +0,0 @@
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"
@@ -1,69 +0,0 @@
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 may also be used under the terms of a commercial license
21
- # if purchased from OpenC3, Inc.
22
-
23
- # This file implements an example background task
24
-
25
- require 'openc3/tools/cmd_tlm_server/background_task'
26
-
27
- module OpenC3
28
- # Starts by sleeping 5 seconds then sends up to three collect commands
29
- class ExampleBackgroundTask < BackgroundTask
30
- def initialize
31
- super()
32
- @name = 'Example Background Task'
33
- # Create Sleeper here in case the task is stopped before call is executed
34
- @sleeper = Sleeper.new
35
- end
36
-
37
- def call
38
- sent_count = 0
39
- @sleeper = Sleeper.new
40
- @status = "Sleeping for 5 seconds"
41
- return if @sleeper.sleep(5) # allow interfaces time to start
42
- initial_count = tlm('INST', 'HEALTH_STATUS', 'COLLECTS')
43
- loop do
44
- # Start up with at least 3 collects
45
- count = tlm('INST', 'HEALTH_STATUS', 'COLLECTS')
46
- if count < (initial_count + 3)
47
- begin
48
- cmd('INST', 'COLLECT', 'TYPE' => 'NORMAL', 'DURATION' => 1)
49
- sent_count += 1
50
- @status = "Sent COLLECT ##{sent_count} at #{Time.now.sys.formatted}"
51
- wait("INST HEALTH_STATUS COLLECTS > #{count}", 5)
52
- @status = "Tlm Updated at #{Time.now.sys.formatted}"
53
- rescue
54
- # Oh well - probably disconnected
55
- end
56
- else
57
- break
58
- end
59
- return if @sleeper.sleep(1)
60
- end
61
- @status = "Finished at #{Time.now.sys.formatted}"
62
- end
63
-
64
- def stop
65
- @sleeper.cancel
66
- @status = "Stopped at #{Time.now.sys.formatted}"
67
- end
68
- end
69
- end
@@ -1,115 +0,0 @@
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 may also be used under the terms of a commercial license
21
- # if purchased from OpenC3, Inc.
22
-
23
- require 'openc3'
24
- require 'openc3/interfaces'
25
- require 'openc3/tools/cmd_tlm_server/interface_thread'
26
-
27
- module OpenC3
28
- class ExampleTarget
29
- class ExampleServerInterface < TcpipServerInterface
30
- PORT = 9999
31
-
32
- def initialize
33
- super(PORT, PORT, 5.0, nil, 'LENGTH', 0, 32, 4, 1, 'BIG_ENDIAN', 4, nil, nil, true)
34
- end
35
- end
36
-
37
- class ExampleInterfaceThread < InterfaceThread
38
- protected
39
- def handle_packet(packet)
40
- identified_packet = System.commands.identify(packet.buffer, ['EXAMPLE'])
41
- if identified_packet
42
- Logger.info "Received command: #{identified_packet.target_name} #{identified_packet.packet_name}"
43
- else
44
- Logger.info "Received UNKNOWN command"
45
- end
46
- end
47
- end
48
-
49
- class ExampleTelemetryThread
50
- attr_reader :thread
51
-
52
- def initialize(interface)
53
- @interface = interface
54
- @sleeper = Sleeper.new
55
- end
56
-
57
- def start
58
- packet = System.telemetry.packet('EXAMPLE', 'STATUS')
59
- @thread = Thread.new do
60
- @stop_thread = false
61
- begin
62
- loop do
63
- packet.write('PACKET_ID', 1)
64
- packet.write('STRING', "The time is now: #{Time.now.sys.formatted}")
65
- @interface.write(packet)
66
- break if @sleeper.sleep(1)
67
- end
68
- rescue Exception => err
69
- Logger.error "ExampleTelemetryThread unexpectedly died\n#{err.formatted}"
70
- end
71
- end
72
- end
73
-
74
- def stop
75
- OpenC3.kill_thread(self, @thread)
76
- end
77
-
78
- def graceful_kill
79
- @sleeper.cancel
80
- end
81
- end
82
-
83
- def initialize
84
- # Create interface to receive commands and send telemetry
85
- @interface = ExampleServerInterface.new
86
- @interface_thread = nil
87
- @telemetry_thread = nil
88
- end
89
-
90
- def start
91
- @interface_thread = ExampleInterfaceThread.new(@interface)
92
- @interface_thread.start
93
- @telemetry_thread = ExampleTelemetryThread.new(@interface)
94
- @telemetry_thread.start
95
- end
96
-
97
- def stop
98
- @telemetry_thread.stop if @telemetry_thread
99
- @interface_thread.stop if @interface_thread
100
- end
101
-
102
- def self.run
103
- Logger.level = Logger::INFO
104
- target = self.new
105
- begin
106
- target.start
107
- while true
108
- sleep 1
109
- end
110
- rescue SystemExit, Interrupt
111
- target.stop
112
- end
113
- end
114
- end
115
- end
@@ -1,67 +0,0 @@
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 may also be used under the terms of a commercial license
21
- # if purchased from OpenC3, Inc.
22
-
23
- require 'openc3/tools/cmd_tlm_server/limits_groups_background_task'
24
-
25
- module OpenC3
26
- # Inheriting from the LimitsGroupsBackgroundTask provides a framework for
27
- # automatically enabling and disabling limits groups based on telemetry.
28
- class LimitsGroups < LimitsGroupsBackgroundTask
29
- def initialize(initial_delay = 0, task_delay = 0.5)
30
- # Initial delay upon starting the server before staring the group checks
31
- # followed by the background task delay between check iterations
32
- super(initial_delay, task_delay)
33
- # Creating a Proc allows for arbitrary code to be executed when a group
34
- # is enabled or disabled.
35
- @temp2_enable_code = Proc.new do
36
- enable_limits_group('INST2_GROUND') # Enable the INST2_GROUND group
37
- end
38
- @temp2_disable_code = Proc.new do
39
- disable_limits_group('INST2_GROUND') # Disable the INST2_GROUND group
40
- end
41
- end
42
-
43
- # This method name is important. It must begin with 'check_' and end with
44
- # the name of a Limits Group defined by the LIMITS_GROUP keyword. In the
45
- # demo this is defined in config/targets/SYSTEM/cmd_tlm/limits_groups.txt.
46
- # Note that there is a LIMITS_GROUP INST2_TEMP2 so we have a match.
47
- def check_inst2_temp2
48
- # Inside this method you must call process_group. The first parameter is
49
- # the number of seconds to delay before enabling the group when the telemetry
50
- # check is true. When the telemetry check is false the group is instantly
51
- # disabled. The next two parameters are Proc objects which are called with
52
- # the group is enabled and disabled respectively. We defined our Proc objects
53
- # in the constructor to enable and disable the GROUND group.
54
- process_group(0, @temp2_enable_code, @temp2_disable_code) do
55
- val = tlm("INST2 HEALTH_STATUS TEMP2")
56
- # The expression returns TRUE (to enable the group) when the value is
57
- # not NAN and not Infinite. If the value is NAN or Infinite the group
58
- # is disabled. Note that this can't prevent false positives because the
59
- # value has to change to something invalid before we can turn off the group
60
- # at which point it is too late. Typically you enable or disable a group
61
- # based on some external telemetry point such as a power supply output
62
- # to enable a group of items powered by the supply.
63
- !val.nan? && !val.infinite?
64
- end
65
- end
66
- end
67
- end
@@ -1,79 +0,0 @@
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 may also be used under the terms of a commercial license
21
- # if purchased from OpenC3, Inc.
22
-
23
- require 'openc3'
24
- require 'openc3/interfaces'
25
- require 'openc3/tools/cmd_tlm_server/interface_thread'
26
-
27
- module OpenC3
28
- class ScpiTarget
29
- class ScpiServerInterface < TcpipServerInterface
30
- PORT = 5025
31
-
32
- def initialize
33
- super(PORT, PORT, 5.0, nil, 'TERMINATED', '0xA', '0xA')
34
- end
35
- end
36
-
37
- class ScpiInterfaceThread < InterfaceThread
38
- def initialize(interface)
39
- super(interface)
40
- @index = 0
41
- end
42
-
43
- protected
44
- def handle_packet(packet)
45
- Logger.info "Received command: #{packet.buffer}"
46
- if packet.buffer.include?('?')
47
- @interface.write_raw(@index.to_s + "\x0A")
48
- end
49
- @index += 1
50
- end
51
- end
52
-
53
- def initialize
54
- # Create interface to receive commands and send telemetry
55
- @target_interface = ScpiServerInterface.new
56
- @interface_thread = nil
57
- end
58
-
59
- def start
60
- @interface_thread = ScpiInterfaceThread.new(@target_interface)
61
- @interface_thread.start
62
- end
63
-
64
- def stop
65
- @interface_thread.stop if @interface_thread
66
- end
67
-
68
- def self.run
69
- Logger.level = Logger::INFO
70
- target = self.new
71
- begin
72
- target.start
73
- loop { sleep 1 }
74
- rescue SystemExit, Interrupt
75
- target.stop
76
- end
77
- end
78
- end
79
- end