mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-12 04:29:49 +08:00
Added republish_tf_static.py for convenience when replaying rosbags with /tf_static not latched
This commit is contained in:
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python
|
||||
import rospy
|
||||
from tf2_msgs.msg import TFMessage
|
||||
|
||||
msg=TFMessage()
|
||||
|
||||
def callback(data):
|
||||
global msg
|
||||
if len(msg.transforms) == 0:
|
||||
msg = data
|
||||
else:
|
||||
msg.transforms = msg.transforms+ data.transforms
|
||||
rospy.loginfo("Received /tf_static_old and republising latched /tf_static")
|
||||
pub.publish(msg)
|
||||
|
||||
if __name__ == '__main__':
|
||||
rospy.init_node('listener', anonymous=True)
|
||||
rospy.Subscriber("tf_static_old", TFMessage, callback)
|
||||
pub = rospy.Publisher('tf_static', TFMessage, queue_size=10, latch=True)
|
||||
rospy.spin()
|
||||
Reference in New Issue
Block a user