From ROS to Real-Time Control: How ASI Biont AI Agent Integrates with ROS/ROS2 Robots

The Problem: ROS Robots Are Powerful, But Hard to Operate Remotely

If you've ever worked with a ROS (Robot Operating System) robot — whether it's a TurtleBot3, a RoboMaster, a custom autonomous rover, or an industrial manipulator — you know the pain. You write launch files, configure nodes, set up topics and services, and then you're stuck debugging over SSH or a local RViz session. Want to change a navigation goal while you're at lunch? Sorry, you need to be on the same network, or you have to build a custom web dashboard. Want the robot to alert you when its battery drops below 20%? You'll need to write a script, set up a Telegram bot, and manage tokens. Want to analyze LiDAR data for anomalies? That's another whole pipeline.

ROS2 improved things with DDS discovery and better security, but the core workflow remains the same: you, the developer, must write every integration piece yourself. That's time-consuming, error-prone, and keeps robots locked inside labs and workshops.

The Solution: ASI Biont AI Agent as Your Robot's Remote Brain

ASI Biont is an AI agent that connects to any device — including ROS/ROS2 robots — through a chat interface. Instead of writing hundreds of lines of boilerplate code, you simply describe what you want. The AI generates the integration code on the fly, executes it, and starts talking to your robot. It uses the execute_python tool (a sandboxed Python environment on the cloud) to run scripts that communicate with your robot via WebSocket (rosbridge), MQTT (if your robot publishes to a broker), or even SSH for direct command execution.

No dashboard. No ‘add device’ button. No waiting for a new feature release. You just chat.

How ASI Biont Connects to ROS/ROS2 Robots

ASI Biont supports multiple connection methods to devices. For ROS/ROS2 robots, the most natural and reliable approach is WebSocket via rosbridge. Here's why:

Connection Method Why It Works for ROS Caveats
WebSocket (rosbridge) ROS has a standard rosbridge_server package that exposes all topics and services over WebSocket. No need to modify your robot code. Requires rosbridge to be running on the robot (or a companion computer).
MQTT If your robot already publishes sensor data to an MQTT broker (common in IoT/robotics hybrids), ASI Biont can subscribe and publish. Not all ROS robots use MQTT; you'd need an MQTT bridge node.
SSH Direct SSH access to the robot's onboard computer (e.g., Raspberry Pi, Jetson Nano) lets ASI Biont run Python scripts with paramiko that execute ros2 topic echo, ros2 service call, or even launch files. Requires SSH credentials and network access. Less elegant for real-time control.

For most use cases, rosbridge + WebSocket is the gold standard. It's secure (you can tunnel over SSH or use a VPN), it's real-time, and it gives the AI agent full read/write access to topics and services.

Step-by-Step: Setting Up rosbridge on Your Robot

  1. Install rosbridge on your ROS2 robot (tested on ROS2 Humble and Iron):
    bash sudo apt update sudo apt install ros-humble-rosbridge-server
    (Replace humble with your ROS2 distribution.)

  2. Launch rosbridge on the robot (on port 9090 by default):
    bash ros2 launch rosbridge_server rosbridge_websocket_launch.xml
    This starts a WebSocket server that listens on ws://0.0.0.0:9090.

  3. Make sure your robot is reachable from the internet (or from where ASI Biont runs). Options:

  4. Use a VPN (Tailscale, ZeroTier, WireGuard) to create a secure tunnel.
  5. Port-forward port 9090 on your router (not recommended for production).
  6. Run ASI Biont's execute_python on a machine that is on the same local network as the robot (the sandbox runs on Railway's cloud, so it needs network access to your robot's IP).

Concrete Use Case: TurtleBot3 + LiDAR Monitoring + Telegram Alerts

Imagine you have a TurtleBot3 Burger running ROS2 in your lab. You want the AI agent to:
- Continuously monitor the LiDAR scan data (/scan topic).
- Detect if an object is closer than 0.3 meters (potential collision).
- Send you a Telegram message with the distance and timestamp.
- Also allow you to send a movement command from Telegram: "Move forward 0.5 meters".

What You Tell ASI Biont in the Chat

"Connect to my TurtleBot3 via rosbridge at ws://192.168.1.100:9090. Subscribe to /scan. If any LiDAR point is < 0.3 meters, send me a Telegram alert with the distance. Also, create a service client for /cmd_vel so I can send 'move forward 0.5' from Telegram."

What ASI Biont Does (Behind the Scenes)

