For the past few months, I’ve been working on a new ROS SLAM package called google_mapping. Along the way, I’ve been taking notes on best practices for making ROS packages offline-friendly. This is when you ask, “isn’t that what bags are for?” Then I reply, “yes, partly.”
Avoid coupling pub/sub with your business logic. Put another way, nodes should be thin wrappers for other classes.
Use dependency injection. For example, instead of creating a TransformListener, pass in a Transformer. A Transformer can be used offline in the same way a TransformListener can be used online by supplying transforms using the Transformer::setTransform() method.
Wait for transforms in nodes, not inside your business logic.
Use options structs that specify defaults and override with params.