├── Python Simulator ├── Frontier Exploration │ ├── cluster │ │ ├── version.txt │ │ ├── util.pyc │ │ ├── util.pyo │ │ ├── __init__.pyc │ │ ├── __init__.pyo │ │ ├── cluster.pyc │ │ ├── cluster.pyo │ │ ├── linkage.pyc │ │ ├── linkage.pyo │ │ ├── matrix.pyc │ │ ├── matrix.pyo │ │ ├── method │ │ │ ├── base.pyc │ │ │ ├── base.pyo │ │ │ ├── kmeans.pyc │ │ │ ├── kmeans.pyo │ │ │ ├── __init__.pyc │ │ │ ├── __init__.pyo │ │ │ ├── hierarchical.pyc │ │ │ ├── hierarchical.pyo │ │ │ ├── __init__.py │ │ │ └── base.py │ │ ├── test │ │ │ ├── test_linkage.py │ │ │ └── test_numpy.py │ │ ├── __init__.py │ │ └── linkage.py │ ├── results │ │ ├── plots │ │ │ ├── FC_work.png │ │ │ ├── forPaper.zip │ │ │ ├── all_infoGain.pdf │ │ │ ├── all_infoGain.png │ │ │ ├── burgard_work.png │ │ │ ├── FC_dispersion.pdf │ │ │ ├── FC_dispersion.png │ │ │ ├── FC_sensitivity.pdf │ │ │ ├── FC_sensitivity.png │ │ │ ├── Sync_time_Free.pdf │ │ │ ├── all_iterations.pdf │ │ │ ├── all_iterations.png │ │ │ ├── all_redundancy.pdf │ │ │ ├── all_redundancy.png │ │ │ ├── Sync_time_Office.pdf │ │ │ ├── Sync_time_Outdoor.pdf │ │ │ ├── forPaper │ │ │ │ ├── map_free.png │ │ │ │ ├── map_office.png │ │ │ │ ├── FC_dispersion.png │ │ │ │ ├── map_outdoor.png │ │ │ │ ├── FC_sensitivity.png │ │ │ │ ├── all_iterations.png │ │ │ │ ├── all_underutilization.png │ │ │ │ └── description.txt │ │ │ ├── all_underutilization.pdf │ │ │ ├── all_underutilization.png │ │ │ ├── plotCode.txt │ │ │ ├── dispersion.dat │ │ │ ├── histogram.gnu │ │ │ ├── immigration.dat │ │ │ └── test.dat │ │ ├── old │ │ │ ├── frontierCluster_OfficeProgress9Bots.png │ │ │ ├── frontierCluster_FreeWorldLargeProgress9Bots.png │ │ │ ├── frontierCluster_OfficeInformationGain9Bots.png │ │ │ ├── frontierCluster_FreeWorldLargeInformationGain9Bots.png │ │ │ └── frontierCluster_freeWorld_redundancy.txt │ │ ├── FrontierClusters_FreeWorld12Robots.txt │ │ ├── FrontierClusters_FreeWorld2Robots_Volume.txt │ │ ├── dispersion.txt │ │ ├── FrontierClusters_FreeWorld_Volume.txt │ │ ├── redundancyHist.py │ │ ├── Sync_test.txt │ │ ├── temp2.txt │ │ └── plot.py │ ├── random.config │ ├── backup │ │ └── 1 (initial backup) │ │ │ ├── AStar.pyc │ │ │ ├── CAC.pyc │ │ │ ├── Cell.pyc │ │ │ ├── FC2.pyc │ │ │ ├── Faigl.pyc │ │ │ ├── Robot.pyc │ │ │ ├── Burgard.pyc │ │ │ ├── Cluster.pyc │ │ │ ├── GridUI.pyc │ │ │ ├── kmeans.pyc │ │ │ ├── GAExplore.pyc │ │ │ ├── GridWorld.pyc │ │ │ ├── Hungarian.pyc │ │ │ ├── Yamauchi.pyc │ │ │ ├── random.config │ │ │ ├── PriorityQueue.pyc │ │ │ ├── ConfigFileReader.pyc │ │ │ ├── FrontierClusters.pyc │ │ │ ├── Cluster.py │ │ │ ├── createRandomCfg.py │ │ │ ├── Changelog │ │ │ ├── freeworld_small.config │ │ │ ├── gridworld1.config │ │ │ ├── freeworld.config │ │ │ ├── README.md │ │ │ ├── Cell.py │ │ │ ├── fastTest.config │ │ │ ├── Robot.py │ │ │ ├── freeworld_large.config │ │ │ ├── hungarianDemo.py │ │ │ ├── PriorityQueue.py │ │ │ ├── livingRoom.config │ │ │ ├── barmaze.config │ │ │ ├── baseline.config │ │ │ ├── circularMaze_easy.config │ │ │ ├── circularMaze.config │ │ │ ├── AStarDemo.py │ │ │ ├── kmeans.py │ │ │ └── AStar.py │ ├── greedy │ │ ├── Cluster.py │ │ ├── results │ │ │ ├── test.py │ │ │ ├── plot.py │ │ │ └── plot_old.py │ │ ├── Changelog │ │ ├── gridworld1.config │ │ ├── freeworld.config │ │ ├── README.md │ │ ├── freeworld_large.config │ │ ├── Cell.py │ │ ├── Robot.py │ │ ├── PriorityQueue.py │ │ ├── livingRoom.config │ │ ├── barmaze.config │ │ ├── circularMaze_easy.config │ │ ├── kmeans.py │ │ ├── circularMaze.config │ │ └── AStar.py │ ├── test.py │ ├── CommandFiles │ │ └── freeworld_small.txt │ ├── Cluster.py │ ├── code_profiler.py │ ├── createRandomCfg.py │ ├── Direct usage of gridworld │ │ ├── BFS.py │ │ ├── Dijkstra.py │ │ ├── AStar.py │ │ └── Datatypes.py │ ├── BFS.py │ ├── Dijkstra.py │ ├── freeworld_small.config │ ├── gridworld1.config │ ├── freeworld.config │ ├── README.md │ ├── fastTest.config │ ├── AStar.py │ ├── Cell.py │ ├── Robot.py │ ├── freeworld_large.config │ ├── hungarianDemo.py │ ├── PriorityQueue.py │ ├── Datatypes.py │ ├── livingRoom.config │ ├── barmaze.config │ ├── baseline.config │ ├── Conversion of gridworld │ │ ├── Dijkstra.py │ │ └── AStar.py │ ├── circularMaze_easy.config │ ├── circularMaze.config │ ├── kmeans.py │ ├── AStar_arjun.py │ └── GAdemo.py └── Path Planners │ ├── Init.py │ ├── Cell.py │ ├── Datatypes.py │ ├── BFS.py │ ├── freeworld_large.config │ ├── Dijkstra.py │ ├── GridWorld.py │ ├── ConfigFileMaker.py │ ├── AStar.py │ ├── ConfigFileReader.py │ ├── README.md │ └── Simulator.py ├── JavaScript Simulator ├── images │ ├── bfs.png │ ├── astar.png │ ├── interface.png │ └── rrtconnect.png ├── stylesheets │ ├── canvas.css │ └── main.css ├── README.md ├── scripts │ └── interaction.js └── index.html ├── Final - Path Planning in Single and Multi-Robot Systems - Sahib Singh Dhanjal (2012A4PS289P).pdf ├── Turtlebot Node - Path Planning ├── pathplanners_plugin.xml ├── package.xml └── launch │ └── pathplanners.launch ├── LICENSE └── README.md /Python Simulator/Frontier Exploration/cluster/version.txt: -------------------------------------------------------------------------------- 1 | 1.3.1 2 | -------------------------------------------------------------------------------- /JavaScript Simulator/images/bfs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/JavaScript Simulator/images/bfs.png -------------------------------------------------------------------------------- /JavaScript Simulator/images/astar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/JavaScript Simulator/images/astar.png -------------------------------------------------------------------------------- /JavaScript Simulator/images/interface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/JavaScript Simulator/images/interface.png -------------------------------------------------------------------------------- /JavaScript Simulator/images/rrtconnect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/JavaScript Simulator/images/rrtconnect.png -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/cluster/util.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/cluster/util.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/cluster/util.pyo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/cluster/util.pyo -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/cluster/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/cluster/__init__.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/cluster/__init__.pyo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/cluster/__init__.pyo -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/cluster/cluster.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/cluster/cluster.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/cluster/cluster.pyo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/cluster/cluster.pyo -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/cluster/linkage.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/cluster/linkage.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/cluster/linkage.pyo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/cluster/linkage.pyo -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/cluster/matrix.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/cluster/matrix.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/cluster/matrix.pyo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/cluster/matrix.pyo -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/cluster/method/base.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/cluster/method/base.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/cluster/method/base.pyo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/cluster/method/base.pyo -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/cluster/method/kmeans.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/cluster/method/kmeans.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/cluster/method/kmeans.pyo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/cluster/method/kmeans.pyo -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/FC_work.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/FC_work.png -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/cluster/method/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/cluster/method/__init__.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/cluster/method/__init__.pyo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/cluster/method/__init__.pyo -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/random.config: -------------------------------------------------------------------------------- 1 | height 50 2 | width 50 3 | numRobots 4 4 | R 500 5 | baseX 0 6 | baseY 0 7 | initLocs 8 | 11 6 9 | 29 5 10 | 43 7 11 | 32 26 12 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/forPaper.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/forPaper.zip -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/all_infoGain.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/all_infoGain.pdf -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/all_infoGain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/all_infoGain.png -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/burgard_work.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/burgard_work.png -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/cluster/method/hierarchical.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/cluster/method/hierarchical.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/cluster/method/hierarchical.pyo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/cluster/method/hierarchical.pyo -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/FC_dispersion.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/FC_dispersion.pdf -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/FC_dispersion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/FC_dispersion.png -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/FC_sensitivity.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/FC_sensitivity.pdf -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/FC_sensitivity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/FC_sensitivity.png -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/Sync_time_Free.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/Sync_time_Free.pdf -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/all_iterations.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/all_iterations.pdf -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/all_iterations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/all_iterations.png -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/all_redundancy.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/all_redundancy.pdf -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/all_redundancy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/all_redundancy.png -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/AStar.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/backup/1 (initial backup)/AStar.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/CAC.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/backup/1 (initial backup)/CAC.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/Cell.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/backup/1 (initial backup)/Cell.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/FC2.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/backup/1 (initial backup)/FC2.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/Faigl.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/backup/1 (initial backup)/Faigl.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/Robot.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/backup/1 (initial backup)/Robot.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/Sync_time_Office.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/Sync_time_Office.pdf -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/Sync_time_Outdoor.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/Sync_time_Outdoor.pdf -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/forPaper/map_free.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/forPaper/map_free.png -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/Burgard.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/backup/1 (initial backup)/Burgard.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/Cluster.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/backup/1 (initial backup)/Cluster.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/GridUI.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/backup/1 (initial backup)/GridUI.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/kmeans.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/backup/1 (initial backup)/kmeans.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/forPaper/map_office.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/forPaper/map_office.png -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/GAExplore.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/backup/1 (initial backup)/GAExplore.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/GridWorld.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/backup/1 (initial backup)/GridWorld.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/Hungarian.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/backup/1 (initial backup)/Hungarian.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/Yamauchi.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/backup/1 (initial backup)/Yamauchi.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/random.config: -------------------------------------------------------------------------------- 1 | height 50 2 | width 50 3 | numRobots 4 4 | R 500 5 | baseX 0 6 | baseY 0 7 | initLocs 8 | 11 6 9 | 29 5 10 | 43 7 11 | 32 26 12 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/all_underutilization.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/all_underutilization.pdf -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/all_underutilization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/all_underutilization.png -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/forPaper/FC_dispersion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/forPaper/FC_dispersion.png -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/forPaper/map_outdoor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/forPaper/map_outdoor.png -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/forPaper/FC_sensitivity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/forPaper/FC_sensitivity.png -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/forPaper/all_iterations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/forPaper/all_iterations.png -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/PriorityQueue.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/backup/1 (initial backup)/PriorityQueue.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/ConfigFileReader.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/backup/1 (initial backup)/ConfigFileReader.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/FrontierClusters.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/backup/1 (initial backup)/FrontierClusters.pyc -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/greedy/Cluster.py: -------------------------------------------------------------------------------- 1 | class Cluster(object): 2 | 3 | def __init__(self, x, y): 4 | 5 | self.x = x 6 | self.y = y 7 | self.alloted = -1 8 | self.dist = 0 9 | self.robot = 0 10 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/forPaper/all_underutilization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/plots/forPaper/all_underutilization.png -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/old/frontierCluster_OfficeProgress9Bots.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/old/frontierCluster_OfficeProgress9Bots.png -------------------------------------------------------------------------------- /Python Simulator/Path Planners/Init.py: -------------------------------------------------------------------------------- 1 | import GridWorld 2 | 3 | class Initialize: 4 | def __init__(self, height, width, obstacles): 5 | self.gridworld = GridWorld.GridWorld(height, width, obstacles) 6 | self.height = height 7 | self.width = width -------------------------------------------------------------------------------- /Final - Path Planning in Single and Multi-Robot Systems - Sahib Singh Dhanjal (2012A4PS289P).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Final - Path Planning in Single and Multi-Robot Systems - Sahib Singh Dhanjal (2012A4PS289P).pdf -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/old/frontierCluster_FreeWorldLargeProgress9Bots.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/old/frontierCluster_FreeWorldLargeProgress9Bots.png -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/old/frontierCluster_OfficeInformationGain9Bots.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/old/frontierCluster_OfficeInformationGain9Bots.png -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/old/frontierCluster_FreeWorldLargeInformationGain9Bots.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahibdhanjal/Path-Planning-Simulator/HEAD/Python Simulator/Frontier Exploration/results/old/frontierCluster_FreeWorldLargeInformationGain9Bots.png -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/FrontierClusters_FreeWorld12Robots.txt: -------------------------------------------------------------------------------- 1 | Read the config file freeworld_large.config 2 | volume: 18 3 | visitednow 21 4 | redundancy: 0 5 | totalMoves: 9 6 | volume: 29 7 | visitednow 31 8 | redundancy: 2 9 | totalMoves: 21 10 | volume: 35 11 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/plotCode.txt: -------------------------------------------------------------------------------- 1 | set ylabel "Number of Iterations" 2 | set xlabel "Number of Robots" 3 | plot 'test.dat' using 2:xtic(1) ti col lw 2 ps 1.5 pt 15, '' using 3 ti col lw 2 ps 1.5 pt 7, '' using 4 ti col lw 2 ps 2.5 pt 9, '' using 5 ti col lw 2 ps 1.5 pt 5 4 | -------------------------------------------------------------------------------- /Python Simulator/Path Planners/Cell.py: -------------------------------------------------------------------------------- 1 | class Cell(object): 2 | def __init__(self, x, y): 3 | self.x = x 4 | self.y = y 5 | self.occupied = False 6 | self.obstacle = False 7 | self.visited = False 8 | self.ispath = False 9 | self.isprinted = False 10 | self.start = False 11 | self.goal = False -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/test.py: -------------------------------------------------------------------------------- 1 | import AStar 2 | import GridWorld 3 | 4 | height=10;width=10; 5 | obstacles=[(3,3),(2,3)] 6 | gridworld = GridWorld.GridWorld(height, width, obstacles) 7 | 8 | astar = AStar.AStar() 9 | 10 | path, arr = astar.aStarSearch(gridworld, (1,1),(9,9)) 11 | 12 | print(path,arr) -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/CommandFiles/freeworld_small.txt: -------------------------------------------------------------------------------- 1 | 6 2 0 4 2 | 0 4 2 6 3 | 2 6 4 0 4 | 8 8 8 8 5 | 0 4 2 6 6 | 6 2 0 4 7 | 6 2 0 4 8 | 4 0 6 2 9 | 4 0 6 2 10 | 8 8 8 8 11 | 6 2 0 4 12 | 6 2 0 4 13 | 0 4 2 6 14 | 0 4 2 6 15 | 2 7 2 0 16 | 4 8 0 2 17 | 4 4 4 2 18 | 8 3 2 8 19 | 0 5 6 6 20 | 0 8 6 6 21 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/FrontierClusters_FreeWorld2Robots_Volume.txt: -------------------------------------------------------------------------------- 1 | 10 2 | 18 3 | 28 4 | 35 5 | 42 6 | 51 7 | 61 8 | 68 9 | 76 10 | 84 11 | 92 12 | 99 13 | 108 14 | 116 15 | 124 16 | 132 17 | 138 18 | 148 19 | 158 20 | 166 21 | 174 22 | 183 23 | 189 24 | 111 25 | 114 26 | 67 27 | 31 28 | 3 29 | 2 30 | 1 31 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/dispersion.dat: -------------------------------------------------------------------------------- 1 | 26 2 | 34 3 | 40 4 | 48 5 | 53 6 | 57 7 | 71 8 | 78 9 | 88 10 | 101 11 | 114 12 | 120 13 | 132 14 | 144 15 | 161 16 | 158 17 | 164 18 | 195 19 | 202 20 | 201 21 | 216 22 | 227 23 | 237 24 | 256 25 | 277 26 | 274 27 | 273 28 | 247 29 | 251 30 | 224 31 | 265 32 | 217 33 | 209 34 | 237 35 | 167 36 | -------------------------------------------------------------------------------- /Turtlebot Node - Path Planning/pathplanners_plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | This is the global path planner plugin which includes A*, Breadth First Search and Dijkstra's algorihtm. 4 | 5 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/Cluster.py: -------------------------------------------------------------------------------- 1 | class Cluster(object): 2 | 3 | def __init__(self, x, y): 4 | 5 | self.x = x 6 | self.y = y 7 | self.allotted = -1 8 | # Distance from the cluster's centroid to the presently allocated robot 9 | self.dist = 0 10 | # Arjun forgot to clean this up 11 | self.robot = 0 12 | # Denotes if the allocated (or reallocated) robot has already entered this cluster for exploration 13 | self.isInside = False 14 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/Cluster.py: -------------------------------------------------------------------------------- 1 | class Cluster(object): 2 | 3 | def __init__(self, x, y): 4 | 5 | self.x = x 6 | self.y = y 7 | self.allotted = -1 8 | # Distance from the cluster's centroid to the presently allocated robot 9 | self.dist = 0 10 | # Arjun forgot to clean this up 11 | self.robot = 0 12 | # Denotes if the allocated (or reallocated) robot has already entered this cluster for exploration 13 | self.isInside = False 14 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/dispersion.txt: -------------------------------------------------------------------------------- 1 | 48 2 | 88 3 | 106 4 | 164 5 | 195 6 | 229 7 | 345 8 | 448 9 | 542 10 | 695 11 | 902 12 | 1016 13 | 1202 14 | 1398 15 | 1693 16 | 1788 17 | 1984 18 | 2509 19 | 2722 20 | 2779 21 | 3118 22 | 3447 23 | 3869 24 | 4434 25 | 4963 26 | 5052 27 | 4983 28 | 4701 29 | 4759 30 | 3950 31 | 5359 32 | 4029 33 | 4027 34 | 4391 35 | 3293 36 | 3469 37 | 3509 38 | 5407 39 | 6499 40 | 6990 41 | 6963 42 | 5314 43 | 4633 44 | 4331 45 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/FrontierClusters_FreeWorld_Volume.txt: -------------------------------------------------------------------------------- 1 | 17 2 | 26 3 | 38 4 | 44 5 | 50 6 | 57 7 | 63 8 | 72 9 | 77 10 | 84 11 | 97 12 | 99 13 | 107 14 | 118 15 | 122 16 | 131 17 | 140 18 | 149 19 | 160 20 | 167 21 | 175 22 | 185 23 | 191 24 | 196 25 | 202 26 | 182 27 | 189 28 | 164 29 | 159 30 | 146 31 | 129 32 | 99 33 | 83 34 | 62 35 | 45 36 | 35 37 | 28 38 | 23 39 | 22 40 | 22 41 | 21 42 | 19 43 | 19 44 | 17 45 | 14 46 | 14 47 | 10 48 | 8 49 | 7 50 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/greedy/results/test.py: -------------------------------------------------------------------------------- 1 | infile = open('freeworld_pruned.txt') 2 | lines = infile.readlines() 3 | avgTime = 0.0 4 | avgMetric = 0.0 5 | count = 0 6 | for line in lines: 7 | currentLine = line.strip().split() 8 | time = int(currentLine[0]) 9 | metric = float(currentLine[1]) 10 | avgTime += time 11 | avgMetric += metric 12 | count += 1 13 | avgTime = avgTime / float(count) 14 | avgMetric = avgMetric / float(count) 15 | print 'avgTime:', avgTime 16 | print 'avgMetric:', avgMetric -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/code_profiler.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Profiler for Path Planning Algorithms 3 | @author - Sahib Singh Dhanjal 4 | ''' 5 | 6 | import GridWorld 7 | import ConfigFileReader 8 | 9 | import BFS 10 | 11 | 12 | start=(0,0) 13 | goal=(49,49) 14 | 15 | configFileName = "office.config" 16 | 17 | ret, height, width, numRobots, R, baseX, baseY, initLocs, obstacles = ConfigFileReader.ConfigFileReader(configFileName).readCfg() 18 | 19 | gridworld = GridWorld.GridWorld(height, width, obstacles) 20 | 21 | path4,actual,cost4=BFS.BFS().BFSsearch(gridworld,start,goal) 22 | print('Profiling Done') -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/redundancyHist.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | 4 | def main(): 5 | 6 | try: 7 | inFile = open(sys.argv[1], 'r') 8 | except Exception, e: 9 | print 'A valid input file was not passed' 10 | 11 | # We assume that the first line contains the number of robots 12 | # and the subsequent lines contain the redundancies incurred in each iteration 13 | numRobots = 0 14 | hist = [] 15 | firstTime = True 16 | 17 | lines = inFile.readlines() 18 | # print lines 19 | for line in lines: 20 | currentLine = line.strip().split() 21 | if firstTime == True: 22 | numRobots = int(currentLine[0]) 23 | firstTime = False 24 | for i in range(numRobots + 1): 25 | hist.append(0) 26 | continue 27 | hist[int(currentLine[0])] += 1 28 | 29 | print 'hist:', hist 30 | 31 | 32 | if __name__ == '__main__': 33 | main() -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/histogram.gnu: -------------------------------------------------------------------------------- 1 | # set terminal png transparent nocrop enhanced size 450,320 font "arial,8" 2 | # set output 'histograms.2.png' 3 | set boxwidth 0.9 absolute 4 | set style fill solid 1.00 border lt -1 5 | set key inside right top vertical Right noreverse noenhanced autotitle nobox 6 | set style histogram clustered gap 1 title textcolor lt -1 7 | set datafile missing '-' 8 | set style data histograms 9 | set xtics border in scale 0,0 nomirror rotate by -45 autojustify 10 | set xtics norangelimit 11 | set xtics () 12 | set title "US immigration from Northern Europe\nPlot selected data columns as histogram of clustered boxes" 13 | set yrange [ 0.00000 : 300000. ] noreverse nowriteback 14 | x = 0.0 15 | i = 22 16 | ## Last datafile plotted: "immigration.dat" 17 | plot 'immigration.dat' using 6:xtic(1) ti col, '' u 12 ti col, '' u 13 ti col, '' u 14 ti col -------------------------------------------------------------------------------- /JavaScript Simulator/stylesheets/canvas.css: -------------------------------------------------------------------------------- 1 | #SearchAlgo{ 2 | max-width: 1000px; 3 | margin: auto; 4 | } 5 | 6 | #stats { 7 | position: absolute; 8 | z-index: 50; 9 | text-align: center; 10 | color: white; 11 | float: right; 12 | cursor: move; 13 | left: 1190px; 14 | top: 135px; 15 | } 16 | 17 | #toggle { 18 | position: relative; 19 | float: right; 20 | z-index: 999; 21 | font: 10pt Futura, ‘Century Gothic’, AppleGothic, sans-serif; 22 | left: 190px; 23 | top: 5px; 24 | width: 21px; 25 | border: 2px solid #555555; 26 | background-color: black; 27 | border-radius: 50%; 28 | } 29 | 30 | #textbar { 31 | position: absolute; 32 | background-color: #2a2e2f; 33 | opacity: 0.7; 34 | height: 145px; 35 | width: 220px; 36 | text-align: center;; 37 | color: white; 38 | z-index: 100; 39 | float: left; 40 | font: 9pt Futura, ‘Century Gothic’, AppleGothic, sans-serif; 41 | } -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/createRandomCfg.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import random 3 | 4 | f = open('random.config', 'w') 5 | f.write('height 50\n') 6 | f.write('width 50\n') 7 | numRobots = 'numRobots ' + str(sys.argv[1]) + '\n' 8 | f.write(numRobots) 9 | numRobots = int(sys.argv[1]) 10 | f.write('R 500\n') 11 | f.write('baseX 0\n') 12 | f.write('baseY 0\n') 13 | f.write('initLocs\n') 14 | initLocs = [] 15 | for i in range(numRobots): 16 | 17 | tempX = random.randint(0, 49) 18 | tempY = random.randint(0, 49) 19 | if (tempX, tempY) in initLocs: 20 | thereFlag = True 21 | while thereFlag == True: 22 | tempX = random.randint(0, 49) 23 | tempY = random.randint(0, 49) 24 | if (tempX, tempY) in initLocs: 25 | thereFlag = True 26 | else: 27 | thereFlag = False 28 | initLocs.append((tempX, tempY)) 29 | initLoc = str(tempX) + ' ' + str(tempY) + '\n' 30 | f.write(initLoc) 31 | f.close() -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/createRandomCfg.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import random 3 | 4 | f = open('random.config', 'w') 5 | f.write('height 50\n') 6 | f.write('width 50\n') 7 | numRobots = 'numRobots ' + str(sys.argv[1]) + '\n' 8 | f.write(numRobots) 9 | numRobots = int(sys.argv[1]) 10 | f.write('R 500\n') 11 | f.write('baseX 0\n') 12 | f.write('baseY 0\n') 13 | f.write('initLocs\n') 14 | initLocs = [] 15 | for i in range(numRobots): 16 | 17 | tempX = random.randint(0, 49) 18 | tempY = random.randint(0, 49) 19 | if (tempX, tempY) in initLocs: 20 | thereFlag = True 21 | while thereFlag == True: 22 | tempX = random.randint(0, 49) 23 | tempY = random.randint(0, 49) 24 | if (tempX, tempY) in initLocs: 25 | thereFlag = True 26 | else: 27 | thereFlag = False 28 | initLocs.append((tempX, tempY)) 29 | initLoc = str(tempX) + ' ' + str(tempY) + '\n' 30 | f.write(initLoc) 31 | f.close() -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/cluster/method/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # This is part of "python-cluster". A library to group similar items together. 3 | # Copyright (C) 2006 Michel Albert 4 | # 5 | # This library is free software; you can redistribute it and/or modify it 6 | # under the terms of the GNU Lesser General Public License as published by the 7 | # Free Software Foundation; either version 2.1 of the License, or (at your 8 | # option) any later version. 9 | # This library is distributed in the hope that it will be useful, but WITHOUT 10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 12 | # for more details. 13 | # You should have received a copy of the GNU Lesser General Public License 14 | # along with this library; if not, write to the Free Software Foundation, 15 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | # 17 | 18 | -------------------------------------------------------------------------------- /Turtlebot Node - Path Planning/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | pathplanners 4 | 1.0.0 5 | The Path Planners package written by Sahib Singh Dhanjal, BITS Pilani. 6 | Sahib Singh Dhanjal 7 | MIT 8 | 9 | catkin 10 | 11 | nav_core 12 | pluginlib 13 | roscpp 14 | rospy 15 | std_msgs 16 | 17 | nav_core 18 | pluginlib 19 | roscpp 20 | rospy 21 | std_msgs 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/Direct usage of gridworld/BFS.py: -------------------------------------------------------------------------------- 1 | from Datatypes import * 2 | 3 | class Dijkstra: 4 | def __init__(self): 5 | pass 6 | 7 | def aStarSearch(self,gridworld,start,goal): 8 | frontier=Queue() 9 | frontier.put(start) 10 | path={} 11 | cost={} 12 | path[start]=None 13 | cost[start]=0 14 | 15 | while not frontier.isEmpty(): 16 | current = frontier.get() 17 | 18 | if current==goal: 19 | break 20 | 21 | for next in gridworld.get8Neighbors(current): 22 | if next not in cost: 23 | frontier.put(next) 24 | path[next]=current 25 | cost[next]=cost[current]+1 26 | 27 | actualpath = [] 28 | current = goal 29 | while current != start: 30 | actualpath.append(current) 31 | current = path[current] 32 | return actualpath,path,cost -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/Direct usage of gridworld/Dijkstra.py: -------------------------------------------------------------------------------- 1 | from Datatypes import * 2 | 3 | class Dijkstra: 4 | def __init__(self): 5 | pass 6 | 7 | def aStarSearch(self,gridworld,start,goal): 8 | frontier=PriorityQueue() 9 | frontier.put(start,0) 10 | path={} 11 | cost={} 12 | path[start]=None 13 | cost[start]=0 14 | 15 | while not frontier.isEmpty(): 16 | current = frontier.get() 17 | 18 | if current==goal: 19 | break 20 | 21 | for next in gridworld.get8Neighbors(current): 22 | if next[0]==current[0] or next[1] == current[1]: 23 | newcost=cost[current]+1 24 | else: 25 | newcost=cost[current]+1.4 26 | 27 | if next not in cost or newcost ) 26 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 27 | # Else, the program could terminate unexpectedly 28 | initLocs 29 | 0 0 30 | 7 7 31 | 7 0 32 | 0 7 33 | 34 | # Specifies the location of each obstacle cell (Format: ) 35 | # Note: You can have any number of obstacle, provided each of them is a valid cell 36 | obstacles 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Sahib Singh Dhanjal 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Turtlebot Node - Path Planning/launch/pathplanners.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/freeworld_small.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for freeworld (a 10x10 grid of empty cells) 6 | 7 | 8 | 9 | 10 | # Specifies the height of the grid 11 | height 8 12 | # Specifies the width of the grid 13 | width 8 14 | 15 | # Specifies the number of robots to be placed 16 | numRobots 4 17 | 18 | # Specifies the communication range (radius) of each robot 19 | R 50 20 | 21 | # Specifies the X and Y coordinates of the base station 22 | baseX 4 23 | baseY 4 24 | 25 | # Specifies the initial locations of each robot (Format: ) 26 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 27 | # Else, the program could terminate unexpectedly 28 | initLocs 29 | 0 0 30 | 7 7 31 | 7 0 32 | 0 7 33 | 34 | # Specifies the location of each obstacle cell (Format: ) 35 | # Note: You can have any number of obstacle, provided each of them is a valid cell 36 | obstacles 37 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/gridworld1.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for gridworld1 (a.k.a. KMworld) 6 | 7 | 8 | 9 | 10 | # Specifies the height of the grid 11 | height 10 12 | # Specifies the width of the grid 13 | width 10 14 | 15 | # Specifies the number of robots to be placed 16 | numRobots 3 17 | 18 | # Specifies the communication range (radius) of each robot 19 | R 50 20 | 21 | # Specifies the X and Y coordinates of the base station 22 | baseX 4 23 | baseY 4 24 | 25 | # Specifies the initial locations of each robot (Format: ) 26 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 27 | # Else, the program could terminate unexpectedly 28 | initLocs 29 | 0 9 30 | 1 9 31 | 2 9 32 | 33 | # Specifies the location of each obstacle cell (Format: ) 34 | # Note: You can have any number of obstacle, provided each of them is a valid cell 35 | obstacles 36 | 0 0 37 | 1 0 38 | 2 2 39 | 3 3 40 | 4 4 41 | 5 5 42 | 6 6 43 | 7 7 44 | 8 8 45 | 9 8 -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/greedy/gridworld1.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for gridworld1 (a.k.a. KMworld) 6 | 7 | 8 | 9 | 10 | # Specifies the height of the grid 11 | height 10 12 | # Specifies the width of the grid 13 | width 10 14 | 15 | # Specifies the number of robots to be placed 16 | numRobots 3 17 | 18 | # Specifies the communication range (radius) of each robot 19 | R 50 20 | 21 | # Specifies the X and Y coordinates of the base station 22 | baseX 4 23 | baseY 4 24 | 25 | # Specifies the initial locations of each robot (Format: ) 26 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 27 | # Else, the program could terminate unexpectedly 28 | initLocs 29 | 0 9 30 | 1 9 31 | 2 9 32 | 33 | # Specifies the location of each obstacle cell (Format: ) 34 | # Note: You can have any number of obstacle, provided each of them is a valid cell 35 | obstacles 36 | 0 0 37 | 1 0 38 | 2 2 39 | 3 3 40 | 4 4 41 | 5 5 42 | 6 6 43 | 7 7 44 | 8 8 45 | 9 8 -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/freeworld.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for freeworld (a 10x10 grid of empty cells) 6 | 7 | 8 | 9 | 10 | # Specifies the height of the grid 11 | height 10 12 | # Specifies the width of the grid 13 | width 10 14 | 15 | # Specifies the number of robots to be placed 16 | numRobots 1 17 | 18 | # Specifies the communication range (radius) of each robot 19 | R 50 20 | 21 | # Specifies the X and Y coordinates of the base station 22 | baseX 4 23 | baseY 4 24 | 25 | # Specifies the initial locations of each robot (Format: ) 26 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 27 | # Else, the program could terminate unexpectedly 28 | initLocs 29 | 3 3 30 | # 3 4 31 | # 2 4 32 | # 2 3 33 | # 4 3 34 | # 4 4 35 | # 3 5 36 | # 4 5 37 | # 5 3 38 | # 5 4 39 | # 5 5 40 | 41 | # Specifies the location of each obstacle cell (Format: ) 42 | # Note: You can have any number of obstacle, provided each of them is a valid cell 43 | obstacles 44 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/greedy/freeworld.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for freeworld (a 10x10 grid of empty cells) 6 | 7 | 8 | 9 | 10 | # Specifies the height of the grid 11 | height 10 12 | # Specifies the width of the grid 13 | width 10 14 | 15 | # Specifies the number of robots to be placed 16 | numRobots 4 17 | 18 | # Specifies the communication range (radius) of each robot 19 | R 50 20 | 21 | # Specifies the X and Y coordinates of the base station 22 | baseX 4 23 | baseY 4 24 | 25 | # Specifies the initial locations of each robot (Format: ) 26 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 27 | # Else, the program could terminate unexpectedly 28 | initLocs 29 | 3 3 30 | 3 4 31 | 2 4 32 | 2 3 33 | # 4 3 34 | # 4 4 35 | # 3 5 36 | # 4 5 37 | # 5 3 38 | # 5 4 39 | # 5 5 40 | 41 | # Specifies the location of each obstacle cell (Format: ) 42 | # Note: You can have any number of obstacle, provided each of them is a valid cell 43 | obstacles 44 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/gridworld1.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for gridworld1 (a.k.a. KMworld) 6 | 7 | 8 | 9 | 10 | # Specifies the height of the grid 11 | height 10 12 | # Specifies the width of the grid 13 | width 10 14 | 15 | # Specifies the number of robots to be placed 16 | numRobots 3 17 | 18 | # Specifies the communication range (radius) of each robot 19 | R 50 20 | 21 | # Specifies the X and Y coordinates of the base station 22 | baseX 4 23 | baseY 4 24 | 25 | # Specifies the initial locations of each robot (Format: ) 26 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 27 | # Else, the program could terminate unexpectedly 28 | initLocs 29 | 0 9 30 | 1 9 31 | 2 9 32 | 33 | # Specifies the location of each obstacle cell (Format: ) 34 | # Note: You can have any number of obstacle, provided each of them is a valid cell 35 | obstacles 36 | 0 0 37 | 1 0 38 | 2 2 39 | 3 3 40 | 4 4 41 | 5 5 42 | 6 6 43 | 7 7 44 | 8 8 45 | 9 8 -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/freeworld.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for freeworld (a 10x10 grid of empty cells) 6 | 7 | 8 | 9 | 10 | # Specifies the height of the grid 11 | height 10 12 | # Specifies the width of the grid 13 | width 10 14 | 15 | # Specifies the number of robots to be placed 16 | numRobots 5 17 | 18 | # Specifies the communication range (radius) of each robot 19 | R 50 20 | 21 | # Specifies the X and Y coordinates of the base station 22 | baseX 4 23 | baseY 4 24 | 25 | # Specifies the initial locations of each robot (Format: ) 26 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 27 | # Else, the program could terminate unexpectedly 28 | initLocs 29 | 3 3 30 | 3 4 31 | 2 4 32 | # 2 3 33 | 4 3 34 | # 4 4 35 | 3 5 36 | # 4 5 37 | # 5 3 38 | # 5 4 39 | # 5 5 40 | 41 | # Specifies the location of each obstacle cell (Format: ) 42 | # Note: You can have any number of obstacle, provided each of them is a valid cell 43 | obstacles 44 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/cluster/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # This is part of "python-cluster". A library to group similar items together. 3 | # Copyright (C) 2006 Michel Albert 4 | # 5 | # This library is free software; you can redistribute it and/or modify it 6 | # under the terms of the GNU Lesser General Public License as published by the 7 | # Free Software Foundation; either version 2.1 of the License, or (at your 8 | # option) any later version. 9 | # This library is distributed in the hope that it will be useful, but WITHOUT 10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 12 | # for more details. 13 | # You should have received a copy of the GNU Lesser General Public License 14 | # along with this library; if not, write to the Free Software Foundation, 15 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | # 17 | 18 | 19 | from pkg_resources import resource_string 20 | 21 | from .method.hierarchical import HierarchicalClustering 22 | from .method.kmeans import KMeansClustering 23 | from .util import ClusteringError 24 | 25 | __version__ = resource_string('cluster', 'version.txt').decode('ascii').strip() 26 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/README.md: -------------------------------------------------------------------------------- 1 | commExplore 2 | =========== 3 | 4 | An implementation of the paper "Multi-Robot Exploration Under the Constraints of Wireless Networking" in Python 5 | 6 | 7 | In order to run the code, dowload all the files in the repository and execute 8 | 9 | $ python demo.py 10 | 11 | For a better understanding of the commandline arguments or creating a configuration file of your own, refer to demo.py and gridworld1.config 12 | 13 | The following variables would be of particular interest to those who wish to test the implementation in various scenarios. 14 | 15 | height - corresponds to the height of the grid world 16 | width - corresponds to the width of the grid world 17 | numRobots - corresponds to the number of robots 18 | obstacles - corresponds to the list of cells that belong to the class of obstacles 19 | initLocs - corresponds to the list of initial positions of each of the robots 20 | R - corresponds to the communication radius (range) of each of the robots; R is same for all the robots 21 | base - corresponds to the coordinates of the base station 22 | T - corresponds to the number of time steps for which robots should explore 23 | k - corresponds to the size of the population of configuration changes that need to be considered -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/greedy/README.md: -------------------------------------------------------------------------------- 1 | commExplore 2 | =========== 3 | 4 | An implementation of the paper "Multi-Robot Exploration Under the Constraints of Wireless Networking" in Python 5 | 6 | 7 | In order to run the code, dowload all the files in the repository and execute 8 | 9 | $ python demo.py 10 | 11 | For a better understanding of the commandline arguments or creating a configuration file of your own, refer to demo.py and gridworld1.config 12 | 13 | The following variables would be of particular interest to those who wish to test the implementation in various scenarios. 14 | 15 | height - corresponds to the height of the grid world 16 | width - corresponds to the width of the grid world 17 | numRobots - corresponds to the number of robots 18 | obstacles - corresponds to the list of cells that belong to the class of obstacles 19 | initLocs - corresponds to the list of initial positions of each of the robots 20 | R - corresponds to the communication radius (range) of each of the robots; R is same for all the robots 21 | base - corresponds to the coordinates of the base station 22 | T - corresponds to the number of time steps for which robots should explore 23 | k - corresponds to the size of the population of configuration changes that need to be considered -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/README.md: -------------------------------------------------------------------------------- 1 | commExplore 2 | =========== 3 | 4 | An implementation of the paper "Multi-Robot Exploration Under the Constraints of Wireless Networking" in Python 5 | 6 | 7 | In order to run the code, dowload all the files in the repository and execute 8 | 9 | $ python demo.py 10 | 11 | For a better understanding of the commandline arguments or creating a configuration file of your own, refer to demo.py and gridworld1.config 12 | 13 | The following variables would be of particular interest to those who wish to test the implementation in various scenarios. 14 | 15 | height - corresponds to the height of the grid world 16 | width - corresponds to the width of the grid world 17 | numRobots - corresponds to the number of robots 18 | obstacles - corresponds to the list of cells that belong to the class of obstacles 19 | initLocs - corresponds to the list of initial positions of each of the robots 20 | R - corresponds to the communication radius (range) of each of the robots; R is same for all the robots 21 | base - corresponds to the coordinates of the base station 22 | T - corresponds to the number of time steps for which robots should explore 23 | k - corresponds to the size of the population of configuration changes that need to be considered -------------------------------------------------------------------------------- /Python Simulator/Path Planners/Datatypes.py: -------------------------------------------------------------------------------- 1 | import heapq 2 | class Queue: 3 | def __init__(self): 4 | self.items=[] 5 | def isEmpty(self): 6 | return len(self.items)==0 7 | def length(self): 8 | return len(self.items) 9 | def put(self,a): 10 | return self.items.insert(0,a) 11 | def get(self): 12 | return self.items.pop() 13 | def _print(self): 14 | print(self.items) 15 | 16 | 17 | class Stack: 18 | def __init__(self): 19 | self.items=[] 20 | def isEmpty(self): 21 | return len(self.items)==0 22 | def length(self): 23 | return len(self.items) 24 | def push(self,a): 25 | return self.items.append(a) 26 | def remove(self): 27 | return self.items.pop() 28 | def _print(self): 29 | print(self.items) 30 | def top(self): 31 | return self.items[len(self.items)-1] 32 | 33 | 34 | class PriorityQueue: 35 | def __init__(self): 36 | self.elements = {} 37 | 38 | def isEmpty(self): 39 | return len(self.elements) == 0 40 | 41 | def put(self, item, priority): 42 | self.elements[item] = priority 43 | 44 | def get(self): 45 | best_item, best_priority = None, None 46 | for item, priority in self.elements.items(): 47 | if best_priority is None or priority < best_priority: 48 | best_item, best_priority = item, priority 49 | 50 | del self.elements[best_item] 51 | return best_item 52 | -------------------------------------------------------------------------------- /JavaScript Simulator/README.md: -------------------------------------------------------------------------------- 1 | # Path Planning Simulator 2 | This folder includes the Javasript based simulator. The following algorithms are being simulated in this implementation: 3 | 1. Breadth First Search (BFS) 4 | 2. Depth First Search (DFS) 5 | 3. Greedy Best First Search 6 | 4. Dijkstra's Algorithm 7 | 5. A-Star Algorithm (A*) 8 | 6. Rapidly Exploring Random Trees (RRT) 9 | 7. RRT - Connect 10 | 8. RRT - Star 11 | 12 | To use the simulator, clone the repository to your computer and launch index.html which contains the web interface. The source file is located in the scripts folder. Upon loading, the site interface looks as follows, showing the algorithms on top with a textbox for statistics: 13 | 14 |

