Last active
January 27, 2020 23:44
-
-
Save matlabbe/ff8d3405ef65ec6116d077dbe6fb86b7 to your computer and use it in GitHub Desktop.
Fix /tf_static not latched when replaying a rosbag (see https://answers.ros.org/question/207551/how-to-save-static-transforms-in-bag-files/?answer=207647#post-id-207647). Start this script before running a rosbag, then do: `rosbag play --clock tf_static:=tf_static_old`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import rospy | |
from tf2_msgs.msg import TFMessage | |
def callback(data): | |
rospy.loginfo("Received /tf_static_old and republising latched /tf_static") | |
pub.publish(data) | |
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment