This documentation will help you set up Arena-Rosnav and provide an overview on how to start a simulation and how to use Arena-Rosnav for training and evaluation of robot navigation. Please also check out the glossary on the bottom of this documentation for better understanding.
Note: If you already have a Linux distribution, you can continue with Installation of Arena-Rosnav.
Please follow the steps in this WSL installation guide for Windows 10 to install WSL2 on your computer.
Note: If you already have a Linux distribution, skip this step.
You might encounter this problem during installation:
Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x80370102
Error: 0x80370102 The virtual machine could not be started because a required feature is not installed.
This problem can be resolved by enabling CPU virtualization in your BIOS. How you can achieve this depends on your hardware. This guide from bleepingcomputer might help you with that.
To use WSL with graphical programs, an X-server will need to be installed on the Windows 10 system and the DISPLAY variable will need to be set in Bash/Zsh. One possible program to use is VcXsrv.
After installing the X-server you need to set the DISPLAY variable in your Bash/Zsh.
Use nano ~/.bashrc
or nano ~/.zshrc
and insert the following code on the bottom of the file.
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
Exit via Ctrl+X. Agree with Y. Press Enter to save the file name (don't change it).
Start Xlaunch and configure it the following way. In the end the configuration can be saved.
- Choose Option: Multiple Windows
- Set Display Number to 0
- Choose Option: Start no Client
- Choose Option: Disable access control
If you encounter problems, you might go to Windows Defender Firewall -> Communication between Applications and Windows Firewall. Look for VcXsrv and change the settings to both private and public checked.
We recommend you use Visual Studio Code as your programming environment. Please follow the instructions in this VS Code with WSL tutorial.
We recommend using ohmyzsh. You can set up ohmyzsh with the following steps.
- Install zsh
sudo apt install zsh
- Install curl
sudo apt install curl
- Install ohmyzsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
- Confirm with Y
- Git clone autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
- Open your .zshrc with editor
nano ~/.zshrc
- Scroll down to
plugins
- Insert
zsh-autosuggestions
intoplugins=()
. Your plugins might look like this:
plugins=(git zsh-autosuggestions)
- Exit with Crtl+X
- Confirm with Y
- Confirm with Enter
- Source your .zshrc
source $HOME/.zshrc
Please install Arena-Rosnav according to the step-by-step instruction in Installation.md.
Different errors can occur during simulation, training or evaluation. Most errors can be resolved by running the following commands in respective order.
- Activate virtual environment
workon rosnav
- Update git repository
cd $HOME/catkin_ws/src/arena-rosnav
git pull
- Update ROS workspace
cd $HOME/catkin_ws/src/arena-rosnav
rosws update
- Build your workspace
cd $HOME/catkin_ws
catkin_make -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3
Another source of error could be your PYTHONPATH
. Please check it with echo $PYTHONPATH
. The output should look like this:
/home/user/catkin_ws/devel/lib/python3/dist-packages:
/home/user/catkin_ws/src/arena-rosnav:
/home/user/geometry2_ws/devel/lib/python3/dist-packages:
/opt/ros/melodic/lib/python2.7/dist-packages
/opt/ros/melodic/lib/python2.7/dist-packages
should be listed last. The order of the first 3 paths is not important.
If not, please follow the instructions Set python path in .zshrc (or .bashrc if you use that) in Installation.md.
The most basic simulation can be started by using the following command. Please make sure you are working in your virtual environment by running workon rosnav
beforehand.
roslaunch arena_bringup start_arena_flatland.launch train_mode:=false
RViz will open. Now you can click on the 2D Nav Goal button in RViz to set a goal anywhere on the map towards which the agent will move automatically and stop after reaching it. Warnings can be ignored as long as no error occurs.
You can specify the following parameters:
- train_mode:=<true, false>
- use_viz:=<true, false> (default true)
- local_planner:=<teb,dwa,mpc,cadrl,arena2d> (default dwa)
task_mode:=<random, manual, scenario> (default random)(redundant and does not need to be specified anymore)- obs_vel:= # maximum velocity of dynamic obstacles [m/s]. It is recommended to set a max velocity within [0.1,0.7] (default 0.3)
- map_file:= # e.g. map1 (default map_empty)
Please refer to DRL-Training.md for detailed explanations about agent, policy and training setups.
During training the agent will at first behave randomly and over time learns to navigate to the goal and (if specified) avoid obstacles. It's not necessary to set any goals. The script will run by itself.
The Quickstart training from DRL-Training.md will look like this:
While trying the Quickstart you might encouter the following error in the second terminal:
Traceback (most recent call last):
File "scripts/training/train_agent.py", line 229, in <module>
treshhold_type="succ", threshold=0.9, verbose=1)
TypeError: __init__() got an unexpected keyword argument 'treshhold_type'
This error can be resolved by updating your stable baselines and your workspace. Therefore run the following commands:
cd $HOME/catkin_ws/src/forks/stable-baselines3
pip install -e.
cd $HOME/catkin_ws/src/arena-rosnav
rosws update
cd $HOME/catkin_ws
catkin_make -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3
After training agents, their performance can be evaluated following Evaluation.md.
To start the simulation with the example command provided in Evaluation.md you need to set the 2D Nav Goal where the goal is visualized. This has to be done only once in the beginning and only when using "teb", "dwa" or "mpc" as local planners.
Note: The evaluation results will be recorded in .rosbag files in the directory in which the rosbag command was run.
Please refer to the readme.md for qualitative plotting for instructions.
There is a script for plotting quantitative results called sim_evaluation_v3.py. The version number might change over time. How to use this script is explained in the readme.md for quantitative plotting.
Note: It's necessary to run the qualitative evaluation first in order to get the json files required for the quantitative evaluation.
- global planner: calculates collision free global path from start to goal only considering the map layout
- local planner: navigates the robot along the global path and reacts to local objects not considered by global path
- waypoint generator: generates sub goals (waypoints) along global path which will each be targeted by the local planner