Go to the documentation of this file.00001
00002
00003 import roslib; roslib.load_manifest('tidyup_tools')
00004 import rospy
00005 import sys
00006 import copy
00007
00008 from pr2_python.base import Base
00009 from tidyup_arm_services.planning_scene_sync import PlanningSceneSync
00010
00011 if __name__ == '__main__':
00012 rospy.init_node('check_robot_locations')
00013 loop_rate = rospy.Rate(0.2)
00014 pss = PlanningSceneSync()
00015 rospy.loginfo('checking current robot state for collisions...')
00016 base = Base()
00017 while not rospy.is_shutdown():
00018 error_codes = base._check_pose_srv(robot_states=[copy.deepcopy(pss._latest_planning_scene.robot_state)]).error_codes
00019 if not len(error_codes) > 0:
00020 raise ex.AllYourBasePosesAreBelongToUs((x,y,z))
00021 if error_codes[0].val == error_codes[0].SUCCESS:
00022 rospy.loginfo('current state is collision free.')
00023 else:
00024 rospy.logwarn('current state is in collision.')
00025 loop_rate.sleep()
00026
00027