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

Adds a dockerfile for webots with nuwebots and robocup environments #101

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

JesseWilliamson
Copy link
Contributor

@JesseWilliamson JesseWilliamson commented Mar 23, 2023

Requirements:

  1. Host must be using X window server
  2. host must be configured to allow local connections on the host machine. To do this, run xhost +local:root. To undo this run xhost -local:root.
  3. For GPU acceleration the host computer must be using a NVIDIA graphics card and have nvidia-container-toolkit installed. nvidia-container-toolkit is available as an Ubuntu package and is on the AUR. Webots recommends using nvidia-docker2 instead, but as far as I can tell this is deprecated.

Notes:

  1. The links on lines 27 and 60 reference files in this PR. For testing replace replace main with williamson/webots-docker.
  2. Using docker for gui applications seems to have some fairly unpredictable problems. If the benefits of this docker image are ease-of-use and standardisation, these problems probably limit its usefulness significantly.
  3. Most of this is from the cyberbotics webots-docker repo

Running on host network:

  1. Build the image. There are arguments for building with different webots or ubuntu versions, but the defaults should be fine for nubots / robocup.
  2. Run with docker run --gpus=all -it -e DISPLAY --env TEAM_NAME=nubots -v /tmp/.X11-unix:/tmp/.X11-unix:rw --network host WebotsImageName. You can add webots pathToWorldFile to run a world file directly, or leave as-is to open a bash shell.

--gpus=all enables gpu acceleration, and TEAM_NAME is for the hlvs_robocup game.json file. If you aren't running on the host network you can use --env ROBOT_HOSTS to add comma separated addresses to the hlvs whitelist.

You should be able to connect with localhost address as if webots was running normally outside a container.

ysims
ysims previously approved these changes Apr 19, 2023
Copy link
Member

@ysims ysims left a comment

Choose a reason for hiding this comment

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

Will need some documentation on NUbook for how to run this. Otherwise lgtm

Copy link
Member

@KipHamiltons KipHamiltons left a comment

Choose a reason for hiding this comment

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

Quick and cheeky one off reviews

webots-docker/Dockerfile Outdated Show resolved Hide resolved
webots-docker/Dockerfile Show resolved Hide resolved
webots-docker/Dockerfile Outdated Show resolved Hide resolved
webots-docker/Dockerfile Outdated Show resolved Hide resolved

# Build the robocup controllers
RUN git clone https://github.com/RoboCup-Humanoid-TC/hlvs_webots.git ./hlvs_webots && \
pip3 install -r ./hlvs_webots/controllers/referee/requirements.txt && make -j$(nproc) -C ./hlvs_webots
Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering - does $(nproc) affect caching if you ran it on a computer with a different amount of cores? Is it worth putting that in a script for that reason? (Presuming my suspicion is correct)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would make sense, but I haven't been able to find any solid info on it, so I'll need to test it. I don't understand why two computers would be building from the same cache though? Maybe I don't understand what you mean.

Copy link
Member

Choose a reason for hiding this comment

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

Doesn't change caching. All that would change it is if you changed the actual text here

webots-docker/webots-config.py Outdated Show resolved Hide resolved
webots-docker/webots-config.py Outdated Show resolved Hide resolved
webots-docker/entrypoint.sh Outdated Show resolved Hide resolved
@ysims
Copy link
Member

ysims commented Sep 9, 2023

@JesseWilliamson could you have a look at addressing Kip's comments. Just run ./b format for the formatting comments.

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