Creating publishers, subscribers, etc., inside a ROS node implementation is a common practice. I did the same with an ImageTransport object, but this resulted in a circular dependency. When you pass a node (using shared_from_this()) to ImageTransport, it holds a reference to the ROS node, and this node holds a reference to the image transport object, thereby creating a circular dependency.
A common solution to avoid circular dependencies is to use weak pointers. What's your opinion on this?
Creating publishers, subscribers, etc., inside a ROS node implementation is a common practice. I did the same with an
ImageTransport
object, but this resulted in a circular dependency. When you pass a node (usingshared_from_this()
) toImageTransport
, it holds a reference to the ROS node, and this node holds a reference to the image transport object, thereby creating a circular dependency.A common solution to avoid circular dependencies is to use weak pointers. What's your opinion on this?