MYR-2017 SimulATOR user manual Naïo technologies - Gazebo on Nvidia-Docker - Author : Andreu Joan Version : 1.0.0 Date : 2017/07/11 Copyright : Naïo Technologies
1. Requirements Minimal requirements : - Linux PC. - 8 Go of RAM is required. - i5 processor. - NVidia Graphic Card. - 1Go free space. We can actually runs the simulation and the client sample program on the same pc, i5, with 8Go Ram, and a NVidia GT730 GeForce. Please note you will much more comfortable running the simulation on one another pc than the one running your IA. You will be much more comfortable running the simulator on a i7 Core, with 16Go Ram, effectively, Gazebo physics motor is not yet properly optimized and use a lot of processor, instead of using graphic card computation power.
2. Docker installation https://docs.docker.com/engine/installation/ The deb command should not be executed but added in the following file : /etc/apt/sources.list You can do it using (For Xenial): echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" sudo tee /etc/apt/sources.list.d/docker.list Do not forget to install and start docker after the prerequisites with the command lines : sudo apt-get update sudo apt-get install docker-engine sudo service docker start NOTE on docker : To use docker, you first have to pull the image of the container where gazebo and the simulator are installed (cf. 4.1). To launch it, use the docker command run (cf. 4.2). You can generate new worlds inside the container (cf. 4.4) and launch the simulator in this terminal (cf. 4.6). You can then open a new terminal inside the container with the docker command exec and launch gzclient to visualize the simulation (cf. 4.3). If you want to exit a terminal, simply type exit in the command line of the container or use CTRL+C. When you exit the container, or when it crashes, make sure that it is stopped properly with the docker command stop (cf. 5.1) and then delete the container with the docker command rm (cf. 5.2).
3. Nvidia-Docker installation Linux/Ubuntu : Get latest release (deb): https://github.com/nvidia/nvidia-docker/releases install it : sudo dpkg -i nvidia-docker*.deb sudo apt-get install nvidia-modprobe sudo apt-get install -y nvidia-375 You need to install proprietary nvidia driver ( tested on 375 ).
4. DOCKER BUILDING 4.1 Pulling and building the dockerfile Start by pulling the image of the container where Gazebo, ROS, Simul'oz and the Test Viewer are installed : git clone https://github.com/naiotechnologies/naio-docker.git cd naio-docker git checkout myr2017 cd.. sudo docker build -t oz-simu:1.0 naio-docker In case you edit the entrypoint file ( the init file of the docker ) recompile the docker with : docker build -t simulatoz.
5. LAUNCHING DOCKER 4.2 Launching the container xhost +local:root sudo nvidia-docker run -it \ --privileged \ --env="display" \ --name simuloz \ --env="qt_x11_no_mitshm=1" \ --volume="/tmp/.x11-unix:/tmp/.x11-unix:rw" \ --volume="/tmp/.xim-unix:/tmp/.xim-unix:rw" \ -p 5900:5900 -p 5554:5554 -p 5555:5555 -p 5556:5556 -p 5557:5557 -p 5558:5558 -p 5559:5559 \ oz-simu:1.0 or sudo nvidia-docker run -it \ --privileged \ --env="display" \ --name simuloz \ --env="qt_x11_no_mitshm=1" \ --volume="/tmp/.x11-unix:/tmp/.x11-unix:rw" \ --volume="/tmp/.xim-unix:/tmp/.xim-unix:rw" \ -p 5900:5900 -p 5554:5554 -p 5559:5559 \ oz-simu:1.0 You may have to delete the existing container : - sudo docker stop simuloz - sudo docker ps -a - sudo docker rm <ID_OF_CONTAINER_SIMU>
6. Simulation Run On a the docker Terminal type : roslaunch oz440_gazebo level1.launch After a while, you should be able to see the Gazebo gui : if not working, check : cd /catkin_ws/src/simulatoz/ git checkout Move_your_robot export GAZEBO_MODEL_PATH=/catkin_ws/src/simulatoz/oz440_description/models:${GAZEBO_MODE L_PATH} export GAZEBO_RESOURCE_PATH=/catkin_ws/src/simulatoz/oz440_description/models:${GAZEBO_R ESOURCE_PATH} cd /catkin_ws && catkin_make
roslaunch oz440_gazebo level1.launch 4.3 Visualisation If by error you closed your gazebo client, you can restart it in the docker container : Open a new terminal in the running container : sudo docker exec -it simuloz bash On the container terminal, launch gzclient. 7.Running ApiClient You will have to install sdl2 libraries : sudo apt-get install libsdl2-dev sudo apt-get install libsdl2-ttf-dev sudo apt-get install libsdl2-gfx-dev Somewhere in your working directory : git clone https://github.com/naiotechnologies/apiclient.git cd ApiClient/ext/ git checkout ApiClient_2016.06.c_api git clone https://github.com/naiotechnologies/apicodec cd../build/ cmake.. make
For accessing ports on the simulator :./ApiClient 127.0.0.1 5559 5554 For accessing ports on the real robot platform :./ApiClient [IP OF THE ROBOT] 5555 5557 Application usage : Now you can use the four arrow keys the send motor command, press o or f for closing opening image socket. With this sample application, you have all packet coded in C++, and you can develop a thread, sending all the needed commands generated by your IA. You can also imagine develop with another language, but you will have to design back the packet protocol and loose some precious time instead thinking on a beautiful guidance algorithm!
Closing the container 3.1 Stopping the container When you have exited the container, stop it : sudo docker stop simuloz 3.2 Deleting the container When you have stopped the container, delete it : sudo docker rm simuloz