fujitatomoya / ros2ai

ros2ai is a next-generation ROS 2 command line interface extension with LLMs
https://github.com/fujitatomoya/ros2ai
Apache License 2.0
216 stars 12 forks source link

humble iron jazzy rolling

ros2ai 🤖

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

see overview slide deck for more information.

ros2ai Architecture Overview

Motivation

Demo 🖥️

See how it works 🔥

https://github.com/fujitatomoya/ros2ai/assets/43395114/78a0799b-40e3-4dc8-99cb-488994e94769

Supported ROS Distribution

Distribution Supported Note
Rolling Ridley Development / Mainstream Branch
Jazzy Jalisco
Iron Irwini
Humble Hawksbill

Installation

Docker Container

see available images for tomoyafujita/ros2ai@dockerhub

docker run -it --rm --net=host -e OPENAI_API_KEY=$OPENAI_API_KEY tomoyafujita/ros2ai:humble

[!NOTE] OPENAI_API_KEY environmental variable is not required if using Ollama. And it is expecting that Ollama runs on the host system mostly, so that container is bound to the host network interface.

https://github.com/fujitatomoya/ros2ai/assets/43395114/2af4fd44-2ccf-472c-9153-c3c19987dc96

Required Package

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

As described in overview diagram, ros2ai uses only OpenAI Python API but backend implementation can be replaced with Ollama that provides the compatible API with OpenAI. User need to choose either of them is used by ros2ai as following configuration, otherwise it falls back to use OpenAI.

Optional

environmental variable default Note
OPENAI_API_KEY None. Required for OpenAI
OPENAI_MODEL_NAME 'gpt-4o' AI model to be used. e.g) llama3.1 (Ollama)
OPENAI_ENDPOINT 'https://api.openai.com/v1' API endpoint URL. e.g) http://localhost:11434/v1 (Ollama)
OPENAI_TEMPERATURE 0.5 OpenAI temperature

[!NOTE] These are optional environmental variables. if not set, default value will be used.

Examples

Basics

Multiple Language

Reference

Special thanks to OpenAI API and Ollama 🌟🌟🌟