demoUpdateInfo.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 import roslib;
00003 roslib.load_manifest('srs_knowledge')
00004 import sys
00005 import rospy
00006 
00007 from srs_knowledge.srv import *
00008 from srs_knowledge.msg import *
00009 
00010 def getObjectsOnMap():
00011     print 'test get all objects from map'
00012     try:
00013         getObjects = rospy.ServiceProxy('get_objects_on_map', GetObjectsOnMap)
00014         res = getObjects('ipa-kitchen-map', True)
00015         return res
00016     except rospy.ServiceException, e:
00017         print "Service call failed: %s"%e
00018 
00019 def getWorkspaceOnMap():
00020     print 'test get all workspace (furnitures basically here) from map'
00021     try:
00022         getWorkspace = rospy.ServiceProxy('get_workspace_on_map', GetWorkspaceOnMap)
00023         res = getWorkspace('ipa-kitchen-map', True)
00024         return res
00025     except rospy.ServiceException, e:
00026         print "Service call failed: %s"%e
00027 
00028 def updatePosInfo():
00029     print 'update spatial info'
00030     try:
00031         posInfo = SRSSpatialInfo()
00032         posInfo.pose.position.x = 100
00033         posInfo.pose.position.y = 1000
00034         posInfo.pose.position.z = 10000
00035         posInfo.pose.orientation.x = 0
00036         posInfo.pose.orientation.y = 0
00037         posInfo.pose.orientation.z = 0
00038         posInfo.pose.orientation.w = 1
00039 
00040         posInfo.l = 2
00041         posInfo.h = 3
00042         posInfo.w = 4
00043 
00044         updatePos = rospy.ServiceProxy('update_pos_info', UpdatePosInfo)
00045         res = updatePos('Dishwasher0', 10, posInfo, 'sss')
00046         return res
00047     except rospy.ServiceException, e:
00048         print "Service call failed: %s"%e
00049 
00050 
00051 def insertObject():
00052     print 'update spatial info'
00053     try:
00054         insertObj = rospy.ServiceProxy('insert_instance', InsertInstance)
00055         res = insertObj('Dishwasher0', 'Dishwasher', '10', 'ss', 'sss')
00056         return res
00057     except rospy.ServiceException, e:
00058         print "Service call failed: %s"%e
00059 
00060 if __name__ == "__main__":
00061     # request a new task
00062     # print requestNewTask()
00063     # print getObjectsOnMap()
00064     # print getWorkspaceOnMap()
00065     print insertObject()
00066     print updatePosInfo()


srs_knowledge
Author(s): Ze Ji
autogenerated on Sun Jan 5 2014 12:03:27