wrt: How to get Omometry and LaserScan topic simultaneously?

asked 2019-08-31 04:11:24 -0500

kane_choigo gravatar image

updated 2019-08-31 04:12:40 -0500

!! Hello !!

I'm working with turtlebot2 in ROS-kinetic of Ubuntu 16.04.(using XBOX-360_Kinect sensors)

Anyway, my question is,(below)

in turtlebot2, the Odometry topic is published at every 0.01 seconds, and LaserScan topic is also published at every 0.11 seconds.

I want to subscribe these two topics simultaneously at the same time.

Using message_filters.TimeSynchronizer command, I succeeded in getting them 'simultaneously' , but I doubt each other's time zone could not be matched. (it means, since the publish time interval of LaserScan topic is 10 times as long as Odomerty topic's, if I get LaserScan topic at time_t=k, i wonder the Odometry topic could be also published at time_t=k , so i can convert a detected position from sensor frame to world frame more correctly.)

(below is my sample code.)

scan_Subscriber = message_filters.Subscriber('/scan', LaserScan)
odom_Subscriber = message_filters.Subscriber('/odom', Odometry)
#
TS = message_filters.TimeSynchronizer([scan_Subscriber, odom_Subscriber], 10)
TS.registerCallback(scan_and_odom_callback)
#
rospy.spin()

how can I get them at the same time zone?

sorry for my poor english and hope today will be your best day :)

edit retag flag offensive close merge delete