20 from geometry_msgs.msg
import Pose2D
21 from cob_map_accessibility_analysis.srv
import CheckPointAccessibility, CheckPointAccessibilityRequest, CheckPointAccessibilityResponse
22 from cob_map_accessibility_analysis.srv
import CheckPerimeterAccessibility, CheckPerimeterAccessibilityRequest, CheckPerimeterAccessibilityResponse
28 rospy.wait_for_service(
"/map_accessibility_analysis/map_points_accessibility_check")
29 rospy.wait_for_service(
"/map_accessibility_analysis/map_perimeter_accessibility_check")
31 rospy.loginfo(
"All map_accessibility_analysis services available")
34 "/map_accessibility_analysis/map_points_accessibility_check", CheckPointAccessibility)
38 "/map_accessibility_analysis/map_perimeter_accessibility_check", CheckPerimeterAccessibility)
44 self.
point_req = CheckPointAccessibilityRequest()
46 self.point_req.points_to_check.append(pose2d)
48 self.point_req.approach_path_accessibility_check =
False 53 except rospy.ServiceException
as e:
54 rospy.logerr(
"Service call 'map_points_accessibility_check' failed: %s" % e)
57 for i
in range(len(self.point_req.points_to_check)):
58 if self.point_res.accessibility_flags[i]:
59 rospy.loginfo(
"Nav Goal is valid")
61 return (
True, self.point_req.points_to_check[i])
63 rospy.logwarn(
"Nav Goal is not accessible")
67 for radius
in [0.1, 0.3, 0.5, 0.7, 1.0, 2.0]:
68 rospy.loginfo(
"Checking with perimeter radius %f", radius)
72 self.perimeter_req.center = pose2d
73 self.perimeter_req.radius = radius
75 self.perimeter_req.rotational_sampling_step = 0.0
80 except rospy.ServiceException
as e:
81 rospy.logerr(
"Service call 'map_perimeter_accessibility_check' failed: %s" % e)
85 if not self.perimeter_res.accessible_poses_on_perimeter == []:
86 rospy.loginfo(
"Found valid alternative")
88 return (
True, self.perimeter_res.accessible_poses_on_perimeter[0])
90 rospy.logerr(
"No valid alternative in perimeter")
def check_perimeter(self, pose2d)
def check_nav_goal(self, pose2d)