⭐ Star us on GitHub — it motivates us a lot!
ROSLine is a natural language interface that bridges WhatsApp and ROS 2. It allows users to control and monitor ROS-based robots through chat commands powered by Gemini and a lightweight reasoning layer. The system consists of two main components: a ROS 2 node that provides a FastAPI web service for robot control, and a WhatsApp client built with Baileys that handles message processing and communication.
The system architecture consists of:
- ROS 2 Node (
ros_line): FastAPI-based web service that processes natural language commands and translates them into ROS 2 actions - WhatsApp Client (
ros-line-whatsapp-qr): TypeScript/Node.js application using Baileys library for WhatsApp Web API integration - AI Integration: Google Gemini for natural language processing and command interpretation
- 📱 WhatsApp Integration: Send commands directly through WhatsApp messages
- 🤖 Natural Language Processing: AI-powered command interpretation using Google Gemini
- 🔄 ROS 2 Communication: Seamless integration with ROS 2 topics and services
- 🚀 FastAPI Backend: High-performance async web service
- 📡 Real-time Communication: Instant message processing and robot control
To build the packages (only if you are using ROS 2 Jazzy and Python 3.12), follow these steps:
- ROS 2 Jazzy Jalisco
- Python 3.12
- Node.js 20.x and npm/yarn
- Google Gemini API key
# First clone the repository in your workspace and create a symlink
cd ~/ros2_ws/src
git clone https://github.com/miguelgonrod/ROSLine
ln -s /home/$USER/ros2_ws/src/ROSLine/ros_line /home/$USER/ros2_ws/src
# Install Python dependencies for ROS 2 node
cd ROSLine/ros_line/resource
pip install -r requirements.txt --break-system-packages
# Build the ROS 2 package
cd ~/ros2_ws
colcon build --packages-select ros_line
source install/setup.bash# Navigate to WhatsApp client directory
cd ~/ros2_ws/src/ROSLine/ros-line-whatsapp-qr
# Install Node.js dependencies
npm install
# Build TypeScript code (if needed)
npx tsx src/index.tsIf npm is not working as expected, is because you need to install nodejs 20.x and this is not supported by default by Ubuntu 24.04. If this is your case run this command before sudo apt install:
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -Create a .env file in the ROS 2 package directory:
# Create environment file
cd ~/ros2_ws/src/ROSLine/ros_line/resource
touch .envAdd your API keys and configuration (you should use ros_line/resource/.env.example as a template):
GOOGLE_API_KEY=[Your API KEY]
GOOGLE_APPLICATION_CREDENTIALS=[Absolute route to your json API KEY]
ROS_DOMAIN_ID=0
ROS_DISTRO=jazzyGOOGLE_API_KEY is needed to connect to Gemini API. This API KEY is created in Google AI Studio
GOOGLE_APPLICATION_CREDENTIALS is needed to connect to Google TTS. To create this API Credentials you need to follow this steps:
- Go to Google Cloud Console
- Go to "APIs and services > Library" and install
Cloud Speech-to-Text API - Go to "Credentials", click "Create credentials", create a
Service accountand give it the name you prefer. (No more configurations needed) - Click on the new Service account, go to "Keys", create a new "JSON" key and save it preferably in
ROSLine/ros_line/resource. (Don't forget to edit the.env)
- Start the WhatsApp client:
cd ~/ros2_ws/src/ROSLine/ros-line-whatsapp-qr
npx tsx src/index.ts-
Scan QR Code:
- A QR code will appear in the terminal
- Open WhatsApp on your phone
- Go to Settings > Linked Devices > Link a Device
- Scan the QR code displayed in the terminal
-
Authentication files will be automatically saved in
auth_info_baileys/directory
- Launch the ROS 2 node:
cd ~/ros2_ws
colcon build
source install/setup.bash
ros2 launch ros_line ros_agent.launch.py- Start the WhatsApp client:
cd ~/ros2_ws/src/ROSLine/ros-line-whatsapp-qr
npx tsx src/index.tsOnce both services are running, you can send natural language commands through WhatsApp:
- "Move the robot forward"
- "Turn left 90 degrees"
- "Stop the robot"
- "Get robot status"
- "Analize this rqt graph"
The system will interpret your commands and execute the corresponding ROS 2 actions.
The ROS 2 node exposes the following endpoint:
POST /api/chat_webservice- Main chat interface
- Text messages: Natural language commands
- Image messages: Visual input for robot perception
- Audio messages: Voice commands (transcribed to text)
ROSLine is available under the BSD-3-Clause license. See the LICENSE file for more details.