Skip to content

Instantly share code, notes, and snippets.

@rethink-imcmahon
Created January 28, 2016 19:45
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rethink-imcmahon/a5af977340c1c452d2d0 to your computer and use it in GitHub Desktop.
Save rethink-imcmahon/a5af977340c1c452d2d0 to your computer and use it in GitHub Desktop.
Take and Image stream and redirect it to Baxter's Display
#! /usr/bin/python
# Copyright (c) 2016 Rethink Robotics, Inc.
# rospy for the subscriber
import rospy
# ROS Image message
from sensor_msgs.msg import Image
def image_callback(msg, pub):
pub.publish(msg)
def main():
rospy.init_node('image_republisher')
# Define your image topic
stream_image_topic = "/cameras/left_hand_camera/image"
# Define the Display topic
xdisplay_topic = "/robot/xdisplay"
# Set up your subscriber and define its callback
pub = rospy.Publisher(xdisplay_topic, Image, queue_size=10)
rospy.Subscriber(stream_image_topic, Image, image_callback, callback_args=pub)
# Spin until ctrl + c
rospy.spin()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment