Skip to content

amjack0/RobotChatGPTControl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Robot Control with ChatGPT/Gemini & PyBullet


This project demonstrates how to control a simulated differential drive robot using natural language commands, powered by ChatGPT/Gemini large language model. The robot simulation is handled by the PyBullet physics engine.

Features

  • Natural Language Control: Speak or type commands like "move forward," "turn left," or "stop."
  • ChatGPT/Gemini Integration: Leverages the ChatGPT/Gemini API to interpret diverse human commands into robot-understandable actions.
  • PyBullet Simulation: Provides a lightweight and robust physics-based simulation environment for a custom differential drive robot.
  • Modular Design: Easily adaptable to more complex robot models (e.g., quadrupeds, humanoids) by modifying only the robot simulation module.

Setup & Installation

  1. Clone this repository:

    git clone [https://github.com/your-username/RobotChatGPTControl.git](https://github.com/your-username/RobotChatGPTControl.git) # Replace with your repo URL
    cd RobotChatGPTControl
  2. Create and activate a Python virtual environment:

    python -m venv venv
    .\venv\Scripts\activate # On Windows
    # source venv/bin/activate # On Linux/macOS
  3. Install dependencies:

    pip install google-generativeai pybullet python-dotenv numpy
  4. Set up your ChatGPT/Gemini API Key:

    • Obtain an API key from the Google Cloud Console.
    • Create a file named .env in the root of this project.
    • Add your API key to the .env file:
      GOOGLE_API_KEY="your_gemini_api_key_here"
      
      or
      OPENAI_API_KEY="your_chatgpt_api_key_here"
      

Running the Simulation

  1. Activate your virtual environment (if not already active):

    Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
    .\venv\Scripts\activate # On Windows
  2. Run the main script:

    python main.py
  3. A PyBullet simulation window will open. In your terminal, you can now type commands like "move forward a little," "turn right sharply," or "stop."

Project Structure

  • main.py: The entry point, orchestrating communication between the user, ChatGPT/Gemini, and the robot simulator.
  • chat_interface.py: Handles API calls to ChatGPT/Gemini and translates natural language into structured robot commands.
  • robot_simulator.py: Manages the PyBullet simulation, loads the robot model, and executes received commands.
  • robots/: Contains the URDF (Universal Robot Description Format) files for the simulated robots (e.g., simple_diff_drive.urdf).

Feel free to explore and modify the code to experiment with different robot behaviors or integrate other simulation environments!

About

This project demonstrates how to control a simulated differential drive robot using ChatGPT/Gemini.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages