コード例 #1
0
ファイル: prm.py プロジェクト: Pankaj-Baranwal/find_path
def give_ans():
    g = grid()
    #grid.big_map()
    g.robolab()
    #grid.example_grid()
    #grid.print_grid()
    graph = create_graph(g.grid)
    #print graph
    dist, previous = prm(graph, 0)
    #print len(dist)
    #print len(previous)
    #print dist, previous
    return get_solution(previous)
コード例 #2
0
ファイル: prm.py プロジェクト: nirajkryadav/find_path
def give_ans():
    g = grid()
    #grid.big_map()
    g.robolab()
    #grid.example_grid()
    #grid.print_grid()
    graph = create_graph(g.grid)
    #print graph
    dist, previous = prm(graph, 0)
    #print len(dist)
    #print len(previous)
    #print dist, previous
    return get_solution(previous)
コード例 #3
0
	def scan_x(self):
		bot = robot()
		grid = grid()
		grid.robolab()

		bot.set_goal(grid, 0, 9)

		rows = len(grid.grid)
		columns = len(grid.grid[0])

		for i in range(0, rows):
			counter = 0
			for j in range(bot.y, bot.fy):
				if grid.grid[i][j] == 1:
					break
				elif grid.grid[i][j] == 0:
					counter += 1
			dmap = [[]]
コード例 #4
0
ファイル: Dijkstra.py プロジェクト: Pankaj-Baranwal/find_path
    elapsed_time_dijkstras = time.time() - start_time
    print "algo =" ,elapsed_time_dijkstras
    return dist, previous

def display_solution(predecessor):
    cell = 9
    while cell:
        print cell
        cell = predecessor[cell]
    print(0)

def get_solution(predecessor):
    array = []
    cell = 9
    while cell:
        array.append(cell)
        cell = predecessor[cell]
    print array
    print(0)

grid = grid()
#grid.big_map()
grid.robolab()
grid.print_grid()
graph = create_graph(grid.grid)
#print graph
dist, previous = dijkstra(graph, 0)
#print len(dist)
#print len(previous)
print dist, previous
display_solution(previous)
コード例 #5
0
ファイル: main.py プロジェクト: Pankaj-Baranwal/find_path
from utils.structure import grid
#from modules.pi_arduino_interface import find_displacement
import motion_planning.search
from modules.get_smooth_path import interpolate_path, plot_path

g = grid()
g.robolab()
grid = g.grid

init=[0,0]
goal = [0, len(grid[0])-1]

def run_motion_planning(grid, init, goal):
	list_of_xy = motion_planning.search.search(grid, init, goal)
	interpolated_xy = interpolate_path(list_of_xy)
	plot_path(list_of_xy, interpolated_xy)
	input_array = 0#find_displacement(interpolated_xy)
	print input_array

run_motion_planning(grid, init, goal)
コード例 #6
0
ファイル: Dijkstra.py プロジェクト: nirajkryadav/find_path

def display_solution(predecessor):
    cell = 9
    while cell:
        print cell
        cell = predecessor[cell]
    print(0)


def get_solution(predecessor):
    array = []
    cell = 9
    while cell:
        array.append(cell)
        cell = predecessor[cell]
    print array
    print(0)


grid = grid()
#grid.big_map()
grid.robolab()
grid.print_grid()
graph = create_graph(grid.grid)
#print graph
dist, previous = dijkstra(graph, 0)
#print len(dist)
#print len(previous)
print dist, previous
display_solution(previous)
コード例 #7
0
from utils.structure import grid
from pi_arduino_interface import find_displacement
import search
from get_path import interpolate_path, plot_path

g = grid()
g.robolab()
grid = g.grid

init = [0, 0]
goal = [0, len(grid[0]) - 1]


def run_motion_planning(grid, init, goal):
    list_of_xy = search.search(grid, init, goal)
    interpolated_xy = interpolate_path(list_of_xy)
    plot_path(list_of_xy, interpolated_xy)
    input_array = find_displacement(interpolated_xy)
    print input_array


run_motion_planning(grid, init, goal)