Daily Archives: November 18, 2020

DonkeySim:Multi-player

Published by:

マルチプレイヤー

DonkeyCarコンテナを同時に作成

chen@Hongs-MacBook-Pro donkeycar-docker % python multi_player.py
Enter number of racer: 4
docker run -p 8000:8000 -p 8887:8887 -v /Users/chen/Docker/donkeycar-docker/mycar1:/root/mycar -v mycar1_db:/donkeycar-console -e WEB_CONTROL_PORT=8887 -e mode=docker –name donkeycar1 –hostname donkeycar1 -d robocarstore/donkeycar:latest
8ada9e9e07a62d1c07c872d1ac5cef78cea931d2d3783e88797bdc25c4f3128f

using donkey v3.1.5 …
Creating car folder: /root/mycar
making dir /root/mycar
Creating data & model folders.
making dir /root/mycar/models
making dir /root/mycar/data
making dir /root/mycar/logs
Copying car application template: complete
Copying car config defaults. Adjust these before starting your car.
Copying train script. Adjust these before starting your car.
Copying calibrate script. Adjust these before starting your car.
Copying my car config overrides
Donkey setup complete.

 

docker run -p 8001:8000 -p 9887:9887 -v /Users/chen/Docker/donkeycar-docker/mycar2:/root/mycar -v mycar2_db:/donkeycar-console -e WEB_CONTROL_PORT=9887 -e mode=docker –name donkeycar2 –hostname donkeycar2 -d robocarstore/donkeycar:latest
5271640695a91d97204f4df669a358f0ceb72bd46eea65bf9b8e6e8c262ddcf4

using donkey v3.1.5 …
Creating car folder: /root/mycar
making dir /root/mycar
Creating data & model folders.
making dir /root/mycar/models
making dir /root/mycar/data
making dir /root/mycar/logs
Copying car application template: complete
Copying car config defaults. Adjust these before starting your car.
Copying train script. Adjust these before starting your car.
Copying calibrate script. Adjust these before starting your car.
Copying my car config overrides
Donkey setup complete.

 

docker run -p 8002:8000 -p 10887:10887 -v /Users/chen/Docker/donkeycar-docker/mycar3:/root/mycar -v mycar3_db:/donkeycar-console -e WEB_CONTROL_PORT=10887 -e mode=docker –name donkeycar3 –hostname donkeycar3 -d robocarstore/donkeycar:latest
6ea11e310c4b039199d101c68e5898736120f3912bf2ddba4b931f5a051cff4c

using donkey v3.1.5 …
Creating car folder: /root/mycar
making dir /root/mycar
Creating data & model folders.
making dir /root/mycar/models
making dir /root/mycar/data
making dir /root/mycar/logs
Copying car application template: complete
Copying car config defaults. Adjust these before starting your car.
Copying train script. Adjust these before starting your car.
Copying calibrate script. Adjust these before starting your car.
Copying my car config overrides
Donkey setup complete.

 

docker run -p 8003:8000 -p 11887:11887 -v /Users/chen/Docker/donkeycar-docker/mycar4:/root/mycar -v mycar4_db:/donkeycar-console -e WEB_CONTROL_PORT=11887 -e mode=docker –name donkeycar4 –hostname donkeycar4 -d robocarstore/donkeycar:latest
ffb1b61eaaa207e4bd8ac9be7bfe6603f9943c267a633654516579b827a4e0da

using donkey v3.1.5 …
Creating car folder: /root/mycar
making dir /root/mycar
Creating data & model folders.
making dir /root/mycar/models
making dir /root/mycar/data
making dir /root/mycar/logs
Copying car application template: complete
Copying car config defaults. Adjust these before starting your car.
Copying train script. Adjust these before starting your car.
Copying calibrate script. Adjust these before starting your car.
Copying my car config overrides
Donkey setup complete.

 

