hans66hsu / commonroad-search

TUM Grundlagen der Künstlichen Intelligenz

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Graph Search-Based Motion Planner with Motion Primitives

This is a programming exercise for the lecture Introduction to Artificial Intelligence (WS19) delivered at the Department of Informatics, TUM. Please clone this repository or download it using the button at the upper-right corner. The repository has the following folder structure:

commonroad-search/
	├GSMP/
		├motion_automata/
			├automata/
			├motion_primitives/
			└vehicle_model/
		└tools/
			├commonroad-collision-checker/
			└commonroad-road-boundary/
	├notebooks/	
		├batch_processing/
		├motion_primitives_generator/
		└tutorials/
	├pdfs/	
	├scenarios/
		├exercise/
		└tutorial/
	└solutions/ 

The codes are written in Python 3.7 and tested on Ubuntu 18.04.

Ways to Install

You can either install the softwares on your own machine, use a virtual machine image or run a docker image.

  1. (Works on Ubuntu) Please follow the installation guide below if you are using your own machine.
  2. (Recommended for Ubuntu, Mac OS & Windows) Alternatively, you can use the virtual machine image provide by us, in which all the necessary modules are installed already. You can down the virtual machine image via this link and run it in Virtual Box. The downloading password and default login password are both commonroad.
  3. (Works on Ubuntu, Mac OS with OS X El Capitan 10.11 or later, Windows 10 64-bit: Pro, Enterprise, or Education, Build 15063 or later) Also, you can run a docker image provided by Tom Dörr. After installing docker, you can run the image using command
docker run -it -p 9000:8888 --mount src="$(pwd)",target=/commonroad-search,type=bind tomdoerr/commonroad-search

     and open the Jupyter Notebook by visiting localhost:9000 in your web browser.

After you have set up your environment, please further proceed with pdfs/0_Guide_for_Exercise.pdf.

Installation guide

Skip this section if you intend to use the provided virtual machine or docker image.

We recommend using Anaconda to manage your environment so that even if you mess up something, you can always have a safe and clean restart. A guide for managing the environments can be found here. Also, the usage of PyCharm is highly recommended (free version available for students).

After installing Anaconda, create a new environment by command:

 $ conda create -n commonroad-py37 python=3.7

Here the name of the environment is called commonroad-py37. You may also change this name as you wish. In such case, don't forget to change it in the following commands as well.

Always activate this environment before you do anything related:

  $ conda activate commonroad-py37
  or
  $ source activate commonroad-py37

Install Jupyter Notebook and supplementary modules:

  $ conda install jupyter
  $ conda install ipykernel
  $ pip install ipython-autotime
  $ conda install ipywidgets
  $ conda install sphinx
  $ conda install scipy
  $ jupyter nbextension install --py widgetsnbextension --user
  $ jupyter nbextension enable widgetsnbextension --user --py

This exercise has three main dependencies that need to be installed.

1. CommonRoad-io

As documented in CommonRoad-io Documentation, type in the following command to install the package:

  $ pip install commonroad-io

2. CommonRoad-Collision-Checker

Go to folder GSMP/tools/commonroad-collision-checker/ and follow the instruction in README.rst. (You may navigate to it from this page for a better rendering of the .rst file)

A tutorial of CommonRoad Collision Checker can be found here.

3. CommonRoad-Road-Boundary

Go to folder GSMP/tools/commonroad-road-boundary/ and follow the instruction in README.md. (You may navigate to it from this page for a better rendering of the .md file) In case you face an error, refer to troubleshooting section.

Tutorials

Navigate your terminal to commonroad-search/ folder, and start Jupyter Notebook with:

  $ jupyter notebook

In the prompt up page, navigate to notebooks/tutorials/ and follow the tutorials tutorial_commonroad-io.ipynb and tutorial_commonroad-search.ipynb. Remember to refer to pdfs/0_Guide_for_Exercise.pdf for additional explanation. The executed Jupyter notebooks for tutorials can also be found here.

Implement your own search algorithm

Open GSMP/motion_automata/automata/MotionPlanner.py. Write your own heuristic functions and/or search algorithm in the following functions:

	def calc_heuristic_cost()
	def search_alg()

There are already two search algorithms, namely A* and Greedy Best First Search, implemented as examples for you. You are free to refer to them for some inspiration.

Troubleshooting

1. Boundary library not working properly

If there are errors stating not finding the boundary library (e. g. module construction not found) while going through the second tutorial, try manually copying all the contents under folder GSMP/tools/commonroad-road-boundary/ into /path/to/your/anaconda3/envs/lib/python3.7/site-packages/commonroad-road-boundary/. Make sure to copy all files within the folder manually, not just copying the folder it self. Also, remember to add this path to your IDE's (e. g. PyCharm) interpretor path.

About

TUM Grundlagen der Künstlichen Intelligenz

License:GNU General Public License v3.0


Languages

Language:HTML 65.4%Language:Jupyter Notebook 27.7%Language:Python 2.9%Language:C++ 2.5%Language:JavaScript 1.1%Language:CSS 0.3%Language:CMake 0.1%Language:C 0.0%