$search
00001 #!/usr/bin/env python 00002 ################################################################# 00003 ##\file 00004 # 00005 # \note 00006 # Copyright (c) 2012 \n 00007 # University of Bedfordshire \n\n 00008 # 00009 ################################################################# 00010 # 00011 # \note 00012 # Project name: care-o-bot 00013 # \note 00014 # ROS stack name: srs_public 00015 # \note 00016 # ROS package name: srs_symbolic_grounding 00017 # 00018 # \author 00019 # Author: Beisheng Liu, email:beisheng.liu@beds.ac.uk 00020 # \author 00021 # Supervised by: Dayou Li, email:dayou.li@beds.ac.uk 00022 # 00023 # \date Date of creation: Mar 2012 00024 # 00025 # \brief 00026 # test client for symbol_grounding_scan_base_pose_server 00027 # 00028 ################################################################# 00029 # 00030 # Redistribution and use in source and binary forms, with or without 00031 # modification, are permitted provided that the following conditions are met: 00032 # 00033 # - Redistributions of source code must retain the above copyright 00034 # notice, this list of conditions and the following disclaimer. \n 00035 # - Redistributions in binary form must reproduce the above copyright 00036 # notice, this list of conditions and the following disclaimer in the 00037 # documentation and/or other materials provided with the distribution. \n 00038 # - Neither the name of the University of Bedfordshire nor the names of its 00039 # contributors may be used to endorse or promote products derived from 00040 # this software without specific prior written permission. \n 00041 # 00042 # This program is free software: you can redistribute it and/or modify 00043 # it under the terms of the GNU Lesser General Public License LGPL as 00044 # published by the Free Software Foundation, either version 3 of the 00045 # License, or (at your option) any later version. 00046 # 00047 # This program is distributed in the hope that it will be useful, 00048 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00049 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00050 # GNU Lesser General Public License LGPL for more details. 00051 # 00052 # You should have received a copy of the GNU Lesser General Public 00053 # License LGPL along with this program. 00054 # If not, see <http://www.gnu.org/licenses/>. 00055 # 00056 ################################################################# 00057 import roslib; roslib.load_manifest('srs_symbolic_grounding') 00058 00059 from srs_symbolic_grounding.srv import * 00060 from srs_symbolic_grounding.msg import * 00061 from geometry_msgs.msg import * 00062 import rospy 00063 00064 00065 00066 def scan_base_pose_client(parent_obj_geometry): 00067 00068 rospy.wait_for_service('scan_base_pose') 00069 00070 scan_base_pose = rospy.ServiceProxy('scan_base_pose', ScanBasePose) 00071 00072 try: 00073 resp = list() 00074 resp.append(scan_base_pose(parent_obj_geometry)) 00075 return resp 00076 00077 except rospy.ServiceException, e: 00078 00079 print "Service call failed: %s" %e 00080 00081 00082 00083 00084 00085 if __name__ == "__main__": 00086 00087 00088 00089 parent_obj_geometry = SRSSpatialInfo() 00090 00091 00092 00093 parent_obj_geometry.pose.position.x = 2.0 00094 parent_obj_geometry.pose.position.y = 2.5 00095 parent_obj_geometry.pose.orientation.x = 0 00096 parent_obj_geometry.pose.orientation.y = 0 00097 parent_obj_geometry.pose.orientation.z = -0.999783754349 00098 parent_obj_geometry.pose.orientation.w = 0.0207948293537 00099 parent_obj_geometry.l = 1.5 00100 parent_obj_geometry.w = 0.4 00101 00102 00103 00104 00105 print "Requesting scan base pose." 00106 00107 result = scan_base_pose_client(parent_obj_geometry) 00108 00109 print result 00110 00111 00112