Skip to content

Commit

Permalink
reducing cosmos setup commands to redo script
Browse files Browse the repository at this point in the history
  • Loading branch information
Jbsco committed Feb 3, 2024
1 parent d6f478b commit 3c604d9
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 9 deletions.
12 changes: 12 additions & 0 deletions gnd/cosmos/build_cosmos_plugin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

#
# Configure cosmos plugin
#

assembly_dir=$1
# Build all cosmos plugin command and telemetry files:
cd $assembly_dir
plugin=`redo what 2>&1 | grep "cosmos/plugin" | awk '{ print $2 }'`
echo $plugin | xargs redo-ifchange
cd - >/dev/null
25 changes: 16 additions & 9 deletions src/assembly/linux/main/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ To best interact with the Linux assembly, we need to use a ground system interfa
Cosmos we need to build the Cosmos plugin configuration files. This will allow Cosmos to decode telemetry from the Linux assembly and properly format
outgoing commands.

From the `adamant_example/src/assembly/linux` directory in your Adamant environment run:
These files are autocoded by Adamant. From the `adamant_example/src/assembly/linux/main` directory in your Adamant environment run:

```
$ redo build/plugin/Config/linux_example_ccsds_commands.txt
$ redo build/plugin/Config/linux_example_ccsds_telemetry.txt
$ redo build/plugin/Config/linux_example_ccsds_plugin.txt
$ redo cosmos_config
```

This generates the plugin configuration file and its respective command and telemetry configurations in the `adamant_example/src/assembly/linux/build/cosmos/plugin/` directory.

To install OpenC3 Cosmos, navigate to an appropriate directory on your host machine and clone the Cosmos example project repository:

```
Expand Down Expand Up @@ -77,7 +77,7 @@ cosmos-project/openc3-cosmos-linux-example/targets/LINUX_EXAMPLE/cmd_tlm/tlm.txt
Replace the contents of these text files with the contents of the corresponding files generated by Redo, located in the Adamant example project directory at:

```
adamant_example/src/assembly/linux/build/plugin/Config
adamant_example/src/assembly/linux/build/cosmos/plugin
```

The Cosmos plugin uses a default CRC protocol provided by Cosmos, but also needs a custom protocol to apply Adamant's command packet checksum correctly. The protocol file is located in the Adamant directory at:
Expand All @@ -95,9 +95,9 @@ cosmos-project/openc3-cosmos-linux-example/targets/LINUX_EXAMPLE/lib/cmd_checksu
If the Cosmos and Admant example project directories are adjacent, complete the configuration by running:

```
$ cp adamant_example/src/assembly/linux/build/plugin/Config/linux_example_ccsds_commands.txt cosmos-project/openc3-cosmos-linux-example/targets/LINUX_EXAMPLE/cmd_tlm/cmd.txt
$ cp adamant_example/src/assembly/linux/build/plugin/Config/linux_example_ccsds_telemetry.txt cosmos-project/openc3-cosmos-linux-example/targets/LINUX_EXAMPLE/cmd_tlm/tlm.txt
$ cp adamant_example/src/assembly/linux/build/plugin/Config/linux_example_ccsds_plugin.txt cosmos-project/openc3-cosmos-linux-example/plugin.txt
$ cp adamant_example/src/assembly/linux/build/cosmos/plugin/linux_example_ccsds_cosmos_commands.txt cosmos-project/openc3-cosmos-linux-example/targets/LINUX_EXAMPLE/cmd_tlm/cmd.txt
$ cp adamant_example/src/assembly/linux/build/cosmos/plugin/linux_example_ccsds_cosmos_telemetry.txt cosmos-project/openc3-cosmos-linux-example/targets/LINUX_EXAMPLE/cmd_tlm/tlm.txt
$ cp adamant_example/src/assembly/linux/build/cosmos/plugin/linux_example_ccsds_cosmos_plugin.txt cosmos-project/openc3-cosmos-linux-example/plugin.txt
$ cp adamant/gnd/cosmos/cmd_checksum.rb cosmos-project/openc3-cosmos-linux-example/targets/LINUX_EXAMPLE/lib/cmd_checksum.rb
```

Expand All @@ -107,9 +107,16 @@ The plugin can now be compiled. Navigate to the plugin directory at `openc3-cosm
$ ./../openc3.sh cli rake build VERSION=1.0.0
```

The Cosmos Docker container must be configured to use the same ports as Adamant. Edit this configuration at `cosmos-project/compose.yaml` and add the following entry to the `openc3-operator:` section:

```
ports:
- "2003:2003/tcp"
```

With the Linux assembly running, start Cosmos by navigating to the `cosmos-project` directory and running `./openc3.sh start`. After the containers start, open a web browser and navigate to `http://localhost:2900`. You will be prompted to configure a password, and then presented with the Cosmos interface. Some modules may still be loading, but after a minute the interface should be complete. Navigate to `ADMIN CONSOLE` and uninstall the "openc3-cosmos-demo" plugin by selecting the `Delete Plugin` icon.

Select `Click to select plugin .gem file to install` and navigate to the compiled plugin gem file at `cosmos-project/openc3-cosmos-linux-example/openc3-cosmos-linux-example-1.0.0.gem` to install our generated plugin.
Select `Click to select plugin .gem file to install` and navigate to the compiled plugin gem file at `cosmos-project/openc3-cosmos-linux-example/openc3-cosmos-linux-example-1.0.0.gem` to install our generated plugin. The plugin is templated to allow changing of parameters such as ports, but the default values are already set to correspond with this project.

The plugin will be installed and you should see events being received every two seconds from the Linux assembly over the socket in the `CmdTLMServer` panel.

Expand Down
6 changes: 6 additions & 0 deletions src/assembly/linux/main/cosmos_config.do
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Create Cosmos plugin configuration files:
export TARGET=
this_dir=`dirname "$0"`
cosmos_dir=`realpath $this_dir/../../../../gnd/cosmos`
assembly_dir=`realpath $this_dir/..`
$cosmos_dir/build_cosmos_plugin.sh $assembly_dir >/dev/null

0 comments on commit 3c604d9

Please sign in to comment.