-
Notifications
You must be signed in to change notification settings - Fork 560
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added republish_tf_static.py for convenience when replaying rosbags w…
…ith /tf_static not latched
- Loading branch information
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |