Complete API documentation for Agent ROS Bridge.
Version: 0.6.5
Base URL: ws://localhost:8765 (WebSocket)
REST API: http://localhost:8765/api
const ws = new WebSocket('ws://localhost:8765?token=JWT_TOKEN');
ws.onopen = () => console.log('Connected');
ws.onmessage = (event) => console.log(JSON.parse(event.data));
ws.onerror = (error) => console.error('Error:', error);
ws.onclose = () => console.log('Disconnected');Include JWT token in connection URL:
ws://localhost:8765?token=eyJhbGciOiJSUzI1NiIs...
Or send authentication message:
{
"type": "auth",
"token": "eyJhbGciOiJSUzI1NiIs..."
}All messages are JSON with a type field:
{
"type": "command",
"...": "..."
}Request:
{
"type": "get_robots"
}Response:
{
"type": "robot_list",
"robots": [
{
"id": "bot_001",
"name": "Warehouse Bot 1",
"type": "TurtleBot3",
"status": "online",
"battery": 85,
"location": "Zone A"
}
]
}Request:
{
"type": "command",
"robot_id": "bot_001",
"command": {
"action": "move",
"parameters": {
"direction": "forward",
"distance": 2.0,
"speed": 0.5
}
}
}Response:
{
"type": "command_result",
"success": true,
"robot_id": "bot_001",
"action": "move",
"duration": 4.2,
"timestamp": "2024-04-02T10:30:00Z"
}Request:
{
"type": "natural_language",
"robot_id": "bot_001",
"text": "Move forward 2 meters slowly"
}Response:
{
"type": "command_result",
"success": true,
"response": "Moving forward 2 meters at 0.3 m/s",
"parsed_intent": "move",
"confidence": 0.94,
"action": "natural_language"
}Request:
{
"type": "get_telemetry",
"robot_id": "bot_001"
}Response:
{
"type": "telemetry",
"robot_id": "bot_001",
"data": {
"position": {
"x": 1.5,
"y": 2.3,
"z": 0.0
},
"orientation": 0.785,
"linear_velocity": 0.5,
"angular_velocity": 0.1,
"battery": 85,
"obstacle_distance": 1.2,
"timestamp": "2024-04-02T10:30:00Z"
}
}Request:
{
"type": "emergency_stop"
}Response:
{
"type": "emergency_stop_result",
"success": true,
"affected_robots": ["bot_001", "bot_002"],
"timestamp": "2024-04-02T10:30:00Z"
}Request:
{
"type": "subscribe_telemetry",
"robot_id": "bot_001",
"interval": 1.0
}Continuous responses (every 1 second):
{
"type": "telemetry",
"robot_id": "bot_001",
"data": { ... }
}Unsubscribe:
{
"type": "unsubscribe_telemetry",
"robot_id": "bot_001"
}| Action | Parameters | Description |
|---|---|---|
move |
direction, distance, speed |
Linear movement |
rotate |
angle, speed |
Rotation in place |
navigate |
target, tolerance |
Navigate to location |
stop |
None | Emergency stop |
| Action | Parameters | Description |
|---|---|---|
pick |
object, height |
Pick up object |
place |
location, height |
Place object |
grasp |
force |
Grasp with force |
release |
None | Release gripper |
| Action | Parameters | Description |
|---|---|---|
status |
None | Get robot status |
home |
None | Return to home |
dock |
None | Dock at charging station |
explore |
duration, area |
Autonomous exploration |
Returns current shadow mode statistics.
Response:
{
"agreement_rate": 0.96,
"total_decisions": 144000,
"pending_count": 0,
"completed_decisions": 144000,
"hours_collected": 200.0,
"required_hours": 200.0
}Query parameters:
limit: Number of decisions (default: 10, max: 1000)offset: Pagination offsetrobot_id: Filter by robotsince: ISO timestamp filter
Response:
{
"decisions": [
{
"timestamp": "2024-04-02T10:30:00Z",
"robot_id": "bot_001",
"ai_proposal": {
"intent_type": "move_forward",
"confidence": 0.94,
"parameters": {"distance": 2.0}
},
"human_action": {
"command": "move_forward",
"parameters": {"distance": 2.0}
},
"agreement": true,
"agreement_score": 0.95
}
],
"total": 144000
}List all connected robots.
Response:
{
"robots": [
{
"id": "bot_001",
"name": "Warehouse Bot 1",
"type": "TurtleBot3",
"status": "online",
"battery": 85,
"location": "Zone A",
"last_seen": "2024-04-02T10:30:00Z"
}
]
}Get specific robot details.
Response:
{
"id": "bot_001",
"name": "Warehouse Bot 1",
"type": "TurtleBot3",
"status": "online",
"battery": 85,
"location": "Zone A",
"capabilities": ["move", "navigate", "sensors"],
"safety_status": "supervised"
}Send command to multiple robots.
Request:
{
"command": {
"action": "return_home"
},
"selector": {
"battery_below": 20
}
}Response:
{
"success": true,
"affected_robots": ["bot_001", "bot_003"],
"results": [
{"robot_id": "bot_001", "success": true},
{"robot_id": "bot_003", "success": true}
]
}Returns service health status.
Response:
{
"status": "healthy",
"version": "0.6.5",
"timestamp": "2024-04-02T10:30:00Z",
"robots_connected": 5,
"uptime_seconds": 86400
}{
"type": "error",
"error": {
"code": "ROBOT_NOT_FOUND",
"message": "Robot 'bot_999' not found",
"details": {
"robot_id": "bot_999"
}
}
}| Code | HTTP Status | Description |
|---|---|---|
AUTH_INVALID |
401 | Invalid authentication token |
AUTH_EXPIRED |
401 | Token expired |
ROBOT_NOT_FOUND |
404 | Robot ID not found |
ROBOT_OFFLINE |
503 | Robot is offline |
COMMAND_INVALID |
400 | Invalid command format |
SAFETY_VIOLATION |
403 | Safety check failed |
RATE_LIMITED |
429 | Too many requests |
INTERNAL_ERROR |
500 | Server error |
import asyncio
import websockets
import json
async def control_robot():
uri = "ws://localhost:8765?token=YOUR_TOKEN"
async with websockets.connect(uri) as ws:
# Send command
await ws.send(json.dumps({
"type": "command",
"robot_id": "bot_001",
"command": {
"action": "move",
"parameters": {"direction": "forward", "distance": 2.0}
}
}))
# Get response
response = await ws.recv()
data = json.loads(response)
print(f"Result: {data}")
asyncio.run(control_robot())const ws = new WebSocket('ws://localhost:8765?token=YOUR_TOKEN');
ws.onopen = () => {
// Send natural language command
ws.send(JSON.stringify({
type: 'natural_language',
robot_id: 'bot_001',
text: 'Navigate to the kitchen'
}));
};
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log('Response:', data);
};# Get metrics
curl http://localhost:8765/api/metrics
# List robots
curl http://localhost:8765/api/robots
# Get decisions
curl "http://localhost:8765/api/decisions?limit=10"- Python:
pip install agent-ros-bridge - JavaScript:
npm install @agent-ros-bridge/sdk
- Go: github.com/example/agent-ros-bridge-go
- Rust: github.com/example/agent-ros-bridge-rs
| Endpoint | Limit | Window |
|---|---|---|
| WebSocket messages | 1000 | per minute |
| REST API | 100 | per minute |
| Telemetry subscriptions | 10 | per robot |
- Added fleet broadcast API
- Added shadow mode metrics endpoint
- Improved telemetry streaming
- Added natural language processing
- Added gRPC support
- Breaking: Changed auth format
See CHANGELOG.md for full history.