ROS / ROS2 Meets AI Agent: How ASI Biont Automates Robotics Navigation and Control

Introduction

Robotic systems built on the Robot Operating System (ROS) and its next-generation ROS2 are the backbone of modern automation—from warehouse robots and autonomous drones to research manipulators and agricultural bots. Yet integrating a ROS-based robot with an intelligent AI agent that can reason, adapt, and make decisions in real time has historically required custom middleware, heavy scripting, and weeks of development. ASI Biont changes that. This article explains how ASI Biont’s AI agent connects to ROS / ROS2 devices using WebSocket and ROS bridge, enabling natural-language-driven navigation, sensor fusion, and autonomous decision-making without writing a single line of integration code yourself.

Why Connect ROS / ROS2 to an AI Agent?

ROS and ROS2 are not just frameworks—they are ecosystems that handle hardware abstraction, message passing, and node coordination. However, they lack built-in high-level reasoning. An AI agent adds:
- Context-aware decision-making: The AI interprets sensor data (LiDAR, camera, IMU) and decides the next action.
- Natural language control: Operators can say "Navigate to the charging station avoiding obstacles" instead of hardcoding waypoints.
- Adaptive learning: The AI can log performance and adjust parameters (speed, obstacle threshold) based on outcomes.
- Multi-device orchestration: Coordinate multiple robots, or integrate a robot arm with a conveyor belt PLC via Modbus.

Connection Architecture: WebSocket + ROS Bridge

ASI Biont connects to ROS / ROS2 devices via WebSocket through the rosbridge_server package, which is the standard way to expose ROS topics and services to non-ROS applications. The AI agent uses the aiohttp or websockets library inside execute_python to establish a persistent WebSocket connection to the robot’s ROS bridge.

Why WebSocket?

Method Latency Ease of setup Security ROS-native?
WebSocket (rosbridge) Low (~10-50 ms) Very easy (one ROS package) TLS supported Yes
MQTT Medium Requires ROS-MQTT bridge Yes No
SSH + CLI High Simple but fragile SSH keys No
HTTP API High Requires custom node Basic No

WebSocket via rosbridge is the recommended approach because it is officially supported by ROS, has low latency, and supports both publishing and subscribing to any topic or service.

Concrete Use Case: Autonomous Navigation with a ROS2 Robot

Imagine you have a ROS2 robot with a LiDAR and a differential drive base (e.g., a TurtleBot3). Your goal: tell the robot in plain English to go to a specific point on the map, avoid obstacles, and report back when done.

Step 1: Prepare the Robot

  • Install rosbridge_server on the robot: sudo apt install ros-humble-rosbridge-server (or your ROS2 distro).
  • Launch the rosbridge WebSocket server: ros2 launch rosbridge_server rosbridge_websocket_launch.xml.
  • Ensure the robot’s navigation stack (Nav2) is running with a map.

Step 2: Connect ASI Biont to the Robot

In the ASI Biont chat, you simply describe:

"Connect to my ROS2 robot at IP 192.168.1.100, port 9090 via WebSocket. I want to send navigation goals to the /navigate_to_pose action server."

The AI agent automatically generates and runs a Python script using aiohttp and websockets inside execute_python. Here’s what the code looks like (generated by AI, not written by you):

import asyncio
import json
import websockets

async def send_nav_goal(robot_ip, port, x, y, theta):
    uri = f"ws://{robot_ip}:{port}"
    async with websockets.connect(uri) as ws:
        # Subscribe to /odom to get current pose (optional)
        sub_msg = {"op": "subscribe", "topic": "/odom", "type": "nav_msgs/msg/Odometry"}
        await ws.send(json.dumps(sub_msg))

        # Call action /navigate_to_pose
        goal_msg = {
            "op": "call_service",
            "service": "/navigate_to_pose",
            "args": {
                "pose": {
                    "header": {"frame_id": "map"},
                    "pose": {
                        "position": {"x": x, "y": y, "z": 0.0},
                        "orientation": {"x": 0.0, "y": 0.0, "z": theta, "w": 1.0}
                    }
                }
            }
        }
        await ws.send(json.dumps(goal_msg))

        # Wait for response
        async for msg in ws:
            data = json.loads(msg)
            if data.get("op") == "service_response":
                print(f"Goal result: {data['values']}")
                break

asyncio.run(send_nav_goal("192.168.1.100", 9090, 1.0, 2.0, 0.0))

The script runs in the ASI Biont sandbox with a 30-second timeout—sufficient for a single navigation command. The AI reads the output and confirms success or failure.

Step 3: Real-time Data Processing

While the robot moves, you can ask:

"Subscribe to /scan (LaserScan) and alert me if any obstacle is closer than 0.3 meters."

The AI generates a subscription script that checks each scan message and sends you a notification via the send_telegram or industrial_command tool if a threshold is breached.

Step 4: Automation Scenario

Combine multiple capabilities into an automated routine:
1. Morning patrol: Robot navigates to waypoints A, B, C every hour.
2. Conditional stop: If battery voltage (from /battery_state) drops below 11V, abort patrol and return to charger.
3. Logging: AI writes a daily report to a Google Sheet or local CSV.

You simply describe this scenario in the chat:

"Create an automation: every hour send the robot to waypoints [1,2,3] defined in the map. Check battery before each move. If low, go to charger. Log all actions to file /home/robot/patrol.log via SSH."

AI writes the complete integration script using paramiko for SSH file access and websockets for ROS control—all in seconds.

How ASI Biont Connects to Any Device

Under the hood, ASI Biont does not have a fixed set of supported devices. Instead, it uses execute_python—a universal sandbox where the AI writes custom Python code for each integration. The supported libraries cover:
- Industrial: pyserial, pymodbus, paho.mqtt, opcua-asyncio, paramiko, snap7, bac0, pycomm3, python-can
- Web: aiohttp, websockets, requests, httpx
- Data: json, csv, lxml, yaml
- AI/ML: transformers, torch, scikit-learn (for on-the-fly analysis)

You never need to wait for a developer to add a new device driver. Just describe the device and its parameters—IP, port, baud rate, API key—and the AI writes the code.

Benefits Over Traditional ROS Integration

Aspect Traditional approach With ASI Biont
Time to first goal Days (write ROS node, debug) Seconds (describe in chat)
Skill required ROS expert, Python None (natural language)
Flexibility Hard-coded logic AI rewrites on the fly
Error handling Manual try-catch AI logs and retries
Multi-device Custom middleware One chat session

Conclusion

Integrating a ROS / ROS2 robot with an AI agent opens the door to truly autonomous robotics—where you communicate with your robot as you would with a colleague. ASI Biont makes this integration instant, secure, and adaptable. No need to learn rosbridge protocol, no need to write a single line of Python. Just connect, describe, and control.

Ready to give your robot a brain? Try the integration today at asibiont.com. Describe your ROS device in the chat and watch the AI take control.

← All posts

Comments