robot-tokens: A token wallet and spending cap for robot planners (ROS 2, Nav2, and MoveIt 2 adapters)
This publication introduces 'robot-tokens', an open-source Python library that enables robot planners to operate within a defined token budget. The system assigns token costs to various services such as electricity, compute, and inter-robot assistance, allowing a human operator to set spending limits or trigger an off-switch. Unofficial adapters are provided for ROS 2, Nav2, and MoveIt 2 to integrate these economic constraints into motion planning and behavior trees.
Hi everyone,
I have been working on a small open-source idea: a robot has a token budget, and every good or service it uses has a token price. Electricity and charging, compute, a delivery, another robot’s help, motion, and energy can all be priced. The planner spends tokens per action and has to choose what is worth doing. A human can set a spending cap, including a cap of zero, and an optional hook for my offswitch library can cut spending entirely. The robot can read the cap and the switch. It cannot reset them.
The core library is Python 3.9+, with no required dependencies:
Repository fitzyracing1/robot-tokens
GitHub - fitzyracing1/robot-tokens: A token wallet and price list for robots: every...
A token wallet and price list for robots: every good or service has a token cost, and a human-held cap or off switch can stop spending.
There are unofficial adapters for a few ROS stacks. None of these is a patch against those projects, and I am not asking anyone to vendor the code. Tests run without a full desktop install.
- robot-tokens-ros2 — publishes a wallet balance topic and serves price and spend requests (rclpy; message types are ordinary dataclasses)
- robot-tokens-nav2 — a behavior-tree condition (
TokensAffordable) and a token costmap layer, plus a header-only C++ helper - robot-tokens-moveit2 — scores motion plans by path length, duration, and energy, then picks the cheapest plan the wallet can afford
A short example:
from robot_tokens import Action, PlannerBudget, Wallet
wallet = Wallet(balance=100, cap=60, name="dock-bot")
planner = PlannerBudget(wallet)
candidates = (
Action("charge 10 Wh", "charging", 10, reason="dock"),
Action("ask a neighbor robot", "assist", 1, reason="help"),
)
chosen = planner.pick(candidates)
planner.spend(chosen.action)
Default prices are illustrative, not a claim about real-world costs. Install from GitHub with pip install git+https://github.com/fitzyracing1/robot-tokens.
I would be glad of feedback: does a token budget belong next to planners like this, and is the ROS 2 / Nav2 / MoveIt 2 shape useful? I am also happy to hear if a listing or link somewhere would be welcome, or if this is better left as a standalone package.
Thanks for reading,
Joshua Almeida