chen@Hongs-MacBook-Pro donkeycar-docker % docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ffb1b61eaaa2 robocarstore/donkeycar:latest “/bin/sh -c ‘/${RUNT…” 11 seconds ago Up 10 seconds 0.0.0.0:11887->11887/tcp, 0.0.0.0:8003->8000/tcp donkeycar4
6ea11e310c4b robocarstore/donkeycar:latest “/bin/sh -c ‘/${RUNT…” 14 seconds ago Up 13 seconds 0.0.0.0:10887->10887/tcp, 0.0.0.0:8002->8000/tcp donkeycar3
5271640695a9 robocarstore/donkeycar:latest “/bin/sh -c ‘/${RUNT…” 17 seconds ago Up 16 seconds 0.0.0.0:9887->9887/tcp, 0.0.0.0:8001->8000/tcp donkeycar2
8ada9e9e07a6 robocarstore/donkeycar:latest “/bin/sh -c ‘/${RUNT…” 19 seconds ago Up 19 seconds 0.0.0.0:8000->8000/tcp, 0.0.0.0:8887->8887/tcp donkeycar1
chen@Hongs-MacBook-Pro donkeycar-docker %

4台立ち上げていることを確認した。

DonkeySimを予め立ち上げてください。

dockerへシェルのアクセス

1台目へアクセス(2−4も同じ方法)
docker exec -it donkeycar1 bash
ここで、myconfig.py で各車両の名前、色などは指定できる。
次はそのDonkey Car をスタートする
# python manage.py drive
(専用Appからもスタートできる)

4台起動してレースする

また山道のレースも可能

DonkeySim:Single Player

Published by:

シングルプレーヤー

初期では、動いてるdockerにはない。

chen@hongs-mbp donkeycar-docker % docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

chen@hongs-mbp donkeycar-docker % ./start.sh
Creating network “donkeycar-docker_default” with the default driver
Pulling donkey (robocarstore/donkeycar:latest)…
latest: Pulling from robocarstore/donkeycar
e4c3d3e4f7b0: Pull complete
101c41d0463b: Pull complete
8275efcd805f: Pull complete
751620502a7a: Pull complete
0a5e725150a2: Pull complete
397dba5694db: Pull complete
88f0c2440f8d: Pull complete
788145ec04e5: Pull complete
596d3ac3bc76: Pull complete
40ca4aef2ef5: Pull complete
87ea2ef1374d: Pull complete
ed6b491920b4: Pull complete
541356a5c8a9: Pull complete
29e6394d4b47: Pull complete
7ce63a883dfe: Pull complete
e491cf5735be: Pull complete
41d9f34e17a6: Pull complete
a0cb20c5d69f: Pull complete
8952866a42e8: Pull complete
423eaa08cdad: Pull complete
c183f420a0cf: Pull complete
85f38d48878d: Pull complete
1ebe7130d062: Pull complete
5154cb95f68b: Pull complete
eac8084e778b: Pull complete
a0f3ba3e8d40: Pull complete
4bd0e60f825c: Pull complete
1070cc2006bd: Pull complete
6f1a4cfc07a2: Pull complete
9814f898c51d: Pull complete
71abaa3a0e71: Pull complete
Digest: sha256:cf62e84ad64f81914cf8459cc0644da1ba5ccd907922761a2188be71144dde13
Status: Downloaded newer image for robocarstore/donkeycar:latest
Creating donkeycar … done
Obtaining file:///donkeycar
Requirement already satisfied: numpy in /env/lib/python3.7/site-packages (from donkeycar==3.1.5) (1.19.4)
Requirement already satisfied: pillow in /env/lib/python3.7/site-packages (from donkeycar==3.1.5) (7.1.2)
Requirement already satisfied: docopt in /env/lib/python3.7/site-packages (from donkeycar==3.1.5) (0.6.2)
Requirement already satisfied: tornado in /env/lib/python3.7/site-packages (from donkeycar==3.1.5) (6.1)
Requirement already satisfied: requests in /env/lib/python3.7/site-packages (from donkeycar==3.1.5) (2.23.0)
Requirement already satisfied: h5py==2.10.0 in /env/lib/python3.7/site-packages (from donkeycar==3.1.5) (2.10.0)
Requirement already satisfied: moviepy in /env/lib/python3.7/site-packages (from donkeycar==3.1.5) (1.0.3)
Requirement already satisfied: pandas in /env/lib/python3.7/site-packages (from donkeycar==3.1.5) (1.1.4)
Requirement already satisfied: PrettyTable in /env/lib/python3.7/site-packages (from donkeycar==3.1.5) (2.0.0)
Requirement already satisfied: paho-mqtt in /env/lib/python3.7/site-packages (from donkeycar==3.1.5) (1.5.1)
Requirement already satisfied: simple_pid in /env/lib/python3.7/site-packages (from donkeycar==3.1.5) (0.2.4)
Requirement already satisfied: matplotlib in /env/lib/python3.7/site-packages (from donkeycar==3.1.5) (3.3.3)
Requirement already satisfied: chardet<4,>=3.0.2 in /env/lib/python3.7/site-packages (from requests->donkeycar==3.1.5) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /env/lib/python3.7/site-packages (from requests->donkeycar==3.1.5) (1.25.11)
Requirement already satisfied: idna<3,>=2.5 in /env/lib/python3.7/site-packages (from requests->donkeycar==3.1.5) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in /env/lib/python3.7/site-packages (from requests->donkeycar==3.1.5) (2020.11.8)
Requirement already satisfied: six in /env/lib/python3.7/site-packages (from h5py==2.10.0->donkeycar==3.1.5) (1.15.0)
Requirement already satisfied: proglog<=1.0.0 in /env/lib/python3.7/site-packages (from moviepy->donkeycar==3.1.5) (0.1.9)
Requirement already satisfied: tqdm<5.0,>=4.11.2 in /env/lib/python3.7/site-packages (from moviepy->donkeycar==3.1.5) (4.51.0)
Requirement already satisfied: imageio<3.0,>=2.5; python_version >= “3.4” in /env/lib/python3.7/site-packages (from moviepy->donkeycar==3.1.5) (2.9.0)
Requirement already satisfied: decorator<5.0,>=4.0.2 in /env/lib/python3.7/site-packages (from moviepy->donkeycar==3.1.5) (4.4.2)
Requirement already satisfied: imageio-ffmpeg>=0.2.0; python_version >= “3.4” in /env/lib/python3.7/site-packages (from moviepy->donkeycar==3.1.5) (0.4.2)
Requirement already satisfied: python-dateutil>=2.7.3 in /env/lib/python3.7/site-packages (from pandas->donkeycar==3.1.5) (2.8.1)
Requirement already satisfied: pytz>=2017.2 in /env/lib/python3.7/site-packages (from pandas->donkeycar==3.1.5) (2020.4)
Requirement already satisfied: setuptools in /env/lib/python3.7/site-packages (from PrettyTable->donkeycar==3.1.5) (47.1.0)
Requirement already satisfied: wcwidth in /env/lib/python3.7/site-packages (from PrettyTable->donkeycar==3.1.5) (0.2.5)
Requirement already satisfied: cycler>=0.10 in /env/lib/python3.7/site-packages (from matplotlib->donkeycar==3.1.5) (0.10.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /env/lib/python3.7/site-packages (from matplotlib->donkeycar==3.1.5) (1.3.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in /env/lib/python3.7/site-packages (from matplotlib->donkeycar==3.1.5) (2.4.7)
Installing collected packages: donkeycar
Attempting uninstall: donkeycar
Found existing installation: donkeycar 3.1.5
Uninstalling donkeycar-3.1.5:
Successfully uninstalled donkeycar-3.1.5
Running setup.py develop for donkeycar
Successfully installed donkeycar
WARNING: You are using pip version 20.1.1; however, version 20.2.4 is available.
You should consider upgrading via the ‘/env/bin/python3 -m pip install –upgrade pip’ command.
using donkey v3.1.5 …
Creating car folder: /root/mycar
making dir /root/mycar
Creating data & model folders.
making dir /root/mycar/models
making dir /root/mycar/data
making dir /root/mycar/logs
Copying car application template: complete
Copying car config defaults. Adjust these before starting your car.
Copying train script. Adjust these before starting your car.
Copying calibrate script. Adjust these before starting your car.
Donkey setup complete.

セットアップ完了

動いてるdockerには、donkeycarが確認できた。

chen@hongs-mbp donkeycar-docker % docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7b6cca26513a robocarstore/donkeycar:latest “/bin/sh -c ‘/${RUNT…” 10 minutes ago Up 10 minutes 0.0.0.0:8000->8000/tcp, 0.0.0.0:8887->8887/tcp donkeycar
chen@hongs-mbp donkeycar-docker %

App からコントロールするのですが、ブラザーから繋ぐと、APIらしい画面が出る

また、ブラウザからのコントロールもできます。

dockerへシェルのアクセス

docker exec -it donkeycar bash
Donkey Car をスタートする
# python manage.py drive
(専用Appからもスタートできる)

DonkeySim:Launch the mobile app

Published by:

モバイルアプリを起動します

投稿用画像

 

アプリ操作

 

仮想車を停止します

レーサー名を変更する

DonkeySim:Install Docker

Published by:

Dockerを使用してPCに仮想Donkey Carをインストールする方法

参考:https://medium.com/robocar-store/how-to-install-a-virtual-donkey-car-on-your-pc-using-docker-9e4e4fcf718a

投稿用画像

バックグラウンド

投稿用画像

インストール

Dockerをインストールする

リポジトリをチェックアウトする

git clone https://github.com/sctse999/donkeycar-docker