Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nos3#264] GSW Switch #268

Merged
merged 4 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fsw:
./scripts/docker_build_fsw.sh

gsw:
./scripts/create_cosmos_gem.sh
./cfg/build/gsw_build.sh

launch:
./scripts/docker_launch.sh
Expand Down
1 change: 1 addition & 0 deletions cfg/nos3-mission.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<nos3-mission-cfg>
<start-time>814048200.0</start-time>
<gsw>cosmos</gsw>
<number-spacecraft>1</number-spacecraft>
<sc-1-cfg>sc-full-config.xml</sc-1-cfg>
<!--
Expand Down
2 changes: 1 addition & 1 deletion components/generic_eps
2 changes: 1 addition & 1 deletion gsw/cosmos
Submodule cosmos updated 30 files
+0 −113 config/system/nos3_system.txt
+52 −2 config/system/system.txt
+1 −1 config/targets/CFDP/lib/cfdp_engine_task.rb
+1 −1 config/targets/CFDP/lib/interfaces/cfdp_protocol.rb
+2 −2 config/targets/CFDP/lib/interfaces/cosmos_cfdp_interface.rb
+1 −1 config/targets/CFDP/lib/interfaces/visiona_cfdp_interface.rb
+2 −2 config/targets/CFDP_TEST/lib/interfaces/cfdp_test_protocol.rb
+2 −2 config/targets/CFS/lib/bit_field_conversion.rb
+1 −1 config/targets/CFS/lib/cosmos_cfs_config.rb
+1 −1 config/targets/CFS/lib/evs_terminal.rb
+2 −2 config/targets/SIM_42_TRUTH/lib/beta_angle.rb
+2 −2 config/targets/SIM_42_TRUTH/lib/geocentric_latitude.rb
+2 −2 config/targets/SIM_42_TRUTH/lib/in_sun.rb
+2 −2 config/targets/SIM_42_TRUTH/lib/nadir_in_body.rb
+2 −2 config/targets/SIM_42_TRUTH/lib/orbit_normal.rb
+2 −2 config/targets/SIM_42_TRUTH/lib/ram_in_body.rb
+2 −2 config/targets/SIM_42_TRUTH/lib/svn.rb
+1 −1 config/targets/SIM_42_TRUTH/lib/utilities.rb
+2 −2 config/targets/SIM_42_TRUTH/lib/vector_magnitude.rb
+2 −2 config/targets/SIM_42_TRUTH/lib/x_ram_angle.rb
+2 −2 config/targets/SIM_42_TRUTH/lib/xz_ram_angle.rb
+2 −2 config/targets/SIM_42_TRUTH/lib/z_nadir_angle.rb
+3 −0 config/tools/cmd_tlm_server/cmd_tlm_server.txt
+4 −4 config/tools/data_viewer/data_viewer.txt
+0 −7 config/tools/data_viewer/nos3_data_viewer.txt
+12 −9 config/tools/launcher/launcher.txt
+0 −46 config/tools/launcher/nos3_launcher.txt
+0 −10 config/tools/test_runner/nos3_test_runner.txt
+2 −0 config/tools/test_runner/test_runner.txt
+2 −2 lib/ds_ccsds_log_reader.rb
23 changes: 22 additions & 1 deletion scripts/configure.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#
# Convenience script for NOS3 development
# Configures NOS3 flight software (FSW) based on mission XML files
# Configures NOS3 based on mission and spacecraft XML files
# Script assumes run from top level directory of NOS3 repo
#

import datetime
import os
import xml.etree.ElementTree as ET

# Parse mission configuration
Expand All @@ -15,6 +16,26 @@
mission_start_time_utc = datetime.datetime(2000, 1, 1, 12, 0) + datetime.timedelta(seconds=float(mission_start_time))
print(' start-time-utc:', mission_start_time_utc)

# GSW
gsw_str = 'gsw'
gsw_cfg = mission_root.find(gsw_str).text
print(' ', gsw_str, ':', gsw_cfg)
gsw_identified = 0
if (gsw_cfg == 'openc3'):
# Copy openc3 scripts into ./cfg/build
gsw_identified = 1
os.system('cp ./scripts/gsw_openc3_build.sh ./cfg/build/gsw_build.sh')
os.system('cp ./scripts/gsw_openc3_launch.sh ./cfg/build/gsw_launch.sh')
if (gsw_cfg == 'cosmos'):
# Copy cosmos scripts into ./cfg/build
gsw_identified = 1
os.system('cp ./scripts/gsw_cosmos_build.sh ./cfg/build/gsw_build.sh')
os.system('cp ./scripts/gsw_cosmos_launch.sh ./cfg/build/gsw_launch.sh')
if (gsw_identified == 0):
print('Invalid GSW in configuration file!')
print('Exiting due to error...')

