pg_ros2
pg_ros2 · ROS 2 graph snapshots and topic subscriptions in PostgreSQL
Overview
PostgreSQL · 18
Usage
Sources:
pg_ros2 exposes ROS 2 graph snapshots in PostgreSQL tables and streams selected topic messages through notifications. Version 0.2.0 documents a Linux/Ubuntu 22.04, PostgreSQL 18, ROS 2 Humble and rclrs runtime.
Graph Snapshots
The PostgreSQL service must inherit the ROS runtime environment. Add pg_ros2 to shared_preload_libraries, set pg_ros2.database to an existing database, and restart. Install as a superuser.
Topic Subscription
In a listener session, subscribe to the channel matching the fully qualified ROS topic. In another autocommit session, start the long-running procedure:
The procedure can run independently of the graph worker. The optional pg_durable integration manages it as a workflow; it is not a hard dependency.
Access and Delivery
Grant table reads and procedure execution only to appropriate roles. Remote parameter snapshots may contain secrets. Notification channels have no per-channel ACL: other database users can listen to a channel.
Graph snapshots are eventually refreshed and may become stale after worker or ROS failures. Topic delivery is transient and best-effort with bounded buffering and drops; it supplies no replay or durable consumer offset. Restart the procedure after a server failure and monitor worker status rather than interpreting an old snapshot as current.