Skip to content

ros2ai is a sub-command for ros2cli to ask AI.

License

Notifications You must be signed in to change notification settings

dhanushguduru/ros2ai

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ros2ai 🤖

ros2ai is a next-generation ROS 2 command line interface extension with OpenAI

Motivation

  • (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.

Demo 🖥️

See how it works 🔥

demo.mp4

Platform

Operating System

Important

Verified on Ubuntu22.04 only, other platform would also work.

Distribution Supported Note
Rolling Ridley Development / Mainstream Branch
Iron Irwini W.I.P (No distro specific dependency, should work.)
Humble Hawksbill W.I.P (No distro specific dependency, should work.)

Installation

Required Package

pip install openai

Note

Should have all required packages described in package.xml

Build

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

Usage

Prerequisites

export OPENAI_API_KEY='your-api-key-here'

Note

There are more tuning parameters and environmental variables to be described.

Examples

Basics

  • 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

Multiple Language

  • 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のパラメータリストの取得を行うことが可能です。なお、上述したコマンドはシェルから直接実行してください。

Reference

Special thanks to OpenAI API 🌟🌟🌟

About

ros2ai is a sub-command for ros2cli to ask AI.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%