SpaceOS flight simulator with ISS orbit and telemetry
OCaml 76.0%
Dune 9.0%
Other 15.0%
5 1 0

Clone this repository

https://tangled.org/gazagnaire.org/space-sim https://tangled.org/did:plc:jhift2vwcxhou52p3sewcrpx/space-sim
git@git.recoil.org:gazagnaire.org/space-sim git@git.recoil.org:did:plc:jhift2vwcxhou52p3sewcrpx/space-sim

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

space-sim#

SpaceOS flight simulator for two-partition demo.

space-sim is a minimal init process (PID 1) for the flight partition (P0) in a SpaceOS two-partition VM setup. It mounts essential filesystems, opens a virtio-serial IPC port, and streams continuous telemetry frames to the SpaceOS partition. The simulator propagates ISS orbital position using SGP4 and generates a realistic mix of telemetry (TM), health (HEALTH), and event (EVR) frames at approximately 1 Hz.

When run outside a VM (not as PID 1), it prints a description of what it would do in a real environment.

Installation#

opam install space-sim

Usage#

The binary is designed to run as PID 1 inside a guest VM booted by space run. It is not typically invoked directly.

Inside the VM, it:

  1. Mounts /proc, /sys, /dev via Pid1.setup_filesystems
  2. Waits for the /dev/virtio-ports/ipc device (5-second timeout)
  3. Propagates the ISS orbit using an embedded TLE and SGP4
  4. Streams a continuous mix of frames over the IPC port:
    • TM (APID 0x101): orbital position (lat, lon, alt, velocity)
    • TM (APID 0x100, 0x102, 0x103): heartbeat, sensor readings, status
    • HEALTH (APID 0x100): CPU, memory, uptime
    • EVR (APID 0x200): system events (orbit updates, command acks, watchdog)

API#

This package is a standalone binary with no public library. It depends on:

  • space-wire -- frame encoding via Space_wire.Msg
  • zephyr -- virtio-serial port I/O
  • pid1 -- PID 1 filesystem setup and signal handling
  • sgp4 (via zephyr) -- SGP4 orbit propagation