-
-
Save tfoote/496139213ff8904fc00c65274e3fdd81 to your computer and use it in GitHub Desktop.
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
import rospy | |
rospy.init_node('node_name') | |
from std_msgs.msg import String | |
def callback(data): | |
rospy.loginfo("I heard %s", data.data) | |
def callback2(data): | |
rospy.loginfo("222I heard %s", data.data) | |
for t in ['foo', 'bar']: | |
if t =='foo': | |
rospy.Subscriber(t, String, callback) | |
if t =='bar': | |
rospy.Subscriber(t, String, callback2) | |
rospy.spin() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment