Skip to content

endeavorXx/Webots-Nao-ROS-Simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ModuBot: Modular LLM-Driven Multi-Persona Robot Framework

Demo Videos: Watch demo videos on Google Drive

ROS2 Humble Webots Python 3.10+ License

A modular, extensible ROS 2 framework for controlling humanoid robots with LLM-powered conversation, persona-aware behavior, and synchronized gesture-speech actions. Demonstrated using the Webots simulator with two humanoid robots: NAO and Robotis OP2.


🎯 Key Features

  • LLM-Powered Conversations β€” Natural dialogue driven by large language models with persona-specific behavior
  • Multi-Persona Support β€” Easily switch between personalities (Angry Cab Driver, Polite Teacher, Polite Receptionist, etc.)
  • Semantic Action Matching β€” Context-appropriate gestures selected via embedding-based intent matching
  • Gesture-Speech Synchronization β€” Dynamic voice rate adjustment to sync actions with speech duration
  • Anticipatory Action Module β€” Learns from failure to adapt action selection for short dialogues
  • Highly Modular Design β€” Identical project structure across robots; only joint names and tuning differ

πŸ—οΈ Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                              ROBOT BRAIN                                    β”‚
β”‚                                                                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”‚
β”‚  β”‚   VAD   │───▢│   STT   │───▢│   LLM   │───▢│ ActionSelect β”‚              β”‚
β”‚  β”‚ (Silero)β”‚    β”‚ (Riva)  β”‚    β”‚ (Llama) β”‚    β”‚ (Embeddings) β”‚              β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚
β”‚       β–²                              β”‚               β”‚                      β”‚
β”‚       β”‚                              β–Ό               β–Ό                      β”‚
β”‚   [Microphone]                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€--┐             β”‚
β”‚                                β”‚   TTS   β”‚    β”‚  Publish to   β”‚             β”‚
β”‚                                β”‚ (Riva)  β”‚    β”‚/perform_actionβ”‚             β”‚
β”‚                                β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜    └──────┬──────---             β”‚
β”‚                                     β”‚                β”‚                      β”‚
β”‚                                     β–Ό                β”‚                      β”‚
β”‚                               [Speaker]              β”‚                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                       β”‚
                           ROS 2 Topic: /perform_actionβ”‚
                                                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                              ROBOT DRIVER                                       β”‚
β”‚                                                                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”‚
β”‚  β”‚ Action Callback│───▢│ Animation Engine│───▢│  Webots Motors  β”‚              β”‚
β”‚  β”‚ (ROS Subscriber)β”‚   β”‚ (Sine Wave Math)β”‚    β”‚ (Joint Control) β”‚              β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ€– Supported Robots

We demonstrate the framework with two humanoid robots. The modular design means the project structure is identical β€” only robot names, joint configurations, and action tuning differ.

Robot Description Documentation
SoftBank NAO Popular humanoid research robot πŸ“– NAO Controller README
Robotis OP2 Open-source humanoid platform πŸ“– OP2 Controller README

πŸ“Š Evaluation Metrics

Comprehensive evaluation conducted over 10 runs, each with 20 conversation messages, testing 3 personas (Angry Cab Driver, Polite Teacher, Polite Receptionist).

Metric Score Description
Persona Fidelity 90% Robot maintains persona-consistent language, tone, and behavior across interactions
Action Grounding & Synchronization 83% Β± 2% Correct action retrieval + well-timed gesture–speech synchronization. Voice rate dynamically adjusted based on words-to-speak vs action duration
Emotional TTS Quality 0.87 Β± 0.03 High emotional expressiveness (Whisper Large + Magpie)
Interaction Latency 3.2 Β± 0.3 sec End-to-end STT β†’ LLM β†’ [TTS + Action] pipeline latency (15-20 words). Includes cloud API overhead
HRI User Study 4.1 Β± 0.5 / 5 MOS-equivalent rating from 20 participants for likeability, clarity, and perceived intelligence
Robustness & Reliability 81% Β± 5% Recovery from uncertainty/noise; avoidance of unsafe motions. Includes anticipatory module that learns from failure to adapt action selection for short dialogues

πŸ”§ Modularity & Extensibility