# Read number of spacecraft
mission_number_spacecraft = mission_root.find('number-spacecraft').text
print(' number-spacecraft:', mission_number_spacecraft)
num_sc = int(mission_number_spacecraft)
Expand Down
18 changes: 4 additions & 14 deletions scripts/docker_launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ mkdir /tmp/uplink 2> /dev/null
cp $BASE_DIR/fsw/build/exe/cpu1/cf/cfe_es_startup.scr /tmp/uplink/tmp0.so 2> /dev/null
cp $BASE_DIR/fsw/build/exe/cpu1/cf/sample.so /tmp/uplink/tmp1.so 2> /dev/null


echo "Create ground networks..."
$DNETWORK create \
--driver=bridge \
Expand All @@ -50,18 +49,19 @@ $DNETWORK create \
nos3_core
echo ""

#echo "Launch GSW..."
$BASE_DIR/cfg/build/gsw_launch.sh
echo ""

echo "Create NOS interfaces..."
export GND_CFG_FILE="-f nos3-simulator.xml"
gnome-terminal --tab --title="NOS Terminal" -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name "nos_terminal" --network=nos3_core -w $SIM_BIN $DBOX ./nos3-single-simulator $GND_CFG_FILE stdio-terminal
gnome-terminal --tab --title="NOS UDP Terminal" -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name "nos_udp_terminal" --network=nos3_core -w $SIM_BIN $DBOX ./nos3-single-simulator $GND_CFG_FILE udp-terminal
echo ""


# Note only currently working with a single spacecraft
export SATNUM=1


#
# Spacecraft Loop
#
Expand All @@ -81,7 +81,7 @@ do
echo ""

echo $SC_NUM " - Connect COSMOS to spacecraft network..."
$DNETWORK connect $SC_NETNAME cosmos_openc3-operator_1 --alias cosmos 2> /dev/null
$DNETWORK connect $SC_NETNAME cosmos_openc3-operator_1 --alias cosmos
echo ""

echo $SC_NUM " - 42..."
Expand Down Expand Up @@ -131,7 +131,6 @@ do
echo ""
done


echo "NOS Time Driver..."
sleep 8
gnome-terminal --tab --title="NOS Time Driver" -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name nos_time_driver --network=nos3_core -w $SIM_BIN $DBOX ./nos3-single-simulator $GND_CFG_FILE time
Expand All @@ -145,13 +144,4 @@ do
done
echo ""


echo "COSMOS Ground Station..."
pidof firefox > /dev/null
if [ $? -eq 1 ]
then
firefox localhost:2900 &
fi
echo ""

