Example #1
0
def _run_voronoi_expansion(c):
    """Runs the voronoi expansion"""
    import time; time.sleep(3)
    from voronoi import VoronoiExpansion
    ve = VoronoiExpansion(c)
    while ve.step_solution():
        pass
Example #2
0
    def reset_algorithm(self):
        """Resets the algorithm"""
        self.costmap_widget.canvas.freeze = True
        self.costmap[:] = 0.0
        Obstacle(3, 3, 3, 3).draw(self.costmap)
        Obstacle(9, 5, 3, 3).draw(self.costmap)
        Obstacle(16, 4, 3, 3).draw(self.costmap)

        self.vo = VoronoiExpansion(self.costmap)
        self.costmap_widget.canvas.freeze = False
        self.costmap_widget.canvas.on_map_update()
Example #3
0
    def setup_algorithm(self):
        """Sets up the algorithm"""
        self.costmap = Costmap2D(DEFAULT_WIDTH,
                                 DEFAULT_HEIGHT,
                                 resolution=DEFAULT_RESOLUTION)
        Obstacle(3, 3, 3, 3).draw(self.costmap)
        Obstacle(9, 5, 3, 3).draw(self.costmap)
        Obstacle(16, 4, 3, 3).draw(self.costmap)

        self.costmap_widget = Costmap2DWidget(self.costmap,
                                              parent=self,
                                              show_goal=False,
                                              show_colorbar=self.colorbar)
        self.costmap_widget.canvas.show_start = False
        self.costmap_widget.canvas.show_goal = False
        self.vo = VoronoiExpansion(self.costmap)
Example #4
0
    def reset_algorithm(self):
        """Resets the algorithm"""
        self.costmap_widget.canvas.freeze = True
        self.costmap[:] = 0.0
        Obstacle(3,3,3,3).draw(self.costmap)
        Obstacle(9,5,3,3).draw(self.costmap)
        Obstacle(16,4,3,3).draw(self.costmap)

        self.vo = VoronoiExpansion(self.costmap)
        self.costmap_widget.canvas.freeze = False
        self.costmap_widget.canvas.on_map_update()
Example #5
0
    def setup_algorithm(self):
        """Sets up the algorithm"""
        self.costmap = Costmap2D(DEFAULT_WIDTH, DEFAULT_HEIGHT, resolution=DEFAULT_RESOLUTION)
        Obstacle(3,3,3,3).draw(self.costmap)
        Obstacle(9,5,3,3).draw(self.costmap)
        Obstacle(16,4,3,3).draw(self.costmap)

        self.costmap_widget = Costmap2DWidget(self.costmap, parent = self, show_goal = False,
                                                show_colorbar = self.colorbar)
        self.costmap_widget.canvas.show_start = False
        self.costmap_widget.canvas.show_goal = False
        self.vo = VoronoiExpansion(self.costmap)
Example #6
0
class VoronoiAlgorithmWidget(AlgorithmWidget):
    def __init__(self, parent=None, colorbar=False):
        self.colorbar = colorbar
        AlgorithmWidget.__init__(self, "Voronoi Algorithm", parent)
        self.pack_buttons()

    def setup_algorithm(self):
        """Sets up the algorithm"""
        self.costmap = Costmap2D(DEFAULT_WIDTH,
                                 DEFAULT_HEIGHT,
                                 resolution=DEFAULT_RESOLUTION)
        Obstacle(3, 3, 3, 3).draw(self.costmap)
        Obstacle(9, 5, 3, 3).draw(self.costmap)
        Obstacle(16, 4, 3, 3).draw(self.costmap)

        self.costmap_widget = Costmap2DWidget(self.costmap,
                                              parent=self,
                                              show_goal=False,
                                              show_colorbar=self.colorbar)
        self.costmap_widget.canvas.show_start = False
        self.costmap_widget.canvas.show_goal = False
        self.vo = VoronoiExpansion(self.costmap)

    def step_solution(self):
        """Steps the solution"""
        result = self.vo.step_solution()
        self.costmap_widget.canvas.on_map_update()

        return result

    def reset_algorithm(self):
        """Resets the algorithm"""
        self.costmap_widget.canvas.freeze = True
        self.costmap[:] = 0.0
        Obstacle(3, 3, 3, 3).draw(self.costmap)
        Obstacle(9, 5, 3, 3).draw(self.costmap)
        Obstacle(16, 4, 3, 3).draw(self.costmap)

        self.vo = VoronoiExpansion(self.costmap)
        self.costmap_widget.canvas.freeze = False
        self.costmap_widget.canvas.on_map_update()
Example #7
0
class VoronoiAlgorithmWidget(AlgorithmWidget):
    def __init__(self, parent = None, colorbar = False):
        self.colorbar = colorbar
        AlgorithmWidget.__init__(self, "Voronoi Algorithm", parent)
        self.pack_buttons()

    def setup_algorithm(self):
        """Sets up the algorithm"""
        self.costmap = Costmap2D(DEFAULT_WIDTH, DEFAULT_HEIGHT, resolution=DEFAULT_RESOLUTION)
        Obstacle(3,3,3,3).draw(self.costmap)
        Obstacle(9,5,3,3).draw(self.costmap)
        Obstacle(16,4,3,3).draw(self.costmap)

        self.costmap_widget = Costmap2DWidget(self.costmap, parent = self, show_goal = False,
                                                show_colorbar = self.colorbar)
        self.costmap_widget.canvas.show_start = False
        self.costmap_widget.canvas.show_goal = False
        self.vo = VoronoiExpansion(self.costmap)

    def step_solution(self):
        """Steps the solution"""
        result = self.vo.step_solution()
        self.costmap_widget.canvas.on_map_update()

        return result

    def reset_algorithm(self):
        """Resets the algorithm"""
        self.costmap_widget.canvas.freeze = True
        self.costmap[:] = 0.0
        Obstacle(3,3,3,3).draw(self.costmap)
        Obstacle(9,5,3,3).draw(self.costmap)
        Obstacle(16,4,3,3).draw(self.costmap)

        self.vo = VoronoiExpansion(self.costmap)
        self.costmap_widget.canvas.freeze = False
        self.costmap_widget.canvas.on_map_update()