To subscribe to 2 different topics simultaneously

asked 2019-10-19 06:32:55 -0500

kane_choigo gravatar image

updated 2019-10-19 06:35:47 -0500


I'm using ROS kinetic on Ubuntu 16.04.

As far as I know, with message_filters it is possible to subscribe to more than 2 different topics simultaneously.

Below is what I wrote in the main node ...

# Subcriber setting
    self.RobotStateSubscriber = message_filters.Subscriber(RobotStateTopic, Odometry)               
    self.RoughDetectedPersonsSubscriber = message_filters.Subscriber(RoughDetectedPersonsTopic, TrackedPersons)
    #self.timeSynchronizer = message_filters.TimeSynchronizer([self.RobotStateSubscriber, self.RoughDetectedPersonsSubscriber], 50)
    self.timeSynchronizer = message_filters.TimeSynchronizer([self.RoughDetectedPersonsSubscriber, self.RobotStateSubscriber], 50)

    # Publisher setting
    self.EKF_PersonsPublisher = rospy.Publisher(EKF_PersonsTopic, TrackedPersons, queue_size=100)

To verify whether it could be run, I also get the test node that publishes dummy data topics corresponding to really needed.

And it works. So I also launched detection packages and my mibile robot's node, but it didn't work with any other errors; following is the only one I got from the compiler.

[WARN] [1571483959.476520]: Inbound TCP/IP connection failed: connection from sender terminated before handshake header received. 0 bytes were received. Please check sender for additional details.

Just so you know, I also tried launching (detection packages, mobile robot's node) and (test node which publishes dummy data corresponding to earlier topics) simultaneously. In that case, all the necessary topics go into my main node but it only subscribed to dummy data topics. As I have never experienced this kind of bugs, I really have no idea even wrt where I should modify.

If anyone has ever experienced or familiar with this kind of bugs, would you please give me super helpful advice? I feel I'm going to crying :)

Thanks in advance.

edit retag flag offensive close merge delete