Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Commit

Permalink
issue #12 prep smartcam integration
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeslabreche committed Jan 13, 2024
1 parent 4585801 commit 89988c6
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 17 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ demos/doom-earth.wad
lib/
deploy/
backup/
extract/
extract/
smartcam/config.dev.ini
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# opssat-doom
# OPS-SAT DOOM

Experiment with the European Space Agency (ESA) to run Doom in Space onboard the [OPS-SAT satellite](https://www.esa.int/Enabling_Support/Operations/OPS-SAT).
Experiment with the European Space Agency (ESA) to run DOOM in Space onboard the [OPS-SAT satellite](https://www.esa.int/Enabling_Support/Operations/OPS-SAT).

### Events

**2023-12-28 18:16:36 (UTC)**Doom runs on OPS-SAT (initial demo checks).
**2023-12-28 18:16:36 (UTC)**DOOM runs on OPS-SAT (initial demo checks).

<div align="center">
<img src="https://github.com/olafurw/opssat-doom/assets/103783/8b2ece4b-bb92-4694-9655-9debc2569c2e" alt="doom-demo-tests" width="600" />
Expand Down Expand Up @@ -32,13 +32,13 @@ cd opssat-doom/
### How We Got Here
A vision brewing for 13 years:
- **2011**: [Georges](https://georges.fyi) stumbles on what would become [his favorite SMBC comic](https://www.smbc-comics.com/comic/2011-02-17), thank you [Zach](https://mastodon.social/@ZachWeinersmith)!
- **2020**: Georges joins the [OPS-SAT-1](https://www.esa.int/Enabling_Support/Operations/OPS-SAT) mission control team as a Spacecraft Operations Engineer at the European Space Agency (ESA). Visions of running Doom on a space computer intensifies.
- **2023**: The reality of a 2024 end-of-mission by atmospheric re-entry starts to hit hard. The spacecraft's impending doom (see what I did there?) is a wake-up call to get serious about running Doom in space before it's too late.
- **2024**: Georges has been asking around for help with compiling and deploying Doom for the spacecraft's ARM32 onboard computer but isn't making progress. One night, instead of sleeping, he is trapped doomscrolling (ha!) on Instagram and stumbles on a reel from [Ólafur](https://mastodon.social/@olafurw)'s "Doom on GitHub Actions" talk at NDC TechTown 2023: [*Playing Video Games One Frame at a Time*](https://www.youtube.com/watch?v=Z1Nf8KcG4ro). After sliding into the DM, the rest is history.
- **2020**: Georges joins the [OPS-SAT-1](https://www.esa.int/Enabling_Support/Operations/OPS-SAT) mission control team as a Spacecraft Operations Engineer at the European Space Agency (ESA). Visions of running DOOM on a space computer intensifies.
- **2023**: The reality of a 2024 end-of-mission by atmospheric re-entry starts to hit hard. The spacecraft's impending doom (see what I did there?) is a wake-up call to get serious about running DOOM in space before it's too late.
- **2024**: Georges has been asking around for help with compiling and deploying DOOM for the spacecraft's ARM32 onboard computer but isn't making progress. One night, instead of sleeping, he is trapped doomscrolling (ha!) on Instagram and stumbles on a reel from [Ólafur](https://mastodon.social/@olafurw)'s "Doom on GitHub Actions" talk at NDC TechTown 2023: [*Playing Video Games One Frame at a Time*](https://www.youtube.com/watch?v=Z1Nf8KcG4ro). After sliding into the DM, the rest is history.

<br>
<div align="center">
<img src="https://www.smbc-comics.com/comics/20110217.gif" alt="Zach Weinersmith SMBC Doom" width="400" />
<img src="https://www.smbc-comics.com/comics/20110217.gif" alt="Zach Weinersmith SMBC DOOM" width="400" />
</div>

### Source Ports
Expand Down
41 changes: 35 additions & 6 deletions sepp_package/CONTROL/postinst
Original file line number Diff line number Diff line change
@@ -1,10 +1,39 @@
#!/bin/sh

echo "Installing experiment..."
echo "Installing..."
chown -R exp272:exp272 /home/exp272
chmod -R 770 /home/exp272
chmod +x /home/exp272/src/chocolate-doom
ln -s /home/exp272/lib/libSDL-1.2.so.0 /lib/libSDL-1.2.so.0
ln -s /home/exp272/lib/libSDL_mixer-1.2.so.0 /lib/libSDL_mixer-1.2.so.0
ln -s /home/exp272/lib/libSDL_net-1.2.so.0 /lib/libSDL_net-1.2.so.0
echo "Installation completed."
chmod +x /home/exp272/src/opssat-doom
chmod +x /home/exp272/start_exp272.sh
chmod +x /home/exp272/smartcam/start.sh

# Backup the SmartCam config
if [ -e "/home/exp1000/config.ini" ] && [ ! -e "/home/exp1000/config.ini.backup" ]; then
mv /home/exp1000/config.ini /home/exp1000/config.ini.backup
fi

# Check if /home/exp1000 directory exists before attempting to overwrite the SmartCam config
if [ -d "/home/exp1000" ]; then
cp /home/exp272/smartcam/config.ini /home/exp1000/config.ini
fi

echo ""
echo "================= =============== =============== ======== ========"
echo "\\\\ . . . . . . .\\\\ //. . . . . . .\\\\ //. . . . . . .\\\\ \\\\. . .\\\\// . . //"
echo "||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\/ . . .||"
echo "|| . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||"
echo "||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||"
echo "|| . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\ . . . . ||"
echo "||. . || ||-’ || || ‘-|| || . .|| ||. . || ||-’ || || ‘|\_ . .|. .||"
echo "|| . _|| || || || || ||_ . || || . _|| || || || |\ ‘-_/| . ||"
echo "||_-’ || .|/ || || \|. || ‘-_|| ||_-’ || .|/ || || | \ / |-_.||"
echo "|| ||_-’ || || ‘-_|| || || ||_-’ || || | \ / | ‘||"
echo "|| ‘’ || || ‘’ || || ‘’ || || | \ / | ||"
echo "|| .===’ ‘===. .===’.‘===. .===’ /==. | \/ | ||"
echo "|| .==’ \_|-_ ‘===. .===’ _|_ ‘===. .===’ _-|/ ‘== \/ | ||"
echo "|| .==’ _-’ ‘-_ ‘=’ _-’ ‘-_ ‘=’ _-’ ‘-_ /| \/ | ||"
echo "|| .==’ _-’ ‘-__\._-’ ‘-_./__-’ ‘’ |. /| | ||"
echo "||.==’ _-’ ‘’ | /==.||"
echo "==’ _-’ \/ ‘=="
echo "\ _-’ ‘-_ /"
echo " ‘’’ ‘‘’"
8 changes: 5 additions & 3 deletions sepp_package/CONTROL/prerm
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/sh
rm /lib/libSDL-1.2.so.0
rm /lib/libSDL_mixer-1.2.so.0
rm /lib/libSDL_net-1.2.so.0

# Restore the backup of the SmartCam config
if [ -e "/home/exp1000/config.ini.backup" ]; then
cp /home/exp1000/config.ini.backup /home/exp1000/config.ini
rm -f /home/exp1000/config.ini.backup
fi
65 changes: 65 additions & 0 deletions smartcam/config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[conf]
downlink_log_if_no_images = yes
entry_point_model = default
downlink_thumbnails = yes
downlink_compressed_raws = no
downlink_compressed_split = 10M
raw_compression_type = fapec
collect_metadata = yes
tle_path = /etc/tle
quota_toGround = 100000
max_error_count = 10

[camera]
cam_exposure = 2
cam_gains = [13,7,8]

[gen]
gen_type = aoi
gen_interval_default = 0.5
gen_interval_throttle = 0
gen_number = 3
gen_geojson = aois/continents.json

[img]
raw_keep = no
png_keep = no

[jpeg]
jpeg_scaling = 0.3
jpeg_quality = 90

[compression_fapec]
chunk = 512K
threads = 1
dtype = 16
band = 1
losses = x10
meaningful_bits = 12
lev = 5

[clustering]
cluster = no
cluster_for_labels = ["earth"]
cluster_k = 4
cluster_collect_threshold = 10
cluster_img_types = ["jpeg","png","ims_rgb","fapec"]

[model_default]
default.tflite_model = models/default/model.tflite
default.labels = models/default/labels.txt
default.labels_keep = ["earth:doom","edge:doom","bad"]
default.input_height = 224
default.input_width = 224
default.input_mean = 0
default.input_std = 255
default.confidence_threshold = 0.70

[model_doom]
doom.bin_model = /home/exp272/smartcam/start.sh
doom.labels = /home/exp272/smartcam/labels.txt
doom.labels_keep = ["doom"]
doom.input_format = jpeg
doom.write_mode = /home/exp272/demos/doom.wad
doom.args =
doom.confidence_threshold = 1
1 change: 1 addition & 0 deletions smartcam/labels.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
doom
46 changes: 46 additions & 0 deletions smartcam/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/sh

# function to show usage
show_usage() {
echo "Usage: $0 -i <image_filepath> -w <wad_filepath>"
}

# check if the number of arguments is correct
if [ "$#" -ne 4 ]; then
show_usage
exit 1
fi

# parsing arguments
while getopts ":i:w:" opt; do
case $opt in
i) image_file="$OPTARG"
;;
w) wad_file="$OPTARG"
;;
\?) show_usage
exit 1
;;
esac
done

# check if both -i and -w arguments were supplied
if [ -z "$image_file" ] || [ -z "$wad_file" ]; then
show_usage
exit 1
fi

# check if both files exist
if [ ! -f "$image_file" ] || [ ! -f "$wad_file" ]; then
echo "Error: One or both files do not exist."
exit 1
fi

# todo: run the DOOM experiment
# ...

# if successful, print JSON string
echo '{"doom": 1}'

# successful exit
exit 0

0 comments on commit 89988c6

Please sign in to comment.