I came across a problem of synchronization of topics on subscriber side (especially in rospy). By it I mean situation when there is more than one topic with data logically in relation. For example there could be /topic_a providing ID of map and /topic_b with map data itself. In normal case data on /topic_a would arrive first and then would be arrival of data on /topic_b (e.g. because of order in publisher), but it is not guaranteed, so subscriber could receive the data in opposite order. In general it could be more than two topics with more publishers in more complicated environment.
The best solution (I suppose) would be change of architecture: all relative data should be published in one message/topic, but it is not always possible. Other solution could be implementation of algorithm/structure/machine state with mutexes receiving and handling “unordered” callbacks.
So, how you handle those situations and is there any library, tool or approach helping handle it?