A web-based robotic navigation simulator that uses Three.js for rendering and Gaussian splatting for visualizing 3D scenes from PLY files.
- PLY File Loading: Load and visualize .ply files with Gaussian splatting-like point cloud rendering
- Navigation: Use arrow keys (or WASD) to navigate through the scene
- Socket Communication: Receive robot commands via WebSocket (forward, turn)
- Image Export: Export scene views as PNG images locally or save to server
- Real-time Rendering: Responsive rendering with camera following robot movement
gs_navsim/
├── frontend/
│ ├── index.html # Main web page
│ ├── main.js # Application entry point
│ ├── renderer.js # Three.js scene setup and rendering
│ ├── socket.js # WebSocket client for robot commands
│ ├── controls.js # Keyboard input handling
│ ├── utils.js # Utility classes (RobotController, CameraController)
│ └── README.md # This file
└── backend/
├── server.js # Express + WebSocket server
├── package.json # Node.js dependencies
└── [exported images] # Generated PNG files
cd backend
npm installcd backend
npm startNavigate to http://localhost:3000 in your web browser.
- Use the file input to load a
.plyfile - The scene will automatically center and display the point cloud
- Arrow Keys or WASD: Move the robot through the scene
- The camera automatically follows the robot's movement
- The view direction matches the robot's orientation
- Export Image: Download PNG to your local machine
- Save to Server: Save PNG to the backend server
The server automatically sends robot commands via WebSocket:
{ type: 'forward' }: Move robot forward{ type: 'turn', value: 0.196 }: Turn robot (value in radians)
- Uses Three.js
PointsMaterialwith additive blending - Vertex colors support for colored point clouds
- Automatic color generation for PLY files without color data
RobotControllerclass manages position and rotationCameraControllerclass handles camera following behaviorKeyboardControlsclass manages input with WASD/arrow key support
- Server sends robot commands to client
- Client responds with rendered images as base64 PNG data
- Automatic image saving on server with timestamps
Modify backend/server.js to send custom commands:
ws.send(JSON.stringify({
type: 'custom_command',
params: { speed: 0.5, angle: Math.PI/4 }
}));Handle in frontend/socket.js:
if (cmd.type === 'custom_command') {
// Handle custom command
}Modify utils.js createGaussianMaterial() function:
export function createGaussianMaterial(options = {}) {
return new THREE.PointsMaterial({
size: options.size || 0.05, // Larger points
transparent: true,
opacity: 0.9,
blending: THREE.NormalBlending // Different blending mode
});
}- Three.js (via CDN)
- PLYLoader (Three.js examples)
- Node.js
- Express.js
- ws (WebSocket library)
- Modern browsers with WebGL support
- WebSocket support required
- File API support for PLY loading