Skip to content

Commit 9efedb8

Browse files
committed
Merge branch 'dev' of https://github.com/aidudezzz/deepbots into dev
update local
2 parents 556ef8e + e95a388 commit 9efedb8

File tree

6 files changed

+506
-0
lines changed

6 files changed

+506
-0
lines changed

.all-contributorsrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@
4949
"contributions": [
5050
"bug"
5151
]
52+
},
53+
{
54+
"login": "NickKok",
55+
"name": "Nikolaos Kokkinis-Ntrenis",
56+
"avatar_url": "https://avatars.githubusercontent.com/u/8222731?v=4",
57+
"profile": "https://nickkok.github.io/my-website/",
58+
"contributions": [
59+
"code",
60+
"doc",
61+
"ideas"
62+
]
5263
}
5364
],
5465
"contributorsPerLine": 7,

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ Thanks goes to these wonderful people
249249
<td align="center"><a href="https://www.linkedin.com/in/kelvin-yang-b7b508198/"><img src="https://avatars.githubusercontent.com/u/49781698?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jiun Kai Yang</b></sub></a><br /><a href="https://github.com/aidudezzz/deepbots/commits?author=KelvinYang0320" title="Code">💻</a></td>
250250
<td align="center"><a href="https://github.com/MentalGear"><img src="https://avatars.githubusercontent.com/u/2837147?v=4?s=100" width="100px;" alt=""/><br /><sub><b>MentalGear</b></sub></a><br /><a href="#ideas-MentalGear" title="Ideas, Planning, & Feedback">🤔</a></td>
251251
<td align="center"><a href="https://github.com/DreamtaleCore"><img src="https://avatars.githubusercontent.com/u/12713528?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Dreamtale</b></sub></a><br /><a href="https://github.com/aidudezzz/deepbots/issues?q=author%3ADreamtaleCore" title="Bug reports">🐛</a></td>
252+
<td align="center"><a href="https://nickkok.github.io/my-website/"><img src="https://avatars.githubusercontent.com/u/8222731?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nikolaos Kokkinis-Ntrenis</b></sub></a><br /><a href="https://github.com/aidudezzz/deepbots/commits?author=NickKok" title="Code">💻</a> <a href="https://github.com/aidudezzz/deepbots/commits?author=NickKok" title="Documentation">📖</a> <a href="#ideas-NickKok" title="Ideas, Planning, & Feedback">🤔</a></td>
252253
</tr>
253254
</table>
254255

docker/Dockerfile

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
FROM nvidia/cudagl:11.0-devel-ubuntu20.04
2+
ARG DEBIAN_FRONTEND=noninteractive
3+
4+
ARG PYTHON_VERSION=3.8
5+
6+
ARG branch
7+
8+
# Install ubuntu libaries
9+
RUN apt-get update && \
10+
apt-get install -y --no-install-recommends build-essential cmake pkg-config \
11+
libfreetype6-dev git nano wget curl vim ca-certificates unzip libjpeg-dev \
12+
libpng-dev libosmesa6-dev software-properties-common xvfb gpg-agent
13+
14+
# Install miniconda
15+
RUN curl -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
16+
chmod +x ~/miniconda.sh && \
17+
~/miniconda.sh -b -p /opt/conda && \
18+
rm ~/miniconda.sh && \
19+
/opt/conda/bin/conda update -n base -c defaults conda && \
20+
/opt/conda/bin/conda install -y python=$PYTHON_VERSION setuptools patchelf && \
21+
/opt/conda/bin/conda clean -ya
22+
ENV PATH /opt/conda/bin:$PATH
23+
24+
25+
# Env vars for the nvidia-container-runtime.
26+
ENV PATH /usr/local/cuda/bin/:$PATH
27+
ENV LD_LIBRARY_PATH /usr/local/cuda/lib:/usr/local/cuda/lib64
28+
ENV NVIDIA_VISIBLE_DEVICES all
29+
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
30+
LABEL com.nvidia.volumes.needed="nvidia_driver"
31+
32+
# Install weebots
33+
RUN wget -qO- https://cyberbotics.com/Cyberbotics.asc | apt-key add -
34+
RUN apt-add-repository 'deb https://cyberbotics.com/debian/ binary-amd64/' && \
35+
apt-get update && apt-get install -y webots
36+
37+
# Save enviroment libraries
38+
ENV WEBOTS_HOME /usr/local/webots
39+
ENV LD_LIBRARY_PATH $WEBOTS_HOME/lib/controller:$LD_LIBRARY_PATH
40+
41+
42+
ADD requirements.txt .
43+
# Install python dependencies
44+
RUN pip install -r requirements.txt
45+
46+
RUN if [ $branch = "dev" ]; then pip install -i https://test.pypi.org/simple/ deepbots ; else pip install deepbots ; fi
47+
48+
RUN pip install 'ray[tune]' 'ray[rllib]'
49+
50+
# Fix the error of the custome enviroment on Ray
51+
ADD preprocessors.py .
52+
RUN cp -r preprocessors.py opt/conda/lib/python3.8/site-packages/ray/rllib/models/
53+
RUN rm preprocessors.py
54+
55+
56+
WORKDIR /workspace
57+
RUN chmod -R a+w /workspace

docker/README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Use the Docker of the deepbots
2+
3+
## In case you would like to add other functionalities/libraries on the docker:
4+
5+
* Edit the Dockerfile
6+
* Build the docker image using below commands
7+
* Building argument ```branch``` specify the ```dev``` or the ```master``` branch of deepbots.
8+
9+
### Building and tagging a Docker image:
10+
```bash
11+
$ docker build -t yourusername/repository-name --build-arg branch=dev .
12+
```
13+
14+
## Pull the existing image from DockerHub
15+
16+
```bash
17+
$ docker pull nickok/deepbots-dev
18+
```
19+
20+
## For the use of Cuda on your docker container
21+
22+
You should install NVIDIA Container Toolkit on your ```host``` machine.
23+
24+
1) Setup the stable repository and the GPG key:
25+
``` bash
26+
$ distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
27+
&& curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \
28+
&& curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
29+
```
30+
2) Install the nvidia-docker2 package (and dependencies) after updating the package listing:
31+
32+
``` bash
33+
$ sudo apt-get update
34+
```
35+
36+
``` bash
37+
$ sudo apt-get install -y nvidia-docker2
38+
```
39+
40+
Restart the Docker daemon to complete the installation after setting the default runtime:
41+
``` bash
42+
$ sudo sudo systemctl restart docker
43+
```
44+
45+
46+
47+
## Run docker
48+
49+
### Use docker with ```cpu```
50+
Mount Webots project and run it on interactive Docker container:
51+
```bash
52+
$ docker run -it -v /absolute/path/to/webots/project:/workspace/name-of-project nickok/deepbots-dev
53+
```
54+
55+
### Use docker with ```cuda``` (GPU)
56+
``` bash
57+
$ docker run --rm --gpus all run -it -v /absolute/path/to/webots/project:/workspace/name-of-project nickok/deepbots
58+
```
59+
60+
After starting the docker container you can start Webots headlessly using xvfb:
61+
```bash
62+
$ xvfb-run webots --stdout --stderr --batch --no-sandbox --mode=fast /path/to/your/world/file
63+
64+
```
65+
66+
Start Webots headlessly using xvfb and save the output at out.txt:
67+
```bash
68+
$ xvfb-run webots --stdout --stderr --batch --no-sandbox --mode=fast /path/to/your/world/file &> out.txt &
69+
```

0 commit comments

Comments
 (0)