Skip to content

Commit 8abacf8

Browse files
committed
improved readme
1 parent 38b45d4 commit 8abacf8

2 files changed

Lines changed: 138 additions & 152 deletions

File tree

README.md

Lines changed: 137 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -13,106 +13,34 @@ A web application for controlling ROS 2 robots, featuring a React frontend, ROS
1313
* 📱 Responsive design for desktop and mobile
1414
* 🔗 ROS 2 connection (via rosbridge)
1515
* 📷 Camera stream display (via web_video_server)
16-
* 🦊 Foxglove WebSocket server for advanced data visualization and debugging
1716
* 🕹️ Interchangeable control interfaces:
18-
* Standard gamepad with dual joysticks (`sensor_msgs/Joy`)
19-
* Retro GameBoy-style control layout
20-
* Voice control input with recording animation
2117
* 🚁 Drone control pad for aerial vehicles
2218
* 🦾 Manipulator control for robotic arms
23-
* 🧊 3D visualization support (using ros3djs)
24-
* 🌈 Customizable point cloud rendering with options for:
25-
* Point size adjustment
26-
* Color selection (fixed or gradient based on x/y/z axis)
27-
* Maximum points setting
28-
* 🌗 Animated Light/Dark mode toggle
19+
* And many more than you can create!
20+
* 🧊 3D visualization support g
2921
* 🎨 Customizable themes with user-created color palettes
30-
* 🛡️ Local HTTPS development setup via Caddy and mkcert
3122

3223
## 🎥 App Demo
3324
<div align="center">
3425
<video src="https://github.com/user-attachments/assets/3972d215-0d26-46f7-98b3-21435ee61ae1" width="30%" controls></video>
3526
</div>
3627

