Go to the documentation of this file.00001
00002 import roslib; roslib.load_manifest('arm_navigation_tutorials')
00003 import sys
00004 import rospy
00005
00006 from planning_environment_msgs.srv import GetStateValidity
00007 from planning_environment_msgs.srv import GetStateValidityRequest
00008
00009
00010 if __name__ == '__main__':
00011 rospy.init_node('get_state_validity_python')
00012
00013 srv_nm = 'environment_server_right_arm/get_state_validity'
00014 rospy.wait_for_service(srv_nm)
00015 get_state_validity = rospy.ServiceProxy(srv_nm, GetStateValidity)
00016
00017 req = GetStateValidityRequest()
00018 req.robot_state.joint_state.name = ['r_shoulder_pan_joint',
00019 'r_shoulder_lift_joint',
00020 'r_upper_arm_roll_joint',
00021 'r_elbow_flex_joint',
00022 'r_forearm_roll_joint',
00023 'r_wrist_flex_joint',
00024 'r_wrist_roll_joint']
00025 req.robot_state.joint_state.position = [0.] * 7
00026 req.robot_state.joint_state.position[0] = 0.4
00027 req.robot_state.joint_state.position[3] = -0.4
00028
00029 req.robot_state.joint_state.header.stamp = rospy.Time.now()
00030 req.check_collisions = True
00031
00032 res = get_state_validity.call(req)
00033
00034 if res.error_code.val == res.error_code.SUCCESS:
00035 rospy.loginfo('Requested state is not in collision')
00036 else:
00037 rospy.loginfo('Requested state is in collision. Error code: %d'%(res.error_code.val))
00038
00039
00040