Skip to content

Software

ros2ai

From github.com/fujitatomoya/ros2ai (opens in a new tab)

  • Middleware
  • Tool
  • Apache-2.0

A ROS 2 command line extension that lets users ask questions and run ROS 2 commands in plain language, using OpenAI or a local Ollama model.

Facts

GitHub stars
342read on 29 Nov 2026
Last update
26 Nov 2026Newest commit on rolling
Maintenance
Activea commit in the last 90 days
Difficulty
Beginner
Hardware it needs, as the project states it
A computer that runs a supported ROS 2 distribution (Rolling, Kilted, Jazzy or Humble), plus either an OpenAI API key or a running Ollama service.

Checked on GitHub on 29 Nov 2026.

Licenses

Code
Apache-2.0 (opens in a new tab)

Read by Robotheca from LICENSE (opens in a new tab) (Apache-2.0) at commit 28adbbc (opens in a new tab), on 29 Nov 2026.

Commercial use
Yes

At a glance

What it is
  • Adds an 'ros2 ai' command with status, query and exec subcommands to the ROS 2 command line.
  • The query subcommand answers ROS 2 questions, including in languages other than English.
  • The exec subcommand runs the appropriate ROS 2 command based on a natural-language request.
  • Uses the OpenAI Python API, and Ollama can replace OpenAI as the backend through a compatible endpoint.
  • Model, endpoint and temperature are set through environment variables, with defaults such as gpt-4o for OpenAI.
  • Ships as a binary package, a Docker image, or can be built from source in a colcon workspace.

Robotheca's summary of the project's documents, not the creator's words.

Robots on Robotheca
No robot on Robotheca uses it yet.
Licence
Apache-2.0. Commercial use: Yes. Where it was read
Install
In the creator's words: The project's website (opens in a new tab)
Maintenance
Active, last commit on 26 Nov 2026.

Use it

How to install it, in the creator's words: The project's website (opens in a new tab)

Robotheca doesn't review code. Read it before running it.

Files and versions

Facts read at commit 28adbbc

Robotheca read the repository at two versions: the summary at c7e3950 and the facts and the README at 28adbbc (read on 29 Nov 2026).

Robotheca never hosts the code: each link goes to the creator's own page.

The README

The creator's own README, copied as written: README.md by @fujitatomoya, at commit 28adbbc, under Apache-2.0 (opens in a new tab). The original on GitHub (opens in a new tab).

Read the README here

(opens in a new tab) (opens in a new tab) (opens in a new tab) (opens in a new tab) (opens in a new tab) (opens in a new tab) (opens in a new tab) (opens in a new tab) (opens in a new tab) (opens in a new tab)

ros2ai 🤖

ros2ai (opens in a new tab) is a next-generation ROS 2 (opens in a new tab) command line interface extension with OpenAI (opens in a new tab), Anthropic (opens in a new tab) and Ollama (opens in a new tab).

see overview slide deck (opens in a new tab) for more information.

ros2ai Architecture Overview

Motivation
Demo 🖥️

See how it works 🔥

ros2ai demo

(Full quality video: ros2ai_demo.mp4 (opens in a new tab))

Supported ROS Distribution (opens in a new tab)
DistributionSupportedNote
Rolling Ridley✅Development / Mainstream Branch
Lyrical Luth✅
Kilted Kaiju✅
Jazzy Jalisco✅
Humble Hawksbill✅
Installation
Binary

ros2ai is released for every supported distribution, replace <distro> with rolling, lyrical, kilted, jazzy or humble.

apt install ros-<distro>-ros2ai
Docker Container

see available images for tomoyafujita/ros2ai@dockerhub (opens in a new tab)

docker run -it --rm --net=host -e ROS2AI_API_KEY=$ROS2AI_API_KEY -e ROS2AI_ENDPOINT=$ROS2AI_ENDPOINT -e ROS2AI_MODEL_NAME=$ROS2AI_MODEL_NAME tomoyafujita/ros2ai:rolling

[!NOTE] ROS2AI_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.

Required Package
Build

To use the latest development version, build it in the 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 any LLM service that provides the compatible API with OpenAI, such as Anthropic and Ollama. User need to choose which of them is used by ros2ai as following configuration, otherwise it falls back to use OpenAI.

Optional
environmental variabledefaultNote
ROS2AI_API_KEYNone.Required for OpenAI and Anthropic
ROS2AI_MODEL_NAME'gpt-5'AI model to be used. e.g) claude-opus-5-5 (Anthropic), llama3.1 (Ollama)
ROS2AI_ENDPOINT'https://api.openai.com/v1 (opens in a new tab)'API endpoint URL. e.g) https://api.anthropic.com/v1/ (opens in a new tab) (Anthropic), http://127.0.0.1:11434/v1 (opens in a new tab) (Ollama)
ROS2AI_TEMPERATURE1.0OpenAI temperature (opens in a new tab), 0.0 - 1.0 for Anthropic
ROS2AI_ROLE_SYSTEMbuilt-in system roleSystem role for the prompt, {} is replaced with the ROS distribution name
ROS2AI_DOCS_CACHE'~/.cache/ros2ai/docs'Directory caching the ROS 2 documentation (opens in a new tab) sources per distribution
ROS2AI_CONTEXT_LIMIT16000Context limit of the session in estimated tokens, the oldest requests are dropped beyond it. Lower it for the local models with a small context window (e.g Ollama num_ctx)
ROS2AI_SESSION_FILE~/.local/state/ros2ai/session.jsonSession file to continue the previous requests with --continue ($XDG_STATE_HOME is honored)

[!NOTE] These are optional environmental variables. if not set, default value will be used. The legacy OPENAI_API_KEY, OPENAI_MODEL_NAME, OPENAI_ENDPOINT, OPENAI_TEMPERATURE and OPENAI_ROLE_SYSTEM are still honored when the corresponding ROS2AI_* variable is not set.

The following command line options prevail over the environmental variables, see ros2 ai -h for the complete list.

optionNote
-m, --model <model>LLM model, prevails over ROS2AI_MODEL_NAME
-u, --url <url>LLM API endpoint URL, prevails over ROS2AI_ENDPOINT
-t, --token <token>Maximum number of tokens of the completion (default: no limit)
-r, --role <role>System role for the prompt, prevails over ROS2AI_ROLE_SYSTEM
-y, --yesExecute the commands that change the system without confirmation
--dry-runPrint the commands that change the system instead of executing them
-c, --continueContinue the previous session with the request, see Session
-n, --nostreamDisable the streaming of the answer
-T, --tracePrint the trace of the request: the tool calls, the executed commands and their output
-v, --verbosePrint the configuration, system role, tool calls and results (implies --trace)
-s, --statusCheck the LLM API status and configuration
-l, --list-modelsPrint the available models on the endpoint
Examples
Basics

ros2 ai has no sub-command, just pass your question or request: ros2 ai "<request>". The ROS 2 assistant decides by itself whether to answer the question or to operate the ROS 2 system on your behalf.

  • configuration

    ### OpenAI configuration
    export ROS2AI_API_KEY=<YOUR_API_KEY>
    export ROS2AI_MODEL_NAME=gpt-5
    export ROS2AI_ENDPOINT=https://api.openai.com/v1
    
    ### Anthropic configuration
    export ROS2AI_API_KEY=<YOUR_API_KEY>
    export ROS2AI_MODEL_NAME=claude-opus-5-5
    export ROS2AI_ENDPOINT=https://api.anthropic.com/v1/
    
    ### Ollama
    unset ROS2AI_API_KEY
    export ROS2AI_MODEL_NAME=llama3.1
    export ROS2AI_ENDPOINT=http://127.0.0.1:11434/v1
    
  • --status (-s) to check API key and configuration are valid, --list-models (-l) prints the available models.

    root@tomoyafujita:~/docker_ws/ros2_colcon# ros2 ai -s -v
    ----- api_model: gpt-5
    ----- api_endpoint: https://api.openai.com/v1
    ----- api_token: None
    ----- api_temperature: 1.0
    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 API key.
    [SUCCESS] Retrieved list of models.
    
  • ask any questions to ROS 2 assistant.

    root@tomoyafujita:~/docker_ws/ros2_colcon# ros2 ai "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.
    
  • request ROS 2 assistant to operate the ROS 2 system.

    The assistant calls the ros2cli (opens in a new tab) tools (ros2 node, ros2 topic, ros2 service, ros2 param and so on) via tool calling (opens in a new tab), observes the result and iterates until the request is done. Every command is executed without shell, so that the model can only run ros2 commands. The commands that change the system are printed before they are executed, the read-only commands and their output are not printed unless --trace (-T) is given, the answer is what you get.

    Tool policyCommandsBehavior
    read-onlynode, topic list/info/echo, service list, param get ...executed automatically
    mutatingtopic pub, service call, param set, action send_goal ...asks for confirmation, -y / --yes skips it
    long-runningrun, launch, bag record ...asks for confirmation, runs in foreground until Ctrl-C
    root@tomoyafujita:~/docker_ws/ros2_colcon# ros2 ai "give me all topics"
    Here are all the available topics in your ROS 2 system:
    | Topic | Message Type |
    |-------|-------------|
    | `/chatter` | `std_msgs/msg/String` |
    | `/parameter_events` | `rcl_interfaces/msg/ParameterEvent` |
    | `/rosout` | `rcl_interfaces/msg/Log` |
    That's 3 topics in total. Let me know if you'd like to inspect any of them further (e.g., see publishers/subscribers, echo a message, or publish to one).
    root@tomoyafujita:~/docker_ws/ros2_colcon# ros2 ai "publish hello message on /chatter topic" -y
    [ros2ai]: ros2 topic pub --once -w 0 /chatter std_msgs/msg/String '{data: hello}'
    Done — I published the message `hello` on `/chatter` (`std_msgs/msg/String`). Note: the topic currently shows 0 subscribers, so no node received it. Let me know if you want me to start a listener (e.g., `demo_nodes_cpp`'s `listener`) first.
    

    Without -y, the assistant asks Execute 'ros2 topic pub --once -w 0 /chatter std_msgs/msg/String '{data: hello}''? [y/N]: before publishing.

    --trace (-T) prints the trace of the request to see how the assistant completes it: the tool calls, the executed commands and their output.

    root@tomoyafujita:~/docker_ws/ros2_colcon# ros2 ai "give me all topics" -T
    [ros2ai]: ros2 topic list -t
    /chatter [std_msgs/msg/String]
    /parameter_events [rcl_interfaces/msg/ParameterEvent]
    /rosout [rcl_interfaces/msg/Log]
    Here are all the available topics in your ROS 2 system:
    ...
    root@tomoyafujita:~/docker_ws/ros2_colcon# ros2 ai "publish hello message on /chatter topic" -y -T
    [ros2ai]: ros2 topic info -v /chatter
    Type: std_msgs/msg/String
    ...
    Subscription count: 0
    [ros2ai]: ros2 topic pub --once -w 0 /chatter std_msgs/msg/String '{data: hello}'
    publisher: beginning loop
    publishing #1: std_msgs.msg.String(data='hello')
    Done — I published the message `hello` on `/chatter` (`std_msgs/msg/String`).
    ...
    

    --dry-run prints the commands that change the system as candidates instead of executing them (read-only commands are still executed, so that the assistant can decide the command), -v prints the system role, the tool calls and results. The answers are streamed as they arrive, -n disables the streaming (the raw completions are printed with -nv).

    Composite tools answer a diagnostic question with several ros2 commands in a single tool call, instead of one completion per command. get_node_status combines node info, lifecycle get, param list and topic hz of the published topics, get_topic_status combines topic info -v, topic hz and topic echo --once. The result is a YAML summary including the warnings found (lifecycle state not active, idle publisher, incompatible QoS and so on), with --trace the commands are printed indented under the tool call.

    root@tomoyafujita:~/docker_ws/ros2_colcon# ros2 ai "is /lc_talker healthy?" -T
    [ros2ai]: get_node_status(node=/lc_talker)
    [ros2ai]:   ros2 node info /lc_talker
    [ros2ai]:   ros2 lifecycle get /lc_talker
    [ros2ai]:   ros2 param list /lc_talker
    node: /lc_talker
    found: true
    lifecycle: unconfigured
    publishers:
    - topic: /lc_talker/transition_event
      type: lifecycle_msgs/msg/TransitionEvent
      hz: not measured
    subscribers: {}
    service_servers: {}
    service_clients: {}
    action_servers: {}
    action_clients: {}
    parameters:
    - use_sim_time
    warnings:
    - lifecycle state is 'unconfigured', not active
    No — `/lc_talker` is not healthy. It's a **lifecycle node stuck in the `unconfigured` state**:
    ...
    So the node exists and is alive on the graph, but it has never been transitioned to an active state. If you'd like, I can transition it to `configured` → `active` via the lifecycle services (`/lc_talker/change_state`), or list the lifecycle service details first.
    root@tomoyafujita:~/docker_ws/ros2_colcon# ros2 ai "what is the status of the /chatter topic?" -T
    [ros2ai]: get_topic_status(topic=/chatter)
    [ros2ai]:   ros2 topic info -v /chatter
    [ros2ai]:   ros2 topic hz /chatter
    [ros2ai]:   ros2 topic echo --once /chatter
    topic: /chatter
    found: true
    type: std_msgs/msg/String
    publishers:
    - node: /talker
      reliability: RELIABLE
      durability: VOLATILE
    subscribers:
    - node: /listener
      reliability: RELIABLE
      durability: VOLATILE
    hz: 1.0
    sample: 'data: ''Hello World: 108'''
    warnings: []
    The `/chatter` topic is healthy and active:
    ...
    Everything looks normal — the topic is being published at 1 Hz and received without issues.
    

    [!NOTE] If the endpoint or the model does not support tool calling, the assistant answers the request without tools, nothing is executed.

Documentation Lookup

The assistant can look up the official ROS 2 documentation (opens in a new tab) of the running distribution (ROS_DISTRO) with the documentation tools, so that the answers about the ROS 2 concepts, tutorials, tools and APIs are grounded on the documentation of your distribution, and cite the page. search_ros2_docs searches the pages, read_ros2_docs reads a page, with --trace the pages found are printed under the tool call.

The documentation sources (ros2/ros2_documentation (opens in a new tab), one branch per distribution) are downloaded once into ~/.cache/ros2ai/docs/<distro> (about 5MB) on the first lookup, and refreshed when older than a week. The lookup works offline afterwards, without the cache the assistant answers from its own knowledge.

root@tomoyafujita:~/docker_ws/ros2_colcon# ros2 ai "what is the difference between reliable and best effort QoS?" -T
[ros2ai]: search_ros2_docs(query='quality of service reliability reliable best effort', limit=3)
[ros2ai]:   downloaded the ROS 2 rolling documentation to /root/.cache/ros2ai/docs/rolling
[ros2ai]:   https://docs.ros.org/en/rolling/ROS-Framework/interfaces/topics/About-Quality-of-Service-Settings.html
[ros2ai]:   https://docs.ros.org/en/rolling/ROS-Framework/interfaces/topics/Working-with-topics/Quality-of-Service.html
[ros2ai]:   https://docs.ros.org/en/rolling/ROS-Framework/interfaces/topics/Working-with-topics/Configuring-QoS-Overrides.html
[ros2ai]: read_ros2_docs(page=ROS-Framework/interfaces/topics/About-Quality-of-Service-Settings)
[ros2ai]:   https://docs.ros.org/en/rolling/ROS-Framework/interfaces/topics/About-Quality-of-Service-Settings.html
[ros2ai]: read_ros2_docs(page=ROS-Framework/interfaces/topics/About-Quality-of-Service-Settings, offset=3500)
[ros2ai]:   https://docs.ros.org/en/rolling/ROS-Framework/interfaces/topics/About-Quality-of-Service-Settings.html
**Reliable and best effort are the two values of the QoS reliability policy.**

- **Best effort** tries to deliver each sample but may lose it if the network is not robust. It does not retry, so it has lower latency and overhead. It is closest to UDP. The built-in **sensor data** profile uses it, because the latest reading matters more than receiving every reading.
- **Reliable** guarantees that samples are delivered and may retry several times. It is closest to TCP, but the docs note it is still implemented over UDP. It is the default for publishers and subscriptions, and also for services and parameters.

**Compatibility.** A subscription asks for a minimum quality and a publisher offers a maximum. A connection is only made if the request is not stricter than the offer:
...
A reliable subscription on a best-effort publisher gets no messages. This is a common reason a topic looks silent, for example with a camera or lidar driver that publishes best effort.

Source: https://docs.ros.org/en/rolling/ROS-Framework/interfaces/topics/About-Quality-of-Service-Settings.html
Session

ros2 ai keeps the context of the session, so that the follow-up requests can refer to the previous ones (e.g it).

  • ros2 ai without a request starts the interactive session, the context is kept until the session ends with exit or Ctrl-D. /clear forgets the context, Ctrl-C aborts the request in progress.

    root@tomoyafujita:~/docker_ws/ros2_colcon# ros2 ai
    ros2ai interactive session (model: gpt-5, endpoint: https://api.openai.com/v1)
    Type /help for the commands, exit or Ctrl-D to end the session.
    ros2ai> do we have /chatter topic?
    Yes, the /chatter topic (std_msgs/msg/String) is available.
    ros2ai> subscribe it
    Subscribed to /chatter and received the message 'Hello World: 12'.
    ros2ai> exit
    
  • --continue (-c) continues the previous session with a single request, every request is saved to the session file.

    root@tomoyafujita:~/docker_ws/ros2_colcon# ros2 ai "do we have /chatter topic?"
    Yes, the /chatter topic (std_msgs/msg/String) is available.
    root@tomoyafujita:~/docker_ws/ros2_colcon# ros2 ai -c "subscribe it"
    Subscribed to /chatter and received the message 'Hello World: 25'.
    

[!NOTE] The messages of the previous requests are sent with every request, so the token consumption grows with the session. The oldest requests are dropped when the estimated number of tokens exceeds ROS2AI_CONTEXT_LIMIT, or when the endpoint reports that the context length is exceeded.

Multiple Language
  • Japanese (could be any language ❓)

    root@tomoyafujita:~/docker_ws/ros2_colcon# ros2 ai "パラメータのリスト取得方法を教えて"
    ROS 2のパラメータリストを取得するには、コマンドラインインターフェース(CLI)を使います。具体的には、次のコマンドを使用します:
    
    ---code
    ros2 param list
    ---
    
    このコマンドは、現在動作しているすべてのノードのパラメーターをリストアップします。特定のノードのパラメータだけを見たい場合には、以下のようにノード名を指定することもできます。
    
    ---code
    ros2 param list /node_name
    ---
    
    このようにして、ROS2のパラメータリストの取得を行うことが可能です。なお、上述したコマンドはシェルから直接実行してください。
    
Reference

Image (opens in a new tab) (opens in a new tab)

Special thanks to OpenAI API (opens in a new tab), Anthropic API (opens in a new tab) and Ollama (opens in a new tab) 🌟🌟🌟

Robotheca lists software as a reference: nothing is hosted or run here, and every fact links to where it was read.