the image has been updated, if you have already followed this process and dont want to pull the docker image again you can just install this from the terminal inside ubuntu
apt-get install -y net-tools iproute2 ros-noetic-plotjuggler* ros-noetic-foxglove-bridge ros-noetic-turtlesim
This Docker container is set up for running a robotic simulation environment with the following specifications:
ROS Version: The container is configured to run with ROS (Robot Operating System) in the "noetic" release.
Catkin_ws: This docker setup will provide a preconfigured catkin workspace accessible both on the HOST MACHINE and the UBUNTU os
https://www.docker.com/products/docker-desktop/
Possible errors
- you have to enable hardware assisted virtualization on windows forums.docker.com/t/hardware-assisted-virtualization-and-data-execution-protection-must-be-enabled-in-the-bios/109073
- if you have an older version of operating system you may want to install an older version of docker docs.docker.com/desktop/release-notes/
This line will download, from docker hub, the docker image if it's not already on your host machine
The image will be then automatically start
- important note:
- for Mac and linux users in docker before executing the following commands you have to set in preferences -> resources -> file sharing the path to the github folder
- for Mac users with M chips (arm) go to docker settings -> general -> enable "Use Rosetta for x86/amd64 emulation on Apple Silicon"
You will have to write to the mount your own folder
Example with a Lab folder
<AbsolutePathOnHost>
the whole string including <> Becomes:
- for MacOS:
/Users/Documents/Lab - for Windows:
C:\Users\user\Lab - for Linux:
/home/user/Lab
Having specified <AbsolutePathOnHost> in the correct place of the following command you can now execute it (remember to have the docker app open in the backround otherwise it won't work).
Docker run will download the image automatically from docker hub and run it.
Do not remove or change :/home/ubuntu/shared as it is the path of the folder that will be created inside the docker container and where the catkin_ws will be stored.
docker run -p 6080:80 --security-opt seccomp=unconfined --shm-size=512m -v <AbsolutePathOnHost>:/home/ubuntu/shared --name roboticapoli vossgit/roboticapoli:prod
At this point you should get as output a bunch of RUNNING state lines from vnc and novnc, you can proceed.
docker exec -it roboticapoli /bin/sh
Inside the shell that will automatically start to use the more useful bash just write next to the #
bash
After running the container, you can access the graphical user interface (GUI) by opening a web browser and navigating to http://localhost:6080. The container exposes the GUI on port 6080, allowing you to interact with the simulation environment.
To restart the container when closed(you should always have the docker app running in the background) in the computer terminal/shell write:docker start roverchallenge
(you should always have the docker app running in the background) in the computer terminal/shell write:
docker start roboticapoli
docker exec -it roboticapoli /bin/sh
bash
There are 2 ways
- from the HOST MACHINE using a shell to access the docker container
- using the UBUNTU GUI using vnc
first method To move to the "catkin_ws" directory from the Docker terminal on the host machine, you can follow these steps:
- Open a shell with docker
docker exec -it roboticapoli /bin/shthen writebash - Use the command
cd /home/ubuntu/shared/catkin_wsto change directory to the "catkin_ws" directory. - Now, you're in the "catkin_ws" directory within your Docker container.
second method If you want to access the same directory on UBUNTU:
- go to http://localhost:6080
- open a terminal with the terminator app and you will be prompted already in the catkin_ws folder (which is inside /home/ubuntu/shared)
Additionally you can find your files and edit them on the HOST MACHINE using your preferred IDE
- You mentioned the directory exists on your host machine at
AbsolutePathOnHost/catkin_ws/.
Because of how the setup is done it's better to follow these steps inside the UBUNTU GUI at http://localhost:6080 to make the catkin_ws accessible to everyone.
This is because if you access with the docker shell from the HOST MACHINE you are seen as root user therefore you create folders accessible just to that user, and consequently not modifiable by the shell in UBUNTU GUI
So from http://localhost:6080 open a terrminal (with terminator) and write
cd /home/ubuntu/shared
mkdir -p catkin_ws2/src
cd /catkin_ws2/
catkin_make
source the work space (this can be done just once)
echo "source /home/ubuntu/shared/catkin_ws2/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
sudo printf "source /home/ubuntu/shared/catkin_ws2/devel/setup.bash\n" >> /home/ubuntu/.bashrc
source /home/ubuntu/.bashrc