def __init__(self, cols, rows, widthMM, heightMM, #the x,y and th of the current location can be passed currentRow = -1, currentCol = -1, currentTh= 0, goalRow = -1, goalCol = -1, gridUpdate = "", image=None, grid=None, gridResize=1.0,showIter=0, title=""): self.markerToolkit = MarkerToolkit() self.x_localizeMM = 0 self.y_localizeMM = 0 self.thr_localize = 0 self.x_last_marker_localizeMM = 0 self.x_last_marker_robotMM = 0 self.y_last_marker_localizeMM = 0 self.y_last_marker_robotMM = 0 self.thr_last_marker_localize = 0 self.thr_last_marker_robot = 0 self.resetMarkers() OccupancyGrid.__init__(self, cols=cols, rows=rows, widthMM=widthMM, heightMM=heightMM, currentRow=currentRow, currentCol=currentCol, currentTh=currentTh, goalRow=goalRow, goalCol=goalCol, image=image, grid=grid, gridResize=gridResize, showIter=showIter, title=title)
def __init__( self, cols, rows, widthMM, heightMM, # the x,y and th of the current location can be passed currentRow=-1, currentCol=-1, currentTh=0, goalRow=-1, goalCol=-1, gridUpdate="", image=None, grid=None, gridResize=1.0, showIter=0, title="", ): self.centros = [] self.markerToolkit = MarkerToolkit() self.x_localizeMM = 0 self.y_localizeMM = 0 self.thr_localize = 0 self.x_last_marker_localizeMM = 0 self.x_last_marker_robotMM = 0 self.y_last_marker_localizeMM = 0 self.y_last_marker_robotMM = 0 self.thr_last_marker_localize = 0 self.thr_last_marker_robot = 0 self.resetMarkers() OccupancyGrid.__init__( self, cols=cols, rows=rows, widthMM=widthMM, heightMM=heightMM, currentRow=currentRow, currentCol=currentCol, currentTh=currentTh, goalRow=goalRow, goalCol=goalCol, image=image, grid=grid, gridResize=gridResize, showIter=showIter, title=title, ) self.distanceToWall = [[self.infinity for col in range(self.cols)] for row in range(self.rows)] # Todos los bloques ocupados forman parte de una pared y por tanto # se les asigna distancia 0 a las paredes. for row in range(self.rows): for col in range(self.cols): if self.grid[row][col] > self.threshhold: self.distanceToWall[row][col] = 0 # Inicia perceptrón con los pesos calculados en la parte1. Si no se desea usar, comentar # esta sección de código. self.pesos = [ -0.25830320437434307, 1.160526501403915, -0.15551005292679421, 1.2578377038143795, -0.55707372041035363, -2.9552247878192888, -1.6809527155003046, -2.2014578204055359, -13.0, 0.0, ] self.calculadorNeuronal = PerceptronMonocapa(self.pesos, w2)