get_state_validity.py
Go to the documentation of this file.
00001 #
00002 # Copyright (c) 2010, 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 (advait@cc.gatech.edu), Healthcare Robotics Lab, Georgia Tech
00029 
00030 import roslib; roslib.load_manifest('arm_navigation_tutorials')
00031 import sys
00032 import rospy
00033 
00034 from planning_environment_msgs.srv import GetStateValidity
00035 from planning_environment_msgs.srv import GetStateValidityRequest
00036 
00037 
00038 if __name__ == '__main__':
00039     rospy.init_node('get_state_validity_python')
00040 
00041     srv_nm = 'environment_server_right_arm/get_state_validity'
00042     rospy.wait_for_service(srv_nm)
00043     get_state_validity = rospy.ServiceProxy(srv_nm, GetStateValidity)
00044 
00045     req = GetStateValidityRequest()
00046     req.robot_state.joint_state.name = ['r_shoulder_pan_joint',
00047                                         'r_shoulder_lift_joint',
00048                                         'r_upper_arm_roll_joint',
00049                                         'r_elbow_flex_joint',
00050                                         'r_forearm_roll_joint',
00051                                         'r_wrist_flex_joint',
00052                                         'r_wrist_roll_joint']
00053     req.robot_state.joint_state.position = [0.] * 7
00054     req.robot_state.joint_state.position[0] = 0.4
00055     req.robot_state.joint_state.position[3] = -0.4
00056 
00057     req.robot_state.joint_state.header.stamp = rospy.Time.now()
00058     req.check_collisions = True
00059 
00060     res = get_state_validity.call(req)
00061     
00062     if res.error_code.val == res.error_code.SUCCESS:
00063         rospy.loginfo('Requested state is not in collision')
00064     else:
00065         rospy.loginfo('Requested state is in collision. Error code: %d'%(res.error_code.val))
00066 
00067 
00068 


arm_navigation_tutorials
Author(s): Advait Jain
autogenerated on Wed Nov 27 2013 12:09:02