37-
## 🎮 Control Interfaces
38-
39-
The application provides multiple control interfaces that can be swapped during runtime:
40-
41-
### Standard Gamepad
42-
A dual-joystick layout for precise control, publishing to the `/joy` topic with ROS standard `sensor_msgs/Joy` messages.
43-
44-
### GameBoy Layout
45-
A nostalgic GameBoy-inspired control interface with D-pad and A/B buttons.
46-
47-
### Voice Control
48-
Record voice commands that can be sent to your robot for voice-activated control.
49-
50-
### Drone Control Pad
51-
Specialized control interface for aerial vehicles. For testing, use in conjunction with [aerial-sim](https://github.com/tessel-la/aerial-sim) repository.
52-
53-
### Manipulator Control
54-
Interface for controlling robotic arms with precise joint movements. For testing, use in conjunction with [manipulator-sim](https://github.com/tessel-la/manipulator-sim) repository.
55-
56-
You can open multiple control panels and switch between them with tabs.
57-
58-
## Theme Customization
59-
60-
<div align="center">
61-
<video src="https://github.com/user-attachments/assets/3f28cc2b-b9e9-46fa-b36c-69324dec5664" width="30%" controls></video>
62-
</div>
63-
64-
The application supports multiple themes, including user-created custom themes. Themes define the color palette for the UI elements.
65-
66-
1. **Access Theme Menu:** Click the theme icon button (usually in the bottom-right corner). This opens a popup menu displaying available themes (default and custom).
67-
2. **Create New Theme:** Click the "Create New Theme..." button in the popup. This opens the Theme Creator modal.
68-
3. **Define Theme:**
69-
* Enter a unique **Name** for your theme.
70-
* Select the base **Colors** (Primary, Secondary, Background) using the color pickers. Optional colors (Text, Border, etc.) can also be set.
71-
* Choose an **Icon** to represent your theme in the selector menu.
72-
* Click **Save Theme**.
73-
4. **Editing/Deleting:** Custom themes will have Edit (pencil) and Delete (trash) icons next to them in the theme selector popup. Clicking Edit opens the Theme Creator pre-filled with that theme's settings. Clicking Delete prompts for confirmation before removing the theme.
74-
75-
### How it Works
76-
77-
* Default themes (`light`, `dark`, `solarized`) have their CSS variables defined directly in `src/index.css` using `[data-theme="themename"]` selectors.
78-
* Custom themes are stored in the browser's `localStorage`.
79-
* When a custom theme is selected, JavaScript dynamically generates a `<style>` tag containing CSS variable overrides based on the saved colors and injects it into the document head. The `<body>` element also gets a `data-theme="custom-theme-id"` attribute.
80-
* UI components should primarily use the defined CSS variables (e.g., `var(--primary-color)`, `var(--background-color)`) for styling to ensure they adapt correctly to the selected theme.
81-
82-
## 🧩 Codebase Organization
83-
84-
The codebase follows a component-based architecture:
85-
86-
- `/src/components` - Main UI components
87-
- `/src/components/gamepads` - All gamepad control interfaces
88-
- `/standard` - Standard dual joystick layout
89-
- `/gameboy` - GameBoy-style control layout
90-
- `/voice` - Voice control interface
91-
- `/drone` - Drone control interface
92-
- `/manipulator` - Robotic arm control interface
93-
- `/src/hooks` - Custom React hooks including ROS connection
94-
- `/src/utils` - Utility functions and helpers
95-
- `/src/features` - Feature-specific code (e.g., theme system)
96-
- `/src/types` - TypeScript type definitions
97-
98-
### Adding Custom Gamepad Layouts
99-
100-
See the dedicated README in the `/src/components/gamepads` directory for instructions on creating custom control interfaces.
101-
10228
## 🚀 Getting Started
10329

104-
### Prerequisites
30+
<details>
31+
<summary><strong>📋 Prerequisites</strong></summary>
10532

10633
* [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/) installed.
107-
* [Node.js](https://nodejs.org/) (v18 LTS or later recommended) and npm. (*Note: Node/npm are technically only needed if modifying dependencies locally before a Docker build, but good to have.*)
10834
* [mkcert](https://github.com/FiloSottile/mkcert#installation) for local HTTPS setup.
35+
</details>
10936

110-
### Local Development Setup
37+
<details>
38+
<summary><strong>⚙️ Local Development Setup</strong></summary>
11139

11240
1. **Clone the Repository:**
11341
```bash
11442
git clone git@github.com:tessel-la/robo-boy.git
115-
cd robo-boy # Or your actual directory name
43+
cd robo-boy
11644
```
11745

11846
2. **Setup Local HTTPS with mkcert:**
@@ -138,8 +66,10 @@ See the dedicated README in the `/src/components/gamepads` directory for instruc
13866
4. **Access the Application:**
13967
* On your development machine: `https://localhost`
14068
* From another device on the same network (e.g., mobile): `https://YOUR_HOST_IP` (using the same IP you used for `mkcert`)
69+
</details>
14170
142-
### Stopping the Services
71+
<details>
72+
<summary><strong>🛑 Stopping the Services</strong></summary>
14373
14474
```bash
14575
# Stop and remove containers
@@ -148,100 +78,156 @@ docker compose down
14878
# Stop, remove containers, AND remove Caddy's data volumes (useful for a clean restart)
14979
docker compose down -v
15080
```
81+
</details>
15182
152-
## 🐳 Services Overview
153-
154-
* **`app`**: Runs the Vite development server for the React frontend with hot-reloading.
155-
* Accessible *internally* at `http://app:5173`.
156-
* **`ros-stack`**: Runs ROS 2 components.
157-
* `rosbridge_server`: Provides WebSocket connection at `ws://ros-stack:9090`.
158-
* `web_video_server`: Streams video topics over HTTP at `http://ros-stack:8080`.
159-
* `foxglove_bridge`: Provides WebSocket connection for Foxglove Studio at `ws://ros-stack:8765`.
160-
* **`caddy`**: Acts as a reverse proxy.
161-
* Listens on host ports `80` and `443`.
162-
* Provides HTTPS using the generated `mkcert` certificates.
163-
* Routes `/websocket` requests to `ros-stack:9090`.
164-
* Routes `/foxglove` requests to `ros-stack:8765`.
165-
* Routes all other requests to the Vite dev server (`app:5173`).
83+
## 🎮 Control Interfaces & Gamepad Creation
16684
167-
## 🦊 Foxglove Studio Integration
168-
169-
The application includes a Foxglove WebSocket server that allows you to connect and visualize your ROS data using [Foxglove Studio](https://foxglove.dev/studio). This provides advanced data visualization, plotting, and debugging capabilities.
170-
171-
### Connecting to Foxglove Studio
172-
173-
1. Launch Foxglove Studio (web or desktop version)
174-
2. Click "Open Connection" and select "WebSocket"
175-
3. Enter one of the following URLs:
176-
- Local machine: `ws://localhost:8765` (direct connection to the port)
177-
- Local machine via Caddy proxy: `wss://localhost/foxglove`
178-
- From another device on the same network: `wss://YOUR_HOST_IP/foxglove`
179-
4. Click "Open"
180-
181-
You should now be connected to the ROS environment and can use all of Foxglove Studio's features to visualize and analyze your robot's data.
85+
The application provides multiple control interfaces that can be swapped during runtime:
18286
183-
## 🛠️ Development Notes
87+
<details>
88+
<summary><strong>🕹️ Pre-built Control Pads</strong></summary>
18489
185-
* Changes to frontend code (in `/src`) should trigger hot-reloading in the browser.
186-
* If you modify `Dockerfile`, `docker-compose.yml`, or `Caddyfile`, you'll need to rebuild and restart the services (`docker compose up -d --build --force-recreate`).
187-
* Caddy logs can be viewed with `docker compose logs caddy`.
188-
* ROS stack logs can be viewed with `docker compose logs ros-stack`.
90+
#### Drone Control Pad
91+
Specialized control interface for aerial vehicles. For testing, use in conjunction with [aerial-sim](https://github.com/tessel-la/aerial-sim) repository.
18992
190-
## 🚀 CI/CD Workflow
93+
#### Manipulator Control
94+
Interface for controlling robotic arms with precise joint movements. For testing, use in conjunction with [manipulator-sim](https://github.com/tessel-la/manipulator-sim) repository.
19195
192-
The project uses GitHub Actions for continuous integration:
96+
#### Standard, GameBoy & Voice Layouts
97+
Additional pre-built interfaces including standard dual-joystick, retro GameBoy-style controls, and voice command interface.
98+
</details>
19399
194-
### Docker CI Workflow
100+
<details>
101+
<summary><strong>🛠️ Custom Gamepad Creator</strong></summary>
195102
196-
The Docker CI workflow runs automatically on every push to the `main` branch and on every pull request. It tests the container build process:
103+
**Create your own control interfaces directly in the app!** The Custom Gamepad Creator allows you to design personalized control layouts using a drag-and-drop interface.
197104
198-
1. **Docker Setup**: Sets up Docker Buildx for multi-platform builds
199-
2. **App Container**: Builds the React application container from `Dockerfile.dev`
200-
3. **ROS Stack Container**: Builds the ROS 2 stack container from `Dockerfile.ros`
201-
4. **Docker Compose**: Tests the full stack build with docker-compose
105+
**Features:**
106+
- **Component Library**: Choose from joysticks, buttons, D-pads, toggles, and sliders
107+
- **Grid-based Design**: Drag and drop components on a customizable grid
108+
- **Real-time Preview**: Test your gamepad while designing
109+
- **ROS Integration**: Configure each component to publish to specific ROS topics
110+
- **Save & Share**: Store layouts locally and export/import via JSON files
202111
203-
This approach ensures that all Docker containers and the full stack can be built successfully.
112+
**Getting Started:**
113+
1. Click the "+" button in the control panel tabs
114+
2. Select "Create Custom Gamepad"
115+
3. Drag components from the palette to design your layout
116+
4. Configure each component's ROS topic and behavior
117+
5. Save your custom gamepad for future use
204118
205-
### Testing Locally
119+
Perfect for creating specialized control interfaces tailored to your specific robot's needs!
120+
</details>
206121
207-
#### Testing Docker Builds Locally
122+
<details>
123+
<summary><strong>📑 Tab Management</strong></summary>
208124
209-
You can test the Docker builds locally using the provided scripts:
125+
You can open multiple control panels and switch between them with tabs. Mix and match pre-built pads with your custom creations for maximum flexibility.
126+
</details>
210127
211-
**Linux/macOS:**
212-
```bash
213-
# Make the script executable
214-
chmod +x scripts/test-docker-build.sh
128+
## 🎨 Theme Customization
215129
216-
# Run the Docker build tests
217-
./scripts/test-docker-build.sh
218-
```
130+
<details>
131+
<summary><strong>🎭 Custom Theme Creator</strong></summary>
219132
220-
> **Note for WSL users**: If you encounter errors like `bash\r: No such file or directory`, you need to convert the file to Unix line endings. Install dos2unix (`sudo apt install dos2unix`) and run `dos2unix scripts/test-docker-build.sh` to fix the line endings.
133+
<div align="center">
134+
<video src="https://github.com/user-attachments/assets/3f28cc2b-b9e9-46fa-b36c-69324dec5664" width="30%" controls></video>
135+
</div>
221136
222-
**Windows:**
223-
```cmd
224-
scripts\test-docker-build.bat
225-
```
137+
The application supports multiple themes, including user-created custom themes. Themes define the color palette for the UI elements.
226138
227-
These scripts will build all Docker containers and test the full docker-compose setup, ensuring everything builds correctly.
139+
1. **Access Theme Menu:** Click the theme icon button (usually in the bottom-right corner). This opens a popup menu displaying available themes (default and custom).
140+
2. **Create New Theme:** Click the "Create New Theme..." button in the popup. This opens the Theme Creator modal.
141+
3. **Define Theme:**
142+
* Enter a unique **Name** for your theme.
143+
* Select the base **Colors** (Primary, Secondary, Background) using the color pickers. Optional colors (Text, Border, etc.) can also be set.
144+
* Choose an **Icon** to represent your theme in the selector menu.
145+
* Click **Save Theme**.
146+
4. **Editing/Deleting:** Custom themes will have Edit (pencil) and Delete (trash) icons next to them in the theme selector popup. Clicking Edit opens the Theme Creator pre-filled with that theme's settings. Clicking Delete prompts for confirmation before removing the theme.
147+
</details>
228148
149+
<details>
150+
<summary><strong>⚙️ How Theme System Works</strong></summary>
229151
230-
## 🚢 Production Deployment
152+
* Default themes (`light`, `dark`, `solarized`) have their CSS variables defined directly in `src/index.css` using `[data-theme="themename"]` selectors.
153+
* Custom themes are stored in the browser's `localStorage`.
154+
* When a custom theme is selected, JavaScript dynamically generates a `<style>` tag containing CSS variable overrides based on the saved colors and injects it into the document head. The `<body>` element also gets a `data-theme="custom-theme-id"` attribute.
155+
* UI components should primarily use the defined CSS variables (e.g., `var(--primary-color)`, `var(--background-color)`) for styling to ensure they adapt correctly to the selected theme.
156+
</details>
231157
232-
### Manual Deployment
158+
## 🛠️ Development Notes
233159
234-
To deploy the application:
160+
<details>
161+
<summary><strong>💻 Development Tips</strong></summary>
235162
236-
```bash
237-
# Install dependencies
238-
npm ci
163+
* Changes to frontend code (in `/src`) should trigger hot-reloading in the browser.
164+
* If you modify `Dockerfile`, `docker-compose.yml`, or `Caddyfile`, you'll need to rebuild and restart the services (`docker compose up -d --build --force-recreate`).
165+
* Caddy logs can be viewed with `docker compose logs caddy`.
166+
* ROS stack logs can be viewed with `docker compose logs ros-stack`.
167+
</details>
239168
240-
# Build for production
241-
npm run build
169+
## 🧩 Codebase Organization
242170
243-
# The 'dist' directory now contains the deployable files
244-
```
171+
<details>
172+
<summary><strong>📁 Project Structure</strong></summary>
245173
246-
The built files in the `dist` directory can be deployed to any static hosting service like GitHub Pages, Netlify, Vercel, or a traditional web server.
174+
The codebase follows a component-based architecture:
247175
176+
- `/src/components` - Main UI components and layouts
177+
- Core UI components: `MainControlView`, `Navbar`, `SettingsPopup`, etc.
178+
- `/gamepads` - Pre-built gamepad control interfaces
179+
- `/standard` - Standard dual joystick layout
180+
- `/gameboy` - GameBoy-style control layout
181+
- `/voice` - Voice control interface
182+
- `/drone` - Drone control interface
183+
- `/manipulator` - Robotic arm control interface
184+
- `/custom` - Custom gamepad wrapper component
185+
- `/visualizers` - 3D visualization components
186+
- `PointCloudViz.tsx` - Point cloud visualization
187+
- `UrdfViz.tsx` - URDF model visualization
188+
- `CameraInfoViz.tsx` - Camera information display
189+
- `/src/features` - Feature-specific code organized by functionality
190+
- `/theme` - Theme system with custom color palette creation
191+
- `/customGamepad` - **Custom Gamepad Creator System**
192+
- `types.ts` - TypeScript interfaces and component definitions
193+
- `defaultLayouts.ts` - Pre-built layouts and component library
194+
- `gamepadStorage.ts` - Local storage management for custom layouts
195+
- `/components` - Custom gamepad editor and component implementations
196+
- `GamepadEditor.tsx` - Main drag-and-drop editor interface
197+
- `CustomGamepadLayout.tsx` - Runtime layout renderer
198+
- `GamepadComponent.tsx` - Generic component wrapper
199+
- `JoystickComponent.tsx`, `ButtonComponent.tsx`, `DPadComponent.tsx`
200+
- `ToggleComponent.tsx`, `SliderComponent.tsx` - Input components
201+
- Various UI components for editor functionality
202+
- `/src/hooks` - Custom React hooks including ROS connection and visualization
203+
- `/src/utils` - Utility functions and helpers
204+
- `/src/types` - TypeScript type definitions
205+
</details>
206+
207+
<details>
208+
<summary><strong>🎨 Adding Custom Gamepad Layouts</strong></summary>
209+
210+
#### 🎨 For End Users (In-App Creator)
211+
Use the built-in Custom Gamepad Creator accessible through the "+" button in control panel tabs. **No coding required!**
212+
- Drag-and-drop interface with pre-built components
213+
- Perfect for most use cases and quick prototyping
214+
- Supports joysticks, buttons, D-pads, toggles, and sliders
215+
- Real-time preview and easy ROS topic configuration
216+
217+
#### 💻 For Developers (Code-Based Implementation)
218+
**When the in-app system isn't enough** for your specific needs, you can implement custom gamepads via code:
219+
220+
- **Advanced Components**: Create custom component types not available in the drag-and-drop editor
221+
- **Complex Logic**: Implement sophisticated control algorithms and state management
222+
- **Performance Optimization**: Fine-tune for high-frequency or specialized operations
223+
- **Custom ROS Integration**: Support for complex message types, actions, and services
224+
225+
**Implementation Paths:**
226+
- **Hardcoded Layouts**: Create traditional gamepad components in `/src/components/gamepads`
227+
- **Extend Custom System**: Add new component types to the custom gamepad library
228+
- **Comprehensive Guide**: See the detailed README in `/src/features/customGamepad` for:
229+
- Architecture overview and component system
230+
- Adding new component types to the library
231+
- Extending ROS message support
232+
- Storage format and data structures
233+
</details>

dev-dist/sw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ define(['./workbox-54d0af47'], (function (workbox) { 'use strict';
8282
"revision": "3ca0b8505b4bec776b69afdba2768812"
8383
}, {
8484
"url": "index.html",
85-
"revision": "0.ala0g4r963o"
85+
"revision": "0.clvgpscl5uo"
8686
}], {});
8787
workbox.cleanupOutdatedCaches();
8888
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {

0 commit comments

Comments
 (0)