3.7 KiB
3.7 KiB
Orbital Simulator Interfaces
This project now includes multiple ways to interact with the orbital simulator:
1. Web Interface
A browser-based interface with real-time 3D visualization.
Features:
- Real-time 3D orbital visualization using Three.js
- Interactive controls (start, pause, stop, step)
- Multiple simulation management
- Custom configuration editor
- Live statistics and energy monitoring
- Responsive design
Usage:
# Start the API server
cargo run --release --bin api_server
# In another terminal, start the web frontend
cd web
npm install
npm run dev
# Open http://localhost:5173 in your browser
2. Desktop GUI
A native desktop application using Tauri (Rust + Web technologies).
Features:
- All web interface features in a native app
- File system integration
- Native notifications
- System tray integration
- Better performance than browser
Usage:
# Install Tauri CLI
cargo install tauri-cli
# Start development mode
cargo tauri dev
# Build for production
cargo tauri build
3. Command Line Interface (Original)
The original command-line tools are still available:
# Run simulation
cargo run --release --bin simulator -- \
--config config/planets.toml \
--time 365d \
--step-size 3600 \
--output-file trajectory.bin
# Visualize results
python3 plot_trajectories.py trajectory.bin --animate
# 3D real-time visualizer
cargo run --release --bin orbiter -- trajectory.bin
API Endpoints
The web API server provides RESTful endpoints:
POST /api/simulations
- Create new simulationGET /api/simulations
- List all simulationsGET /api/simulations/:id
- Get simulation statePOST /api/simulations/:id/control
- Control simulation (start/pause/stop)DELETE /api/simulations/:id
- Delete simulationGET /api/configs
- List available configurations
Installation
Prerequisites:
- Rust (latest stable)
- Node.js 18+ (for web interface)
- Python 3.7+ (for visualization)
Full Installation:
# Clone and build
git clone <repository-url>
cd orbital_simulator
# Install Rust dependencies
cargo build --release
# Install Node.js dependencies
cd web
npm install
cd ..
# Install Python dependencies
pip install -r requirements.txt
# Install Tauri CLI (optional, for desktop GUI)
cargo install tauri-cli
Quick Start:
# Start everything with one command
./start_interfaces.sh
This will launch:
- API server on port 3000
- Web interface on port 5173
- Desktop GUI (if Tauri is installed)
Development
Architecture:
┌─────────────────┐ ┌─────────────────┐
│ Desktop GUI │ │ Web Interface │
│ (Tauri) │ │ (React) │
└─────────┬───────┘ └─────────┬───────┘
│ │
└──────────┬───────────┘
│
┌─────────────────┐
│ API Server │
│ (Axum) │
└─────────┬───────┘
│
┌─────────────────┐
│ Rust Simulator │
│ (Core Logic) │
└─────────────────┘
Adding Features:
- Backend: Add endpoints in
src/bin/api_server.rs
- Web: Add components in
web/src/components/
- Desktop: Add commands in
src-tauri/src/main.rs
Testing:
# Test Rust code
cargo test
# Test web interface
cd web
npm test
# Test API endpoints
curl http://localhost:3000/api/simulations