The framework is designed for rapid adaptation and extension:

Task Effort Details
Add New Persona ~20 Β± 5 minutes JSON-only configuration
Add New Action ~30 Β± 3 LOC Action-specific driver control implementation
Add New Robot 150–200 LOC (~30-40 min) Previously required 8-10 hours of extensive effort per robot

πŸš€ Why ROS 2?

  • Wide Community Support β€” Extensive documentation, tutorials, and active development
  • Robot Agnostic β€” Framework adapts to any humanoid robot with ROS 2 support
  • Modular by Design β€” Nodes communicate via topics, enabling flexible system composition
  • Simulation Ready β€” Seamless integration with Webots and other simulators

πŸ“ Directory Structure

.
β”œβ”€β”€ ReadMe.md                    # This file
β”œβ”€β”€ my_nao_controller/           # NAO Robot Controller Package
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   └── config.py            # API keys, paths, parameters
β”‚   β”œβ”€β”€ docs/
β”‚   β”‚   └── README.md            # Detailed NAO documentation
β”‚   β”œβ”€β”€ launch/
β”‚   β”‚   └── robot_launch.py      # ROS 2 launch file
β”‚   β”œβ”€β”€ my_nao_controller/
β”‚   β”‚   β”œβ”€β”€ nao_brain.py         # AI node (STT β†’ LLM β†’ TTS β†’ Action)
β”‚   β”‚   β”œβ”€β”€ nao_driver.py        # Animation engine (Webots controller)
β”‚   β”‚   β”œβ”€β”€ nao_action_vocab.py  # Action vocabulary definitions
β”‚   β”‚   β”œβ”€β”€ personas.py          # Persona definitions
β”‚   β”‚   β”œβ”€β”€ generate_action_embeddings.py
β”‚   β”‚   └── action_embeddings.pkl
β”‚   β”œβ”€β”€ resource/
β”‚   β”‚   └── nao.urdf
β”‚   β”œβ”€β”€ worlds/
β”‚   β”‚   └── nao_world.wbt
β”‚   β”œβ”€β”€ package.xml
β”‚   β”œβ”€β”€ setup.py
β”‚   └── run.py
β”‚
└── op2_controller/              # Robotis OP2 Controller Package
    β”œβ”€β”€ config/
    β”‚   └── config.py
    β”œβ”€β”€ docs/
    β”‚   └── README.md            # Detailed OP2 documentation
    β”œβ”€β”€ launch/
    β”‚   └── robot_launch.py
    β”œβ”€β”€ op2_controller/
    β”‚   β”œβ”€β”€ op2_brain.py
    β”‚   β”œβ”€β”€ op2_driver.py
    β”‚   β”œβ”€β”€ op2_action_vocab.py
    β”‚   β”œβ”€β”€ personas.py
    β”‚   β”œβ”€β”€ generate_action_embeddings.py
    β”‚   └── action_embeddings.pkl
    β”œβ”€β”€ resource/
    β”‚   └── op2.urdf
    β”œβ”€β”€ worlds/
    β”‚   └── op2_world.wbt
    β”œβ”€β”€ package.xml
    β”œβ”€β”€ setup.py
    └── run.py

πŸ› οΈ System Requirements

Component Version
OS Ubuntu 22.04 LTS (Jammy Jellyfish)
ROS 2 Humble Hawksbill
Simulator Webots R2023b or newer
Python 3.10+

πŸ“š Getting Started

  1. Clone the repository into your ROS 2 workspace:

    cd ~/ros2_ws/src
    git clone https://github.com/endeavorXx/ROS-Nao-Simulation-in-Webots.git
  2. Follow robot-specific instructions:

  3. Build the workspace:

    cd ~/ros2_ws
    colcon build
    source install/setup.bash

πŸ“– Documentation

For detailed setup, configuration, and usage instructions, refer to the robot-specific documentation:


πŸ“„ License

This project is licensed under the MIT License.


πŸ™ Acknowledgments

Built with ROS 2 Humble, Webots, and various open-source AI/ML libraries including Silero VAD, NVIDIA Riva, and Sentence Transformers.

Webots-Nao-Simulation

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages