警告
您正在閱讀已達到生命週期結束(end-of-life,EOL)版本的 ROS 2 文件,該版本不再正式受支援。如果您想獲取最新資訊,請參見 Kilted。
Running 2 nodes in a single docker container [community-contributed]
Pull the ROS docker image with tag "eloquent-desktop".
docker pull osrf/ros:eloquent-desktop
Run the image in a container in interactive mode.
$ docker run -it osrf/ros:eloquent-desktop
root@<container-id>:/#
Your best friend is the ros2 command line help now.
root@<container-id>:/# ros2 --help
E.g. list all installed packages.
root@<container-id>:/# ros2 pkg list
(you will see a list of packages)
E.g. list all executables:
root@<container-id>:/# ros2 pkg executables
(you will see a list of <package> <executable>)
Run a minimal example of 2 C++ nodes (1 topic subscriber listener, 1 topic publisher talker) from the package demo_nodes_cpp in this container:
ros2 run demo_nodes_cpp listener &
ros2 run demo_nodes_cpp talker