Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,4 @@ pyrightconfig.json

# camera
/camera/*
examples/2_gemini/gemini_live/mcp_config.json
102 changes: 102 additions & 0 deletions examples/2_gemini/gemini_live/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Gemini Live with ROS MCP Server

Control ROS robots with voice commands using Google's Gemini Live API.

**Pre-requisites** See the [installation instructions](../../../docs/installation.md) for detailed setup steps.

**Tested In:** Ubuntu 22.04, Python 3.10, ROS2 Humble
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work also on WSL?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unsure, I have not used WSL before.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, then let's make sure we specify it only works with Ubuntu.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll specify that for now. I'll work on learning WSL so I can support it in the future.


## Quick Setup

1. **Install ROS MCP Server**: Follow the [installation guide](../../../docs/installation.md)

2. **Get Google API Key**: Visit [Google AI Studio](https://aistudio.google.com) and create an API key

3. **Create a `.env` file in the same folder as gemini_client.py**:
```env
GOOGLE_API_KEY="your_google_api_key_here"
```

4. **Create `mcp_config.json` in the same folder as gemini_client.py**:
Replace `/absolute/path/to/ros-mcp-server` with your actual path.
```json
{
"mcpServers": {
"ros-mcp-server": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/ros-mcp-server",
"run",
"server.py"
]
}
}
}
```

## Usage

**Start Gemini Live:**
```bash
cd ros-mcp-server/examples/2_gemini/gemini_live
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename this to gemini_client.py or client_gemini.py?

uv run gemini_client.py --mode=none
```

**Video modes:**
- `--mode=none` - Audio only
- `--mode=camera` - Include camera
- `--mode=screen` - Include screen capture

**Example Voice commands:**
- "Connect to the robot on ip _ and port _ "
- "List all available tools"
- "What ROS topics are available?"
- "Go to the kitchen"
- "Move forward at 1 m/s for 1 s"

Type `q` + Enter to quit.

## Test with Turtlesim

**Start rosbridge and turtlesim** (separate terminals):
```bash
# Terminal 1: Launch rosbridge
ros2 launch rosbridge_server rosbridge_websocket_launch.xml
```
```bash
# Terminal 2: Start turtlesim
ros2 run turtlesim turtlesim_node
```

**Try these voice commands:**
- "Connect to the robot on ip _ and port _ "
- "What ROS topics are available?"
- "Move the turtle forward at 1 m/s and 0 rad/s"
- "Rotate the turtle at 3 rad/s"
- "Change the pen color to red"


See [Turtlesim Tutorial](../../1_turtlesim/README.md) for more examples.

## Troubleshooting

**Not responding to voice?**
- Check microphone permissions and volume
- Test: `arecord -d 5 test.wav && aplay test.wav`

**Robot not moving?**
- Verify robot/simulation is running
- Check rosbridge is running: `ros2 launch rosbridge_server rosbridge_websocket_launch.xml`
- Check: `ros2 topic list`
- Ask: "List all available tools" to verify MCP connection

**API key errors?**
- Verify `.env` file exists with correct key
- Check key is active in Google AI Studio

**Virtual environment issues?**
- Exit any active environments: `deactivate`
- UV creates its own environment automatically


Loading