WebAssembly build of the Tudat astrodynamics library, enabling orbital mechanics simulations directly in web browsers and Node.js.
This repository provides:
- WASM bindings for the Tudat C++ astrodynamics library via Emscripten/Embind
- NPM package (
@tudat/tudatpy-wasm) for JavaScript/TypeScript integration - Interactive demos hosted on GitHub Pages
- Test suite for both Node.js and browser environments
- CMake 3.20+
- Ninja build system
- Git
- Python 3.x
- Node.js (for testing)
The Emscripten SDK is downloaded automatically during the first build.
# Clone the repository
git clone https://github.com/tudat-team/tudat-wasm.git
cd tudat-wasm
# Build visualization demo (faster)
cmake -P wasm.cmake
# Build full API with tests
cmake -DFULL_BUILD=1 -P wasm.cmakeThe build script will:
- Download and install Emscripten SDK (v3.1.51) if needed
- Configure the WASM build
- Compile the WASM modules
- Deploy to
docs/for GitHub Pages - Start a local web server at http://localhost:8832
# Configure
cmake -B build-wasm \
-DCMAKE_TOOLCHAIN_FILE=cmake_modules/toolchain-emscripten.cmake \
-DCMAKE_BUILD_TYPE=Release \
-G Ninja
# Build visualization demo
cmake --build build-wasm --target tudat_wasm_web
# Build full Embind API
cmake --build build-wasm --target tudatpy_wasmtudat-wasm/
├── cmake_modules/
│ └── toolchain-emscripten.cmake # Emscripten toolchain
├── cmake/
│ └── patches/
│ └── cspice-wasm.patch # SPICE library WASM patch
├── docs/ # GitHub Pages deployment
├── src/
│ └── tudatpy_wasm/ # WASM bindings source
│ ├── npm/ # NPM package
│ └── [binding modules]
├── tests/
│ └── wasm/ # Test suite
│ ├── src/ # C++ tests
│ ├── web/ # Browser test UI
│ └── test_wasm_*.js # Node.js tests
├── wasm.cmake # Build orchestration script
└── CMakeLists.txt # Main build configuration
The @tudat/tudatpy-wasm package provides TypeScript-friendly bindings:
import createTudatModule from '@tudat/tudatpy-wasm';
const tudat = await createTudatModule();
// Access astrodynamics functions
const mu = tudat.constants.GRAVITATIONAL_CONSTANT;cd tests/wasm
node test_wasm_api.js
node test_wasm_integration.jsThe build script starts a web server automatically. Alternatively:
cd tests/wasm/web
python start_server.pyThen open http://localhost:8832 in your browser.
The docs/ directory is deployed to GitHub Pages, providing:
- Interactive orbit visualization demos
- API documentation (TypeDoc)
- Test suite accessible in-browser
- Emscripten SDK: v3.1.51 (auto-downloaded)
- Tudat: Fetched via CMake FetchContent
- Boost: Headers via Emscripten port
- Eigen3: Linear algebra library
- CSpice: Planetary ephemerides (with WASM patch)
- SOFA: Fundamental astronomy standards
- CesiumJS: 3D globe visualization (for demos)
This project follows the same license as Tudat. See LICENSE for details.