get_point.py
Go to the documentation of this file.
00001 #
00002 # Copyright (c) 2009, Georgia Tech Research Corporation
00003 # All rights reserved.
00004 #
00005 # Redistribution and use in source and binary forms, with or without
00006 # modification, are permitted provided that the following conditions are met:
00007 #     * Redistributions of source code must retain the above copyright
00008 #       notice, this list of conditions and the following disclaimer.
00009 #     * Redistributions in binary form must reproduce the above copyright
00010 #       notice, this list of conditions and the following disclaimer in the
00011 #       documentation and/or other materials provided with the distribution.
00012 #     * Neither the name of the Georgia Tech Research Corporation nor the
00013 #       names of its contributors may be used to endorse or promote products
00014 #       derived from this software without specific prior written permission.
00015 #
00016 # THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
00017 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00018 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019 # DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
00020 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00021 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
00022 # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00023 # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
00024 # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00025 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 #
00027 
00028 #  \author Advait Jain (Healthcare Robotics Lab, Georgia Tech.)
00029 
00030 import roslib; roslib.load_manifest('UI_segment_object')
00031 
00032 import rospy
00033 from UI_segment_object.srv import GetPt
00034 from UI_segment_object.srv import None_Bool
00035 
00036 reset_ui = None
00037 get_3d_point = None
00038 
00039 def initialize_service():
00040     global reset_ui, get_3d_point
00041     reset_srv_name = 'UI_reset'
00042     srv_name = 'get_3D_pt'
00043 
00044     rospy.loginfo('waiting for service: %s'%reset_srv_name)
00045     rospy.wait_for_service(reset_srv_name)
00046     rospy.loginfo('waiting for service: %s'%srv_name)
00047     rospy.wait_for_service(srv_name)
00048     rospy.loginfo('Done')
00049 
00050     reset_ui = rospy.ServiceProxy(reset_srv_name, None_Bool)
00051     get_3d_point = rospy.ServiceProxy(srv_name, GetPt)
00052 
00053 
00054 def get_point():
00055     global reset_ui, get_3d_point
00056     reset_ui()
00057     resp = get_3d_point()
00058     return resp.pt.x, resp.pt.y, resp.pt.z
00059 
00060 
00061 if __name__ == '__main__':
00062     rospy.init_node('point_and_click_client')
00063 
00064     initialize_service()
00065     x,y,z = get_point()
00066     print '3D point:', x, y, z
00067 
00068 
00069 


UI_segment_object
Author(s): Marc Killpack / mkillpack3@gatech.edu, Advisor: Prof. Charlie Kemp, Lab: Healthcare Robotics Lab at Georgia Tech
autogenerated on Wed Nov 27 2013 11:45:01