6 from visualization_msgs.msg
import Marker
7 from nav_msgs.msg
import OccupancyGrid
8 from geometry_msgs.msg
import PointStamped
9 from getfrontier
import getfrontier
13 mapData=OccupancyGrid()
26 exploration_goal=PointStamped()
27 map_topic= rospy.get_param(
'~map_topic',
'/robot_1/map')
28 rospy.Subscriber(map_topic, OccupancyGrid, mapCallBack)
29 targetspub = rospy.Publisher(
'/detected_points', PointStamped, queue_size=10)
30 pub = rospy.Publisher(
'shapes', Marker, queue_size=10)
31 rospy.init_node(
'detector', anonymous=
False)
33 while mapData.header.seq<1
or len(mapData.data)<1:
40 points.header.frame_id=mapData.header.frame_id
41 points.header.stamp=rospy.Time.now()
46 points.type = Marker.POINTS
48 points.action = Marker.ADD;
50 points.pose.orientation.w = 1.0;
51 points.scale.x=points.scale.y=0.3;
52 points.color.r = 255.0/255.0
53 points.color.g = 0.0/255.0
54 points.color.b = 0.0/255.0
56 points.lifetime == rospy.Duration();
59 while not rospy.is_shutdown():
61 for i
in range(len(frontiers)):
63 exploration_goal.header.frame_id= mapData.header.frame_id
64 exploration_goal.header.stamp=rospy.Time(0)
65 exploration_goal.point.x=x[0]
66 exploration_goal.point.y=x[1]
67 exploration_goal.point.z=0
70 targetspub.publish(exploration_goal)
71 points.points=[exploration_goal.point]
83 if __name__ ==
'__main__':
86 except rospy.ROSInterruptException: