turtle.py
Go to the documentation of this file.
00001 
00002 import roslib; roslib.load_manifest('multi_resource_handler')
00003 import rospy
00004 from demo_msgs.msg import *
00005 from geometry_msgs.msg import Twist
00006 
00007 class Turtle(object):
00008 
00009     def __init__(self,name,status):
00010         self.name = name
00011         self.status = status
00012         self.wait = False
00013 
00014         self.pub = {}
00015         self.pub['request_move_turtle'] = rospy.Publisher(self.name+'/request_move',RequestMoveRobot)
00016 
00017         self.sub = {}
00018         self.sub['response_move_turtle'] = rospy.Subscriber(self.name + '/response_move',ResponseMoveRobot,self.process_response_move_robot)
00019 
00020 
00021     def set_task(self,id):
00022         self.task_id = id
00023         self.status = True
00024 
00025     def goto(self,loc):
00026         rmr = RequestMoveRobot()
00027         rmr.task_id = self.task_id
00028         rmr.pose.position.x = loc[0]
00029         rmr.pose.position.y = loc[1]
00030         rmr.pose.position.z = 0 
00031         rmr.pose.orientation.x = 0
00032         rmr.pose.orientation.y = 0
00033         rmr.pose.orientation.z = 0
00034         rmr.pose.orientation.w = 1
00035         
00036         self.pub['request_move_turtle'].publish(rmr)
00037 
00038         self.wait = True
00039         while not rospy.is_shutdown() and self.wait == True:
00040             rospy.sleep(0.2)
00041 
00042     def process_response_move_robot(self,msg):
00043         self.wait = False
00044 
00045     def release(self):
00046         self.task_id = None
00047         self.status = False
 All Classes Namespaces Files Functions Variables Typedefs Enumerations


multi_resource_handler
Author(s): Jihoon
autogenerated on Thu Jan 24 2013 13:33:41