The AI agent writes a Python script using aiohttp and websockets (both available in the sandbox) to:
- Connect to the rosbridge WebSocket.
- Advertise a service client for /cmd_vel (geometry_msgs/Twist).
- Subscribe to /scan (sensor_msgs/LaserScan).
- Parse incoming scan data, find minimum range.
- If threshold exceeded, call the Telegram API (via aiohttp) to send a message.
- Also listen for incoming Telegram commands (via webhook or polling) to publish Twist commands.

Here's the simplified code that ASI Biont would generate and execute (this runs in the sandbox):

import asyncio
import json
import websockets
import aiohttp

ROBOT_WS = "ws://192.168.1.100:9090"
TELEGRAM_BOT_TOKEN = "YOUR_BOT_TOKEN"
TELEGRAM_CHAT_ID = "YOUR_CHAT_ID"

async def send_telegram(message):
    url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage"
    async with aiohttp.ClientSession() as session:
        await session.post(url, json={"chat_id": TELEGRAM_CHAT_ID, "text": message})

async def connect_to_robot():
    async with websockets.connect(ROBOT_WS) as ws:
        # Subscribe to /scan
        sub_msg = {
            "op": "subscribe",
            "topic": "/scan",
            "type": "sensor_msgs/LaserScan"
        }
        await ws.send(json.dumps(sub_msg))

        # Advertise cmd_vel service (using service call pattern)
        # For simplicity, we'll just publish to /cmd_vel
        pub_msg = {
            "op": "advertise",
            "topic": "/cmd_vel",
            "type": "geometry_msgs/Twist"
        }
        await ws.send(json.dumps(pub_msg))

        async for message in ws:
            data = json.loads(message)
            if data.get("topic") == "/scan":
                ranges = data["msg"]["ranges"]
                min_range = min(ranges)
                if min_range < 0.3:
                    await send_telegram(f"⚠️ Object detected at {min_range:.2f}m!")
            # Handle incoming Telegram commands (simplified)
            # In real implementation, we'd poll Telegram updates in a separate task

asyncio.run(connect_to_robot())

Important: This script runs in the sandbox with a 30-second timeout. For continuous monitoring, ASI Biont uses a loop that reconnects. The AI handles all error handling, reconnection logic, and message parsing automatically.

Result

You open Telegram, type /start to the bot, and instantly see:

🤖 TurtleBot3 LiDAR Monitor
Connected to /scan at 192.168.1.100:9090
Waiting for alerts...

Then you walk in front of the robot. Within seconds, you get:

⚠️ Object detected at 0.28m!

You reply:

Move forward 0.5

And the robot moves exactly 0.5 meters forward (because the AI publishes a Twist message with linear.x=0.5).

Why This Approach Beats Custom Dashboards

Aspect Custom Dashboard ASI Biont Chat
Development time Days to weeks Seconds (describe in chat)
Flexibility Fixed features Any logic you can describe
Remote access Requires VPN, port forwarding, or cloud hosting Works from anywhere with internet
Alerts Need separate Telegram/email setup Built-in via chat or any API
Cost Server, domain, maintenance Free to start, pay-per-use only for heavy compute

Other ROS/ROS2 Integration Scenarios You Can Try

  • Autonomous navigation monitoring: Subscribe to /amcl_pose and /map, get notified if the robot's localization confidence drops.
  • Manipulator control: Connect to a ROS2 robot arm (e.g., Moveit2), send joint angle commands via chat.
  • Multi-robot coordination: Run multiple rosbridge connections in parallel, orchestrate a fleet of robots from one chat.
  • Data logging: Have the AI subscribe to /battery_state, /imu, and /odom, log to a Google Sheet (via API), and generate daily reports.

All you need to do is describe the goal. The AI writes the integration code using aiohttp, websockets, paramiko, or any of the 50+ libraries available in the sandbox.

Getting Started

  1. Go to asibiont.com and create an account (free tier available).
  2. Start a new chat with the AI agent.
  3. Describe your robot: "I have a ROS2 robot at ws://192.168.1.50:9090. Subscribe to /scan and send alerts to my email if anything is closer than 0.2m."
  4. Watch the AI work: It will generate the code, connect to your robot, and start monitoring — all within seconds.

No coding required. No dashboard setup. Just pure conversation with an AI that understands ROS.

Conclusion

ROS and ROS2 are the backbone of modern robotics, but they were designed for local, developer-centric workflows. ASI Biont breaks that barrier by giving you an AI agent that can speak to your robot over WebSocket, MQTT, or SSH — and do anything you ask: monitor, control, alert, log, analyze. It's like having a remote control room in your pocket, powered by an AI that writes its own code.

Ready to give your robot a brain that lives in the cloud? Try ASI Biont today at asibiont.com — your first integration is free.

← All posts

Comments