Some examples of ROS based navigation
For convenience it is recommended to use Docker containers. Please follow these steps to run Docker container on your machine.
- Install Desktop OS Ubuntu Trusty or Xenial on your machine or in virtual machine
- Install Docker-CE using these instructions
- In order to executed Docker without sudo please execute
sudo usermod -aG docker $USER
- Logout and login to your machine again :)
- For development the following docker container was used.
- To pull it please run
docker pull shadowrobot/build-tools:xenial-kinetic-ide
- Use the following command to start Docker container for simulation only
docker run -it --name navigation_demo -e DISPLAY -e LOCAL_USER_ID=$(id -u) -v /tmp/.X11-unix:/tmp/.X11-unix:rw shadowrobot/build-tools:xenial-kinetic-ide
In case if you have real robot you should start the following Docker container
docker run -it --name navigation_demo -e DISPLAY -e LOCAL_USER_ID=$(id -u) --device=/dev/ttyACM0 -v /tmp/.X11-unix:/tmp/.X11-unix:rw shadowrobot/build-tools:xenial-kinetic-ide
- Black window of Terminator UI console will appear after some time.
- You can use it's features to split terminal window into smaller terminals and run few commands in parallel (Ctrl+Shift+E).
- If you want to run real robot add user to dialout group and restart Docker container
sudo usermod -a -G dialout user
In order to relaunch docker container after you closed Terminator window or rebooted machine please run
docker start navigation_demo
After some time Terminator window will reappear.
Download Gazebo models for first time
bash <( curl -Ls https://raw.githubusercontent.com/shadow-robot/sr-build-tools/master/docker/utils/load_gazebo_models.sh)
Install ROS and compile source code (it will ask you for sudo password at some point, just press Enter)
bash <(curl -Ls https://raw.githubusercontent.com/shadow-robot/sr-build-tools/master/ansible/deploy.sh) -o AndriyPt -r ros-navigation-examples -b kinetic-devel -v kinetic
Source workspace which is located here ~/workspace/ros-navigation-examples/base/
source ~/workspace/ros-navigation-examples/base/devel/setup.bash
Start simulation
roslaunch moon_launch simulation.launch
or real robot
roslaunch moon_launch real_robot.launch
Launch navigation stack (in order to launch second command split Terminator window by two using Ctrl-Shift-E. More information on Terminator shortcuts can be found here)
roslaunch moon_launch navigation.launch
In RViz which appear after some time select "2D Nav Goal" and robot will travel to it. Like it is shown in this video.
Start simulation
roslaunch moon_launch simulation.launch
or real robot
roslaunch moon_launch real_robot.launch
Launch gmapping node
roslaunch moon_launch gmapping.launch
Drive arround environment to build map using the following keys. Please note that console window with gmapping launch file should be active in order to teleoperate robot using keys
Save map to file
rosrun map_server map_saver -f <map_file_name>