openc3-demo 5.0.6
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
## OpenC3 Demo Plugin
|
2
|
+
|
3
|
+
[Documentation](https://openc3.com)
|
4
|
+
|
5
|
+
This plugin provides a simple demo configuration for OpenC3 that shows off a lot of the features of OpenC3 and provides a test environment.
|
6
|
+
|
7
|
+
## Getting Started
|
8
|
+
|
9
|
+
1. At the OpenC3 Admin - Plugins, upload the openc3-demo.gem file
|
10
|
+
|
11
|
+
2. To build widgets run: yarn && yarn build
|
12
|
+
|
13
|
+
## Contributing
|
14
|
+
|
15
|
+
We encourage you to contribute to OpenC3!
|
16
|
+
|
17
|
+
Contributing is easy.
|
18
|
+
|
19
|
+
1. Fork the project
|
20
|
+
2. Create a feature branch
|
21
|
+
3. Make your changes
|
22
|
+
4. Submit a pull request
|
23
|
+
|
24
|
+
Before any contributions can be incorporated we do require all contributors to agree to a Contributor License Agreement.
|
25
|
+
|
26
|
+
This protects both you and us and you retain full rights to any code you write.
|
27
|
+
|
28
|
+
## License
|
29
|
+
|
30
|
+
This OpenC3 plugin is released under the AGPLv3.0 with a few addendums. See [LICENSE.txt](LICENSE.txt)
|
data/Rakefile
ADDED
@@ -0,0 +1,42 @@
|
|
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
|
+
PLUGIN_NAME = Dir['*.gemspec'][0].split('.')[0..-2].join('.')
|
21
|
+
|
22
|
+
task :require_version do
|
23
|
+
if ENV['VERSION']
|
24
|
+
if ENV['VERSION'] =~ /-/
|
25
|
+
# Add Timestamp to prerelease versions
|
26
|
+
ENV['VERSION'] = ENV['VERSION'] + "." + Time.now.utc.strftime("%Y%m%d%H%M%S")
|
27
|
+
end
|
28
|
+
else
|
29
|
+
puts "VERSION is required: rake <task> VERSION=X.X.X"
|
30
|
+
exit 1
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
task :build => [:require_version] do
|
35
|
+
_, platform, *_ = RUBY_PLATFORM.split("-")
|
36
|
+
if platform == 'mswin32' or platform == 'mingw32'
|
37
|
+
puts "Warning: Building gem on Windows will lose file permissions"
|
38
|
+
end
|
39
|
+
# Build the widgets in the src directory
|
40
|
+
system("yarn run build")
|
41
|
+
system("gem build #{PLUGIN_NAME}")
|
42
|
+
end
|
@@ -0,0 +1,123 @@
|
|
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
|
+
def initialize(port)
|
28
|
+
super(port.to_i, port.to_i, 5.0, nil, 'LENGTH', 0, 32, 4, 1, 'BIG_ENDIAN', 4, nil, nil, true)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class ExampleInterfaceThread < InterfaceThread
|
33
|
+
attr_accessor :target_name
|
34
|
+
|
35
|
+
protected
|
36
|
+
def handle_packet(packet)
|
37
|
+
identified_packet = System.commands.identify(packet.buffer, [@target_name])
|
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, target_name)
|
50
|
+
@interface = interface
|
51
|
+
@target_name = target_name
|
52
|
+
@sleeper = Sleeper.new
|
53
|
+
end
|
54
|
+
|
55
|
+
def start
|
56
|
+
packet = System.telemetry.packet(@target_name, 'STATUS')
|
57
|
+
@thread = Thread.new do
|
58
|
+
@stop_thread = false
|
59
|
+
@sleeper.sleep(5)
|
60
|
+
begin
|
61
|
+
loop do
|
62
|
+
packet.write('PACKET_ID', 1)
|
63
|
+
packet.write('STRING', "The time is now: #{Time.now.sys.formatted}")
|
64
|
+
@interface.write(packet)
|
65
|
+
break if @sleeper.sleep(1)
|
66
|
+
end
|
67
|
+
rescue Exception => err
|
68
|
+
Logger.error "ExampleTelemetryThread unexpectedly died\n#{err.formatted}"
|
69
|
+
raise err
|
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(target_name, port)
|
84
|
+
# Create interface to receive commands and send telemetry
|
85
|
+
@target_name = target_name
|
86
|
+
@interface = ExampleServerInterface.new(port)
|
87
|
+
@interface_thread = nil
|
88
|
+
@telemetry_thread = nil
|
89
|
+
end
|
90
|
+
|
91
|
+
def start
|
92
|
+
@interface_thread = ExampleInterfaceThread.new(@interface)
|
93
|
+
@interface_thread.target_name = @target_name
|
94
|
+
@interface_thread.start
|
95
|
+
@telemetry_thread = ExampleTelemetryThread.new(@interface, @target_name)
|
96
|
+
@telemetry_thread.start
|
97
|
+
end
|
98
|
+
|
99
|
+
def stop
|
100
|
+
@telemetry_thread.stop if @telemetry_thread
|
101
|
+
@interface_thread.stop if @interface_thread
|
102
|
+
end
|
103
|
+
|
104
|
+
def self.run(target_name, port)
|
105
|
+
Logger.level = Logger::INFO
|
106
|
+
Thread.abort_on_exception = true
|
107
|
+
temp_dir = Dir.mktmpdir
|
108
|
+
System.setup_targets([target_name], temp_dir, scope: ENV['OPENC3_SCOPE'])
|
109
|
+
target = self.new(target_name, port)
|
110
|
+
begin
|
111
|
+
target.start
|
112
|
+
while true
|
113
|
+
sleep 1
|
114
|
+
end
|
115
|
+
rescue SystemExit, Interrupt
|
116
|
+
target.stop
|
117
|
+
FileUtils.remove_entry(temp_dir) if File.exist?(temp_dir)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
OpenC3::ExampleTarget.run(ARGV[0], ARGV[1]) if __FILE__ == $0
|
@@ -0,0 +1,79 @@
|
|
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
|
+
def initialize(port)
|
28
|
+
super(port.to_i, port.to_i, 5.0, nil, 'TERMINATED', '0xA', '0xA')
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class ScpiInterfaceThread < InterfaceThread
|
33
|
+
def initialize(interface)
|
34
|
+
super(interface)
|
35
|
+
@index = 0
|
36
|
+
end
|
37
|
+
|
38
|
+
protected
|
39
|
+
def handle_packet(packet)
|
40
|
+
Logger.info "Received command: #{packet.buffer}"
|
41
|
+
if packet.buffer.include?('?')
|
42
|
+
@interface.write_raw(@index.to_s + "\x0A")
|
43
|
+
end
|
44
|
+
@index += 1
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def initialize(port)
|
49
|
+
# Create interface to receive commands and send telemetry
|
50
|
+
@target_interface = ScpiServerInterface.new(port)
|
51
|
+
@interface_thread = nil
|
52
|
+
end
|
53
|
+
|
54
|
+
def start
|
55
|
+
@interface_thread = ScpiInterfaceThread.new(@target_interface)
|
56
|
+
@interface_thread.start
|
57
|
+
end
|
58
|
+
|
59
|
+
def stop
|
60
|
+
@interface_thread.stop if @interface_thread
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.run(target_name, port)
|
64
|
+
Logger.level = Logger::INFO
|
65
|
+
temp_dir = Dir.mktmpdir
|
66
|
+
System.setup_targets([target_name], temp_dir, scope: ENV['OPENC3_SCOPE'])
|
67
|
+
target = self.new(port)
|
68
|
+
begin
|
69
|
+
target.start
|
70
|
+
loop { sleep 1 }
|
71
|
+
rescue SystemExit, Interrupt
|
72
|
+
target.stop
|
73
|
+
FileUtils.remove_entry(temp_dir) if File.exist?(temp_dir)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
OpenC3::ScpiTarget.run(ARGV[0], ARGV[1]) if __FILE__ == $0
|
data/plugin.txt
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
# Note: This plugin includes 4 targets in one plugin to make it easy to install
|
2
|
+
# the OpenC3 demo with one plugin. Generally it is better to only have one
|
3
|
+
# target per plugin
|
4
|
+
|
5
|
+
VARIABLE inst_target_name INST
|
6
|
+
VARIABLE inst2_target_name INST2
|
7
|
+
VARIABLE example_target_name EXAMPLE
|
8
|
+
VARIABLE templated_target_name TEMPLATED
|
9
|
+
VARIABLE system_target_name SYSTEM
|
10
|
+
VARIABLE inst_int_name INST_INT
|
11
|
+
VARIABLE inst_router_name INST_ROUTER
|
12
|
+
VARIABLE inst2_int_name INST2_INT
|
13
|
+
VARIABLE example_int_name EXAMPLE_INT
|
14
|
+
VARIABLE templated_int_name TEMPLATED_INT
|
15
|
+
VARIABLE demo_tool_name Demo
|
16
|
+
VARIABLE example_microservice_name openc3-example
|
17
|
+
VARIABLE templated_microservice_name openc3-templated
|
18
|
+
VARIABLE example_port 9999
|
19
|
+
VARIABLE templated_port 5025
|
20
|
+
VARIABLE log_retain_time 172800
|
21
|
+
VARIABLE reduced_log_retain_time 2592000
|
22
|
+
|
23
|
+
<% include_inst = (inst_target_name.strip.length > 0) %>
|
24
|
+
<% include_inst2 = (inst2_target_name.strip.length > 0) %>
|
25
|
+
<% include_example = (example_target_name.strip.length > 0) %>
|
26
|
+
<% include_templated = (templated_target_name.strip.length > 0) %>
|
27
|
+
<% include_system = (system_target_name.strip.length > 0) %>
|
28
|
+
<% include_inst_int = (inst_int_name.strip.length > 0) %>
|
29
|
+
<% include_inst_router = (inst_router_name.strip.length > 0) %>
|
30
|
+
<% include_inst2_int = (inst2_int_name.strip.length > 0) %>
|
31
|
+
<% include_example_int = (example_int_name.strip.length > 0) %>
|
32
|
+
<% include_templated_int = (templated_int_name.strip.length > 0) %>
|
33
|
+
<% include_example_microservice = (example_microservice_name.strip.length > 0) %>
|
34
|
+
<% include_templated_microservice = (templated_microservice_name.strip.length > 0) %>
|
35
|
+
|
36
|
+
<% if include_inst %>
|
37
|
+
TARGET INST <%= inst_target_name %>
|
38
|
+
LOG_RETAIN_TIME <%= log_retain_time %>
|
39
|
+
REDUCED_LOG_RETAIN_TIME <%= reduced_log_retain_time %>
|
40
|
+
TLM_LOG_CYCLE_TIME 300
|
41
|
+
<% end %>
|
42
|
+
|
43
|
+
<% if include_inst2 %>
|
44
|
+
TARGET INST <%= inst2_target_name %>
|
45
|
+
LOG_RETAIN_TIME <%= log_retain_time %>
|
46
|
+
REDUCED_LOG_RETAIN_TIME <%= reduced_log_retain_time %>
|
47
|
+
TLM_LOG_CYCLE_TIME 600
|
48
|
+
<% end %>
|
49
|
+
|
50
|
+
<% if include_example %>
|
51
|
+
TARGET EXAMPLE <%= example_target_name %>
|
52
|
+
LOG_RETAIN_TIME <%= log_retain_time %>
|
53
|
+
REDUCED_LOG_RETAIN_TIME <%= reduced_log_retain_time %>
|
54
|
+
<% end %>
|
55
|
+
|
56
|
+
<% if include_templated %>
|
57
|
+
TARGET TEMPLATED <%= templated_target_name %>
|
58
|
+
LOG_RETAIN_TIME <%= log_retain_time %>
|
59
|
+
REDUCED_LOG_RETAIN_TIME <%= reduced_log_retain_time %>
|
60
|
+
<% end %>
|
61
|
+
|
62
|
+
<% if include_system %>
|
63
|
+
TARGET SYSTEM <%= system_target_name %>
|
64
|
+
LOG_RETAIN_TIME <%= log_retain_time %>
|
65
|
+
REDUCED_LOG_RETAIN_TIME <%= reduced_log_retain_time %>
|
66
|
+
<% end %>
|
67
|
+
|
68
|
+
<% if include_inst and include_inst_int %>
|
69
|
+
INTERFACE <%= inst_int_name %> simulated_target_interface.rb sim_inst.rb
|
70
|
+
MAP_TARGET <%= inst_target_name %>
|
71
|
+
PROTOCOL READ OverrideProtocol
|
72
|
+
<% end %>
|
73
|
+
|
74
|
+
<% if include_inst2 and include_inst2_int %>
|
75
|
+
INTERFACE <%= inst2_int_name %> simulated_target_interface.rb sim_inst.rb
|
76
|
+
MAP_TARGET <%= inst2_target_name %>
|
77
|
+
DONT_LOG
|
78
|
+
PROTOCOL READ_WRITE OverrideProtocol
|
79
|
+
<% end %>
|
80
|
+
|
81
|
+
<% if include_example and include_example_int %>
|
82
|
+
INTERFACE <%= example_int_name %> example_interface.rb openc3-operator <%= example_port %>
|
83
|
+
MAP_TARGET <%= example_target_name %>
|
84
|
+
DONT_CONNECT
|
85
|
+
LOG_RAW
|
86
|
+
<% end %>
|
87
|
+
|
88
|
+
<% if include_templated and include_templated_int %>
|
89
|
+
INTERFACE <%= templated_int_name %> templated_interface.rb openc3-operator <%= templated_port %> <%= templated_port %> 5.0 nil TEMPLATE 0xA 0xA
|
90
|
+
MAP_TARGET <%= templated_target_name %>
|
91
|
+
DONT_CONNECT
|
92
|
+
<% end %>
|
93
|
+
|
94
|
+
<% if include_inst and include_inst_router %>
|
95
|
+
ROUTER <%= inst_router_name %> tcpip_server_interface.rb 7779 7779 nil 10.0 PREIDENTIFIED
|
96
|
+
MAP_TARGET <%= inst_target_name %>
|
97
|
+
<% end %>
|
98
|
+
|
99
|
+
<% if include_example_microservice %>
|
100
|
+
MICROSERVICE EXAMPLE <%= example_microservice_name %>
|
101
|
+
WORK_DIR .
|
102
|
+
CMD ruby example_target.rb <%= example_target_name %> <%= example_port %>
|
103
|
+
<% end %>
|
104
|
+
|
105
|
+
<% if include_templated_microservice %>
|
106
|
+
MICROSERVICE TEMPLATED <%= templated_microservice_name %>
|
107
|
+
WORK_DIR .
|
108
|
+
CMD ruby scpi_target.rb <%= templated_target_name %> <%= templated_port %>
|
109
|
+
<% end %>
|
110
|
+
|
111
|
+
WIDGET BIG
|
112
|
+
WIDGET HELLOWORLD
|
@@ -0,0 +1,27 @@
|
|
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/tcpip_client_interface'
|
22
|
+
|
23
|
+
class ExampleInterface < OpenC3::TcpipClientInterface
|
24
|
+
def initialize (hostname, port, write_timeout = 10.0, read_timeout = nil)
|
25
|
+
super(hostname, port, port, write_timeout, read_timeout, 'LENGTH', 0, 32, 4, 1, 'BIG_ENDIAN', 4, nil, nil, true)
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
PARAMETER CCSDSVER 0 3 UINT 0 0 0 "CCSDS primary header version number"
|
2
|
+
PARAMETER CCSDSTYPE 3 1 UINT 1 1 1 "CCSDS primary header packet type"
|
3
|
+
PARAMETER CCSDSSHF 4 1 UINT 0 0 0 "CCSDS primary header secondary header flag"
|
4
|
+
ID_PARAMETER CCSDSAPID 5 11 UINT 0 2047 999 "CCSDS primary header application id"
|
5
|
+
PARAMETER CCSDSSEQFLAGS 16 2 UINT 3 3 3 "CCSDS primary header sequence flags"
|
6
|
+
PARAMETER CCSDSSEQCNT 18 14 UINT 0 16383 0 "CCSDS primary header sequence count"
|
7
|
+
OVERFLOW TRUNCATE
|
8
|
+
PARAMETER CCSDSLENGTH 32 16 UINT MIN MAX 12 "CCSDS primary header packet length"
|
9
|
+
ID_PARAMETER PKTID 48 16 UINT MIN MAX <%= id %> "Packet id"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
APPEND_ITEM CCSDSVER 3 UINT "CCSDS packet version number (See CCSDS 133.0-B-1)"
|
2
|
+
APPEND_ITEM CCSDSTYPE 1 UINT "CCSDS packet type (command or telemetry)"
|
3
|
+
STATE TLM 0
|
4
|
+
STATE CMD 1
|
5
|
+
APPEND_ITEM CCSDSSHF 1 UINT "CCSDS secondary header flag"
|
6
|
+
STATE FALSE 0
|
7
|
+
STATE TRUE 1
|
8
|
+
APPEND_ID_ITEM CCSDSAPID 11 UINT <%= apid %> "CCSDS application process id"
|
9
|
+
APPEND_ITEM CCSDSSEQFLAGS 2 UINT "CCSDS sequence flags"
|
10
|
+
STATE FIRST 1
|
11
|
+
STATE CONT 0
|
12
|
+
STATE LAST 2
|
13
|
+
STATE NOGROUP 3
|
14
|
+
APPEND_ITEM CCSDSSEQCNT 14 UINT "CCSDS packet sequence count"
|
15
|
+
OVERFLOW TRUNCATE
|
16
|
+
APPEND_ITEM CCSDSLENGTH 16 UINT "CCSDS packet data length"
|
17
|
+
APPEND_ITEM TIMESEC 32 UINT "Seconds since epoch (January 1st, 1970, midnight)"
|
18
|
+
APPEND_ITEM TIMEUS 32 UINT "Microseconds of second"
|
19
|
+
APPEND_ID_ITEM PKTID 16 UINT 1 "Packet id (The combination of CCSDS_APID and PACKET_ID identify the packet)"
|
@@ -0,0 +1,57 @@
|
|
1
|
+
COMMAND <%= target_name %> COLLECT BIG_ENDIAN "Starts a collect on the <%= target_name %> target"
|
2
|
+
<%= render "_ccsds_cmd.txt", locals: {id: 1} %>
|
3
|
+
PARAMETER TYPE 64 16 UINT MIN MAX 0 "Collect type"
|
4
|
+
REQUIRED
|
5
|
+
STATE NORMAL 0
|
6
|
+
STATE SPECIAL 1 HAZARDOUS
|
7
|
+
PARAMETER DURATION 80 32 FLOAT 0.0 10.0 1.0 "Collect duration"
|
8
|
+
PARAMETER OPCODE 112 8 UINT 0x0 0xFF 0xAB "Collect opcode"
|
9
|
+
FORMAT_STRING "0x%0X"
|
10
|
+
PARAMETER TEMP 120 32 FLOAT 0.0 25.0 0.0 "Collect temperature"
|
11
|
+
UNITS Celsius C
|
12
|
+
|
13
|
+
COMMAND <%= target_name %> ABORT BIG_ENDIAN "Aborts a collect on the <%= target_name %> instrument"
|
14
|
+
<%= render "_ccsds_cmd.txt", locals: {id: 2} %>
|
15
|
+
|
16
|
+
COMMAND <%= target_name %> CLEAR BIG_ENDIAN "Clears counters on the <%= target_name %> instrument"
|
17
|
+
HAZARDOUS "Clearing counters may lose valuable information."
|
18
|
+
<%= render "_ccsds_cmd.txt", locals: {id: 3} %>
|
19
|
+
|
20
|
+
COMMAND <%= target_name %> SETPARAMS BIG_ENDIAN "Sets numbered parameters"
|
21
|
+
<%= render "_ccsds_cmd.txt", locals: {id: 4} %>
|
22
|
+
# ERB syntax:
|
23
|
+
<% (1..5).each do |i| %>
|
24
|
+
APPEND_PARAMETER VALUE<%= i %> 16 UINT 0 5 1 "Value <%= i %> setting"
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
SELECT_PARAMETER VALUE5
|
28
|
+
POLY_WRITE_CONVERSION 0 2
|
29
|
+
|
30
|
+
COMMAND <%= target_name %> ASCIICMD BIG_ENDIAN "Enumerated ASCII command"
|
31
|
+
<%= render "_ccsds_cmd.txt", locals: {id: 5} %>
|
32
|
+
APPEND_PARAMETER STRING 2048 STRING "NOOP" "Enumerated string parameter"
|
33
|
+
STATE "NOOP" "NOOP"
|
34
|
+
STATE "ARM LASER" "ARM LASER" HAZARDOUS "Arming the laser poses an eye safety hazard."
|
35
|
+
STATE "FIRE LASER" "FIRE LASER" HAZARDOUS "WARNING Laser will be fired!"
|
36
|
+
APPEND_PARAMETER BINARY 32 STRING 0xDEADBEEF "Binary string"
|
37
|
+
APPEND_PARAMETER ASCII 80 STRING "0xDEADBEEF" "ASCII string"
|
38
|
+
|
39
|
+
COMMAND <%= target_name %> FLTCMD BIG_ENDIAN "Command with float parameters"
|
40
|
+
<%= render "_ccsds_cmd.txt", locals: {id: 6} %>
|
41
|
+
PARAMETER FLOAT32 64 32 FLOAT MIN MAX 0.0 "Float32 parameter"
|
42
|
+
PARAMETER FLOAT64 96 64 FLOAT MIN MAX 0.0 "Float64 parameter"
|
43
|
+
|
44
|
+
COMMAND <%= target_name %> ARYCMD BIG_ENDIAN "Command with array parameter"
|
45
|
+
<%= render "_ccsds_cmd.txt", locals: {id: 7} %>
|
46
|
+
ARRAY_PARAMETER ARRAY 64 32 UINT -8 "Array parameter"
|
47
|
+
PARAMETER CRC -8 8 UINT MIN MAX 0 "CRC"
|
48
|
+
|
49
|
+
COMMAND <%= target_name %> SLRPNLDEPLOY BIG_ENDIAN "Deploy solar array panels"
|
50
|
+
<%= render "_ccsds_cmd.txt", locals: {id: 8} %>
|
51
|
+
|
52
|
+
COMMAND <%= target_name %> SLRPNLRESET BIG_ENDIAN "Reset solar array panels"
|
53
|
+
<%= render "_ccsds_cmd.txt", locals: {id: 9} %>
|
54
|
+
|
55
|
+
COMMAND <%= target_name %> MEMLOAD BIG_ENDIAN "Load memory"
|
56
|
+
<%= render "_ccsds_cmd.txt", locals: {id: 10} %>
|
57
|
+
APPEND_PARAMETER DATA 80 BLOCK "" "Block of data"
|