15 | 16 | 17 |

18 | 19 | The respective planners can be invoked by clicking on the appropriate buttons. The textbox shows relevant statistics like the queued nodes, planner name, start and goal, when the planner is running. The preview of BFS, A*, and RRT-Connect is shown below 20 | 21 |

22 | 23 | 24 | 25 |

26 | 27 | 28 | The start and goal nodes can be changed by modifying the URL as follows: 29 | 30 | ../index.html ? q_init = [3,3] ? q_goal = [4.5,4.5] 31 | -------------------------------------------------------------------------------- /JavaScript Simulator/stylesheets/main.css: -------------------------------------------------------------------------------- 1 | body{ 2 | background-color: #e4e4e4; 3 | font: Futura, ‘Century Gothic’, AppleGothic, sans-serif; 4 | width: 98%; 5 | } 6 | 7 | h1,h2 { 8 | font-family: Futura, ‘Century Gothic’, AppleGothic, sans-serif; 9 | color:#3D2A24; 10 | text-align: center; 11 | margin: 5px; 12 | } 13 | 14 | p { 15 | font-size: 12pt; 16 | padding: 10px; 17 | color: white; 18 | text-align: center; 19 | background-color: #555555; 20 | } 21 | 22 | button { 23 | background: none !important; 24 | border: none; 25 | padding: 0! important; 26 | cursor: pointer; 27 | outline: inherit !important; 28 | background-color: inherit !important; 29 | } 30 | 31 | input[type=button] { 32 | font: 18pt; 33 | font-size:70%; 34 | cursor: pointer; 35 | width: 120px; 36 | background-color: #555555; 37 | color: white; 38 | border-radius: 8px; 39 | } 40 | 41 | input[type=button]:hover, active { 42 | background-color: #e4e4e4; 43 | border: 2px solid #555555; 44 | color: black; 45 | border-radius: 8px; 46 | } 47 | 48 | #container { 49 | max-width: 1000px; 50 | margin: auto; 51 | } 52 | 53 | #myCanvas { 54 | background-color: #fafafa; 55 | text-align: center; 56 | margin: 5px; 57 | } 58 | 59 | a { 60 | text-decoration: none; 61 | color: #5b5b5b; 62 | 63 | } 64 | 65 | a:hover { 66 | color: black; 67 | 68 | } -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/immigration.dat: -------------------------------------------------------------------------------- 1 | # IMMIGRATION BY REGION AND SELECTED COUNTRY OF LAST RESIDENCE 2 | # 3 | Region Austria Hungary Belgium Czechoslovakia Denmark France Germany Greece Ireland Italy Netherlands Norway Sweden Poland Portugal Romania Soviet_Union Spain Switzerland United_Kingdom Yugoslavia Other_Europe TOTAL 4 | 1891-1900 234081 181288 18167 - 50231 30770 505152 15979 388416 651893 26758 95015 226266 96720 27508 12750 505290 8731 31179 271538 - 282 3378014 5 | 1901-1910 668209 808511 41635 - 65285 73379 341498 167519 339065 2045877 48262 190505 249534 - 69149 53008 1597306 27935 34922 525950 - 39945 7387494 6 | 1911-1920 453649 442693 33746 3426 41983 61897 143945 184201 146181 1109524 43718 66395 95074 4813 89732 13311 921201 68611 23091 341408 1888 31400 4321887 7 | 1921-1930 32868 30680 15846 102194 32430 49610 412202 51084 211234 455315 26948 68531 97249 227734 29994 67646 61742 28958 29676 339570 49064 42619 2463194 8 | 1931-1940 3563 7861 4817 14393 2559 12623 144058 9119 10973 68028 7150 4740 3960 17026 3329 3871 1370 3258 5512 31572 5835 11949 377566 9 | 1941-1950 24860 3469 12189 8347 5393 38809 226578 8973 19789 57661 14860 10100 10665 7571 7423 1076 571 2898 10547 139306 1576 8486 621147 10 | 1951-1960 67106 36637 18575 918 10984 51121 477765 47608 43362 185491 52277 22935 21697 9985 19588 1039 671 7894 17675 202824 8225 16350 1325727 11 | 1961-1970 20621 5401 9192 3273 9201 45237 190796 85969 32966 214111 30606 15484 17116 53539 76065 3531 2465 44659 18453 213822 20381 11604 1124492 12 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plots/test.dat: -------------------------------------------------------------------------------- 1 | # all_iterations 2 | # NumRobots Burgard Puig Proposed LowerBound 3 | # 2 1858 1636 1448 1250 4 | # 4 954 850 728 625 5 | # 6 652 600 541 417 6 | # 8 501 450 401 313 7 | # 10 389 382 322 250 8 | 9 | # all_redundancy 10 | # NumRobots Burgard Puig Proposed 11 | # 2 12 5 13 12 | # 4 34 14 16 13 | # 6 36 24 22 14 | # 8 37 29 21 15 | # 10 35 43 20 16 | 17 | # sensitivity_to_maps 18 | # Numrobots Free Outdoor Office 19 | # 2 1448 1228 1478 20 | # 4 728 707 765 21 | # 6 541 430 562 22 | # 8 401 336 477 23 | # 10 382 252 389 24 | 25 | # all_infoGain 26 | # FreqOfInfoGain Burgard Puig Proposed 27 | # 0 21 11 0 28 | # 1 35 43 13 29 | # 2 44 55 26 30 | # 3 136 80 54 31 | # 4 197 114 126 32 | # 5 133 141 163 33 | # 6 86 156 159 34 | 35 | # all_underutilization 36 | # Underutilization Burgard Puig Proposed 37 | # 2 1216 774 390 38 | # 4 1316 907 398 39 | # 6 1412 1110 746 40 | # 8 1508 1052 733 41 | # 10 1930 1330 692 42 | 43 | # timeSteps_office 44 | # NumRobots Proposed(Old) Awesome Lowerbound 45 | # 2 2454 1236 1071 46 | # 4 1549 644 536 47 | # 6 612 429 357 48 | # 8 513 322 268 49 | # 10 412 274 215 50 | 51 | # timeSteps_outdoor 52 | # NumRobots Proposed(Old) Awesome Lowerbound 53 | # 2 1549 1099 912 54 | # 4 707 576 456 55 | # 6 483 391 304 56 | # 8 341 320 228 57 | # 10 252 262 183 58 | 59 | # timeSteps_freeWorld 60 | NumRobots Proposed(Old) Awesome Lowerbound 61 | 2 1448 1250 1250 62 | 4 728 646 625 63 | 6 541 435 417 64 | 8 401 332 313 65 | 10 382 273 250 -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/Direct usage of gridworld/AStar.py: -------------------------------------------------------------------------------- 1 | from Datatypes import * 2 | 3 | class AStar: 4 | def __init__(self): 5 | pass 6 | 7 | def heuristic(self, a, b, n=4): 8 | dx=abs(b[0]-a[0]) 9 | dy=abs(b[1]-a[1]) 10 | 11 | # Manhattan Heuristic 12 | if n==1: 13 | return dx+dy 14 | 15 | # Euclidean Heuristic 16 | elif n==2: 17 | return (dx**2 + dy**2)**0.5 18 | 19 | # Chebychev Heuristic 20 | elif n==3: 21 | return max(dx,dy) 22 | 23 | # Octile Heuristic 24 | else: 25 | return dx+dy+(2**0.5-2)*min (dx,dy) 26 | 27 | def aStarSearch(self,gridworld,start,goal): 28 | frontier=PriorityQueue() 29 | frontier.put(start,0) 30 | 31 | path={};cost={} 32 | path[start]=None;cost[start]=0 33 | flag=0 34 | 35 | while not frontier.isEmpty(): 36 | current = frontier.get() 37 | 38 | if current==goal: 39 | flag=1 40 | break 41 | 42 | for next in gridworld.get8Neighbors(current): 43 | if next[0]==current[0] or next[1] == current[1]: 44 | newcost=cost[current]+1 45 | else: 46 | newcost=cost[current]+1.4 47 | 48 | if next not in cost or newcost ) 26 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 27 | # Else, the program could terminate unexpectedly 28 | initLocs 29 | 23 23 30 | 23 24 31 | 23 25 32 | 24 23 33 | 24 24 34 | 24 25 35 | 25 23 36 | 25 24 37 | 25 25 38 | # 26 25 39 | 40 | # Specifies the location of each obstacle cell (Format: ) 41 | # Note: You can have any number of obstacle, provided each of them is a valid cell 42 | obstacles 43 | # 10 10 44 | # 10 12 45 | # 10 11 46 | # 11 10 47 | # 11 11 48 | # 11 12 49 | # 35 10 50 | # 35 11 51 | # 35 12 52 | # 36 10 53 | # 36 11 54 | # 36 12 55 | # 10 35 56 | # 10 36 57 | # 10 37 58 | # 11 35 59 | # 11 36 60 | # 11 37 61 | # 35 35 62 | # 35 36 63 | # 35 37 64 | # 36 35 65 | # 36 36 66 | # 36 37 67 | 68 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/cluster/test/test_numpy.py: -------------------------------------------------------------------------------- 1 | # 2 | # This is part of "python-cluster". A library to group similar items together. 3 | # Copyright (C) 2006 Michel Albert 4 | # 5 | # This library is free software; you can redistribute it and/or modify it under 6 | # the terms of the GNU Lesser General Public License as published by the Free 7 | # Software Foundation; either version 2.1 of the License, or (at your option) 8 | # any later version. 9 | # This library is distributed in the hope that it will be useful, but WITHOUT 10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 12 | # details. 13 | # You should have received a copy of the GNU Lesser General Public License 14 | # along with this library; if not, write to the Free Software Foundation, Inc., 15 | # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | # 17 | 18 | import unittest 19 | 20 | from cluster import KMeansClustering 21 | try: 22 | import numpy 23 | NUMPY_AVAILABLE = True 24 | except: 25 | NUMPY_AVAILABLE = False 26 | 27 | 28 | @unittest.skipUnless(NUMPY_AVAILABLE, 29 | 'numpy not available. Associated test will not be loaded!') 30 | class NumpyTests(unittest.TestCase): 31 | 32 | def testNumpyRandom(self): 33 | data = numpy.random.rand(500, 2) 34 | cl = KMeansClustering(data, lambda p0, p1: ( 35 | p0[0] - p1[0]) ** 2 + (p0[1] - p1[1]) ** 2, numpy.array_equal) 36 | cl.getclusters(10) 37 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/greedy/Cell.py: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | # Copyright (c) 2015 INSPIRE Lab, BITS Pilani 4 | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | 24 | """Class to hold a grid cell""" 25 | 26 | 27 | # The Cell class 28 | class Cell(object): 29 | 30 | def __init__(self, x, y): 31 | 32 | self.x = x 33 | self.y = y 34 | self.occupied = False 35 | self.obstacle = False 36 | self.visited = False 37 | self.cluster = -1 38 | self.centroid=False 39 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/greedy/Robot.py: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | # Copyright (c) 2014 INSPIRE Lab, BITS Pilani 4 | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | 24 | """Class to hold a robot""" 25 | 26 | 27 | # The robot class 28 | class Robot: 29 | 30 | def __init__(self, id, curX, curY): 31 | 32 | self.id = id 33 | self.curX = curX 34 | self.curY = curY 35 | 36 | 37 | def setLocation(self, curX, curY): 38 | 39 | self.curX = curX 40 | self.curY = curY -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/fastTest.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for freeworld (a 10x10 grid of empty cells) 6 | 7 | 8 | 9 | 10 | # Specifies the height of the grid 11 | height 50 12 | # Specifies the width of the grid 13 | width 50 14 | 15 | # Specifies the number of robots to be placed 16 | numRobots 8 17 | 18 | # Specifies the communication range (radius) of each robot 19 | R 500 20 | 21 | # Specifies the X and Y coordinates of the base station 22 | baseX 4 23 | baseY 4 24 | 25 | # Specifies the initial locations of each robot (Format: ) 26 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 27 | # Else, the program could terminate unexpectedly 28 | initLocs 29 | 0 0 30 | 0 1 31 | 0 2 32 | 0 3 33 | 0 4 34 | 0 5 35 | 0 6 36 | 0 7 37 | # 1 0 38 | # 1 1 39 | # 1 2 40 | # 2 0 41 | # 2 1 42 | # 2 2 43 | # 26 25 44 | 45 | # Specifies the location of each obstacle cell (Format: ) 46 | # Note: You can have any number of obstacle, provided each of them is a valid cell 47 | obstacles 48 | # 10 10 49 | # 10 12 50 | # 10 11 51 | # 11 10 52 | # 11 11 53 | # 11 12 54 | # 35 10 55 | # 35 11 56 | # 35 12 57 | # 36 10 58 | # 36 11 59 | # 36 12 60 | # 10 35 61 | # 10 36 62 | # 10 37 63 | # 11 35 64 | # 11 36 65 | # 11 37 66 | # 35 35 67 | # 35 36 68 | # 35 37 69 | # 36 35 70 | # 36 36 71 | # 36 37 72 | 73 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/AStar.py: -------------------------------------------------------------------------------- 1 | from Datatypes import * 2 | 3 | class AStar: 4 | def __init__(self): 5 | pass 6 | 7 | def heuristic(self, a, b, n=4): 8 | dx=abs(b[0]-a[0]) 9 | dy=abs(b[1]-a[1]) 10 | 11 | # Manhattan Heuristic 12 | if n==1: 13 | return dx+dy 14 | 15 | # Euclidean Heuristic 16 | elif n==2: 17 | return (dx**2 + dy**2)**0.5 18 | 19 | # Chebychev Heuristic 20 | elif n==3: 21 | return max(dx,dy) 22 | 23 | # Octile Heuristic 24 | else: 25 | return dx+dy+(2**0.5-2)*min (dx,dy) 26 | 27 | def aStarSearch(self,gridworld,start,goal): 28 | frontier=PriorityQueue() 29 | frontier.put(start,0) 30 | 31 | path={};cost={};v=1 32 | path[start]=None;cost[start]=0 33 | flag=0 34 | 35 | while not frontier.isEmpty(): 36 | current = frontier.get() 37 | 38 | if current==goal: 39 | flag=1 40 | break 41 | 42 | for next in gridworld.get8Neighbors(current): 43 | if next[0]==current[0] or next[1] == current[1]: 44 | newcost=cost[current]+5 45 | else: 46 | newcost=cost[current]+7 47 | 48 | if next not in cost or newcost ) 26 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 27 | # Else, the program could terminate unexpectedly 28 | initLocs 29 | 0 0 30 | 0 1 31 | 0 2 32 | 0 3 33 | 0 4 34 | 0 5 35 | 0 6 36 | 0 7 37 | # 1 0 38 | # 1 1 39 | # 1 2 40 | # 2 0 41 | # 2 1 42 | # 2 2 43 | # 26 25 44 | 45 | # Specifies the location of each obstacle cell (Format: ) 46 | # Note: You can have any number of obstacle, provided each of them is a valid cell 47 | obstacles 48 | # 10 10 49 | # 10 12 50 | # 10 11 51 | # 11 10 52 | # 11 11 53 | # 11 12 54 | # 35 10 55 | # 35 11 56 | # 35 12 57 | # 36 10 58 | # 36 11 59 | # 36 12 60 | # 10 35 61 | # 10 36 62 | # 10 37 63 | # 11 35 64 | # 11 36 65 | # 11 37 66 | # 35 35 67 | # 35 36 68 | # 35 37 69 | # 36 35 70 | # 36 36 71 | # 36 37 72 | 73 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/Direct usage of gridworld/Datatypes.py: -------------------------------------------------------------------------------- 1 | import heapq 2 | class Queue: 3 | def __init__(self): 4 | self.items=[] 5 | def isEmpty(self): 6 | return len(self.items)==0 7 | def length(self): 8 | return len(self.items) 9 | def put(self,a): 10 | return self.items.insert(0,a) 11 | def get(self): 12 | return self.items.pop() 13 | def _print(self): 14 | print(self.items) 15 | 16 | 17 | class Stack: 18 | def __init__(self): 19 | self.items=[] 20 | def isEmpty(self): 21 | return len(self.items)==0 22 | def length(self): 23 | return len(self.items) 24 | def push(self,a): 25 | return self.items.append(a) 26 | def remove(self): 27 | return self.items.pop() 28 | def _print(self): 29 | print(self.items) 30 | def top(self): 31 | return self.items[len(self.items)-1] 32 | 33 | 34 | class PriorityQueue: 35 | def __init__(self): 36 | self.elements = {} 37 | 38 | def isEmpty(self): 39 | return len(self.elements) == 0 40 | 41 | def put(self, item, priority): 42 | if item in self.elements: 43 | print("Reprioritizing", item, "from", self.elements[item], "to", priority) 44 | else: 45 | print("Inserting", item, "with priority", priority) 46 | self.elements[item] = priority 47 | 48 | def get(self): 49 | best_item, best_priority = None, None 50 | for item, priority in self.elements.items(): 51 | if best_priority is None or priority < best_priority: 52 | best_item, best_priority = item, priority 53 | 54 | del self.elements[best_item] 55 | return best_item 56 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/Cell.py: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | # Copyright (c) 2015 INSPIRE Lab, BITS Pilani 4 | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | 24 | """Class to hold a grid cell""" 25 | 26 | 27 | # The Cell class 28 | class Cell(object): 29 | 30 | def __init__(self, x, y): 31 | 32 | self.x = x 33 | self.y = y 34 | self.occupied = False 35 | self.obstacle = False 36 | self.visited = False 37 | self.cluster = -1 38 | self.centroid = False 39 | self.utility = 1 40 | # Used for GUI redrawing test 41 | self.expandedBy = -1 42 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/Robot.py: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | # Copyright (c) 2014 INSPIRE Lab, BITS Pilani 4 | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | 24 | """Class to hold a robot""" 25 | 26 | 27 | # The robot class 28 | class Robot: 29 | 30 | def __init__(self, id, curX, curY): 31 | 32 | self.id = id 33 | self.curX = curX 34 | self.curY = curY 35 | # Parameters included for supporting Burgard's work 36 | self.isJobless = True 37 | 38 | 39 | def setLocation(self, curX, curY): 40 | 41 | self.curX = curX 42 | self.curY = curY 43 | 44 | -------------------------------------------------------------------------------- /Python Simulator/Path Planners/BFS.py: -------------------------------------------------------------------------------- 1 | from Datatypes import * 2 | import sys 3 | 4 | frontier = Queue() 5 | start = set() 6 | goal = set() 7 | explored = {} 8 | cost = {} 9 | 10 | class BFS: 11 | def __init__(self): 12 | pass 13 | 14 | def search(self,gridworld,begin,end): 15 | global frontier 16 | global start, goal, explored, cost 17 | 18 | start = begin ; goal = end 19 | frontier.put(start) 20 | 21 | explored[start]=None 22 | cost[start]=0 23 | 24 | gridworld.mark(start) 25 | gridworld.markpath(start) 26 | 27 | 28 | if self.proceed(gridworld) == 1: 29 | self.makepath() 30 | return False 31 | else: 32 | self.proceed(gridworld) 33 | return True 34 | 35 | def proceed(self,gridworld): 36 | global frontier 37 | global start, goal, explored, cost 38 | 39 | if frontier.isEmpty(): 40 | return 1 41 | 42 | else: 43 | current=frontier.get() 44 | 45 | if current==goal: 46 | return 1 47 | # sys.exit() 48 | for next in gridworld.get8Neighbors(current): 49 | if next not in cost: 50 | if next[0]==current[0] or next[1] == current[1]: 51 | cost[next]=cost[current] + 5 52 | else: 53 | cost[next]=cost[current] + 7 54 | frontier.put(next) 55 | gridworld.mark(next) 56 | explored[next]=current 57 | return 0 58 | 59 | def makepath(self,gridworld): 60 | global goal, explored,cost,start 61 | path = [] 62 | current = goal 63 | while current != start: 64 | path.append(current) 65 | gridworld.markpath(current) 66 | current = explored[current] 67 | path.reverse() ; path=[start]+path 68 | return path,explored,cost -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/Robot.py: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | # Copyright (c) 2014 INSPIRE Lab, BITS Pilani 4 | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | 24 | """Class to hold a robot""" 25 | 26 | 27 | # The robot class 28 | class Robot: 29 | 30 | def __init__(self, id, curX, curY): 31 | 32 | self.id = id 33 | self.curX = curX 34 | self.curY = curY 35 | # Parameters included for supporting Burgard's work 36 | self.isJobless = True 37 | 38 | 39 | def setLocation(self, curX, curY): 40 | 41 | self.curX = curX 42 | self.curY = curY -------------------------------------------------------------------------------- /Python Simulator/Path Planners/freeworld_large.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for freeworld (a 10x10 grid of empty cells) 6 | 7 | 8 | 9 | 10 | # Specifies the height of the grid 11 | height 50 12 | # Specifies the width of the grid 13 | width 50 14 | 15 | # Specifies the number of robots to be placed 16 | numRobots 8 17 | 18 | # Specifies the communication range (radius) of each robot 19 | R 500 20 | 21 | # Specifies the X and Y coordinates of the base station 22 | baseX 4 23 | baseY 4 24 | 25 | # Specifies the initial locations of each robot (Format: ) 26 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 27 | # Else, the program could terminate unexpectedly 28 | initLocs 29 | 23 23 30 | 23 24 31 | 23 25 32 | 24 23 33 | 24 24 34 | 24 25 35 | 25 23 36 | 25 24 37 | # 25 25 38 | # 26 25 39 | 40 | # 0 0 41 | # 14 15 42 | # 23 34 43 | # 30 30 44 | # 0 40 45 | # 40 0 46 | # 49 49 47 | # 35 40 48 | # 8 9 49 | 50 | # Specifies the location of each obstacle cell (Format: ) 51 | # Note: You can have any number of obstacle, provided each of them is a valid cell 52 | obstacles 53 | # 10 10 54 | # 10 12 55 | # 10 11 56 | # 11 10 57 | # 11 11 58 | # 11 12 59 | # 35 10 60 | # 35 11 61 | # 35 12 62 | # 36 10 63 | # 36 11 64 | # 36 12 65 | # 10 35 66 | # 10 36 67 | # 10 37 68 | # 11 35 69 | # 11 36 70 | # 11 37 71 | # 35 35 72 | # 35 36 73 | # 35 37 74 | # 36 35 75 | # 36 36 76 | # 36 37 77 | 78 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/freeworld_large.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for freeworld (a 10x10 grid of empty cells) 6 | 7 | 8 | 9 | 10 | # Specifies the height of the grid 11 | height 50 12 | # Specifies the width of the grid 13 | width 50 14 | 15 | # Specifies the number of robots to be placed 16 | numRobots 8 17 | 18 | # Specifies the communication range (radius) of each robot 19 | R 500 20 | 21 | # Specifies the X and Y coordinates of the base station 22 | baseX 4 23 | baseY 4 24 | 25 | # Specifies the initial locations of each robot (Format: ) 26 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 27 | # Else, the program could terminate unexpectedly 28 | initLocs 29 | 23 23 30 | 23 24 31 | 23 25 32 | 24 23 33 | 24 24 34 | 24 25 35 | 25 23 36 | 25 24 37 | # 25 25 38 | # 26 25 39 | 40 | # 0 0 41 | # 14 15 42 | # 23 34 43 | # 30 30 44 | # 0 40 45 | # 40 0 46 | # 49 49 47 | # 35 40 48 | # 8 9 49 | 50 | # Specifies the location of each obstacle cell (Format: ) 51 | # Note: You can have any number of obstacle, provided each of them is a valid cell 52 | obstacles 53 | # 10 10 54 | # 10 12 55 | # 10 11 56 | # 11 10 57 | # 11 11 58 | # 11 12 59 | # 35 10 60 | # 35 11 61 | # 35 12 62 | # 36 10 63 | # 36 11 64 | # 36 12 65 | # 10 35 66 | # 10 36 67 | # 10 37 68 | # 11 35 69 | # 11 36 70 | # 11 37 71 | # 35 35 72 | # 35 36 73 | # 35 37 74 | # 36 35 75 | # 36 36 76 | # 36 37 77 | 78 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/freeworld_large.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for freeworld (a 10x10 grid of empty cells) 6 | 7 | 8 | 9 | 10 | # Specifies the height of the grid 11 | height 50 12 | # Specifies the width of the grid 13 | width 50 14 | 15 | # Specifies the number of robots to be placed 16 | numRobots 8 17 | 18 | # Specifies the communication range (radius) of each robot 19 | R 500 20 | 21 | # Specifies the X and Y coordinates of the base station 22 | baseX 4 23 | baseY 4 24 | 25 | # Specifies the initial locations of each robot (Format: ) 26 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 27 | # Else, the program could terminate unexpectedly 28 | initLocs 29 | 23 23 30 | 23 24 31 | 23 25 32 | 24 23 33 | 24 24 34 | 24 25 35 | 25 23 36 | 25 24 37 | # 25 25 38 | # 26 25 39 | 40 | # 0 0 41 | # 14 15 42 | # 23 34 43 | # 30 30 44 | # 0 40 45 | # 40 0 46 | # 49 49 47 | # 35 40 48 | # 8 9 49 | 50 | # Specifies the location of each obstacle cell (Format: ) 51 | # Note: You can have any number of obstacle, provided each of them is a valid cell 52 | obstacles 53 | # 10 10 54 | # 10 12 55 | # 10 11 56 | # 11 10 57 | # 11 11 58 | # 11 12 59 | # 35 10 60 | # 35 11 61 | # 35 12 62 | # 36 10 63 | # 36 11 64 | # 36 12 65 | # 10 35 66 | # 10 36 67 | # 10 37 68 | # 11 35 69 | # 11 36 70 | # 11 37 71 | # 35 35 72 | # 35 36 73 | # 35 37 74 | # 36 35 75 | # 36 36 76 | # 36 37 77 | 78 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/hungarianDemo.py: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | # Copyright (c) 2015 INSPIRE Lab, BITS Pilani 4 | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | 24 | """ 25 | Provides a demo of the Hungarian assignment technique. 26 | """ 27 | 28 | 29 | import Hungarian 30 | 31 | 32 | def main(): 33 | 34 | costMatrix = [[90, 75, 75, 80], [35, 85, 55, 65], [125, 95, 90, 105], [45, 110, 95, 115]] 35 | hungarian = Hungarian.Hungarian() 36 | hungarian.calculate(costMatrix) 37 | print 'Results: ', hungarian.get_results() 38 | print 'Total Potential: ', hungarian.get_total_potential() 39 | 40 | 41 | if __name__ == '__main__': 42 | 43 | main() -------------------------------------------------------------------------------- /Python Simulator/Path Planners/Dijkstra.py: -------------------------------------------------------------------------------- 1 | from Datatypes import * 2 | import sys 3 | 4 | frontier = PriorityQueue() 5 | start = set() 6 | goal = set() 7 | explored = {} 8 | cost = {} 9 | 10 | class Dijkstra: 11 | def __init__(self): 12 | pass 13 | 14 | def search(self,gridworld,begin,end): 15 | global frontier 16 | global start, goal, explored, cost 17 | 18 | start = begin ; goal = end 19 | frontier.put(start,0) 20 | 21 | explored[start]=None 22 | cost[start]=0 23 | 24 | gridworld.mark(start) 25 | gridworld.markpath(start) 26 | 27 | 28 | if self.proceed(gridworld) == 1: 29 | self.makepath() 30 | return False 31 | else: 32 | self.proceed(gridworld) 33 | return True 34 | 35 | def proceed(self,gridworld): 36 | global frontier 37 | global start, goal, explored, cost 38 | 39 | if frontier.isEmpty(): 40 | return 1 41 | 42 | else: 43 | current=frontier.get() 44 | 45 | if current==goal: 46 | return 1 47 | # sys.exit() 48 | for next in gridworld.get8Neighbors(current): 49 | if next[0]==current[0] or next[1] == current[1]: 50 | newcost=cost[current]+5 51 | else: 52 | newcost=cost[current]+7 53 | 54 | if next not in cost or newcost", callback) 46 | 47 | def ok(): 48 | print("Config file prepared") 49 | 50 | def exit(): 51 | for i in a: 52 | print(' '.join(str(j) for j in i)) 53 | sys.exit() 54 | 55 | obstacles = tk.Button(root,text="Set",command=ok) 56 | quit = tk.Button(root,text="Exit",command=exit) 57 | obstacles.pack() ; quit.pack() 58 | root.mainloop() 59 | f.close() 60 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/PriorityQueue.py: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | # Copyright (c) 2014 INSPIRE Lab, BITS Pilani 4 | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | 24 | """ 25 | Provides an implementation of a reasonably fast Priority Queue that uses binary heaps. 26 | But, this implementation does not support reprioritization. 27 | """ 28 | 29 | 30 | import heapq 31 | 32 | 33 | # The PriorityQueue class 34 | class PriorityQueue: 35 | 36 | def __init__(self): 37 | 38 | self.elements = [] 39 | 40 | 41 | # Method to see if the queue is empty 42 | def isEmpty(self): 43 | 44 | return len(self.elements) == 0 45 | 46 | 47 | # Method to push an item into the queue 48 | def put(self, item, priority): 49 | 50 | heapq.heappush(self.elements, (priority, item)) 51 | 52 | 53 | # Method to pop an item (having the lowest value of priority) from the queue 54 | def get(self): 55 | 56 | return heapq.heappop(self.elements)[1] -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/greedy/PriorityQueue.py: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | # Copyright (c) 2014 INSPIRE Lab, BITS Pilani 4 | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | 24 | """ 25 | Provides an implementation of a reasonably fast Priority Queue that uses binary heaps. 26 | But, this implementation does not support reprioritization. 27 | """ 28 | 29 | 30 | import heapq 31 | 32 | 33 | # The PriorityQueue class 34 | class PriorityQueue: 35 | 36 | def __init__(self): 37 | 38 | self.elements = [] 39 | 40 | 41 | # Method to see if the queue is empty 42 | def isEmpty(self): 43 | 44 | return len(self.elements) == 0 45 | 46 | 47 | # Method to push an item into the queue 48 | def put(self, item, priority): 49 | 50 | heapq.heappush(self.elements, (priority, item)) 51 | 52 | 53 | # Method to pop an item (having the lowest value of priority) from the queue 54 | def get(self): 55 | 56 | return heapq.heappop(self.elements)[1] -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/PriorityQueue.py: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | # Copyright (c) 2014 INSPIRE Lab, BITS Pilani 4 | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | 24 | """ 25 | Provides an implementation of a reasonably fast Priority Queue that uses binary heaps. 26 | But, this implementation does not support reprioritization. 27 | """ 28 | 29 | 30 | import heapq 31 | 32 | 33 | # The PriorityQueue class 34 | class PriorityQueue: 35 | 36 | def __init__(self): 37 | 38 | self.elements = [] 39 | 40 | 41 | # Method to see if the queue is empty 42 | def isEmpty(self): 43 | 44 | return len(self.elements) == 0 45 | 46 | 47 | # Method to push an item into the queue 48 | def put(self, item, priority): 49 | 50 | heapq.heappush(self.elements, (priority, item)) 51 | 52 | 53 | # Method to pop an item (having the lowest value of priority) from the queue 54 | def get(self): 55 | 56 | return heapq.heappop(self.elements)[1] -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/Sync_test.txt: -------------------------------------------------------------------------------- 1 | Read the config file freeworld.config 2 | visitednow 10 3 | redundancy: 0 4 | totalMoves: 5 5 | self.exploredCells: 5 6 | visitednow 15 7 | redundancy: 0 8 | totalMoves: 10 9 | self.exploredCells: 10 10 | visitednow 20 11 | redundancy: 0 12 | totalMoves: 15 13 | self.exploredCells: 15 14 | visitednow 21 15 | redundancy: 4 16 | totalMoves: 20 17 | self.exploredCells: 16 18 | visitednow 25 19 | redundancy: 1 20 | totalMoves: 25 21 | self.exploredCells: 20 22 | visitednow 29 23 | redundancy: 1 24 | totalMoves: 30 25 | self.exploredCells: 24 26 | visitednow 34 27 | redundancy: 0 28 | totalMoves: 35 29 | self.exploredCells: 29 30 | visitednow 39 31 | redundancy: 0 32 | totalMoves: 40 33 | self.exploredCells: 34 34 | visitednow 43 35 | redundancy: 1 36 | totalMoves: 45 37 | self.exploredCells: 38 38 | visitednow 48 39 | redundancy: 0 40 | totalMoves: 50 41 | self.exploredCells: 43 42 | visitednow 53 43 | redundancy: 0 44 | totalMoves: 55 45 | self.exploredCells: 48 46 | visitednow 58 47 | redundancy: 0 48 | totalMoves: 60 49 | self.exploredCells: 53 50 | visitednow 63 51 | redundancy: 0 52 | totalMoves: 65 53 | self.exploredCells: 58 54 | visitednow 68 55 | redundancy: 0 56 | totalMoves: 70 57 | self.exploredCells: 63 58 | visitednow 73 59 | redundancy: 0 60 | totalMoves: 75 61 | self.exploredCells: 68 62 | visitednow 76 63 | redundancy: 2 64 | totalMoves: 80 65 | self.exploredCells: 71 66 | visitednow 80 67 | redundancy: 1 68 | totalMoves: 85 69 | self.exploredCells: 75 70 | visitednow 84 71 | redundancy: 1 72 | totalMoves: 90 73 | self.exploredCells: 79 74 | visitednow 88 75 | redundancy: 1 76 | totalMoves: 95 77 | self.exploredCells: 83 78 | visitednow 93 79 | redundancy: 0 80 | totalMoves: 100 81 | self.exploredCells: 88 82 | visitednow 97 83 | redundancy: 1 84 | totalMoves: 105 85 | self.exploredCells: 92 86 | visitednow 100 87 | redundancy: 2 88 | totalMoves: 110 89 | self.exploredCells: 95 90 | visitednow 100 91 | redundancy: 5 92 | totalMoves: 115 93 | self.exploredCells: 95 94 | -------------------------------------------------------------------------------- /JavaScript Simulator/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Path Planning Simulator 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 |

Path Planner Simulation

17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
32 |
33 |

Press one of the buttons above to start!

34 |
35 | 36 |
37 |
38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/greedy/results/plot.py: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | # Copyright (c) 2014 INSPIRE Lab, BITS Pilani 4 | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | 24 | """ 25 | Provides a script to plot results 26 | """ 27 | 28 | 29 | import sys 30 | 31 | import matplotlib.pyplot as plt 32 | 33 | 34 | def main(): 35 | 36 | try: 37 | inFile = open(sys.argv[1], 'r') 38 | except Exception, e: 39 | print 'A valid input file was not passed' 40 | sys.exit(-1) 41 | 42 | y = [] 43 | x = [] 44 | 45 | lines = inFile.readlines() 46 | count = 1 47 | noGain = 0 48 | 49 | for line in lines: 50 | currentLine = line.strip().split() 51 | 52 | try: 53 | if int(currentLine[0]) == 0: 54 | noGain += 1 55 | y.append(int(currentLine[0])) 56 | x.append(count) 57 | except: 58 | pass 59 | 60 | count += 1 61 | 62 | plt.bar(x, y) 63 | plt.show() 64 | print 'noGain:', noGain 65 | 66 | 67 | if __name__ == '__main__': 68 | 69 | main() -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/greedy/results/plot_old.py: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | # Copyright (c) 2014 INSPIRE Lab, BITS Pilani 4 | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | 24 | """ 25 | Provides a script to plot results 26 | """ 27 | 28 | 29 | import sys 30 | 31 | import matplotlib.pyplot as plt 32 | 33 | 34 | def main(): 35 | 36 | try: 37 | inFile = open(sys.argv[1], 'r') 38 | except Exception, e: 39 | print 'A valid input file was not passed' 40 | sys.exit(-1) 41 | 42 | y = [] 43 | x = [] 44 | 45 | lines = inFile.readlines() 46 | count = 1 47 | noGain = 0 48 | 49 | for line in lines: 50 | currentLine = line.strip().split() 51 | 52 | try: 53 | if int(currentLine[0]) == 0: 54 | noGain += 1 55 | y.append(int(currentLine[0])) 56 | x.append(count) 57 | except: 58 | pass 59 | 60 | count += 1 61 | 62 | plt.bar(x, y) 63 | plt.show() 64 | print 'noGain:', noGain 65 | 66 | 67 | if __name__ == '__main__': 68 | 69 | main() -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/Datatypes.py: -------------------------------------------------------------------------------- 1 | import heapq 2 | class Queue: 3 | def __init__(self): 4 | self.items=[] 5 | def isEmpty(self): 6 | return len(self.items)==0 7 | def length(self): 8 | return len(self.items) 9 | def put(self,a): 10 | return self.items.insert(0,a) 11 | def get(self): 12 | return self.items.pop() 13 | def _print(self): 14 | print(self.items) 15 | 16 | 17 | class Stack: 18 | def __init__(self): 19 | self.items=[] 20 | def isEmpty(self): 21 | return len(self.items)==0 22 | def length(self): 23 | return len(self.items) 24 | def push(self,a): 25 | return self.items.append(a) 26 | def remove(self): 27 | return self.items.pop() 28 | def _print(self): 29 | print(self.items) 30 | def top(self): 31 | return self.items[len(self.items)-1] 32 | 33 | 34 | # class PriorityQueue: 35 | # def __init__(self): 36 | # self.elements = {} 37 | 38 | # def isEmpty(self): 39 | # return len(self.elements) == 0 40 | 41 | # def put(self, item, priority): 42 | # ''' 43 | # if item in self.elements: 44 | # print("Reprioritizing", item, "from", self.elements[item], "to", priority) 45 | # else: 46 | # print("Inserting", item, "with priority", priority) 47 | # ''' 48 | # self.elements[item] = priority 49 | 50 | # def get(self): 51 | # best_item, best_priority = None, None 52 | # for item, priority in self.elements.items(): 53 | # if best_priority is None or priority < best_priority: 54 | # best_item, best_priority = item, priority 55 | 56 | # del self.elements[best_item] 57 | # return best_item 58 | 59 | class PriorityQueue: 60 | def __init__(self): 61 | self._queue = [] 62 | self._index = 0 63 | 64 | def isEmpty(self): 65 | return len(self.elements) == 0 66 | 67 | def put(self, item, priority): 68 | heapq.heappush(self._queue, (-priority, self._index, item)) 69 | self._index += 1 70 | 71 | def get(self): 72 | return heapq.heappop(self._queue)[-1] -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/livingRoom.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for the living room scenario described in the following paper 6 | # "A Practical Framework for Cleaning Robots", 2011 7 | # Wen-Mau Chong, Chien-Le Goh, and Yoon-Teck Bau 8 | # In the Sixth International Conference of Bio-inspired Computing : Theories and Applications 9 | 10 | 11 | 12 | 13 | # Specifies the height of the grid 14 | height 15 15 | # Specifies the width of the grid 16 | width 15 17 | 18 | # Specifies the number of robots to be placed 19 | numRobots 10 20 | 21 | # Specifies the communication range (radius) of each robot 22 | R 50 23 | 24 | # Specifies the X and Y coordinates of the base station 25 | baseX 0 26 | baseY 0 27 | 28 | # Specifies the initial locations of each robot (Format: ) 29 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 30 | # Else, the program could terminate unexpectedly 31 | initLocs 32 | 13 2 33 | 13 3 34 | 13 4 35 | 13 5 36 | 13 6 37 | 13 7 38 | 13 8 39 | 13 9 40 | 13 10 41 | 13 11 42 | 43 | # Specifies the location of each obstacle cell (Format: ) 44 | # Note: You can have any number of obstacle, provided each of them is a valid cell 45 | obstacles 46 | 0 13 47 | 0 14 48 | 1 14 49 | 2 5 50 | 2 6 51 | 2 7 52 | 2 8 53 | 2 9 54 | 3 0 55 | 3 5 56 | 3 6 57 | 3 7 58 | 3 8 59 | 3 9 60 | 4 0 61 | 4 1 62 | 4 8 63 | 4 9 64 | 5 0 65 | 5 1 66 | 5 8 67 | 5 9 68 | 6 0 69 | 6 1 70 | 6 5 71 | 6 6 72 | 6 8 73 | 6 9 74 | 7 0 75 | 7 1 76 | 7 5 77 | 7 6 78 | 7 8 79 | 7 9 80 | 8 0 81 | 8 1 82 | 8 8 83 | 8 9 84 | 8 13 85 | 9 0 86 | 9 1 87 | 9 8 88 | 9 9 89 | 9 12 90 | 9 14 91 | 10 0 92 | 10 1 93 | 10 5 94 | 10 6 95 | 11 0 96 | 11 5 97 | 11 6 98 | 12 12 99 | 12 14 100 | 13 0 101 | 13 1 102 | 13 13 103 | 14 0 104 | 14 1 -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/greedy/livingRoom.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for the living room scenario described in the following paper 6 | # "A Practical Framework for Cleaning Robots", 2011 7 | # Wen-Mau Chong, Chien-Le Goh, and Yoon-Teck Bau 8 | # In the Sixth International Conference of Bio-inspired Computing : Theories and Applications 9 | 10 | 11 | 12 | 13 | # Specifies the height of the grid 14 | height 15 15 | # Specifies the width of the grid 16 | width 15 17 | 18 | # Specifies the number of robots to be placed 19 | numRobots 10 20 | 21 | # Specifies the communication range (radius) of each robot 22 | R 50 23 | 24 | # Specifies the X and Y coordinates of the base station 25 | baseX 0 26 | baseY 0 27 | 28 | # Specifies the initial locations of each robot (Format: ) 29 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 30 | # Else, the program could terminate unexpectedly 31 | initLocs 32 | 13 2 33 | 13 3 34 | 13 4 35 | 13 5 36 | 13 6 37 | 13 7 38 | 13 8 39 | 13 9 40 | 13 10 41 | 13 11 42 | 43 | # Specifies the location of each obstacle cell (Format: ) 44 | # Note: You can have any number of obstacle, provided each of them is a valid cell 45 | obstacles 46 | 0 13 47 | 0 14 48 | 1 14 49 | 2 5 50 | 2 6 51 | 2 7 52 | 2 8 53 | 2 9 54 | 3 0 55 | 3 5 56 | 3 6 57 | 3 7 58 | 3 8 59 | 3 9 60 | 4 0 61 | 4 1 62 | 4 8 63 | 4 9 64 | 5 0 65 | 5 1 66 | 5 8 67 | 5 9 68 | 6 0 69 | 6 1 70 | 6 5 71 | 6 6 72 | 6 8 73 | 6 9 74 | 7 0 75 | 7 1 76 | 7 5 77 | 7 6 78 | 7 8 79 | 7 9 80 | 8 0 81 | 8 1 82 | 8 8 83 | 8 9 84 | 8 13 85 | 9 0 86 | 9 1 87 | 9 8 88 | 9 9 89 | 9 12 90 | 9 14 91 | 10 0 92 | 10 1 93 | 10 5 94 | 10 6 95 | 11 0 96 | 11 5 97 | 11 6 98 | 12 12 99 | 12 14 100 | 13 0 101 | 13 1 102 | 13 13 103 | 14 0 104 | 14 1 -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/livingRoom.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for the living room scenario described in the following paper 6 | # "A Practical Framework for Cleaning Robots", 2011 7 | # Wen-Mau Chong, Chien-Le Goh, and Yoon-Teck Bau 8 | # In the Sixth International Conference of Bio-inspired Computing : Theories and Applications 9 | 10 | 11 | 12 | 13 | # Specifies the height of the grid 14 | height 15 15 | # Specifies the width of the grid 16 | width 15 17 | 18 | # Specifies the number of robots to be placed 19 | numRobots 10 20 | 21 | # Specifies the communication range (radius) of each robot 22 | R 50 23 | 24 | # Specifies the X and Y coordinates of the base station 25 | baseX 0 26 | baseY 0 27 | 28 | # Specifies the initial locations of each robot (Format: ) 29 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 30 | # Else, the program could terminate unexpectedly 31 | initLocs 32 | 13 2 33 | 13 3 34 | 13 4 35 | 13 5 36 | 13 6 37 | 13 7 38 | 13 8 39 | 13 9 40 | 13 10 41 | 13 11 42 | 43 | # Specifies the location of each obstacle cell (Format: ) 44 | # Note: You can have any number of obstacle, provided each of them is a valid cell 45 | obstacles 46 | 0 13 47 | 0 14 48 | 1 14 49 | 2 5 50 | 2 6 51 | 2 7 52 | 2 8 53 | 2 9 54 | 3 0 55 | 3 5 56 | 3 6 57 | 3 7 58 | 3 8 59 | 3 9 60 | 4 0 61 | 4 1 62 | 4 8 63 | 4 9 64 | 5 0 65 | 5 1 66 | 5 8 67 | 5 9 68 | 6 0 69 | 6 1 70 | 6 5 71 | 6 6 72 | 6 8 73 | 6 9 74 | 7 0 75 | 7 1 76 | 7 5 77 | 7 6 78 | 7 8 79 | 7 9 80 | 8 0 81 | 8 1 82 | 8 8 83 | 8 9 84 | 8 13 85 | 9 0 86 | 9 1 87 | 9 8 88 | 9 9 89 | 9 12 90 | 9 14 91 | 10 0 92 | 10 1 93 | 10 5 94 | 10 6 95 | 11 0 96 | 11 5 97 | 11 6 98 | 12 12 99 | 12 14 100 | 13 0 101 | 13 1 102 | 13 13 103 | 14 0 104 | 14 1 -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/barmaze.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for the bar maze scenario described in the following paper 6 | # "A Practical Framework for Cleaning Robots", 2011 7 | # Wen-Mau Chong, Chien-Le Goh, and Yoon-Teck Bau 8 | # In the Sixth International Conference of Bio-inspired Computing : Theories and Applications 9 | 10 | 11 | 12 | 13 | # Specifies the height of the grid 14 | height 15 15 | # Specifies the width of the grid 16 | width 15 17 | 18 | # Specifies the number of robots to be placed 19 | numRobots 9 20 | 21 | # Specifies the communication range (radius) of each robot 22 | R 50 23 | 24 | # Specifies the X and Y coordinates of the base station 25 | baseX 0 26 | baseY 0 27 | 28 | # Specifies the initial locations of each robot (Format: ) 29 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 30 | # Else, the program could terminate unexpectedly 31 | initLocs 32 | 0 9 33 | 1 9 34 | 2 9 35 | 3 9 36 | 4 9 37 | 5 9 38 | 6 9 39 | 7 9 40 | 8 9 41 | # 9 9 42 | 43 | # Specifies the location of each obstacle cell (Format: ) 44 | # Note: You can have any number of obstacle, provided each of them is a valid cell 45 | obstacles 46 | 0 2 47 | 1 2 48 | 2 2 49 | 3 2 50 | 4 2 51 | 5 2 52 | 6 2 53 | 7 2 54 | 7 0 55 | 8 0 56 | 9 0 57 | 10 0 58 | 11 0 59 | 12 0 60 | 13 0 61 | 14 0 62 | 0 6 63 | 1 6 64 | 2 6 65 | 3 6 66 | 4 6 67 | 5 6 68 | 6 6 69 | 7 6 70 | 7 4 71 | 8 4 72 | 9 4 73 | 10 4 74 | 11 4 75 | 12 4 76 | 13 4 77 | 14 4 78 | 0 10 79 | 1 10 80 | 2 10 81 | 3 10 82 | 4 10 83 | 5 10 84 | 6 10 85 | 7 10 86 | 7 8 87 | 8 8 88 | 9 8 89 | 10 8 90 | 11 8 91 | 12 8 92 | 13 8 93 | 14 8 94 | 0 14 95 | 1 14 96 | 2 14 97 | 3 14 98 | 4 14 99 | 5 14 100 | 6 14 101 | 7 14 102 | 7 12 103 | 8 12 104 | 9 12 105 | 10 12 106 | 11 12 107 | 12 12 108 | 13 12 109 | 14 12 110 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/baseline.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for the baseline scenario described in the following paper 6 | # "A Practical Framework for Cleaning Robots", 2011 7 | # Wen-Mau Chong, Chien-Le Goh, and Yoon-Teck Bau 8 | # In the Sixth International Conference of Bio-inspired Computing : Theories and Applications 9 | 10 | 11 | 12 | 13 | # Specifies the height of the grid 14 | height 14 15 | # Specifies the width of the grid 16 | width 14 17 | 18 | # Specifies the number of robots to be placed 19 | # Easy scenario 20 | # numRobots 10 21 | # Hard scenario 22 | numRobots 9 23 | 24 | # Specifies the communication range (radius) of each robot 25 | R 50 26 | 27 | # Specifies the X and Y coordinates of the base station 28 | baseX 7 29 | baseY 7 30 | 31 | # Specifies the initial locations of each robot (Format: ) 32 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 33 | # Else, the program could terminate unexpectedly 34 | initLocs 35 | 0 0 36 | 0 1 37 | 0 2 38 | 1 0 39 | 1 1 40 | 1 2 41 | 2 0 42 | 2 1 43 | 2 2 44 | 45 | # Specifies the location of each obstacle cell (Format: ) 46 | # Note: You can have any number of obstacle, provided each of them is a valid cell 47 | obstacles 48 | 0 4 49 | 0 5 50 | 0 10 51 | 0 11 52 | 1 4 53 | 1 5 54 | 1 10 55 | 1 11 56 | 2 4 57 | 2 5 58 | 2 10 59 | 2 11 60 | 3 4 61 | 3 5 62 | 3 10 63 | 3 11 64 | 6 0 65 | 6 1 66 | 6 2 67 | 6 3 68 | 7 0 69 | 7 1 70 | 7 2 71 | 7 3 72 | 8 6 73 | 8 7 74 | 9 6 75 | 9 7 76 | 10 6 77 | 10 7 78 | 11 6 79 | 11 7 80 | 12 4 81 | 12 5 82 | 12 6 83 | 12 7 84 | 12 8 85 | 12 9 86 | 12 10 87 | 12 11 88 | 13 5 89 | 13 6 90 | 13 7 91 | 13 8 92 | 13 9 93 | 13 10 94 | 13 11 95 | # Following are the locations of the unforseen obstacle 96 | # Comment them if you want the map to be easier 97 | 5 7 98 | 5 8 99 | 6 7 100 | 6 8 101 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/greedy/barmaze.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for the bar maze scenario described in the following paper 6 | # "A Practical Framework for Cleaning Robots", 2011 7 | # Wen-Mau Chong, Chien-Le Goh, and Yoon-Teck Bau 8 | # In the Sixth International Conference of Bio-inspired Computing : Theories and Applications 9 | 10 | 11 | 12 | 13 | # Specifies the height of the grid 14 | height 15 15 | # Specifies the width of the grid 16 | width 15 17 | 18 | # Specifies the number of robots to be placed 19 | numRobots 4 20 | 21 | # Specifies the communication range (radius) of each robot 22 | R 50 23 | 24 | # Specifies the X and Y coordinates of the base station 25 | baseX 0 26 | baseY 0 27 | 28 | # Specifies the initial locations of each robot (Format: ) 29 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 30 | # Else, the program could terminate unexpectedly 31 | initLocs 32 | 0 9 33 | 1 9 34 | 2 9 35 | 3 9 36 | # 4 9 37 | # 5 9 38 | # 6 9 39 | # 7 9 40 | # 8 9 41 | # 9 9 42 | 43 | # Specifies the location of each obstacle cell (Format: ) 44 | # Note: You can have any number of obstacle, provided each of them is a valid cell 45 | obstacles 46 | 0 2 47 | 1 2 48 | 2 2 49 | 3 2 50 | 4 2 51 | 5 2 52 | 6 2 53 | 7 2 54 | 7 0 55 | 8 0 56 | 9 0 57 | 10 0 58 | 11 0 59 | 12 0 60 | 13 0 61 | 14 0 62 | 0 6 63 | 1 6 64 | 2 6 65 | 3 6 66 | 4 6 67 | 5 6 68 | 6 6 69 | 7 6 70 | 7 4 71 | 8 4 72 | 9 4 73 | 10 4 74 | 11 4 75 | 12 4 76 | 13 4 77 | 14 4 78 | 0 10 79 | 1 10 80 | 2 10 81 | 3 10 82 | 4 10 83 | 5 10 84 | 6 10 85 | 7 10 86 | 7 8 87 | 8 8 88 | 9 8 89 | 10 8 90 | 11 8 91 | 12 8 92 | 13 8 93 | 14 8 94 | 0 14 95 | 1 14 96 | 2 14 97 | 3 14 98 | 4 14 99 | 5 14 100 | 6 14 101 | 7 14 102 | 7 12 103 | 8 12 104 | 9 12 105 | 10 12 106 | 11 12 107 | 12 12 108 | 13 12 109 | 14 12 110 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/barmaze.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for the bar maze scenario described in the following paper 6 | # "A Practical Framework for Cleaning Robots", 2011 7 | # Wen-Mau Chong, Chien-Le Goh, and Yoon-Teck Bau 8 | # In the Sixth International Conference of Bio-inspired Computing : Theories and Applications 9 | 10 | 11 | 12 | 13 | # Specifies the height of the grid 14 | height 15 15 | # Specifies the width of the grid 16 | width 15 17 | 18 | # Specifies the number of robots to be placed 19 | numRobots 9 20 | 21 | # Specifies the communication range (radius) of each robot 22 | R 50 23 | 24 | # Specifies the X and Y coordinates of the base station 25 | baseX 0 26 | baseY 0 27 | 28 | # Specifies the initial locations of each robot (Format: ) 29 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 30 | # Else, the program could terminate unexpectedly 31 | initLocs 32 | 0 9 33 | 1 9 34 | 2 9 35 | 3 9 36 | 4 9 37 | 5 9 38 | 6 9 39 | 7 9 40 | 8 9 41 | # 9 9 42 | 43 | # Specifies the location of each obstacle cell (Format: ) 44 | # Note: You can have any number of obstacle, provided each of them is a valid cell 45 | obstacles 46 | 0 2 47 | 1 2 48 | 2 2 49 | 3 2 50 | 4 2 51 | 5 2 52 | 6 2 53 | 7 2 54 | 7 0 55 | 8 0 56 | 9 0 57 | 10 0 58 | 11 0 59 | 12 0 60 | 13 0 61 | 14 0 62 | 0 6 63 | 1 6 64 | 2 6 65 | 3 6 66 | 4 6 67 | 5 6 68 | 6 6 69 | 7 6 70 | 7 4 71 | 8 4 72 | 9 4 73 | 10 4 74 | 11 4 75 | 12 4 76 | 13 4 77 | 14 4 78 | 0 10 79 | 1 10 80 | 2 10 81 | 3 10 82 | 4 10 83 | 5 10 84 | 6 10 85 | 7 10 86 | 7 8 87 | 8 8 88 | 9 8 89 | 10 8 90 | 11 8 91 | 12 8 92 | 13 8 93 | 14 8 94 | 0 14 95 | 1 14 96 | 2 14 97 | 3 14 98 | 4 14 99 | 5 14 100 | 6 14 101 | 7 14 102 | 7 12 103 | 8 12 104 | 9 12 105 | 10 12 106 | 11 12 107 | 12 12 108 | 13 12 109 | 14 12 110 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/baseline.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for the baseline scenario described in the following paper 6 | # "A Practical Framework for Cleaning Robots", 2011 7 | # Wen-Mau Chong, Chien-Le Goh, and Yoon-Teck Bau 8 | # In the Sixth International Conference of Bio-inspired Computing : Theories and Applications 9 | 10 | 11 | 12 | 13 | # Specifies the height of the grid 14 | height 14 15 | # Specifies the width of the grid 16 | width 14 17 | 18 | # Specifies the number of robots to be placed 19 | # Easy scenario 20 | # numRobots 10 21 | # Hard scenario 22 | numRobots 9 23 | 24 | # Specifies the communication range (radius) of each robot 25 | R 50 26 | 27 | # Specifies the X and Y coordinates of the base station 28 | baseX 7 29 | baseY 7 30 | 31 | # Specifies the initial locations of each robot (Format: ) 32 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 33 | # Else, the program could terminate unexpectedly 34 | initLocs 35 | 0 0 36 | 0 1 37 | 0 2 38 | 1 0 39 | 1 1 40 | 1 2 41 | 2 0 42 | 2 1 43 | 2 2 44 | 45 | # Specifies the location of each obstacle cell (Format: ) 46 | # Note: You can have any number of obstacle, provided each of them is a valid cell 47 | obstacles 48 | 0 4 49 | 0 5 50 | 0 10 51 | 0 11 52 | 1 4 53 | 1 5 54 | 1 10 55 | 1 11 56 | 2 4 57 | 2 5 58 | 2 10 59 | 2 11 60 | 3 4 61 | 3 5 62 | 3 10 63 | 3 11 64 | 6 0 65 | 6 1 66 | 6 2 67 | 6 3 68 | 7 0 69 | 7 1 70 | 7 2 71 | 7 3 72 | 8 6 73 | 8 7 74 | 9 6 75 | 9 7 76 | 10 6 77 | 10 7 78 | 11 6 79 | 11 7 80 | 12 4 81 | 12 5 82 | 12 6 83 | 12 7 84 | 12 8 85 | 12 9 86 | 12 10 87 | 12 11 88 | 13 5 89 | 13 6 90 | 13 7 91 | 13 8 92 | 13 9 93 | 13 10 94 | 13 11 95 | # Following are the locations of the unforseen obstacle 96 | # Comment them if you want the map to be easier 97 | 5 7 98 | 5 8 99 | 6 7 100 | 6 8 101 | -------------------------------------------------------------------------------- /Python Simulator/Path Planners/AStar.py: -------------------------------------------------------------------------------- 1 | from Datatypes import * 2 | import sys 3 | 4 | frontier = PriorityQueue() 5 | start = set() 6 | goal = set() 7 | explored = {} 8 | cost = {} 9 | 10 | class AStar: 11 | def __init__(self): 12 | pass 13 | 14 | def heuristic(self, a, b, n=1): 15 | dx=abs(b[0]-a[0]) 16 | dy=abs(b[1]-a[1]) 17 | 18 | # Manhattan Heuristic 19 | if n==1: 20 | return dx+dy 21 | 22 | # Euclidean Heuristic 23 | elif n==2: 24 | return (dx**2 + dy**2)**0.5 25 | 26 | # Chebychev Heuristic 27 | elif n==3: 28 | return max(dx,dy) 29 | 30 | # Octile Heuristic 31 | else: 32 | return dx+dy+(2**0.5-2)*min (dx,dy) 33 | 34 | def search(self,gridworld,begin,end): 35 | global frontier 36 | global start, goal, explored, cost 37 | 38 | start = begin ; goal = end 39 | frontier.put(start,0) 40 | 41 | explored[start]=None 42 | cost[start]=0 43 | 44 | gridworld.mark(start) 45 | gridworld.markpath(start) 46 | 47 | 48 | if self.proceed(gridworld) == 1: 49 | self.makepath() 50 | return False 51 | else: 52 | self.proceed(gridworld) 53 | return True 54 | 55 | def proceed(self,gridworld): 56 | global frontier 57 | global start, goal, explored, cost 58 | 59 | if frontier.isEmpty(): 60 | return 1 61 | 62 | else: 63 | current=frontier.get() 64 | 65 | if current==goal: 66 | return 1 67 | # sys.exit() 68 | for next in gridworld.get8Neighbors(current): 69 | if next[0]==current[0] or next[1] == current[1]: 70 | newcost=cost[current]+5 71 | else: 72 | newcost=cost[current]+7 73 | 74 | if next not in cost: 75 | cost[next]=newcost 76 | priority = newcost + self.heuristic(next,goal) 77 | print(newcost,priority) 78 | frontier.put(next, priority) 79 | gridworld.mark(next) 80 | explored[next]=current 81 | 82 | return 0 83 | 84 | def makepath(self,gridworld): 85 | global goal, explored,cost,start 86 | path = [] 87 | current = goal 88 | while current != start: 89 | path.append(current) 90 | gridworld.markpath(current) 91 | current = explored[current] 92 | path.reverse() ; path=[start]+path 93 | return path,explored,cost -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/Conversion of gridworld/Dijkstra.py: -------------------------------------------------------------------------------- 1 | from heapq import * 2 | #Dijkstra algorithm 3 | 4 | class Dijkstra: 5 | def __init__(self): 6 | pass 7 | 8 | def convert(self,gridworld): 9 | h=gridworld.height;w=gridworld.width 10 | a=[[0]*w for i in range(h)] 11 | for obstacle in gridworld.obstacles: 12 | a[obstacle[0]][obstacle[1]]=1 13 | return a 14 | 15 | def aStarSearch(self,gridworld, start, goal): 16 | path=[];cost2={};(x,y)=goal 17 | 18 | #for case when infinite map is given 19 | if x>gridworld.height or y>gridworld.width: 20 | return path,cost2 21 | 22 | array=self.convert(gridworld) 23 | close_set = set() 24 | came_from = {} 25 | gscore = {start:0} 26 | oheap = [] 27 | heappush(oheap, (gscore[start], start)) 28 | 29 | while oheap: 30 | current = heappop(oheap)[1] 31 | if current == goal: 32 | path = [] ; cost = 0 ; arr = {} 33 | while current in came_from: 34 | path.append(current) ; current = came_from[current] ; cost+=1 ; arr[current]=cost 35 | 36 | l=len(arr) 37 | for c in arr: 38 | arr[c]=l-arr[c] 39 | arr[goal]=l 40 | return (path[::-1],arr) 41 | 42 | close_set.add(current) 43 | 44 | for neighbor in gridworld.get8Neighbors(current): 45 | if neighbor[0]==current[0] or neighbor[1]==current[1]: 46 | tentative_g_score = gscore[current]+1 47 | else: 48 | tentative_g_score = gscore[current]+1.4 49 | 50 | if neighbor in close_set and tentative_g_score >= gscore.get(neighbor, 0): 51 | continue 52 | 53 | if tentative_g_score < gscore.get(neighbor, 0) or neighbor not in [i[1]for i in oheap]: 54 | came_from[neighbor] = current 55 | gscore[neighbor] = tentative_g_score 56 | heappush(oheap, (gscore[neighbor], neighbor)) 57 | return False 58 | 59 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/circularMaze_easy.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for the circular maze scenario described in the following paper 6 | # "A Practical Framework for Cleaning Robots", 2011 7 | # Wen-Mau Chong, Chien-Le Goh, and Yoon-Teck Bau 8 | # In the Sixth International Conference of Bio-inspired Computing : Theories and Applications 9 | 10 | 11 | 12 | 13 | # Specifies the height of the grid 14 | height 15 15 | # Specifies the width of the grid 16 | width 15 17 | 18 | # Specifies the number of robots to be placed 19 | # Easy scenario 20 | numRobots 2 21 | # Hard scenario 22 | # numRobots 4 23 | 24 | # Specifies the communication range (radius) of each robot 25 | R 50 26 | 27 | # Specifies the X and Y coordinates of the base station 28 | baseX 0 29 | baseY 0 30 | 31 | # Specifies the initial locations of each robot (Format: ) 32 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 33 | # Else, the program could terminate unexpectedly 34 | initLocs 35 | # Easy set (10 robots) 36 | 0 14 37 | # 1 14 38 | # 14 0 39 | # 0 0 40 | 14 14 41 | 42 | # Hard set (9 robots) 43 | # 6 6 44 | # 6 7 45 | # 6 8 46 | # 7 6 47 | # 7 8 48 | # 8 6 49 | # 8 7 50 | # 3 3 51 | # 3 11 52 | # 11 11 53 | 54 | # Specifies the location of each obstacle cell (Format: ) 55 | # Note: You can have any number of obstacle, provided each of them is a valid cell 56 | obstacles 57 | 2 2 58 | 2 3 59 | 2 4 60 | 2 5 61 | 2 6 62 | 2 8 63 | 2 9 64 | 2 10 65 | 2 11 66 | 2 12 67 | 3 2 68 | 3 12 69 | 4 2 70 | 4 12 71 | 5 2 72 | 5 5 73 | 5 6 74 | 5 7 75 | 5 8 76 | 5 9 77 | 5 12 78 | 6 2 79 | 6 5 80 | 6 9 81 | 6 12 82 | 7 2 83 | 7 5 84 | 7 7 85 | 7 9 86 | 7 12 87 | 8 2 88 | 8 5 89 | 8 9 90 | 8 12 91 | 9 2 92 | 9 5 93 | 9 6 94 | 9 8 95 | 9 9 96 | 9 12 97 | 10 2 98 | 10 12 99 | 11 2 100 | 11 12 101 | 12 2 102 | 12 3 103 | 12 4 104 | 12 5 105 | 12 6 106 | 12 7 107 | 12 8 108 | 12 9 109 | 12 10 110 | 12 11 111 | 12 12 112 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/greedy/circularMaze_easy.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for the circular maze scenario described in the following paper 6 | # "A Practical Framework for Cleaning Robots", 2011 7 | # Wen-Mau Chong, Chien-Le Goh, and Yoon-Teck Bau 8 | # In the Sixth International Conference of Bio-inspired Computing : Theories and Applications 9 | 10 | 11 | 12 | 13 | # Specifies the height of the grid 14 | height 15 15 | # Specifies the width of the grid 16 | width 15 17 | 18 | # Specifies the number of robots to be placed 19 | # Easy scenario 20 | # numRobots 2 21 | # Hard scenario 22 | numRobots 4 23 | 24 | # Specifies the communication range (radius) of each robot 25 | R 50 26 | 27 | # Specifies the X and Y coordinates of the base station 28 | baseX 0 29 | baseY 0 30 | 31 | # Specifies the initial locations of each robot (Format: ) 32 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 33 | # Else, the program could terminate unexpectedly 34 | initLocs 35 | # Easy set (10 robots) 36 | 0 14 37 | # 1 14 38 | 14 0 39 | 0 0 40 | 14 14 41 | 42 | # Hard set (9 robots) 43 | # 6 6 44 | # 6 7 45 | # 6 8 46 | # 7 6 47 | # 7 8 48 | # 8 6 49 | # 8 7 50 | # 3 3 51 | # 3 11 52 | # 11 11 53 | 54 | # Specifies the location of each obstacle cell (Format: ) 55 | # Note: You can have any number of obstacle, provided each of them is a valid cell 56 | obstacles 57 | 2 2 58 | 2 3 59 | 2 4 60 | 2 5 61 | 2 6 62 | 2 8 63 | 2 9 64 | 2 10 65 | 2 11 66 | 2 12 67 | 3 2 68 | 3 12 69 | 4 2 70 | 4 12 71 | 5 2 72 | 5 5 73 | 5 6 74 | 5 7 75 | 5 8 76 | 5 9 77 | 5 12 78 | 6 2 79 | 6 5 80 | 6 9 81 | 6 12 82 | 7 2 83 | 7 5 84 | 7 7 85 | 7 9 86 | 7 12 87 | 8 2 88 | 8 5 89 | 8 9 90 | 8 12 91 | 9 2 92 | 9 5 93 | 9 6 94 | 9 8 95 | 9 9 96 | 9 12 97 | 10 2 98 | 10 12 99 | 11 2 100 | 11 12 101 | 12 2 102 | 12 3 103 | 12 4 104 | 12 5 105 | 12 6 106 | 12 7 107 | 12 8 108 | 12 9 109 | 12 10 110 | 12 11 111 | 12 12 112 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/greedy/kmeans.py: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | # Copyright (c) 2015 INSPIRE Lab, BITS Pilani 4 | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | import numpy 24 | import cluster 25 | import Cluster 26 | 27 | def centroidnp(size, *points): 28 | x_coords = [t[0] for p in points for t in p] 29 | y_coords = [t[1] for p in points for t in p] 30 | 31 | #print x_coords 32 | #print y_coords 33 | #print size 34 | centroid_x = sum(x_coords)/size 35 | centroid_y = sum(y_coords)/size 36 | return [centroid_x, centroid_y] 37 | 38 | class kmeans: 39 | def __init__(self): 40 | self.freeclusters=[] 41 | pass 42 | 43 | def Kmeanscluster(self, frontiers, no_robots): 44 | from cluster import KMeansClustering 45 | self.freeclusters=[] 46 | cl = KMeansClustering(frontiers) 47 | clusters = cl.getclusters(no_robots) 48 | #print clusters 49 | centroids=[] 50 | for i in range(no_robots): 51 | gen = centroidnp(len(clusters[i]),clusters[i]) 52 | centroids.append(gen) 53 | genagain = Cluster.Cluster(centroids[i][0], centroids[i][1]) 54 | genagain.occupied = False 55 | self.freeclusters.append(genagain) 56 | return self.freeclusters, clusters 57 | 58 | 59 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/circularMaze.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for the circular maze scenario described in the following paper 6 | # "A Practical Framework for Cleaning Robots", 2011 7 | # Wen-Mau Chong, Chien-Le Goh, and Yoon-Teck Bau 8 | # In the Sixth International Conference of Bio-inspired Computing : Theories and Applications 9 | 10 | 11 | 12 | 13 | # Specifies the height of the grid 14 | height 15 15 | # Specifies the width of the grid 16 | width 15 17 | 18 | # Specifies the number of robots to be placed 19 | # Easy scenario 20 | # numRobots 10 21 | # Hard scenario 22 | numRobots 9 23 | 24 | # Specifies the communication range (radius) of each robot 25 | R 50 26 | 27 | # Specifies the X and Y coordinates of the base station 28 | baseX 7 29 | baseY 7 30 | 31 | # Specifies the initial locations of each robot (Format: ) 32 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 33 | # Else, the program could terminate unexpectedly 34 | initLocs 35 | # Easy set (10 robots) 36 | # 0 14 37 | # 1 14 38 | # 2 14 39 | # 3 14 40 | # 4 14 41 | # 5 14 42 | # 6 14 43 | # 7 14 44 | # 8 14 45 | # 9 14 46 | # Hard set (9 robots) 47 | 6 6 48 | 6 7 49 | 6 8 50 | 7 6 51 | 7 8 52 | 8 6 53 | 8 7 54 | 8 8 55 | 9 7 56 | 57 | # Specifies the location of each obstacle cell (Format: ) 58 | # Note: You can have any number of obstacle, provided each of them is a valid cell 59 | obstacles 60 | 2 2 61 | 2 3 62 | 2 4 63 | 2 5 64 | 2 6 65 | 2 8 66 | 2 9 67 | 2 10 68 | 2 11 69 | 2 12 70 | 3 2 71 | 3 12 72 | 4 2 73 | 4 12 74 | 5 2 75 | 5 5 76 | 5 6 77 | 5 7 78 | 5 8 79 | 5 9 80 | 5 12 81 | 6 2 82 | 6 5 83 | 6 9 84 | 6 12 85 | 7 2 86 | 7 5 87 | 7 7 88 | 7 9 89 | 7 12 90 | 8 2 91 | 8 5 92 | 8 9 93 | 8 12 94 | 9 2 95 | 9 5 96 | 9 6 97 | 9 8 98 | 9 9 99 | 9 12 100 | 10 2 101 | 10 12 102 | 11 2 103 | 11 12 104 | 12 2 105 | 12 3 106 | 12 4 107 | 12 5 108 | 12 6 109 | 12 7 110 | 12 8 111 | 12 9 112 | 12 10 113 | 12 11 114 | 12 12 -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/circularMaze_easy.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for the circular maze scenario described in the following paper 6 | # "A Practical Framework for Cleaning Robots", 2011 7 | # Wen-Mau Chong, Chien-Le Goh, and Yoon-Teck Bau 8 | # In the Sixth International Conference of Bio-inspired Computing : Theories and Applications 9 | 10 | 11 | 12 | 13 | # Specifies the height of the grid 14 | height 15 15 | # Specifies the width of the grid 16 | width 15 17 | 18 | # Specifies the number of robots to be placed 19 | # Easy scenario 20 | numRobots 2 21 | # Hard scenario 22 | # numRobots 4 23 | 24 | # Specifies the communication range (radius) of each robot 25 | R 50 26 | 27 | # Specifies the X and Y coordinates of the base station 28 | baseX 0 29 | baseY 0 30 | 31 | # Specifies the initial locations of each robot (Format: ) 32 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 33 | # Else, the program could terminate unexpectedly 34 | initLocs 35 | # Easy set (10 robots) 36 | 0 14 37 | # 1 14 38 | # 14 0 39 | # 0 0 40 | 14 14 41 | 42 | # Hard set (9 robots) 43 | # 6 6 44 | # 6 7 45 | # 6 8 46 | # 7 6 47 | # 7 8 48 | # 8 6 49 | # 8 7 50 | # 3 3 51 | # 3 11 52 | # 11 11 53 | 54 | # Specifies the location of each obstacle cell (Format: ) 55 | # Note: You can have any number of obstacle, provided each of them is a valid cell 56 | obstacles 57 | 2 2 58 | 2 3 59 | 2 4 60 | 2 5 61 | 2 6 62 | 2 8 63 | 2 9 64 | 2 10 65 | 2 11 66 | 2 12 67 | 3 2 68 | 3 12 69 | 4 2 70 | 4 12 71 | 5 2 72 | 5 5 73 | 5 6 74 | 5 7 75 | 5 8 76 | 5 9 77 | 5 12 78 | 6 2 79 | 6 5 80 | 6 9 81 | 6 12 82 | 7 2 83 | 7 5 84 | 7 7 85 | 7 9 86 | 7 12 87 | 8 2 88 | 8 5 89 | 8 9 90 | 8 12 91 | 9 2 92 | 9 5 93 | 9 6 94 | 9 8 95 | 9 9 96 | 9 12 97 | 10 2 98 | 10 12 99 | 11 2 100 | 11 12 101 | 12 2 102 | 12 3 103 | 12 4 104 | 12 5 105 | 12 6 106 | 12 7 107 | 12 8 108 | 12 9 109 | 12 10 110 | 12 11 111 | 12 12 112 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/greedy/circularMaze.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for the circular maze scenario described in the following paper 6 | # "A Practical Framework for Cleaning Robots", 2011 7 | # Wen-Mau Chong, Chien-Le Goh, and Yoon-Teck Bau 8 | # In the Sixth International Conference of Bio-inspired Computing : Theories and Applications 9 | 10 | 11 | 12 | 13 | # Specifies the height of the grid 14 | height 15 15 | # Specifies the width of the grid 16 | width 15 17 | 18 | # Specifies the number of robots to be placed 19 | # Easy scenario 20 | # numRobots 10 21 | # Hard scenario 22 | numRobots 9 23 | 24 | # Specifies the communication range (radius) of each robot 25 | R 50 26 | 27 | # Specifies the X and Y coordinates of the base station 28 | baseX 7 29 | baseY 7 30 | 31 | # Specifies the initial locations of each robot (Format: ) 32 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 33 | # Else, the program could terminate unexpectedly 34 | initLocs 35 | # Easy set (10 robots) 36 | # 0 14 37 | # 1 14 38 | # 2 14 39 | # 3 14 40 | # 4 14 41 | # 5 14 42 | # 6 14 43 | # 7 14 44 | # 8 14 45 | # 9 14 46 | # Hard set (9 robots) 47 | 6 6 48 | 6 7 49 | 6 8 50 | 7 6 51 | 7 8 52 | 8 6 53 | 8 7 54 | 8 8 55 | 9 7 56 | 57 | # Specifies the location of each obstacle cell (Format: ) 58 | # Note: You can have any number of obstacle, provided each of them is a valid cell 59 | obstacles 60 | 2 2 61 | 2 3 62 | 2 4 63 | 2 5 64 | 2 6 65 | 2 8 66 | 2 9 67 | 2 10 68 | 2 11 69 | 2 12 70 | 3 2 71 | 3 12 72 | 4 2 73 | 4 12 74 | 5 2 75 | 5 5 76 | 5 6 77 | 5 7 78 | 5 8 79 | 5 9 80 | 5 12 81 | 6 2 82 | 6 5 83 | 6 9 84 | 6 12 85 | 7 2 86 | 7 5 87 | 7 7 88 | 7 9 89 | 7 12 90 | 8 2 91 | 8 5 92 | 8 9 93 | 8 12 94 | 9 2 95 | 9 5 96 | 9 6 97 | 9 8 98 | 9 9 99 | 9 12 100 | 10 2 101 | 10 12 102 | 11 2 103 | 11 12 104 | 12 2 105 | 12 3 106 | 12 4 107 | 12 5 108 | 12 6 109 | 12 7 110 | 12 8 111 | 12 9 112 | 12 10 113 | 12 11 114 | 12 12 -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/circularMaze.config: -------------------------------------------------------------------------------- 1 | # Anything that begins with # is treated as a comment 2 | 3 | # Blank lines such as the one above are ignored 4 | 5 | # Configuration file for the circular maze scenario described in the following paper 6 | # "A Practical Framework for Cleaning Robots", 2011 7 | # Wen-Mau Chong, Chien-Le Goh, and Yoon-Teck Bau 8 | # In the Sixth International Conference of Bio-inspired Computing : Theories and Applications 9 | 10 | 11 | 12 | 13 | # Specifies the height of the grid 14 | height 15 15 | # Specifies the width of the grid 16 | width 15 17 | 18 | # Specifies the number of robots to be placed 19 | # Easy scenario 20 | # numRobots 10 21 | # Hard scenario 22 | numRobots 9 23 | 24 | # Specifies the communication range (radius) of each robot 25 | R 50 26 | 27 | # Specifies the X and Y coordinates of the base station 28 | baseX 7 29 | baseY 7 30 | 31 | # Specifies the initial locations of each robot (Format: ) 32 | # IMPORTANT: Make sure that the number of lines after 'initLocs' is exactly equal to numRobots 33 | # Else, the program could terminate unexpectedly 34 | initLocs 35 | # Easy set (10 robots) 36 | # 0 14 37 | # 1 14 38 | # 2 14 39 | # 3 14 40 | # 4 14 41 | # 5 14 42 | # 6 14 43 | # 7 14 44 | # 8 14 45 | # 9 14 46 | # Hard set (9 robots) 47 | 6 6 48 | 6 7 49 | 6 8 50 | 7 6 51 | 7 8 52 | 8 6 53 | 8 7 54 | 8 8 55 | 9 7 56 | 57 | # Specifies the location of each obstacle cell (Format: ) 58 | # Note: You can have any number of obstacle, provided each of them is a valid cell 59 | obstacles 60 | 2 2 61 | 2 3 62 | 2 4 63 | 2 5 64 | 2 6 65 | 2 8 66 | 2 9 67 | 2 10 68 | 2 11 69 | 2 12 70 | 3 2 71 | 3 12 72 | 4 2 73 | 4 12 74 | 5 2 75 | 5 5 76 | 5 6 77 | 5 7 78 | 5 8 79 | 5 9 80 | 5 12 81 | 6 2 82 | 6 5 83 | 6 9 84 | 6 12 85 | 7 2 86 | 7 5 87 | 7 7 88 | 7 9 89 | 7 12 90 | 8 2 91 | 8 5 92 | 8 9 93 | 8 12 94 | 9 2 95 | 9 5 96 | 9 6 97 | 9 8 98 | 9 9 99 | 9 12 100 | 10 2 101 | 10 12 102 | 11 2 103 | 11 12 104 | 12 2 105 | 12 3 106 | 12 4 107 | 12 5 108 | 12 6 109 | 12 7 110 | 12 8 111 | 12 9 112 | 12 10 113 | 12 11 114 | 12 12 -------------------------------------------------------------------------------- /Python Simulator/Path Planners/ConfigFileReader.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | class ConfigFileReader: 4 | 5 | def __init__(self, fileName): 6 | self.fileName = fileName 7 | 8 | def readCfg(self): 9 | l = len(self.fileName) 10 | 11 | # CHECK VALID CONFIG FILE NAME 12 | if self.fileName[l-7:] != '.config': 13 | print('Invalid configuration file. The filename of a valid configuration file is *.config') 14 | sys.exit(-1) 15 | 16 | cfgFile = open(self.fileName, "r") 17 | lines = cfgFile.readlines() 18 | cfgFile.close() 19 | 20 | initLocsFlag = False 21 | obstacleFlag = False 22 | height = 0 23 | width = 0 24 | numRobots = 0 25 | R = 0 26 | baseX = 0 27 | baseY = 0 28 | initLocs = [] 29 | obstacles = [] 30 | 31 | # Used in counting the number of initLocs read 32 | tempCount = 0 33 | 34 | for i in range(len(lines)): 35 | currentLine = lines[i].strip().split() 36 | if currentLine == []: 37 | pass 38 | 39 | elif currentLine[0] == '#': 40 | pass 41 | 42 | elif initLocsFlag == True: 43 | initLocs.append((int(currentLine[0]) , int(currentLine[1]))) 44 | tempCount += 1 45 | if tempCount == numRobots: 46 | initLocsFlag = False 47 | 48 | elif obstacleFlag == True: 49 | obstacles.append((int(currentLine[0]) , int(currentLine[1]))) 50 | 51 | elif currentLine[0] == 'height': 52 | height = int(currentLine[1]) 53 | 54 | elif currentLine[0] == 'width': 55 | width = int(currentLine[1]) 56 | 57 | elif currentLine[0] == 'numRobots': 58 | numRobots = int(currentLine[1]) 59 | 60 | elif currentLine[0] == 'R': 61 | R = int(currentLine[1]) 62 | 63 | elif currentLine[0] == 'baseX': 64 | baseX = int(currentLine[1]) 65 | 66 | elif currentLine[0] == 'baseY': 67 | baseY = int(currentLine[1]) 68 | 69 | elif currentLine[0] == 'initLocs': 70 | initLocsFlag = True 71 | 72 | elif currentLine[0] == 'obstacles': 73 | obstacleFlag = True 74 | else: 75 | print('Invalid configuration file syntax') 76 | if initLocsFlag == True: 77 | print('Check the number of initLocs provided in the configuration file.') 78 | return -1, height, width, numRobots, R, baseX, baseY, initLocs, obstacles 79 | 80 | return 0, height, width, numRobots, R, baseX, baseY, initLocs, obstacles -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/AStarDemo.py: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | # Copyright (c) 2015 INSPIRE Lab, BITS Pilani 4 | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | 24 | """ 25 | Provides an implementation of the Communicative Exploration algorithm for a fixed base station. 26 | """ 27 | 28 | 29 | import math 30 | import random 31 | import sys 32 | import time 33 | 34 | import AStar 35 | import Cluster 36 | import CommExplore 37 | import ConfigFileReader 38 | import GridWorld 39 | import Hungarian 40 | import kmeans 41 | import Robot 42 | 43 | from collections import defaultdict 44 | 45 | 46 | def main(): 47 | 48 | if len(sys.argv) == 2: 49 | configFileName = sys.argv[1] 50 | else: 51 | configFileName = "freeworld.config" 52 | 53 | cfgReader = ConfigFileReader.ConfigFileReader(configFileName) 54 | 55 | ret, height, width, numRobots, R, baseX, baseY, initLocs, obstacles = cfgReader.readCfg() 56 | if ret == -1: 57 | print 'readCfg() Unsuccessful!' 58 | sys.exit(-1) 59 | else: 60 | print 'Read the config file', configFileName 61 | 62 | k = 2 63 | T = 100000 64 | 65 | algo = CommExplore.CommExplore(height, width, obstacles, numRobots, initLocs, T) 66 | 67 | astar = AStar.AStar() 68 | 69 | path, cost = astar.aStarSearch(algo.gridworld, (0, 0), (6, 6)) 70 | cost = cost[(6, 6)] 71 | print 'cost:', cost 72 | 73 | 74 | if __name__ == '__main__': 75 | main() -------------------------------------------------------------------------------- /Python Simulator/Path Planners/README.md: -------------------------------------------------------------------------------- 1 |

Simulator Usage:

2 |
    3 |
  1. Navigate to the folder and run the file named ConfigFileMaker.py
  2. 4 |
  3. Click on the opened GUI to make obstacles. Once done doing this, click on “Set” and then “Exit” button.
  4. 5 |
  5. By default the size of the map is given to be a grid of 20 x 20 cells. However this can be changed by changing the values of ROWS and COLUMNS in the above mentioned file. The name of the config file generated is “one.config” by default. You can change it by changing line 8 of the above mentioned file.
  6. 6 |
  7. Once done run the Simulator.py file via terminal. The syntax is to be: 7 | python Simulator.py 8 | Eg. python Simulator.py one.config 1,0 10,10
  8. 9 | 10 | Program Structure: 11 | 1. Datatypes.py - > Contains implementations of all the ADT’s such as queue, stack and priority queue. 12 | 13 | 2. Cell.py - > A class that is used to initialize the basic cell on the grid and its properties. The properties are: 14 | a. (x,y) – the coordinates of the cell 15 | b. Occupied – flag to see if the cell is occupied or not 16 | c. Obstacle – flag to determine if the cell is an obstacle or not 17 | d. Visited - flag to determine if the cell has been previously visited or not 18 | e. ispath – flag to determine if the cell lies in the path of the robot 19 | f. isprinted - flag to determine if the cell has been marked or not when visited 20 | g. start – is the cell the starting node 21 | h. goal – is the cell a goal node 22 | 23 | 3. Init.py -> takes as input the height, width and obstacle coordinates and returns an object representing the grid map 24 | 25 | 4. ConfigFileMaker.py -> Makes a .config file in the required format using user input from a gui 26 | 27 | 5. ConfigFileReader.py -> Reads the .config file and determines the characteristics of the map such as height, width, number of robots, start positions, and the obstacle positions 28 | 29 | 6. Gridworld.py -> Gives functionality to the map by basic functions such as : 30 | a. isstart() – if the cell is a start node 31 | b. isgoal() – if the cell is a goal node 32 | c. mark() - if the cell has been visited 33 | d. markjump() – if the cell has been marked as a jump point or not 34 | e. get4neighbors() – returns the 4 cardinal neighbors of the cell 35 | f. get8neighbors() – returns all 8 neighbors(cardinal + diagonal) of the cell 36 | 37 | 7. Interface.py -> creates a GUI interface based on the data obtained from the config file 38 | 39 | 8. Simulator.py -> Main function that simulates the algorithms on the given map. 40 | 41 | 9. BFS.py , Dijsktra.py, Astar.py -> The working algorithms which work the simulator 42 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/kmeans.py: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | # Copyright (c) 2015 INSPIRE Lab, BITS Pilani 4 | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | import numpy 24 | import cluster 25 | import Cluster 26 | 27 | 28 | """ 29 | Computes the centroid, given the set of points in a cluster 30 | """ 31 | def centroidnp(points): 32 | 33 | x_coords = [t[0] for t in points] 34 | y_coords = [t[1] for t in points] 35 | 36 | centroid_x = sum(x_coords)/len(points) 37 | centroid_y = sum(y_coords)/len(points) 38 | return [centroid_x, centroid_y] 39 | 40 | 41 | """ 42 | Computes clusters, given a list of data points, using K-Means 43 | """ 44 | class kmeans: 45 | 46 | def __init__(self): 47 | self.freeclusters = [] 48 | pass 49 | 50 | def Kmeanscluster(self, frontiers, no_robots): 51 | 52 | from cluster import KMeansClustering 53 | self.freeclusters = [] 54 | # Perform clustering 55 | cl = KMeansClustering(frontiers) 56 | clusters = cl.getclusters(no_robots) 57 | 58 | # Compute centroids 59 | centroids=[] 60 | for i in range(no_robots): 61 | # Cheap hack (If the algorithm returns only a tuple convert it into a list, 62 | # because centroidnp takes as input only a list) 63 | if type(clusters[i]) is tuple: 64 | clusters[i] = [clusters[i]] 65 | temp = centroidnp(clusters[i]) 66 | centroids.append(temp) 67 | # Store each centroid in its corresponding Cluster object 68 | clusterObject = Cluster.Cluster(centroids[i][0], centroids[i][1]) 69 | clusterObject.occupied = False 70 | self.freeclusters.append(clusterObject) 71 | 72 | return self.freeclusters, clusters 73 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/kmeans.py: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | # Copyright (c) 2015 INSPIRE Lab, BITS Pilani 4 | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | import numpy 24 | import cluster 25 | import Cluster 26 | 27 | 28 | """ 29 | Computes the centroid, given the set of points in a cluster 30 | """ 31 | def centroidnp(points): 32 | 33 | x_coords = [t[0] for t in points] 34 | y_coords = [t[1] for t in points] 35 | 36 | centroid_x = sum(x_coords)/len(points) 37 | centroid_y = sum(y_coords)/len(points) 38 | return [centroid_x, centroid_y] 39 | 40 | 41 | """ 42 | Computes clusters, given a list of data points, using K-Means 43 | """ 44 | class kmeans: 45 | 46 | def __init__(self): 47 | self.freeclusters = [] 48 | pass 49 | 50 | def Kmeanscluster(self, frontiers, no_robots): 51 | 52 | from cluster import KMeansClustering 53 | self.freeclusters = [] 54 | # Perform clustering 55 | cl = KMeansClustering(frontiers) 56 | clusters = cl.getclusters(no_robots) 57 | 58 | # Compute centroids 59 | centroids=[] 60 | for i in range(no_robots): 61 | # Cheap hack (If the algorithm returns only a tuple convert it into a list, 62 | # because centroidnp takes as input only a list) 63 | if type(clusters[i]) is tuple: 64 | clusters[i] = [clusters[i]] 65 | temp = centroidnp(clusters[i]) 66 | centroids.append(temp) 67 | # Store each centroid in its corresponding Cluster object 68 | clusterObject = Cluster.Cluster(centroids[i][0], centroids[i][1]) 69 | clusterObject.occupied = False 70 | self.freeclusters.append(clusterObject) 71 | 72 | return self.freeclusters, clusters 73 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/cluster/method/base.py: -------------------------------------------------------------------------------- 1 | # 2 | # This is part of "python-cluster". A library to group similar items together. 3 | # Copyright (C) 2006 Michel Albert 4 | # 5 | # This library is free software; you can redistribute it and/or modify it 6 | # under the terms of the GNU Lesser General Public License as published by the 7 | # Free Software Foundation; either version 2.1 of the License, or (at your 8 | # option) any later version. 9 | # This library is distributed in the hope that it will be useful, but WITHOUT 10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 12 | # for more details. 13 | # You should have received a copy of the GNU Lesser General Public License 14 | # along with this library; if not, write to the Free Software Foundation, 15 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | # 17 | 18 | 19 | class BaseClusterMethod(object): 20 | """ 21 | The base class of all clustering methods. 22 | 23 | :param input: a list of objects 24 | :distance_function: a function returning the distance - or opposite of 25 | similarity ``(distance = -similarity)`` - of two items from the input. 26 | In other words, the closer the two items are related, the smaller this 27 | value needs to be. With 0 meaning they are exactly the same. 28 | 29 | .. note:: 30 | The distance function should always return the absolute distance between 31 | two given items of the list. Say:: 32 | 33 | distance(input[1], input[4]) = distance(input[4], input[1]) 34 | 35 | This is very important for the clustering algorithm to work! Naturally, 36 | the data returned by the distance function MUST be a comparable 37 | datatype, so you can perform arithmetic comparisons on them (``<`` or 38 | ``>``)! The simplest examples would be floats or ints. But as long as 39 | they are comparable, it's ok. 40 | """ 41 | 42 | def __init__(self, input, distance_function, progress_callback=None): 43 | self.distance = distance_function 44 | self._input = input # the original input 45 | self._data = input[:] # clone the input so we can work with it 46 | # without distroying the original data. 47 | self.progress_callback = progress_callback 48 | 49 | def topo(self): 50 | """ 51 | Returns the structure (topology) of the cluster. 52 | 53 | See :py:meth:`~cluster.cluster.Cluster.topology` for more information. 54 | """ 55 | return self.data[0].topology() 56 | 57 | @property 58 | def data(self): 59 | """ 60 | Returns the data that is currently in process. 61 | """ 62 | return self._data 63 | 64 | @property 65 | def raw_data(self): 66 | """ 67 | Returns the raw data (data without being clustered). 68 | """ 69 | return self._input 70 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/temp2.txt: -------------------------------------------------------------------------------- 1 | 8 2 | 2 3 | 1 4 | 1 5 | 0 6 | 3 7 | 1 8 | 1 9 | 1 10 | 3 11 | 2 12 | 2 13 | 0 14 | 0 15 | 0 16 | 0 17 | 0 18 | 0 19 | 0 20 | 0 21 | 1 22 | 1 23 | 0 24 | 1 25 | 1 26 | 1 27 | 1 28 | 2 29 | 1 30 | 0 31 | 0 32 | 0 33 | 0 34 | 0 35 | 0 36 | 0 37 | 0 38 | 0 39 | 0 40 | 0 41 | 0 42 | 1 43 | 1 44 | 1 45 | 2 46 | 2 47 | 1 48 | 2 49 | 2 50 | 1 51 | 1 52 | 2 53 | 2 54 | 2 55 | 2 56 | 3 57 | 3 58 | 3 59 | 3 60 | 2 61 | 1 62 | 1 63 | 1 64 | 1 65 | 1 66 | 1 67 | 1 68 | 1 69 | 1 70 | 1 71 | 1 72 | 1 73 | 1 74 | 1 75 | 0 76 | 1 77 | 1 78 | 1 79 | 2 80 | 2 81 | 1 82 | 1 83 | 2 84 | 3 85 | 3 86 | 2 87 | 1 88 | 1 89 | 1 90 | 1 91 | 1 92 | 1 93 | 1 94 | 2 95 | 1 96 | 1 97 | 2 98 | 2 99 | 3 100 | 2 101 | 2 102 | 3 103 | 2 104 | 1 105 | 0 106 | 0 107 | 0 108 | 0 109 | 0 110 | 0 111 | 0 112 | 0 113 | 0 114 | 0 115 | 0 116 | 0 117 | 0 118 | 0 119 | 0 120 | 0 121 | 0 122 | 0 123 | 0 124 | 0 125 | 0 126 | 0 127 | 1 128 | 1 129 | 1 130 | 2 131 | 2 132 | 1 133 | 1 134 | 3 135 | 1 136 | 1 137 | 0 138 | 0 139 | 1 140 | 1 141 | 1 142 | 1 143 | 1 144 | 1 145 | 2 146 | 2 147 | 3 148 | 4 149 | 3 150 | 4 151 | 4 152 | 3 153 | 1 154 | 0 155 | 1 156 | 0 157 | 1 158 | 0 159 | 0 160 | 0 161 | 0 162 | 0 163 | 0 164 | 0 165 | 0 166 | 0 167 | 0 168 | 0 169 | 0 170 | 0 171 | 0 172 | 0 173 | 0 174 | 1 175 | 1 176 | 1 177 | 0 178 | 0 179 | 0 180 | 1 181 | 2 182 | 1 183 | 2 184 | 2 185 | 1 186 | 0 187 | 0 188 | 0 189 | 1 190 | 1 191 | 2 192 | 2 193 | 2 194 | 0 195 | 0 196 | 0 197 | 4 198 | 2 199 | 3 200 | 3 201 | 2 202 | 2 203 | 2 204 | 3 205 | 3 206 | 3 207 | 3 208 | 2 209 | 1 210 | 0 211 | 0 212 | 2 213 | 0 214 | 0 215 | 0 216 | 0 217 | 1 218 | 0 219 | 0 220 | 0 221 | 0 222 | 0 223 | 0 224 | 0 225 | 0 226 | 0 227 | 0 228 | 0 229 | 0 230 | 0 231 | 0 232 | 0 233 | 0 234 | 0 235 | 0 236 | 0 237 | 1 238 | 0 239 | 0 240 | 0 241 | 1 242 | 1 243 | 0 244 | 1 245 | 1 246 | 1 247 | 1 248 | 2 249 | 2 250 | 1 251 | 1 252 | 0 253 | 0 254 | 0 255 | 1 256 | 1 257 | 1 258 | 1 259 | 2 260 | 1 261 | 1 262 | 2 263 | 2 264 | 3 265 | 2 266 | 1 267 | 1 268 | 1 269 | 1 270 | 2 271 | 3 272 | 3 273 | 2 274 | 2 275 | 2 276 | 2 277 | 2 278 | 2 279 | 2 280 | 1 281 | 2 282 | 4 283 | 3 284 | 3 285 | 2 286 | 1 287 | 1 288 | 1 289 | 1 290 | 1 291 | 0 292 | 0 293 | 0 294 | 0 295 | 0 296 | 1 297 | 1 298 | 0 299 | 0 300 | 0 301 | 0 302 | 0 303 | 0 304 | 0 305 | 0 306 | 0 307 | 1 308 | 1 309 | 1 310 | 0 311 | 1 312 | 3 313 | 3 314 | 4 315 | 4 316 | 4 317 | 4 318 | 4 319 | 2 320 | 3 321 | 3 322 | 2 323 | 2 324 | 2 325 | 2 326 | 2 327 | 1 328 | 2 329 | 2 330 | 2 331 | 2 332 | 2 333 | 2 334 | 3 335 | 2 336 | 2 337 | 2 338 | 3 339 | 1 340 | 1 341 | 2 342 | 2 343 | 3 344 | 4 345 | 5 346 | 4 347 | 4 348 | 3 349 | 4 350 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Path-Planning-Simulator 2 | The repository contains two simulators - 3 | ## Python Simulator 4 | ### Path Planning Algorithms 5 | A python based simulator for path planning algorithms such as A*, JPS, Dijkstra, and other state-of-the-art algorithms. 6 |

    The project builds upon the Cluster Allocate Cover (CAC) simulator implemented by Prof.Avinash to make it faster and more efficient. The bottle neck, as found by profiling the code was turning out to be the path planning algorithm for the simulator. To tackle this issue, comparative analysis of state-of-the-art path planning and exploration algorithms via simulation and experimentation was performed in this project. The simulation is performed on 50+ custom grid maps of size 50 x 50 on a python based simulator. Experiments are also performed on a Turtlebot, on which a node containing all studied path planning algorithms is written on the ROS Indigo platform and tests on 10+ real maps are performed (On Gazebo/Rviz as well as in the lab). The following graph search algorithms were tested in the study:

    7 |
      8 |
    1. Breadth First Search
    2. 9 |
    3. Depth First Search
    4. 10 |
    5. Dijkstra's Algorithm
    6. 11 |
    7. A-Star Algorithm
    8. 12 |
    9. D-Star Algorithm
    10. 13 |
    11. Greedy Best First Search
    12. 14 |
    13. Jump Point Search (JPS)
    14. 15 |
    15. Jump Point Search extensions - JPS+ and JPS+B
    16. 16 |
    17 |

    JPS was found to be the best performing algorithm on the simulator as well as the Turtlebot.

    18 | 19 | ### Exploration Algorithms 20 | The srepository also includes implementations of the following frontier based exploration algorithms 21 |
      22 |
    1. Yamauchi's Frontier Algorithm
    2. 23 |
    3. Burgard's Frontier Algorithm
    4. 24 |
    5. Faigl's Frontier Algorithm
    6. 25 |
    7. Cluster Allocate Cover
    8. 26 |
    27 | 28 | ## Javascript Simulator 29 | A simple extension of the simulator has been implemented in JavaScript for ease of viewing in web browsers. The JavaScript version contains the following algorithms: 30 |
      31 |
    1. Breadth First Search
    2. 32 |
    3. Depth First Search
    4. 33 |
    5. Dijkstra's Algorithm
    6. 34 |
    7. Greedy Best First Search
    8. 35 |
    9. A-Star Algorithm
    10. 36 |
    11. Rapidly Exploring Random Trees (RRT)
    12. 37 |
    13. RRT-Connect
    14. 38 |
    15. RRT-Star
    16. 39 |
    40 | Just one map has been created for this simulator, this being the secondary version to the Python Simluator. 41 | 42 | ## TurtleBot Path Planning Node 43 | A path planning node for Robot Operating System (ROS-Indigo) has been implemented and can be found in the /Turtlebot Node - Path Planning/ folder of this repository. To integrate this node into your ROS package, you may follow this article. 44 | This package contains implementations of the following algorithms: 45 | 1. Depth First Search 46 | 2. Breadth First Search 47 | 3. Greedy Best First Search 48 | 4. Dijkstra's Algorithm 49 | 5. A-Star Algorithm 50 | 6. D-Star Algorithm 51 | 7. Jump Point Search 52 | 53 | 54 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/greedy/AStar.py: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | # Copyright (c) 2015 INSPIRE Lab, BITS Pilani 4 | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | 24 | """ 25 | Provides an implementation of the A* algorithm to find the shortest path between two nodes. 26 | Since we use an optimal heuristic (here, Manhattan distance), the path returned is guaranteed to be optimal. 27 | """ 28 | 29 | 30 | import PriorityQueue 31 | 32 | 33 | # The AStar class 34 | class AStar: 35 | 36 | def __init__(self): 37 | pass 38 | 39 | 40 | # Method that computes the value of the heuristic between two locations a, b in the gridworld 41 | # Here the heuristic is taken to be the Manhattan distance from a to b, ignoring obstacles 42 | def heuristic(self, a, b): 43 | 44 | (x1, y1) = a 45 | (x2, y2) = b 46 | return abs(x1 - x2) + abs(y1 + y2) 47 | 48 | 49 | # Method that runs the A* algorithm and returns the computed path as well as its cost 50 | def aStarSearch(self, gridworld, start, goal): 51 | 52 | # Frontier of the A* algorithm. Not to be confused with the frontier that we use in exploration 53 | # Initialize the frontier and put the start cell on it 54 | frontier = PriorityQueue.PriorityQueue() 55 | frontier.put(start, 0) 56 | 57 | # Declare and initialize other variables to store the computed path and cost 58 | path = {} 59 | cost = {} 60 | path[start] = None 61 | cost[start] = 0 62 | flag=0 63 | # Compute the next location to be added to the path 64 | while not frontier.isEmpty(): 65 | 66 | current = frontier.get() 67 | 68 | if current == goal: 69 | flag=1 70 | break 71 | 72 | for next in gridworld.get8Neighbors(current): 73 | 74 | newCost = cost[current] + 1 75 | 76 | if next not in cost or newCost < cost[next]: 77 | cost[next] = newCost 78 | priority = newCost + self.heuristic(goal, next) 79 | frontier.put(next, priority) 80 | path[next] = current 81 | if flag == 0: 82 | path[goal]=current 83 | cost[goal]=newCost 84 | return path, cost 85 | 86 | 87 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/AStar_arjun.py: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | # Copyright (c) 2015 INSPIRE Lab, BITS Pilani 4 | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | 24 | """ 25 | Provides an implementation of the A* algorithm to find the shortest path between two nodes. 26 | Since we use an optimal heuristic (here, Manhattan distance), the path returned is guaranteed to be optimal. 27 | """ 28 | 29 | 30 | import PriorityQueue 31 | 32 | 33 | # The AStar class 34 | class AStar: 35 | 36 | def __init__(self): 37 | pass 38 | 39 | 40 | # Method that computes the value of the heuristic between two locations a, b in the gridworld 41 | # Here the heuristic is taken to be the Manhattan distance from a to b, ignoring obstacles 42 | def heuristic(self, a, b): 43 | 44 | (x1, y1) = a 45 | (x2, y2) = b 46 | return abs(x1 - x2) + abs(y1 + y2) 47 | 48 | 49 | # Method that runs the A* algorithm and returns the computed path as well as its cost 50 | def aStarSearch(self, gridworld, start, goal): 51 | print(start,goal) 52 | # Frontier of the A* algorithm. Not to be confused with the frontier that we use in exploration 53 | # Initialize the frontier and put the start cell on it 54 | frontier = PriorityQueue.PriorityQueue() 55 | frontier.put(start, 0) 56 | 57 | # Declare and initialize other variables to store the computed path and cost 58 | path = {} 59 | cost = {} 60 | path[start] = None 61 | cost[start] = 0 62 | flag=0 63 | # Compute the next location to be added to the path 64 | while not frontier.isEmpty(): 65 | 66 | current = frontier.get() 67 | 68 | if current == goal: 69 | flag=1 70 | break 71 | 72 | for next in gridworld.get8Neighbors(current): 73 | 74 | newCost = cost[current] + 1 75 | 76 | if next not in cost or newCost < cost[next]: 77 | cost[next] = newCost 78 | priority = newCost + self.heuristic(goal, next) 79 | frontier.put(next, priority) 80 | path[next] = current 81 | if flag == 0: 82 | path[goal]=current 83 | cost[goal]=newCost 84 | return path, cost 85 | 86 | 87 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/backup/1 (initial backup)/AStar.py: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | # Copyright (c) 2015 INSPIRE Lab, BITS Pilani 4 | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | 24 | """ 25 | Provides an implementation of the A* algorithm to find the shortest path between two nodes. 26 | Since we use an optimal heuristic (here, Manhattan distance), the path returned is guaranteed to be optimal. 27 | """ 28 | 29 | 30 | import PriorityQueue 31 | 32 | 33 | # The AStar class 34 | class AStar: 35 | 36 | def __init__(self): 37 | pass 38 | 39 | 40 | # Method that computes the value of the heuristic between two locations a, b in the gridworld 41 | # Here the heuristic is taken to be the Manhattan distance from a to b, ignoring obstacles 42 | def heuristic(self, a, b): 43 | 44 | (x1, y1) = a 45 | (x2, y2) = b 46 | return abs(x1 - x2) + abs(y1 + y2) 47 | 48 | 49 | # Method that runs the A* algorithm and returns the computed path as well as its cost 50 | def aStarSearch(self, gridworld, start, goal): 51 | 52 | # Frontier of the A* algorithm. Not to be confused with the frontier that we use in exploration 53 | # Initialize the frontier and put the start cell on it 54 | frontier = PriorityQueue.PriorityQueue() 55 | frontier.put(start, 0) 56 | 57 | # Declare and initialize other variables to store the computed path and cost 58 | path = {} 59 | cost = {} 60 | path[start] = None 61 | cost[start] = 0 62 | flag=0 63 | # Compute the next location to be added to the path 64 | while not frontier.isEmpty(): 65 | 66 | current = frontier.get() 67 | 68 | if current == goal: 69 | flag=1 70 | break 71 | 72 | for next in gridworld.get8Neighbors(current): 73 | 74 | newCost = cost[current] + 1 75 | 76 | if next not in cost or newCost < cost[next]: 77 | cost[next] = newCost 78 | priority = newCost + self.heuristic(goal, next) 79 | frontier.put(next, priority) 80 | path[next] = current 81 | if flag == 0: 82 | path[goal]=current 83 | cost[goal]=newCost 84 | return path, cost 85 | 86 | 87 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/plot.py: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | # Copyright (c) 2014 INSPIRE Lab, BITS Pilani 4 | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | 24 | """ 25 | Provides a script to plot results 26 | """ 27 | 28 | 29 | import sys 30 | 31 | import matplotlib.pyplot as plt 32 | 33 | 34 | def main(): 35 | 36 | try: 37 | inFile = open(sys.argv[1], 'r') 38 | except Exception, e: 39 | print 'A valid input file was not passed' 40 | sys.exit(-1) 41 | 42 | y = [] 43 | x = [] 44 | 45 | lines = inFile.readlines() 46 | count = 1 47 | noGain = 0 48 | 49 | for line in lines: 50 | currentLine = line.strip().split() 51 | 52 | try: 53 | if int(currentLine[0]) == 0: 54 | noGain += 1 55 | y.append(int(currentLine[0])) 56 | x.append(count) 57 | except: 58 | pass 59 | 60 | count += 1 61 | 62 | 63 | # Compute redundancy 64 | redundancy = 0 65 | for i in range(len(y)): 66 | redundancy += y[i] 67 | 68 | print 'redundancy:', redundancy 69 | 70 | 71 | # Compute information gain 72 | infoGain = [] 73 | infoGainX = [] 74 | infoGainCount = 1 75 | bins = [] 76 | for i in range(10): 77 | bins.append(i) 78 | 79 | nineCount = [0 for i in range(10)] 80 | for i in range(len(y)): 81 | if i < 1: 82 | continue 83 | temp = y[i] - y[i-1] 84 | if temp == 0: 85 | noGain += 1 86 | infoGain.append(temp) 87 | infoGainX.append(infoGainCount) 88 | 89 | nineCount[temp] += 1 90 | infoGainCount += 1 91 | 92 | #print 'nineCount:', nineCount 93 | # plt.bar(x, y) 94 | # plt.plot(x, y) 95 | print len(y) 96 | # plt.plot(x,y) 97 | # plt.bar(bins, nineCount) 98 | 99 | plt.title('FreeWorld Redundancy') 100 | # plt.title('Office Information Gain Histogram') 101 | # plt.xlabel('Number of new cells visited in one timestep') 102 | # plt.ylabel('Frequency of occurance') 103 | plt.xlabel('Number of timesteps') 104 | # plt.ylabel('Percentage of Map covered') 105 | plt.ylabel('Number of redundant moves') 106 | plt.show() 107 | print 'noGain:', noGain 108 | 109 | 110 | if __name__ == '__main__': 111 | 112 | main() -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/Conversion of gridworld/AStar.py: -------------------------------------------------------------------------------- 1 | from heapq import * 2 | 3 | class AStar: 4 | def __init__(self): 5 | pass 6 | 7 | def convert(self,gridworld): 8 | h=gridworld.height;w=gridworld.width 9 | a=[[0]*w for i in range(h)] 10 | for obstacle in gridworld.obstacles: 11 | print(obstacle) 12 | a[obstacle[0]][obstacle[1]]=1 13 | return a 14 | 15 | def heuristic(self, a, b, n=4): 16 | dx=abs(b[0]-a[0]) 17 | dy=abs(b[1]-a[1]) 18 | 19 | # Manhattan Heuristic 20 | if n==1: 21 | return dx+dy 22 | 23 | # Euclidean Heuristic 24 | elif n==2: 25 | return (dx**2 + dy**2)**0.5 26 | 27 | # Chebychev Heuristic 28 | elif n==3: 29 | return max(dx,dy) 30 | 31 | # Octile Heuristic 32 | else: 33 | return dx+dy+(2**0.5-2)*min (dx,dy) 34 | 35 | def aStarSearch(self,gridworld, start, goal): 36 | print(start,goal) 37 | path=[];cost2={};(x,y)=goal 38 | 39 | #for case when infinite map is given 40 | if x>gridworld.height or y>gridworld.width: 41 | return path,cost2 42 | 43 | array=self.convert(gridworld) 44 | close_set = set() 45 | came_from = {} 46 | gscore = {start:0} 47 | fscore = {start:self.heuristic(start, goal)} 48 | oheap = [] 49 | heappush(oheap, (fscore[start], start)) 50 | 51 | 52 | while oheap: 53 | current = heappop(oheap)[1] 54 | if current == goal: 55 | path = [] 56 | cost = 0; 57 | arr = {} 58 | 59 | # make dictionary to store path and calculate cost 60 | while current in came_from: 61 | path.append(current) 62 | current = came_from[current] 63 | cost+=1 64 | arr[current]=cost 65 | 66 | l=len(arr) 67 | 68 | # return costs 69 | for c in arr: 70 | arr[c]=l-arr[c] 71 | arr[goal]=l 72 | return (path[::-1],arr) 73 | 74 | close_set.add(current) 75 | 76 | for neighbor in gridworld.get8Neighbors(current): 77 | tentative_g_score = gscore[current] + self.heuristic(current, neighbor) 78 | if 0 <= neighbor[0] < gridworld.height: 79 | if 0 <= neighbor[1] < gridworld.width: 80 | if array[neighbor[0]][neighbor[1]] == 1: 81 | continue 82 | 83 | if neighbor in close_set and tentative_g_score >= gscore.get(neighbor, 0): 84 | continue 85 | 86 | if tentative_g_score < gscore.get(neighbor, 0) or neighbor not in [i[1]for i in oheap]: 87 | came_from[neighbor] = current 88 | gscore[neighbor] = tentative_g_score 89 | fscore[neighbor] = tentative_g_score + self.heuristic(neighbor, goal) 90 | heappush(oheap, (fscore[neighbor], neighbor)) 91 | return False 92 | 93 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/results/old/frontierCluster_freeWorld_redundancy.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 2 3 | 0 4 | 2 5 | 0 6 | 2 7 | 1 8 | 3 9 | 1 10 | 1 11 | 0 12 | 1 13 | 1 14 | 1 15 | 0 16 | 2 17 | 1 18 | 2 19 | 2 20 | 1 21 | 0 22 | 2 23 | 1 24 | 2 25 | 4 26 | 2 27 | 0 28 | 2 29 | 2 30 | 2 31 | 1 32 | 0 33 | 1 34 | 1 35 | 1 36 | 1 37 | 0 38 | 0 39 | 0 40 | 0 41 | 1 42 | 1 43 | 2 44 | 2 45 | 1 46 | 4 47 | 2 48 | 0 49 | 1 50 | 1 51 | 2 52 | 0 53 | 3 54 | 2 55 | 1 56 | 2 57 | 3 58 | 1 59 | 0 60 | 0 61 | 1 62 | 1 63 | 1 64 | 2 65 | 3 66 | 4 67 | 5 68 | 3 69 | 2 70 | 3 71 | 3 72 | 3 73 | 1 74 | 2 75 | 3 76 | 2 77 | 0 78 | 1 79 | 0 80 | 0 81 | 1 82 | 2 83 | 1 84 | 3 85 | 5 86 | 2 87 | 1 88 | 1 89 | 1 90 | 1 91 | 1 92 | 2 93 | 2 94 | 2 95 | 3 96 | 3 97 | 2 98 | 2 99 | 3 100 | 2 101 | 2 102 | 2 103 | 0 104 | 2 105 | 2 106 | 2 107 | 1 108 | 3 109 | 1 110 | 2 111 | 2 112 | 3 113 | 5 114 | 3 115 | 3 116 | 2 117 | 1 118 | 0 119 | 0 120 | 0 121 | 1 122 | 2 123 | 3 124 | 2 125 | 1 126 | 1 127 | 0 128 | 0 129 | 2 130 | 2 131 | 1 132 | 1 133 | 0 134 | 0 135 | 1 136 | 4 137 | 4 138 | 3 139 | 3 140 | 5 141 | 7 142 | 2 143 | 2 144 | 3 145 | 2 146 | 1 147 | 1 148 | 1 149 | 0 150 | 0 151 | 1 152 | 1 153 | 1 154 | 1 155 | 1 156 | 1 157 | 1 158 | 2 159 | 1 160 | 0 161 | 2 162 | 2 163 | 2 164 | 1 165 | 1 166 | 1 167 | 1 168 | 0 169 | 1 170 | 1 171 | 1 172 | 0 173 | 0 174 | 1 175 | 2 176 | 3 177 | 3 178 | 2 179 | 2 180 | 1 181 | 2 182 | 2 183 | 2 184 | 0 185 | 0 186 | 1 187 | 0 188 | 0 189 | 0 190 | 0 191 | 0 192 | 0 193 | 0 194 | 0 195 | 0 196 | 2 197 | 2 198 | 2 199 | 2 200 | 4 201 | 3 202 | 4 203 | 3 204 | 4 205 | 3 206 | 6 207 | 6 208 | 3 209 | 2 210 | 2 211 | 1 212 | 1 213 | 0 214 | 1 215 | 1 216 | 1 217 | 1 218 | 1 219 | 0 220 | 0 221 | 0 222 | 1 223 | 1 224 | 1 225 | 2 226 | 0 227 | 1 228 | 3 229 | 5 230 | 6 231 | 4 232 | 2 233 | 1 234 | 1 235 | 1 236 | 1 237 | 1 238 | 0 239 | 1 240 | 2 241 | 3 242 | 2 243 | 6 244 | 5 245 | 3 246 | 3 247 | 2 248 | 3 249 | 2 250 | 1 251 | 2 252 | 2 253 | 2 254 | 2 255 | 3 256 | 3 257 | 4 258 | 5 259 | 5 260 | 5 261 | 5 262 | 6 263 | 5 264 | 5 265 | 6 266 | 5 267 | 4 268 | 4 269 | 4 270 | 4 271 | 3 272 | 3 273 | 3 274 | 2 275 | 3 276 | 4 277 | 4 278 | 2 279 | 2 280 | 2 281 | 1 282 | 1 283 | 3 284 | 2 285 | 4 286 | 4 287 | 4 288 | 5 289 | 4 290 | 4 291 | 4 292 | 3 293 | 4 294 | 5 295 | 4 296 | 5 297 | 5 298 | 5 299 | 5 300 | 5 301 | 4 302 | 5 303 | 3 304 | 3 305 | 2 306 | 5 307 | 4 308 | 3 309 | 3 310 | 7 311 | 6 312 | 6 313 | 5 314 | 6 315 | 4 316 | 5 317 | 5 318 | 4 319 | 3 320 | 3 321 | 2 322 | 2 323 | 2 324 | 2 325 | 2 326 | 3 327 | 3 328 | 2 329 | 3 330 | 4 331 | 4 332 | 4 333 | 4 334 | 5 335 | 3 336 | 2 337 | 1 338 | 5 339 | 3 340 | 3 341 | 3 342 | 3 343 | 3 344 | 3 345 | 6 346 | 4 347 | 4 348 | 6 349 | 5 350 | 4 351 | 4 352 | 4 353 | 4 354 | 3 355 | 3 356 | 2 357 | 3 358 | 4 359 | 4 360 | 4 361 | 4 362 | 3 363 | 6 364 | 6 365 | 6 366 | 5 367 | 5 368 | 5 369 | 7 370 | 5 371 | 6 372 | 7 373 | 7 374 | 6 375 | 7 376 | 6 377 | 7 378 | 7 379 | 5 380 | 7 381 | 6 382 | 6 383 | 5 384 | 2 385 | 1 386 | 0 387 | -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/cluster/linkage.py: -------------------------------------------------------------------------------- 1 | from __future__ import division 2 | from functools import wraps 3 | 4 | 5 | def cached(fun): 6 | """ 7 | memoizing decorator for linkage functions. 8 | 9 | Parameters have been hardcoded (no ``*args``, ``**kwargs`` magic), because, 10 | the way this is coded (interchangingly using sets and frozensets) is true 11 | for this specific case. For other cases that is not necessarily guaranteed. 12 | """ 13 | 14 | _cache = {} 15 | 16 | @wraps(fun) 17 | def newfun(a, b, distance_function): 18 | frozen_a = frozenset(a) 19 | frozen_b = frozenset(b) 20 | if (frozen_a, frozen_b) not in _cache: 21 | result = fun(a, b, distance_function) 22 | _cache[(frozen_a, frozen_b)] = result 23 | return _cache[(frozen_a, frozen_b)] 24 | return newfun 25 | 26 | 27 | @cached 28 | def single(a, b, distance_function): 29 | """ 30 | Given two collections ``a`` and ``b``, this will return the distance of the 31 | points which are closest together. ``distance_function`` is used to 32 | determine the distance between two elements. 33 | 34 | Example:: 35 | 36 | >>> single([1, 2], [3, 4], lambda x, y: abs(x-y)) 37 | 1 # (distance between 2 and 3) 38 | """ 39 | left_a, right_a = min(a), max(a) 40 | left_b, right_b = min(b), max(b) 41 | result = min(distance_function(left_a, right_b), 42 | distance_function(left_b, right_a)) 43 | return result 44 | 45 | 46 | @cached 47 | def complete(a, b, distance_function): 48 | """ 49 | Given two collections ``a`` and ``b``, this will return the distance of the 50 | points which are farthest apart. ``distance_function`` is used to determine 51 | the distance between two elements. 52 | 53 | Example:: 54 | 55 | >>> single([1, 2], [3, 4], lambda x, y: abs(x-y)) 56 | 3 # (distance between 1 and 4) 57 | """ 58 | left_a, right_a = min(a), max(a) 59 | left_b, right_b = min(b), max(b) 60 | result = max(distance_function(left_a, right_b), 61 | distance_function(left_b, right_a)) 62 | return result 63 | 64 | 65 | @cached 66 | def average(a, b, distance_function): 67 | """ 68 | Given two collections ``a`` and ``b``, this will return the mean of all 69 | distances. ``distance_function`` is used to determine the distance between 70 | two elements. 71 | 72 | Example:: 73 | 74 | >>> single([1, 2], [3, 100], lambda x, y: abs(x-y)) 75 | 26 76 | """ 77 | distances = [distance_function(x, y) 78 | for x in a for y in b] 79 | return sum(distances) / len(distances) 80 | 81 | 82 | @cached 83 | def uclus(a, b, distance_function): 84 | """ 85 | Given two collections ``a`` and ``b``, this will return the *median* of all 86 | distances. ``distance_function`` is used to determine the distance between 87 | two elements. 88 | 89 | Example:: 90 | 91 | >>> single([1, 2], [3, 100], lambda x, y: abs(x-y)) 92 | 2.5 93 | """ 94 | distances = sorted([distance_function(x, y) 95 | for x in a for y in b]) 96 | midpoint, rest = len(distances) // 2, len(distances) % 2 97 | if not rest: 98 | return sum(distances[midpoint-1:midpoint+1]) / 2 99 | else: 100 | return distances[midpoint] 101 | -------------------------------------------------------------------------------- /Python Simulator/Path Planners/Simulator.py: -------------------------------------------------------------------------------- 1 | from ConfigFileReader import * 2 | import time,sys,Init 3 | from Dijkstra import * 4 | from Interface import * 5 | from AStar import * 6 | from BFS import * 7 | 8 | start = (0,10) 9 | goal = (2,48) 10 | 11 | t = 2 # Set time to display GUI 12 | 13 | if len(sys.argv)>1: 14 | configFileName = sys.argv[1] 15 | algo = sys.argv[2] ; s = sys.argv[3] ; g = sys.argv[4] 16 | 17 | if algo == 'bfs': 18 | algoflag=1 19 | elif algo == 'dijkstra': 20 | algoflag=2 21 | elif algo == 'astar': 22 | algoflag=3 23 | else: 24 | raise("No such algorithm present!") 25 | 26 | x,y=s.split(',') 27 | x=int(x) 28 | y=int(y) 29 | start=(x,y) 30 | 31 | xg,yg=g.split(',') 32 | xg=int(xg) ; yg=int(yg) 33 | goal=(xg,yg) 34 | 35 | else: 36 | configFileName = "freeworld_large.config" 37 | algoflag = 3 ; start = (0,0) ; goal = (49,49) 38 | 39 | 40 | 41 | ret, height, width, numRobots, R, baseX, baseY, initLocs, obstacles=ConfigFileReader(configFileName).readCfg() 42 | 43 | if height <= 10: 44 | xoffset = 300 45 | else: 46 | xoffset = 100 47 | if width <= 10: 48 | yoffset = 300 49 | else: 50 | yoffset = 100 51 | 52 | maxScreenHeight = 700 53 | cellSize = int(floor(maxScreenHeight / (height + 2))) 54 | 55 | root = Tk() 56 | 57 | initializer = Init.Initialize(height, width, obstacles) 58 | gui = Interface(root, height, width, cellSize, initializer.gridworld) 59 | guiHeight = str((height + 2) * cellSize) 60 | guiWidth = str((width + 2) * cellSize) 61 | xOffset = str(xoffset) 62 | yOffset = str(yoffset) 63 | geometryParam = guiWidth + 'x' + guiHeight + '+' + xOffset + '+' + yOffset 64 | root.geometry(geometryParam) 65 | 66 | if initializer.gridworld.cells[goal[0]][goal[1]].obstacle==True: 67 | raise('Goal is an obstacle!') 68 | 69 | if initializer.gridworld.cells[start[0]][start[1]].obstacle==True: 70 | raise('Start is an obstacle!') 71 | 72 | 73 | initializer.gridworld.isstart(start) 74 | initializer.gridworld.isgoal(goal) 75 | 76 | flag=False ; p=[]; cost = 0 77 | 78 | def run(): 79 | global flag,p,cost 80 | 81 | gui.redraw(height, width, cellSize, initializer.gridworld) 82 | 83 | if algoflag == 1: 84 | path = BFS().search(initializer.gridworld, start, goal) 85 | elif algoflag == 2: 86 | path = Dijkstra().search(initializer.gridworld, start, goal) 87 | else: 88 | path = AStar().search(initializer.gridworld, start, goal) 89 | 90 | if flag== False: 91 | if path== True and initializer.gridworld.cells[goal[0]][goal[1]].visited==False: 92 | if algoflag == 1: 93 | BFS().search(initializer.gridworld, start, goal) 94 | elif algoflag == 2: 95 | Dijkstra().search(initializer.gridworld, start, goal) 96 | else: 97 | AStar().search(initializer.gridworld, start, goal) 98 | 99 | else: 100 | if algoflag == 1: 101 | p, explored, cost= BFS().makepath(initializer.gridworld) 102 | elif algoflag == 2: 103 | p, explored, cost= Dijkstra().makepath(initializer.gridworld) 104 | else: 105 | p, explored, cost= AStar().makepath(initializer.gridworld) 106 | flag=True 107 | gui.redraw(height, width, cellSize, initializer.gridworld) 108 | 109 | else: 110 | print('Path found!') 111 | print('The path is:',p) 112 | print('The cost is:',cost[goal]) 113 | print('GUI will exit in:',t,'seconds') 114 | time.sleep(t) 115 | sys.exit() 116 | 117 | root.after(1,run) 118 | root.after(1,run) 119 | root.mainloop() -------------------------------------------------------------------------------- /Python Simulator/Frontier Exploration/GAdemo.py: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | # Copyright (c) 2014 INSPIRE Lab, BITS Pilani 4 | 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | 12 | # The above copyright notice and this permission notice shall be included in all 13 | # copies or substantial portions of the Software. 14 | 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | # SOFTWARE. 22 | 23 | 24 | """ 25 | Provides a demo of the GA-based Exploration algorithm for a fixed base station. 26 | """ 27 | 28 | 29 | from math import floor 30 | import sys 31 | from time import sleep 32 | from Tkinter import Tk, Canvas, Frame, BOTH 33 | 34 | 35 | import AStar 36 | import GAExplore 37 | import ConfigFileReader 38 | import GridUI 39 | 40 | 41 | def main(): 42 | 43 | if len(sys.argv) == 2: 44 | configFileName = sys.argv[1] 45 | else: 46 | configFileName = "freeworld.config" 47 | 48 | cfgReader = ConfigFileReader.ConfigFileReader(configFileName) 49 | 50 | ret, height, width, numRobots, R, baseX, baseY, initLocs, obstacles = cfgReader.readCfg() 51 | if ret == -1: 52 | print 'readCfg() Unsuccessful!' 53 | sys.exit(-1) 54 | else: 55 | print 'Read the config file', configFileName 56 | 57 | # print 'height', height 58 | # print 'width', width 59 | # print 'numRobots', numRobots 60 | # print 'R', R 61 | # print 'baseX', baseX 62 | # print 'baseY', baseY 63 | # print 'initLocs', initLocs 64 | # print 'obstacles', obstacles 65 | 66 | k = 50 67 | # T = 1000 68 | T = 10000000 69 | 70 | algo = GAExplore.GAExplore(height, width, obstacles, numRobots, initLocs, R, k, T, [baseX, baseY]) 71 | # algo.printGrid() 72 | # print '' 73 | # print '' 74 | # cfgc = algo.generateCfgcPopulation() 75 | 76 | # for j in range(T): 77 | # algo.runOneIterV2() 78 | 79 | # timeTaken = algo.printVisitedStatus() 80 | # if timeTaken == 0: 81 | # return T 82 | # return timeTaken 83 | 84 | 85 | # GUI Invocation 86 | 87 | if height <= 10: 88 | xoffset = 300 89 | else: 90 | xoffset = 100 91 | if width <= 10: 92 | yoffset = 300 93 | else: 94 | yoffset = 100 95 | 96 | maxScreenHeight = 700 97 | cellSize = int(floor(maxScreenHeight / (height + 2))) 98 | 99 | root = Tk() 100 | # ex = Example(root) 101 | # root.geometry('400x100+500+500') 102 | # root.mainloop() 103 | 104 | gui = GridUI.GridUI(root, height, width, cellSize, algo.gridworld, algo.robots, algo.frontier) 105 | guiHeight = str((height + 2) * cellSize) 106 | guiWidth = str((width + 2) * cellSize) 107 | xOffset = str(xoffset) 108 | yOffset = str(yoffset) 109 | geometryParam = guiWidth + 'x' + guiHeight + '+' + xOffset + '+' + yOffset 110 | root.geometry(geometryParam) 111 | 112 | def run(): 113 | 114 | algo.runOneIterV2() 115 | gui.redraw(height, width, cellSize, algo.gridworld, algo.robots, algo.frontier) 116 | root.after(50, run) 117 | 118 | root.after(50, run) 119 | root.mainloop() 120 | 121 | 122 | if __name__ == '__main__': 123 | 124 | main() --------------------------------------------------------------------------------