Companion OpenClaw plugin that adds embodied autonomy behaviors on top of the base RosClaw plugin.
This package is not a replacement for rosclaw. The base rosclaw plugin
still owns the direct ROS 2 interface surface (ros2_* tools, transport
switching, emergency stop command, capability discovery). rosclaw-autonomy
adds:
- high-level
rosclaw_*autonomy tools - autonomy-mode aware prompt context
- safety policy that constrains raw motion tools from the base plugin
- optional background autonomy turns when the OpenClaw runtime supports them
- structured autonomy audit logging
Install both plugins together.
Use the base plugin for:
- raw ROS 2 tools such as
ros2_publish,ros2_service_call,ros2_action_goal, andros2_subscribe_once - transport management
- capability discovery
- direct commands like
/estop
Use this plugin for:
- autonomy mode changes
- roaming and exploration requests
- return-home and hold-position behaviors
- robot belief injection into the agent prompt
- policy that prefers high-level autonomy over direct
/cmd_velcontrol
The intended setup is:
- Install
rosclaw - Install
rosclaw-autonomy - Configure both against the same robot / namespace
- Let the base plugin expose raw ROS interfaces while the autonomy plugin steers the agent toward embodied, higher-level behavior
The autonomy plugin expects the robot to expose the RosClaw autonomy interfaces.
These are typically provided by the rosclaw_autonomy ROS 2 package in the
robot stack.
Expected interfaces:
- Topic:
/rosclaw/autonomy_mode(rosclaw_autonomy_msgs/msg/AutonomyMode) - Topic:
/rosclaw/robot_belief(rosclaw_autonomy_msgs/msg/RobotBelief) - Topic:
/rosclaw/current_intent(std_msgs/msg/String) - Service:
/rosclaw/set_autonomy_mode(rosclaw_autonomy_msgs/srv/SetAutonomyMode) - Service:
/rosclaw/return_home(rosclaw_autonomy_msgs/srv/ReturnHome) - Action:
/rosclaw/roam(rosclaw_autonomy_msgs/action/Roam)
Optional but useful:
- Topic:
/rosclaw/safety_statusfor robot-reported velocity limits - Topic:
/rosclaw/scenefor perception summaries injected into the prompt
If these autonomy interfaces are missing, the plugin can still load, but high-level autonomy tools will fail or operate with degraded context.
Install the base plugin first:
openclaw plugins install @openclaw/rosclawThen install the autonomy companion plugin:
openclaw plugins install @openclaw/rosclaw-autonomyIf you are developing locally:
npm install
npm run buildThis package is designed to be used alongside the base @openclaw/rosclaw
plugin, not instead of it.
The autonomy plugin uses the same transport and robot targeting concepts as the
base plugin, plus an autonomy block.
{
"transport": {
"mode": "rosbridge"
},
"rosbridge": {
"url": "ws://localhost:9090",
"reconnect": true,
"reconnectInterval": 3000
},
"robot": {
"name": "Robot",
"namespace": ""
},
"safety": {
"maxLinearVelocity": 1.0,
"maxAngularVelocity": 1.5,
"allowlistedTopics": [],
"allowlistedServices": [],
"allowlistedActions": [],
"workspaceLimits": {
"xMin": -10,
"xMax": 10,
"yMin": -10,
"yMax": 10
}
},
"autonomy": {
"enabled": true,
"startupMode": "FULL_AUTONOMY",
"tickHz": 1,
"idleRoamStrategy": "frontier",
"defaultExecutor": "auto",
"manualReturnDelaySec": 5,
"lowBatteryPct": 20,
"stuckTimeoutSec": 15,
"maxToolCallsPerMinute": 30
}
}| Key | Default | Description |
|---|---|---|
transport.mode |
"rosbridge" |
Transport mode for autonomy subscriptions and autonomy tool execution. |
rosbridge.url |
"ws://localhost:9090" |
Rosbridge WebSocket URL. |
rosbridge.reconnect |
true |
Auto-reconnect autonomy transport on disconnect. |
rosbridge.reconnectInterval |
3000 |
Reconnect interval in milliseconds. |
local.domainId |
0 |
ROS 2 domain ID for local DDS mode. |
robot.name |
"Robot" |
Display name used in logs and fallback prompt context. |
robot.namespace |
"" |
Namespace used to resolve /rosclaw/* autonomy interfaces. |
safety.maxLinearVelocity |
1.0 |
Fallback max linear speed used by autonomy policy. |
safety.maxAngularVelocity |
1.5 |
Fallback max angular speed used by autonomy policy. |
safety.allowlistedTopics |
[] |
Raw ROS topics the autonomy policy may allow through. |
safety.allowlistedServices |
[] |
Raw ROS services the autonomy policy may allow through. |
safety.allowlistedActions |
[] |
Raw ROS actions the autonomy policy may allow through. |
safety.workspaceLimits |
{-10..10} |
Navigation goal bounds enforced by the autonomy validator. |
autonomy.enabled |
true |
Enables the autonomy runtime service and autonomy hooks. |
autonomy.startupMode |
"FULL_AUTONOMY" |
Seed mode used until live robot mode is observed. |
autonomy.tickHz |
1 |
Background autonomy tick frequency. |
autonomy.idleRoamStrategy |
"frontier" |
Default roam strategy for rosclaw_start_roam. |
autonomy.defaultExecutor |
"auto" |
Preferred roam executor: auto, nav2, or cmd_vel. |
autonomy.manualReturnDelaySec |
5 |
Delay before autonomy should resume after manual intervention. |
autonomy.lowBatteryPct |
20 |
Threshold for low-battery autonomy logic on the robot side. |
autonomy.stuckTimeoutSec |
15 |
Timeout for stuck-motion detection on the robot side. |
autonomy.maxToolCallsPerMinute |
30 |
Rate limit applied per tool by the autonomy validator. |
| Tool | Description |
|---|---|
rosclaw_set_mode |
Set the robot autonomy mode via /rosclaw/set_autonomy_mode |
rosclaw_start_roam |
Start a robot-side roam / explore behavior |
rosclaw_stop_and_hold |
Stop roaming and move into supervised hold |
rosclaw_return_home |
Ask the robot autonomy manager to return home |
rosclaw_get_belief |
Return the latest autonomy / belief snapshot cached by the plugin |
-
before_prompt_build- fetches the capability manifest through the plugin transport
- reads autonomy state from
/rosclaw/autonomy_mode,/rosclaw/robot_belief, and/rosclaw/current_intent - optionally reads
/rosclaw/scene - injects an autonomy overlay into the system prompt that explicitly tells the
agent to use
rosclaw_*tools first and treat rawros2_*driving as an exception
-
before_tool_call- rate limits autonomy-sensitive tool usage
- blocks direct
/cmd_velpublishes in autonomous modes - blocks unsafe navigation goals outside the configured workspace
- blocks protected control-plane parameter and service changes
- prevents conflicting motion commands while a roam behavior is already active
-
rosclaw-autonomy-transport- maintains a ROS transport for autonomy tool execution and subscriptions
-
rosclaw-autonomy- seeds autonomy mode state
- subscribes to robot autonomy topics
- optionally asks the OpenClaw runtime for low-rate autonomous background
turns when
runtime.agent.enqueueAutonomousTurn(...)is available
The autonomy plugin does not try to replace the base plugin's capability dump. Instead, it adds an autonomy-specific overlay that tells the agent:
- the current autonomy mode
- the current intent
- current robot belief such as pose, nav state, obstacle distance, battery, and active executor
- which autonomy interfaces are actually present on the robot
- that
rosclaw_*tools should be preferred for exploration and free-roaming - that raw
ros2_*tools from the base plugin are still available for recovery, inspection, or clearly manual tasks
This is the core of the split: the base plugin exposes raw affordances, and the autonomy plugin shapes how the agent uses them.
This plugin enforces autonomy policy in front of both:
- its own
rosclaw_*tools - the raw
ros2_*tools exposed by the base plugin
Key rules:
- direct
ros2_publishto/cmd_velis blocked unless the robot is inMANUALorASSISTED - navigation goals outside
workspaceLimitsare blocked - raw parameter service calls and protected RosClaw node parameter writes are blocked
- if a roam action is active, a second motion action is blocked until the agent stops and holds first
This means the autonomy plugin can be installed as a policy overlay without duplicating the base ROS interface surface.
Run the local checks:
npm run typecheck
npm testThe current autonomy-focused tests cover:
- package identity and split behavior
- autonomy-only tool registration
- direct-drive blocking in autonomous modes
- roam request validation
- autonomy overlay prompt generation
- manifest caching and transport lifecycle handling
Apache-2.0