本家docker リポジトリはここ
https://hub.docker.com/r/osrf/ros2/
$ docker run -it --rm osrf/ros2:r2b3-core
でいろいろと試せます。が、
r2b3版だとtopicコマンド等がないのでardentの全部入りをつくってみました
参考:
- https://github.com/ros2/ros2/wiki/Introspection-with-command-line-tools
- https://github.com/ros2/ros2/wiki/Linux-Install-Debians
dockerコマンドで試す
事前準備:
$ docker network create -d bridge --subnet 172.1.0.0/16 ros2
terminal1:
$ docker run -it --rm --net ros2 atotto/ros2-core:latest ros2 topic pub /chatter std_msgs/String "data: Hello world"
publisher: beginning loop
publishing std_msgs.msg.String(data='Hello world')
publishing std_msgs.msg.String(data='Hello world')
publishing std_msgs.msg.String(data='Hello world')
publishing std_msgs.msg.String(data='Hello world')
publishing std_msgs.msg.String(data='Hello world')
publishing std_msgs.msg.String(data='Hello world')
terminal2:
$ docker run -it --rm --net ros2 atotto/ros2-core:latest ros2 topic echo /chatter
data: Hello world
data: Hello world
data: Hello world
data: Hello world
data: Hello world
data: Hello world
片付け
$ docker network rm ros2
docker-composeで試す
上と同じことをさせた(つもり)
version: '3'
services:
talker:
image: atotto/ros2-core:latest
command: 'ros2 topic pub /chatter std_msgs/String "data: Hello world"'
networks:
- ros2
listener:
image: atotto/ros2-core:latest
command: 'ros2 topic echo /chatter'
networks:
- ros2
list:
image: atotto/ros2-core:latest
command: ros2 topic list
networks:
- ros2
networks:
ros2:
driver: bridge
が、ちゃんと動かず。なんか遅い?