echo "Docker launch script completed!"
1 change: 1 addition & 0 deletions scripts/docker_stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ rm -rf $BASE_DIR/fsw/build/exe/cpu1/scratch/*
cd $SCRIPT_DIR; $DFLAG compose down > /dev/null 2>&1
$DCALL ps --filter=name="sc_*" -aq | xargs $DCALL stop > /dev/null 2>&1 &
$DCALL ps --filter=name="nos_*" -aq | xargs $DCALL stop > /dev/null 2>&1 &
$DCALL ps --filter ancestor="ballaerospace/cosmos:4.5.0" -aq | xargs $DCALL stop > /dev/null 2>&1 &

# Intentionally wait to complete
wait
Expand Down
24 changes: 0 additions & 24 deletions scripts/gsw.sh

This file was deleted.

20 changes: 20 additions & 0 deletions scripts/gsw_cosmos_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash -i
#
# Convenience script for NOS3 development
#

CFG_BUILD_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
SCRIPT_DIR=$CFG_BUILD_DIR/../../scripts
source $SCRIPT_DIR/env.sh

# Debugging
#echo "Script directory = " $SCRIPT_DIR
#echo "Base directory = " $BASE_DIR
#exit

#echo "Make /tmp folders..."
#mkdir /tmp/data 2> /dev/null
#mkdir /tmp/data/hk 2> /dev/null
#mkdir /tmp/uplink 2> /dev/null

echo "COSMOS build..."
21 changes: 21 additions & 0 deletions scripts/gsw_cosmos_launch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash -i
#
# Convenience script for NOS3 development
#

CFG_BUILD_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
SCRIPT_DIR=$CFG_BUILD_DIR/../../scripts
source $SCRIPT_DIR/env.sh

# Debugging
#echo "Script directory = " $SCRIPT_DIR
#echo "Base directory = " $BASE_DIR
#exit

#echo "Make /tmp folders..."
#mkdir /tmp/data 2> /dev/null
#mkdir /tmp/data/hk 2> /dev/null
#mkdir /tmp/uplink 2> /dev/null

echo "COSMOS launch..."
gnome-terminal --tab --title="Cosmos" -- $DFLAGS -v $BASE_DIR:$BASE_DIR -v /tmp/.X11-unix:/tmp/.X11-unix:ro -e DISPLAY=$DISPLAY -e QT_X11_NO_MITSHM=1 -w $GSW_DIR --name cosmos_openc3-operator_1 --network=nos3_core ballaerospace/cosmos:4.5.0
20 changes: 17 additions & 3 deletions scripts/create_cosmos_gem.sh → scripts/gsw_openc3_build.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# Convenience script for NOS3 development
#

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
CFG_BUILD_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
SCRIPT_DIR=$CFG_BUILD_DIR/../../scripts
source $SCRIPT_DIR/env.sh

# Check that local NOS3 directory exists
Expand All @@ -14,6 +15,17 @@ if [ ! -d $USER_NOS3_DIR ]; then
exit 1
fi

echo "Prepare openc3-cosmos containers..."
cd $OPENC3_DIR
$OPENC3_PATH run
echo ""

#echo "Set a password in openc3-cosmos via firefox..."
#echo " Refresh webpage if error page shown."
#echo ""
#sleep 5
#firefox localhost:2900 &

# Start by changing to a known location
cd $OPENC3_DIR

Expand Down Expand Up @@ -146,6 +158,8 @@ echo ""
## Set permissions on build files
#chmod -R 777 $BASE_DIR/gsw/cosmos/build

echo "Create COSMOS gem script complete."
echo "Note that while this script is complete, COSMOS is likely still be processing behind the scenes!"
echo "OpenC3 build script complete."
echo "Note that while this script is complete, OpenC3 is likely still be processing behind the scenes!"
sleep 15
echo "Done sleeping, but check cpu use prior to proceeding!"
echo ""
25 changes: 25 additions & 0 deletions scripts/gsw_openc3_launch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash -i
#
# Convenience script for NOS3 development
#

CFG_BUILD_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
SCRIPT_DIR=$CFG_BUILD_DIR/../../scripts
source $SCRIPT_DIR/env.sh

# Debugging
#echo "Script directory = " $SCRIPT_DIR
#echo "Base directory = " $BASE_DIR
#exit

#echo "Make /tmp folders..."
#mkdir /tmp/data 2> /dev/null
#mkdir /tmp/data/hk 2> /dev/null
#mkdir /tmp/uplink 2> /dev/null

echo "OpenC3 launch..."
pidof firefox > /dev/null
if [ $? -eq 1 ]
then
firefox localhost:2900 &
fi
13 changes: 4 additions & 9 deletions scripts/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source $SCRIPT_DIR/env.sh
echo ""
echo ""

echo "Create local user directory..."
mkdir $USER_NOS3_DIR 2> /dev/null
Expand All @@ -20,9 +22,8 @@ git reset --hard
echo ""
echo ""

echo "Prepare openc3-cosmos containers..."
cd $OPENC3_DIR
$OPENC3_PATH run
echo "Prepare cosmos docker container..."
$DCALL image pull ballaerospace/cosmos:4.5.0
echo ""
echo ""

Expand All @@ -38,9 +39,3 @@ cd $USER_NOS3_DIR/42
$DFLAGS_CPUS -v $BASE_DIR:$BASE_DIR -v $USER_NOS3_DIR:$USER_NOS3_DIR -w $USER_NOS3_DIR/42 --name "nos3_42_build" $DBOX make
echo ""
echo ""

echo "Set a password in openc3-cosmos via firefox..."
echo " Refresh webpage if error page shown."
echo ""
sleep 5
firefox localhost:2900 &
3 changes: 3 additions & 0 deletions scripts/real_clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@ yes | rm $BASE_DIR/minicom.cap 2> /dev/null

$DCALL system prune -f

echo "Cleaning up local user directory..."
yes | rm -r $USER_NOS3_DIR 2> /dev/null

exit 0
7 changes: 6 additions & 1 deletion scripts/stop_gsw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source $SCRIPT_DIR/env.sh

echo "Stop openc3-cosmos..."
echo "Stop gsw..."

# OpenC3
cd $OPENC3_DIR
$OPENC3_PATH stop

# COSMOS
$DCALL ps --filter ancestor="ballaerospace/cosmos:4.5.0" -aq | xargs $DCALL stop > /dev/null 2>&1 &