Go to the documentation of this file.00001
00002
00003 import roslib; roslib.load_manifest('iri_common_smach')
00004 import rospy
00005 import smach
00006 import smach_ros
00007
00008 class TopicPublisher(smach.State):
00009 def __init__(self, topic, msg_type):
00010 smach.State.__init__(self, outcomes=['finish'],
00011 input_keys=['msg'])
00012 self.topic = topic
00013 self.msg_type = msg_type
00014
00015 def execute(self, userdata):
00016
00017 pub = rospy.Publisher(self.topic, self.msg_type, None, False, True)
00018 pub.publish(userdata.msg)
00019 return 'finish'