Skip to content

Commit ea8a95c

Browse files
[update] Update the version of 'pytorch_ros', 'docker-compose.xml', and 'README.md'
1 parent 5ec29a6 commit ea8a95c

File tree

4 files changed

+29
-48
lines changed

4 files changed

+29
-48
lines changed

README.md

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,30 @@
11
# enet-pytorch-docker
2-
Docker environment to use [PyTorch-ENet](https://github.com/davidtvs/PyTorch-ENet)
2+
3+
Docker environment to use [pytorch_ros](https://github.com/ActiveIntelligentSystemsLab/pytorch_enet_ros/)
34

45
# How to use
56
## Building the image
67
```
78
make build
89
```
910

10-
## Running the codes in the container
11-
### Network training
12-
1. Example : Network training
13-
```
14-
docker-compose up pytorch-train
15-
```
16-
2. Visualization using Tensorboard
17-
```
18-
docker-compose up tensorboard
19-
```
11+
## Running the ROS nodes in the container
2012

21-
### ROS node
2213
1. Build (`catkin build`)
2314
```
24-
docker-compose up build
15+
docker-compose up catkin-build
2516
```
17+
2618
2. Launch `roscore`
2719
```
28-
docker-compose up pytorch-ros-master
20+
docker-compose up master
2921
```
30-
3. Run a ROS node (`roslaunch pytorch_enet_ros pytorch_enet_ros.launch`)
22+
23+
3. Run a ROS node (`roslaunch pytorch_ros pytorch_enet_ros.launch`)
3124
```
32-
docker-compose up pytorch-ros-node
25+
docker-compose up pytorch-ros
3326
```
27+
28+
4. (Optional) Run `sh docker_ros_setup.sh` to set the environment variables in the host.
29+
30+
If you want to run other nodes in the host and let them communicate with the nodes in the container, this is necessary.

docker-compose.yml

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,5 @@
11
version: "2.3"
22
services:
3-
pytorch-train:
4-
container_name: pytorch-train
5-
image: aisl/pytorch-enet:20.03-py3
6-
runtime: nvidia
7-
build: .
8-
command: >
9-
python /root/PyTorch-ENet/main.py -m train
10-
--save-dir /root/PyTorch-ENet/save/ENet_CamVid_matsuzaki_20190921/
11-
--name my_cityscapes_20190921
12-
--dataset camvid
13-
--dataset-dir /tmp/dataset/CamVid/
14-
--batch-size 8
15-
volumes:
16-
- ./PyTorch-ENet:/root/PyTorch-ENet
17-
- /media/data/dataset/matsuzaki:/tmp/dataset
18-
shm_size: 1G
19-
20-
tensorboard:
21-
container_name: tensorboard
22-
image: aisl/pytorch-enet:latest
23-
command: tensorboard --logdir /root/PyTorch-ENet/runs
24-
build: .
25-
ports:
26-
- 60006:6006
27-
volumes:
28-
- ./PyTorch-ENet:/root/PyTorch-ENet
29-
303
master:
314
container_name: master
325
image: ros:kinetic-ros-core
@@ -42,13 +15,11 @@ services:
4215
build: .
4316
runtime: nvidia
4417
image: aisl/pytorch-enet:20.03-py3
45-
command: roslaunch pytorch_enet_ros pytorch_enet_ros.launch image:=/kinect2/qhd/image_color_rect
18+
command: roslaunch pytorch_ros pytorch_enet_ros.launch image:=/kinect2/qhd/image_color_rect
4619
environment:
4720
- ROS_MASTER_URI=http://master:11311
48-
# - ROS_IP=172.24.0.3
4921
volumes:
5022
- ./catkin_ws/:/root/catkin_ws/
51-
- ./PyTorch-ENet:/root/PyTorch-ENet
5223
- /media/data/dataset/matsuzaki:/tmp/dataset
5324
tty: true
5425
shm_size: 1G
@@ -63,7 +34,6 @@ services:
6334
- CMAKE_PREFIX_PATH=/opt/ros/melodic:${CMAKE_PREFIX_PATH}
6435
volumes:
6536
- ./catkin_ws/:/root/catkin_ws/
66-
- ./PyTorch-ENet:/root/PyTorch-ENet
6737
# - /media/data/dataset/matsuzaki:/tmp/dataset
6838
tty: true
6939
shm_size: 1G

docker_ros_setup.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
# docker_ros_setup.sh
3+
# set the ROS-related environment variables
4+
# according to the docker container running 'roscore'
5+
6+
#
7+
# Get an (virtual) IP address of a docker container named "master"
8+
#
9+
IP_ADDRESS=`docker inspect master | grep -E "IPAddress" | grep -o "[0-9]\+.[0-9]\+.[0-9]\+.[0-9]\+"`
10+
export ROS_MASTER_URI=http://$IP_ADDRESS:11311
11+
export ROS_IP="172.19.0.1"
12+
13+
echo "Docker ROS setup : $IP_ADDRESS"
14+
echo "ROS IP : $ROS_IP"

0 commit comments

Comments
 (0)