2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ros2をdockerで試す

Posted at

本家docker リポジトリはここ
https://hub.docker.com/r/osrf/ros2/

$ docker run -it --rm osrf/ros2:r2b3-core

でいろいろと試せます。が、
r2b3版だとtopicコマンド等がないのでardentの全部入りをつくってみました

参考:

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

が、ちゃんと動かず。なんか遅い?

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?