build details

Show: section status errors & todos local changes recent changes last change in-page changes feedback controls

Map

Modified 2021-06-24 by Jason Hu

The city layout is fixed and ready.

The city layout is transcribed in duckietown-world, to be used for visualization tools, for localization and much more.

In this section, the user will formalize the Duckietown built to a predefined map format, and integrate the map into the duckietown/duckietown-world Github repository. The formalized map is required for subsequent operations, e.g. localization.

The term venv used in texts of this document refers to the python3 virtual environment.

Setting up duckietown-world

Modified 2021-06-24 by Jason Hu

Fork and clone the repository

Modified 2021-06-24 by Jason Hu

Fork the repository duckietown/duckietown-world (how-to) and clone your fork to the local machine (how-to).

Then, replace the [path/to] with the path to where the repository is cloned to, and:

laptop $ cd [path/to]duckietown-world

Install git-lfs and pull all lfs files:

laptop $ sudo apt update -y && sudo apt install -y git-lfs
laptop $ git-lfs

Create the venv

Modified 2021-06-24 by Jason Hu

duckietown-world currently needs python3.7 or higher. You should verify this before proceeding.

Install and create venv:

laptop $ sudo apt update -y && sudo apt install -y python3-venv
laptop $ python3 -m venv duckietown-world-venv
laptop $ source duckietown-world-venv/bin/activate

Please don’t add the venv files to git commits.

(Later, to get out of the venv, just run deactivate)

Further setup in the venv

Modified 2021-06-24 by Jason Hu

laptop $ python3 -m pip install --upgrade pip
laptop $ python3 -m pip install -r requirements.txt
laptop $ python3 setup.py develop --no-deps

in case the last command returns the error ‘Permission denied: ‘src/duckietown_world_daffy.egg-info/PKG-INFO ‘, go to the folder src/duckietown_world_daffy.egg-info and change permission for the folder itself as well as all the files within the folder with sudo chmod 777 *. After doing this, run the last command again

Create your map

Modified 2021-06-24 by Jason Hu

To create a map interactively with the jupyter notebook, with your venv activated, inside the duckietown-worldrepository:

laptop $ jupyter notebook

Please open the notebooks with browsers other than Firefox, which has a known bug with visuals of maps. Chrome works fine.

Now, navigate to the notebooks directory and click open 30-DuckietownWorld-maps.ipynb. Go through the steps in order to get familiar with the code functions until the Creating new maps section is reached. Once there, you can start creating your own new map. In the section below there’re all the tile names and representation to help you.

You can add your map line by line, until satisfied with the result. Once this is done:

  • Adjust the tile size parameter. The size is the interior to exterior size (on most tiles it is 0.585 meters).
  • Create, in duckietown-world/src/duckietown_world/data/gd1/maps directory, a new yaml file for your map (e.g. ETH_small_loop.yaml).
  • Copy the working map contents that you just created in the juypter notebook to the yaml map file.
  • Check that you haves the tiles and the tile-size.

Create map visualization files

Modified 2021-06-24 by Jason Hu

Once [MAP_NAME].yaml file is composed, in the root of duckietown-world, with venv activated, run (without .yaml):

laptop $ dt-world-draw-maps MAP_NAME

This should generate a new folder with your map name in the out-draw_maps directory. You can now move this folder to the visualization/maps/ folder.

laptop $ mv out-draw_maps/MAP_NAME visualization/maps/

Verification

Modified 2021-06-24 by Jason Hu

If you now go back to the notebook and run the line that lists all maps, you should find yours in the list.

Committing

Modified 2021-06-24 by Jason Hu

again, please do not commit any venv files.

Now that the map is ready, you can commit locally:

  • the map yaml file in duckietown-world/src/duckietown_world/data/gd1/maps
  • the generated visualization in visualization/maps/

Then push the local commit to your forked repository, and create a pull request to the official duckietown/duckietown-world repository (how-to).

In case the pull request is not reviewed in time, please ask for help in the #devel-autolab channel on the Duckietown Slack.