Skip to content

ros-ai/ros2_llm_if

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TurtleSim ChatGPT

This demo demonstrates how ChatGPT can be used to call into ROS services, specifically services in turtlesim.

ROS is interfaced via WebSockets through rosbridge_suite. ChatGPT:

  • Calls into WebSockets
  • Does not execute any code on your machine
  • Is given knowledge about the API via api.json

Prompt:

Move the turtle left by 2, then rotate 180 degrees, and move back to (5, 5). Finally, spawn a turtle named turtle2 at (10, 10) and remove turtle1.

Result:

Installation

Run the Demo

  1. Run turtlesim
source /opt/ros/humble/setup.bash # source your ROS distribution
ros2 run turtlesim turtlesim_node
  1. Run rosbridge_server
source /opt/ros/humble/setup.bash # source your ROS distribution
ros2 launch rosbridge_server rosbridge_websocket_launch.xml
  1. Prompt OpenAI's GPT models
python main.py \
    --prompt "\
        Move the turtle left by 2, then rotate 180 degrees, and move back to (5, 5).\
        Finally, spawn a turtle named turtle2 at (10, 10) and remove turtle1.\
    " \
    --key your_key

You should see the turtle move.

Notes

This repository is just a proof of concept and it is rather slow. It, however, demonstrates how such a system could work more broadly across ROS.

Why roslibpy and rosbridge_suite? Why not just execute Python code?
Operating ROS services through WebSockets limits GPT's access to your system. It futher relieves users from ROS dependencies.
Where to go from here?
Play around and have ChatGPT call into any desired services.
Why not action clients instead of services?
By the time of this writing, action clients are not supported via rosbridge_suite yet, refer to RobotWebTools/rosbridge_suite#697.

About

ROS 2 Large Language Model Interface

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages