RobotMem + ROS 2
Run persistent memory as a native ROS 2 service node. Save perceptions and recall experiences through standard topics and services.
Quick Start
import rclpy
from rclpy.node import Node
from robotmem import RobotMemory
class MemoryNode(Node):
def __init__(self):
super().__init__("robotmem_node")
self.mem = RobotMemory(db_path="/opt/ros/memory.db")
self.create_subscription(
Image, "/camera/rgb", self.on_image, 10
)
def on_image(self, msg):
# Save visual perception with spatial context
self.mem.save_perception(
observation=msg.data,
context={"frame": msg.header.frame_id},
tags=["visual", "navigation"],
)
# Recall similar scenes for obstacle avoidance
prior = self.mem.recall(
query="obstacle near doorway",
top_k=3,
)
self.get_logger().info(f"Recalled {len(prior)} experiences")
What This Integration Does
ROS 2 is the industry standard for robot software, powering everything from warehouse mobile robots to surgical systems and autonomous vehicles. The framework excels at real-time communication between sensor drivers, planners, and actuators. But ROS 2 has no built-in concept of persistent memory. When a robot node restarts, all accumulated experience is lost. Parameters persist through YAML files, but there is no structured way to store and retrieve experiential knowledge across sessions.
RobotMem fills this gap by running as a standard ROS 2 node. It subscribes to sensor topics, stores observations as indexed memory entries, and exposes recall functionality through ROS 2 services. Any node in your system can call the memory service to retrieve relevant past experiences before making decisions. The memory database persists on disk between reboots, giving your robot genuine long-term memory that survives power cycles and software updates.
The Bloom release for RobotMem has been submitted to the rosdistro repository, which means installation
will be as simple as apt install ros-jazzy-robotmem once the release is accepted. Until
then, you can install from PyPI and launch the memory node alongside your existing ROS 2 stack. The
node integrates with the standard ROS 2 lifecycle, supporting configure, activate, deactivate, and
cleanup transitions. This lets your launch files manage memory alongside every other component in your
system.
- Native ROS 2 node — launches with
ros2 runor from launch files, follows lifecycle conventions - Topic subscriptions — subscribe to any sensor topic (Image, LaserScan, PointCloud2) and auto-save perceptions
- Service interface — expose
/robotmem/saveand/robotmem/recallas standard ROS 2 services - TF integration — automatically tag memories with spatial frame information from the TF tree
- Multi-robot support — namespace-aware design lets multiple robots share a memory server via DDS
- Lifecycle managed — supports ROS 2 managed nodes with proper state transitions and cleanup
Deployment Architecture
In a typical deployment, the RobotMem node runs on the robot's onboard computer alongside perception and planning nodes. Memories are stored in a local SQLite database, ensuring zero-latency recall even without network connectivity. For fleet deployments, you can configure a central memory server that aggregates experiences from multiple robots. Each robot pushes new memories to the server during connectivity windows and pulls relevant memories from the fleet's collective experience. This architecture works equally well for a single research robot in a lab and a fleet of delivery robots spanning multiple buildings.