A modern React-based user interface for monitoring and controlling lunar mission operations. This application connects to the lunarterm system via a WebSocket bridge server, providing real-time telemetry display and command interface.
-
Real-time Telemetry Display: View live sensor data including:
- IMU (Gyroscope and Accelerometer) data
- Magnetometer readings
- Radiation sensor data
- System status indicators
- Temperature readings
-
Command Interface: Send commands to the lunarterm system:
- System control (idle, initialize sensors, start operations)
- Camera operations (capture, download, send images)
- Motor and power management
- LED control
-
Dual Connection Status: Monitor both server and hardware connections
-
Modern UI: Dark theme optimized for mission control environments
-
Real-time Command Feedback: See actual responses from the hardware
-
Responsive Design: Works on desktop and mobile devices
┌─────────────────┐ HTTP API ┌─────────────────┐ WebSocket ┌─────────────────┐ WebSocket ┌─────────────────┐
│ │ ◄─────────────► │ │ ◄─────────────► │ │ ◄─────────────► │ │
│ React App │ │ HTTP Bridge │ │ WebSocket Server│ │ lunarterm │
│ (Port 2178) │ │ (Port 2179) │ │ (Port 2177) │ │ on rasb |
└─────────────────┘ └─────────────────┘ └─────────────────┘ └─────────────────┘
The system consists of four main components:
- React Frontend - Modern UI for displaying telemetry and sending commands
- HTTP Bridge - Node.js HTTP server that converts HTTP requests to WebSocket messages
- WebSocket Server - Node.js WebSocket server that forwards commands and responses
- lunarterm (Hardware) - Python application that communicates with the spacecraft hardware
- Website → HTTP Bridge: React app sends HTTP requests to the bridge
- HTTP Bridge → WebSocket Server: Bridge forwards commands via WebSocket
- WebSocket Server → Hardware: Server communicates with lunarterm hardware
- Hardware → WebSocket Server → HTTP Bridge → Website: Responses flow back through the chain
This architecture solves browser WebSocket connection issues by using reliable HTTP communication between the frontend and backend.
- Node.js (v16 or higher)
- npm or yarn
cd lunarterm
npm installThis will install dependencies for both the React app and the bridge server.
cd lunarterm
./start-system.shThis will automatically start all three components:
- WebSocket server (port 2177)
- HTTP bridge (port 2179)
- React app (port 2178)
To stop everything:
./stop-system.shIf you prefer to run each component separately:
cd lunarterm/bridge-server
node server.jscd lunarterm/bridge-server
node http-bridge.jscd lunarterm
npm startWhen everything is running correctly:
WebSocket Server (port 2177):
WebSocket server starting on 0.0.0.0:2177...
New connection from 127.0.0.1 <- HTTP bridge connected
HTTP Bridge (port 2179):
🌉 HTTP Bridge server running on port 2179
🔗 Connected to main WebSocket server
React App (port 2178):
webpack compiled successfully
Local: http://localhost:2178
Browser: http://localhost:2178
- Server: connected ✅
- Hardware: disconnected (until hardware connects)
Configure your lunarterm system to connect to the WebSocket server:
- Server URL:
ws://[SERVER_IP]:2177 - Connection Type: WebSocket client
The hardware should connect and send identification or telemetry data.
The website displays dual connection status in the top bar:
- Server: connected/disconnected - Connection between website and bridge server
- Hardware: connected/disconnected - Connection between bridge server and lunarterm hardware
- Website → Server: Website connects to bridge server on port 2177
- Hardware → Server: lunarterm hardware connects to bridge server on port 2177
- Command Flow: Website → Bridge Server → Hardware
- Response Flow: Hardware → Bridge Server → Website
The system supports all lunarterm commands:
idle- Stop all operationssen_init- Initialize sensorsstart_conops- Start concept of operationsimg_capture- Capture imageimg_download- Download imageimg_send- Send imagemotor_up/motor_down- Motor controlcut_thermal- Thermal knife controlled_proc- LED controlreset- Reset systemlong- Long duration operation
Unlike traditional systems that show generic "command sent" messages, this system displays actual hardware responses:
- Success: "Command idle sent to hardware" with port status
- Error: Specific error messages from the hardware
- Timeout: If hardware doesn't respond within 10 seconds
Edit bridge-server/server.js to modify:
PORT: WebSocket server port (default: 2177)HOST: Server bind address (default: 0.0.0.0 - all interfaces)
Edit src/hooks/useTelemetry.ts to modify:
SERVER_URL: WebSocket server URL (default: ws://localhost:2177)
You can also use environment variables:
REACT_APP_SERVER_URL=ws://your-server:2177 npm startBoth components support hot reload during development:
# React app (automatically reloads on changes)
npm start
# Bridge server (restart manually after changes)
cd bridge-server
node server.jsYou can test commands directly from the bridge server terminal:
command> idle
command> sen_init
Website shows "Server: disconnected"
- Ensure bridge server is running on port 2177
- Check browser console for WebSocket errors
- Verify no firewall blocking localhost connections
Website shows "Hardware: disconnected"
- Ensure lunarterm hardware is running
- Check hardware is configured to connect to correct WebSocket URL
- Verify hardware is sending proper identification or telemetry data
Commands timeout or fail
- Check bridge server logs for error messages
- Ensure hardware connection is stable
- Verify command format matches lunarterm expectations
The bridge server includes detailed logging:
[WEBSITE COMMAND]- Commands received from website[HARDWARE RESPONSE]- Responses from hardware[FORWARDING]- Message forwarding between connections
- Website:
http://localhost:2178 - Bridge Server:
ws://localhost:2177
If hardware is on a different machine:
- Bridge Server:
ws://[SERVER_IP]:2177 - Ensure port 2177 is accessible from hardware machine
This project is part of the Lunar Mission Control System. Please refer to the main project license for usage terms.