Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add instructions for using webots_ros2 packages with Docker on macOS and Ubuntu #4145

Open
wants to merge 5 commits into
base: rolling
Choose a base branch
from

Conversation

adamlm
Copy link

@adamlm adamlm commented Jan 28, 2024

Overview

This PR adds instructions for using the webots_ros2 packages when Webots is installed natively on macOS or Ubuntu and the associated ROS packages are installed in a Docker container. There is a PR that adds Docker support for working with ROS and Webots on macOS and Ubuntu, and the relevant documentation needs to be updated.

Related issues

Related to cyberbotics/webots_ros2#889
Depends on cyberbotics/webots_ros2#889

The documentation for macOS only shows how to use the webots_ros2_driver
for a virtual machine, but users can also configure it to work for
Docker containers.
These are instructions for an alternative Ubuntu setup where Webots
runs natively and the ROS packages run in a Docker container. This is
most likely an uncommon setup, but the instructions are provided for
completeness.
These entries cover the macOS Finder file and the default Python
virtual environment directory name. Neither of which should be
version controlled.
Fix typos, grammatical errors, and clarify some instructions.
Fix some grammatical errors and elaborate in some areas.
Copy link
Contributor

@omichel omichel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks very good to me.
Thank you.

Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have several comments, but any of my comments should not block this PR. (besides, i cannot comment on macOS.)

* Install Docker Engine on your Ubuntu machine.
The instructions can be found on the `Docker website <https://docs.docker.com/engine/install/ubuntu/>`_.

* Pull a Docker image for ROS. This tutorial uses the latest `ROS Base <https://hub.docker.com/layers/library/ros/latest/images/sha256-52e27b46c352d7ee113f60b05590bb089628a17ef648fff6992ca363c5e14945?context=explore>`_ image.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would avoid using xxx:latest image, instead ros:humble is better for everyone what image is used here? this becomes the problem as time goes, what is the ros:latest?

The following instructions and commands all are run on the host machine.

* Create a folder to use as a shared folder.
In this example, the shared folder on Ubuntu is ``/home/username/shared``, where ``username`` is your actual username.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would conceal the username with $HOME so that they do not need to replace the command.

Comment on lines +76 to +79
.. note::
Unlike Docker Desktop for Mac and Docker Desktop for Windows, you will need to specify your machine as an extra host.
This allows the container to resolve Docker's special ``host.docker.internal`` DNS name, allowing the container to communicate with the host.
See `this <https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach>`_ StackOverflow post for more information about why this is needed.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if we need this. this explains pretty much about docker option feature...

See `this <https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach>`_ StackOverflow post for more information about why this is needed.


* The environment variable ``WEBOTS_SHARED_FOLDER`` must always be set in order for the package to work properly in the Docker container.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can bind the environmental variable with -e option via docker run above without this explanation?

Comment on lines +153 to +156
.. note::
If you are using a Docker container, you will need to run a local TCP simulation server on the host so the ``webots_ros2`` packages can communicate with the Webots simulator.
The server can be downloaded here: `local_simulation_server.py <https://github.com/cyberbotics/webots-server/blob/main/local_simulation_server.py>`_.
Specify (on the host) the Webots installation folder in ``WEBOTS_HOME`` environment variable and run the server using the following commands in a new terminal on the host (not in the container):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am not familiar with webots simulator but if user wants to use container, probably user wants to run the simulator in the container as well? why simulator needs to be running in the host system?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The simulator needs to run outside of the container to benefit from hardware acceleration.

Comment on lines +1 to +2
.DS_Store
venv/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user is not expected to develop the virtual env or desktop service in this ros2_documentation repository? i guess those files should be set in the global user configuration .gitignore instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants