-
Notifications
You must be signed in to change notification settings - Fork 112
Add voice interactions with Gemini Live and ros-mcp-server to Gemini example. #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tracelarue
wants to merge
2
commits into
robotmcp:develop
Choose a base branch
from
tracelarue:Gemini-Live-with-ros-mcp-server
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -179,3 +179,4 @@ pyrightconfig.json | |
|
||
# camera | ||
/camera/* | ||
examples/2_gemini/gemini_live/mcp_config.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
## 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.