def put_up_windows(self, facade_image, windows, wall_length, model_wall): rospy.loginfo("Planner received information about the windows. Putting windows on walls") # Generate an array that takes the time from now and the next 30 minutes, which we will say is the estimated mission duration # We assume that the image itself is the plane, which is harsh to assume, but it's the best we've got... # Based on the size of the image (width, height), we make translation factors for x and y to be able to place the windows on the planes. # Let's then generate windows in the form that our mission class can understand, taking the bounding boxes of the instance segmentation, aka the rois and make windows out of them for i in range(len(windows)): # Remember that the coordinates of the rois (windows) are upside down on the y-axis # The rois are in the following form : y1,x1, y2,x2 n_xy_tiles = len(model_wall.x) n_z_tiles = len(model_wall.z) # this is the y coordinate of the image, but the z coordinate in the world-frame x1 = n_xy_tiles - round((windows[i].roi[1] / facade_image.width) * n_xy_tiles) - 1 y1 = n_z_tiles - round((windows[i].roi[0] / facade_image.height) * n_z_tiles) - 1 x2 = n_xy_tiles - round((windows[i].roi[3] / facade_image.width) * n_xy_tiles) - 1 y2 = n_z_tiles - round((windows[i].roi[2] / facade_image.height) * n_z_tiles) - 1 #rospy.loginfo([x1, y1, x2, y2]) # We are going to find indecies for the plane and just select the ones that the window covers # TODO: COrrect this method. It's not quite right... p1 = np.array([model_wall.x[x1], model_wall.y[x1], model_wall.z[y2]]) p2 = np.array([model_wall.x[x2], model_wall.y[x2], model_wall.z[y2]]) p3 = np.array([model_wall.x[x1], model_wall.y[x1], model_wall.z[y1]]) window = Boundary(p1[0], p1[1], p1[2], p2[0], p2[1], p2[2], p3[0], p3[2], p3[2], "window", self.s.get_lightsource()) window.plot(self.ax) self.model_windows.append(window) rospy.loginfo(self.s.date.timestamp()) return PoseArray()
s.get_lightsource) south_wall = Boundary(local4[0], local4[1], 0.0, local1[0], local1[1], 0.0, local4[0], local4[1], height, "wall", s.get_lightsource()) #ground_plane = Boundary(-5, -5, 0, 5, -5, 0, -5, 5, 0, "grass", s.get_lightsource()) list_of_reflective_boundaries = [ fake_east_window, south_window, fake_west_window ] list_of_walls = [east_wall, north_wall, west_wall, south_wall] fig = plt.figure(num=1, clear=True) ax = fig.add_subplot(1, 1, 1, projection='3d') east_wall.plot(ax) south_window.plot(ax) north_wall.plot(ax) fake_east_window.plot(ax) west_wall.plot(ax) fake_west_window.plot(ax) south_wall.plot(ax) #ground_plane.plot(ax) s.cast_on(list_of_reflective_boundaries, ax) m.draw_mission_planes(list_of_walls, ax) ax.set_xlabel('X: East') ax.set_xlim(-10, 10) ax.set_ylabel('Y: North')