ros2ai is a next-generation ROS 2 command line interface extension with OpenAI
see overview slide deck for more information.
- (Just for fun 😝)
- Getting answers against the questions directly without browsing, clicking and typing many times.
- Easy to use for everyone, especially for ROS 2 beginners and students who do not really know ros2cli.
- Multiple language support.
See how it works 🔥
demo.mp4
Supported ROS Distribution
Distribution | Supported | Note |
---|---|---|
Rolling Ridley | ✅ | Development / Mainstream Branch |
Jazzy Jalisco | ✅ | |
Iron Irwini | ✅ | |
Humble Hawksbill | ✅ |
see available images for tomoyafujita/ros2ai@dockerhub
docker run -it --rm -e OPENAI_API_KEY=$OPENAI_API_KEY tomoyafujita/ros2ai:humble
Note
OPENAI_API_KEY
environmental variable must be set
demo_docker.mp4
rolling
/jazzy
pip install openai --break-system-packages
Note
see [PEP 668 – Marking Python base environments as “externally managed”](PEP 668 – Marking Python base environments as “externally managed”) why --break-system-packages
is required.
iron
/humble
pip install openai
No released package is available, needs to be build in colcon workspace.
source /opt/ros/rolling/setup.bash
mkdir -p colcon_ws/src
cd colcon_ws/src
git clone https://github.com/fujitatomoya/ros2ai.git
cd ..
colcon build --symlink-install --packages-select ros2ai
ros2ai
requires OpenAI API key
export OPENAI_API_KEY='your-api-key-here'
Caution
Do not share or expose your OpenAI API key.
environmental variable | default | Note |
---|---|---|
OPENAI_MODEL_NAME | 'gpt-4o' | AI model to be used. |
OPENAI_ENDPOINT | 'https://api.openai.com/v1' | API endpoint URL. |
OPENAI_TEMPERATURE | 0.5 | OpenAI temperature |
Note
These are optional environmental variables. if not set, default value will be used.
status
to check OpenAI API key is valid.
root@tomoyafujita:~/docker_ws/ros2_colcon# ros2 ai status -v
----- api_model: gpt-4
----- api_endpoint: https://api.openai.com/v1
----- api_token: None
As an artificial intelligence, I do not have a physical presence, so I can't be "in service" in the traditional sense. But I am available to assist you 24/7.
[SUCCESS] Valid OpenAI API key.
query
to ask any questions to ROS 2 assistant.
root@tomoyafujita:~/docker_ws/ros2_colcon# ros2 ai query "Tell me how to check the available topics?"
To check the available topics in ROS 2, you can use the following command in the terminal:
---
ros2 topic list
---
After you enter this command, a list of all currently active topics in your ROS2 system will be displayed. This list includes all topics that nodes in your system are currently publishing to or subscribing from.
exec
that ROS 2 assistant can execute the appropriate command based on your request.
root@tomoyafujita:~/docker_ws/ros2_colcon# ros2 ai exec "give me all nodes"
/talker
root@tomoyafujita:~/docker_ws/ros2_colcon# ros2 ai exec "what topics available"
/chatter
/parameter_events
/rosout
root@tomoyafujita:~/docker_ws/ros2_colcon# ros2 ai exec "give me detailed info for topic /chatter"
Type: std_msgs/msg/String
Publisher count: 1
Subscription count: 0
- Japanese (could be any language ❓)
root@tomoyafujita:~/docker_ws/ros2_colcon# ros2 ai query "パラメータのリスト取得方法を教えて"
ROS 2のパラメータリストを取得するには、コマンドラインインターフェース(CLI)を使います。具体的には、次のコマンドを使用します:
---code
ros2 param list
---
このコマンドは、現在動作しているすべてのノードのパラメーターをリストアップします。特定のノードのパラメータだけを見たい場合には、以下のようにノード名を指定することもできます。
---code
ros2 param list /node_name
---
このようにして、ROS2のパラメータリストの取得を行うことが可能です。なお、上述したコマンドはシェルから直接実行してください。
Special thanks to OpenAI API 🌟🌟🌟