torrent_ws implements submap-level pose graph sharing for a multi-robot fleet
using a BitTorrent-style distribution mechanism integrated with ROS 2.
Each robot runs the same ROS node and cooperatively exchanges pose-graph submaps ("pieces") using gossip, scheduling, and libtorrent.
Reads a pose graph from $VTRTEMP, splits it into submap-level pieces, and stores
them at:
deconstructed/<robot_id>/<posegraph_name>/
Example:
deconstructed/0/woody_convoy/
robot_id identifies the robot that originally generated the pose graph.
Reads submap pieces from:
deconstructed/<robot_id>/<posegraph_name>/
Reassembles them into a valid pose graph and writes the result to:
reconstructed/<robot_id>/<posegraph_name>/
RegistryNode is the main ROS 2 node run on every robot in the fleet.
Each instance performs the following:
- Publishes local piece possession via gossip
- Receives gossip from other robots and maintains a local registry
- Determines which piece to request next and from which peer
- Requests or serves magnet links using ROS services
- Initiates BitTorrent downloads via libtorrent
All robots run the same node; behavior is determined by robot_id.
RegistryNode is composed of several modular components.
- Authority on local piece possession
- Only component allowed to read from the filesystem
- Scans available submap files at startup
- Provides thread-safe access to:
- owned pieces
- missing pieces
- bitfield representation for gossip
Used by the Scheduler and gossip publisher.
- Maintains a local view of which peers have which pieces
- Updated from incoming gossip messages
- Provides:
- known peers
- per-piece availability across the fleet
- Compares local state (PieceState) with fleet knowledge (GossipInterface)
- Selects the next piece to download
- Tracks in-flight requests to avoid duplicates
Current policy (21-01):
Request the lowest-index missing piece that at least one peer advertises.
- ROS service interface for magnet link exchange
- Responsibilities:
- Request a magnet link from a peer for (peer_id, piece_id)
- Serve magnet links to requesting peers
Acts as a bridge between the Scheduler and TorrentManager.
- Wraps libtorrent
- Runs in its own thread
- Handles:
- seeding local pieces
- downloading pieces via magnet links
- tracking torrent progress and completion
