前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Ubuntu与ROS的Docker桌面系统与ROS在线练习课程(在线Linux虚拟机)

Ubuntu与ROS的Docker桌面系统与ROS在线练习课程(在线Linux虚拟机)

作者头像
zhangrelay
发布2019-01-23 14:37:28
5.9K0
发布2019-01-23 14:37:28
举报
文章被收录于专栏:机器人课程与技术

ROS在线练习课程正在逐步完善中,目前以ROS官网中文资料制作,可参考:

https://www.shiyanlou.com/courses/854 邀请码 U23ERF8H

安装Ubuntu+ROS对于零Linux基础的小伙伴有些困难,最近发现了一个学习Linux非常好的网站实验楼,链接如下:

****https://www.shiyanlou.com/****

非常好奇如何实现了,于是查阅了一些资料,觉得最好的如下:

1    实验楼这个网站是怎样实现的在线linux虚拟机?

2    基于 VNCServer + noVNC 构建 Docker 桌面系统

3    Docker一些资料汇总

4    https://hub.docker.com

4.1 https://hub.docker.com/r/dorowu/ubuntu-desktop-lxde-vnc/

4.2 https://hub.docker.com/r/kaixhin/vnc-ros/

4.3 https://hub.docker.com/_/ros/

----~~~~----

ubuntu-desktop-lxde-vnc

代码语言:javascript
复制
relaybot@relaybot-desktop:~$ docker search dorowu
NAME                                         DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
dorowu/ubuntu-desktop-lxde-vnc               Ubuntu with openssh-server and NoVNC            114                  [OK]
dorowu/ubuntu-ssh-ttyjs                      Ubuntu with openssh server and tty.js enab...   8                    [OK]
dorowu/apt-repo-server                       apt-repo-server is a debian repository ser...   6                    [OK]
dorowu/ubuntu-lxqt-vnc                                                                       5                    [OK]
dorowu/qemu-iso                              Boot VM by QEMU/KVM with ISO and access it...   4                    [OK]
dorowu/lightop-ubuntu-trusty-ttyjs                                                           2                    [OK]
dorowu/ntopng                                                                                1                    [OK]
hardock14/dorowu-docker-ubuntu-vnc-desktop   dorowus images with additional software         1                    [OK]
dorowu/online-document.amd64                                                                 0                    
dorowu/lightop-ubuntu-trusty-lxde                                                            0                    [OK]
dorowu/qdk2                                  Create Docker App on QNAP NAS in QPKG format    0                    [OK]
dorowu/glusterfs-keepalived                                                                  0                    [OK]
dorowu/lightop                                                                               0                    [OK]
dorowu/pekaboo2qnap                                                                          0                    
dorowu/ubuntu_amd64                                                                          0                    
dorowu/nodejs_amd64                                                                          0                    
dorowu/ruby_amd64                                                                            0                    
dorowu/ubuntu_armhf                                                                          0                    
dorowu/qiot-mongodb_amd64                                                                    0                    
dorowu/qdk2-build                                                                            0                    
dorowu/qiot-mongodb_armhf                                                                    0                    
dorowu/dashing                                                                               0                    
dorowu/supershell                                                                            0                    
dorowu/mattermostdocker_db                                                                   0                    
dorowu/qiot-mongo-express_amd64                                                              0                    
relaybot@relaybot-desktop:~$ docker pull dorowu/ubuntu-desktop-lxde-vnc
Using default tag: latest
latest: Pulling from dorowu/ubuntu-desktop-lxde-vnc
aafe6b5e13de: Pull complete 
0a2b43a72660: Pull complete 
18bdd1e546d2: Pull complete 
8198342c3e05: Pull complete 
f56970a44fd4: Pull complete 
da6ac41ac9c8: Pull complete 
6f3a5e5efdea: Downloading [============>                                      ]  111.4MB/441.9MB
d9dd7dde4295: Download complete 
ab365adf65d2: Download complete 
06b2cd083c64: Download complete 
c524c4444fb2: Download complete 

kaixhin/vnc-ros

代码语言:javascript
复制
relaybot@relaybot-desktop:~$ docker search ros
NAME                                        DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
mono                                        Mono is an open source implementation of M...   233       [OK]       
ros                                         The Robot Operating System (ROS) is an ope...   111       [OK]       
aerospike                                   Aerospike – the reliable, high performance...   76        [OK]       
cirros                                      CirrOS is a Tiny OS that specializes in ru...   38        [OK]       
neurodebian                                 NeuroDebian provides neuroscience research...   36        [OK]       
osrf/ros                                    The Robot Operating System (ROS) is an ope...   28                   [OK]
quantumobject/docker-ros-base               ROS-Base container (Robot Operating System)     5                    [OK]
px4io/px4-dev-ros                           Container with PX4 tool chain and SITL sim...   3                    [OK]
px4io/px4-ros-full                                                                          2                    [OK]
virgiletn/docker-ros                        Set of usefull tools for running ros throu...   1                    [OK]
personalrobotics/ros-openrave               ROS Indigo Base + Personal Robotics OpenRAVE    1                    [OK]
kaixhin/vnc-ros                             Ubuntu Core 14.04 + LXDE desktop + Firefox...   1                    [OK]
shadowrobot/ubuntu-ros-indigo-build-tools   DEPRECATED!!! Ubuntu 14.04 ROS Indigo imag...   0                    [OK]
autharl/ros                                 ROS images                                      0                    [OK]
timn/fedora-ros                             Robot Operating System (ROS) on Fedora          0                    [OK]
harmish/ros                                 Images of ROS (Robot Operating System)          0                    [OK]
jacknlliu/tiago-ros                         A tiago robot ros development environment.      0                    [OK]
kaixhin/ros                                 Ubuntu Core 14.04 + ROS Jade Base.              0                    [OK]
pmallozzi/ros                               Ros                                             0                    [OK]
nhzio/ros-weave                             rancheros weave + iptables                      0                    [OK]
ivs0/b-ros                                  Jenkins builder for ROS                         0                    [OK]
mjenz/ros-datacollection                    A container based on mjenz/ros-indigo-perc...   0                    [OK]
jacknlliu/ros                               ROS desktop-full docker images with Qt C++...   0                    [OK]
sigproc/ros                                                                                 0                    [OK]
diegoferigo/ros                             Dockerfile for my ROS Kinetic desktop-full...   0                    [OK]
relaybot@relaybot-desktop:~$ docker pull ros
Using default tag: latest
latest: Pulling from library/ros
bd97b43c27e3: Waiting 
6960dc1aba18: Waiting 
2b61829b0db5: Waiting 
1f88dc826b14: Waiting 
73b3859b1e43: Waiting 
27d60414a57e: Waiting 
d93e52c3383b: Waiting 
357b9c9b1672: Waiting 
e7c791091ba5: Waiting 
a55e61abbe79: Waiting 
3bdd92756f16: Waiting 
a75e7cd84889: Waiting 
^C
relaybot@relaybot-desktop:~$ docker pull kaixhin/vnc-ros
Using default tag: latest
latest: Pulling from kaixhin/vnc-ros
16da43b30d89: Pull complete 
1840843dafed: Pull complete 
91246eb75b7d: Pull complete 
7faa681b41d7: Pull complete 
97b84c64d426: Pull complete 
f6f12794daea: Downloading [==========>                                        ]  44.32MB/204.3MB
e7841d035bd3: Download complete 
440e2abbd651: Download complete 
09e4cb06ebb5: Download complete 
067189fe4086: Download complete 
52c18283b71e: Download complete 
49495db30f44: Download complete 
32e45df178f9: Downloading [=>                                                 ]  20.52MB/629.6MB
a138ae9132ab: Waiting 
15247c05ac4a: Waiting 

----~~~~----

当镜像完全下载后可以进行查看,如下:

代码语言:javascript
复制
relaybot@relaybot-desktop:~$ docker images -a
REPOSITORY                       TAG                 IMAGE ID            CREATED             SIZE
dorowu/ubuntu-desktop-lxde-vnc   latest              ec8a8836ea5f        6 weeks ago         1.23GB
kaixhin/vnc-ros                  latest              0948d9f58857        5 months ago        2.71GB

----ubuntu-desktop-lxde-vnc使用说明----

代码语言:javascript
复制
relaybot@relaybot-desktop:~$ docker run -it --rm -p 6080:80 dorowu/ubuntu-desktop-lxde-vnc
/usr/lib/python2.7/dist-packages/supervisor/options.py:297: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
  'Supervisord is running as root and it is searching '
2017-06-20 23:01:40,847 CRIT Supervisor running as root (no user in config file)
2017-06-20 23:01:40,847 WARN Included extra file "/etc/supervisor/conf.d/supervisord.conf" during parsing
2017-06-20 23:01:40,869 INFO RPC interface 'supervisor' initialized
2017-06-20 23:01:40,870 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2017-06-20 23:01:40,870 INFO supervisord started with pid 19
2017-06-20 23:01:41,873 INFO spawned: 'xvfb' with pid 26
2017-06-20 23:01:41,876 INFO spawned: 'pcmanfm' with pid 27
2017-06-20 23:01:41,879 INFO spawned: 'lxpanel' with pid 28
2017-06-20 23:01:41,882 INFO spawned: 'lxsession' with pid 29
2017-06-20 23:01:41,884 INFO spawned: 'x11vnc' with pid 30
2017-06-20 23:01:41,887 INFO spawned: 'novnc' with pid 31
2017-06-20 23:01:41,971 INFO exited: lxsession (exit status 1; not expected)
2017-06-20 23:01:41,994 INFO exited: lxpanel (exit status 1; not expected)
2017-06-20 23:01:42,951 INFO success: xvfb entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-06-20 23:01:42,951 INFO success: pcmanfm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-06-20 23:01:42,951 INFO success: x11vnc entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-06-20 23:01:42,951 INFO success: novnc entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-06-20 23:01:42,973 INFO spawned: 'lxsession' with pid 52
2017-06-20 23:01:43,055 INFO spawned: 'lxpanel' with pid 54
2017-06-20 23:01:44,106 INFO success: lxpanel entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-06-20 23:01:44,106 INFO success: lxsession entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-06-20 23:01:58,177 INFO waiting for novnc, pcmanfm, lxpanel, xvfb, x11vnc, lxsession to die
2017-06-20 23:01:58,463 INFO stopped: novnc (terminated by SIGQUIT (core dumped))
2017-06-20 23:01:58,465 INFO stopped: x11vnc (exit status 2)
2017-06-20 23:01:58,669 INFO stopped: lxsession (terminated by SIGABRT (core dumped))
2017-06-20 23:01:59,871 INFO stopped: lxpanel (terminated by SIGQUIT (core dumped))
2017-06-20 23:02:00,056 INFO stopped: pcmanfm (terminated by SIGQUIT (core dumped))
2017-06-20 23:02:00,060 INFO stopped: xvfb (exit status 1)
2017-06-20 23:02:00,076 CRIT Supervisor running as root (no user in config file)
2017-06-20 23:02:00,076 WARN Included extra file "/etc/supervisor/conf.d/supervisord.conf" during parsing
2017-06-20 23:02:00,077 INFO RPC interface 'supervisor' initialized
2017-06-20 23:02:00,077 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2017-06-20 23:02:00,077 INFO supervisord started with pid 19
2017-06-20 23:02:00,867 INFO spawned: 'xvfb' with pid 75
2017-06-20 23:02:00,870 INFO spawned: 'pcmanfm' with pid 76
2017-06-20 23:02:00,873 INFO spawned: 'lxpanel' with pid 77
2017-06-20 23:02:00,878 INFO spawned: 'lxsession' with pid 78
2017-06-20 23:02:00,881 INFO spawned: 'x11vnc' with pid 79
2017-06-20 23:02:00,884 INFO spawned: 'novnc' with pid 80
2017-06-20 23:02:01,913 INFO success: xvfb entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-06-20 23:02:01,914 INFO success: pcmanfm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-06-20 23:02:01,914 INFO success: lxpanel entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-06-20 23:02:01,914 INFO success: lxsession entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-06-20 23:02:01,914 INFO success: x11vnc entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-06-20 23:02:01,914 INFO success: novnc entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

Ubuntu的VNC桌面

Docker图像提供HTML5 VNC界面访问Ubuntu 16.04 LXDE桌面环境。

快速开始

运行码头图像并打开端口 6080

代码语言:javascript
复制
docker run -it --rm -p 6080:80 dorowu/ubuntu-desktop-lxde-vnc

浏览http://127.0.0.1:6080/

<img src =“https://raw.github.com/fcwu/docker-ubuntu-vnc-desktop/master/screenshots/lxde.png?v1”width = 700 />

连接VNC Viewer并通过VNC密码进行保护

将VNC服务端口5900转发到主机

代码语言:javascript
复制
docker run -it --rm -p 6080:80 -p 5900:5900 dorowu/ubuntu-desktop-lxde-vnc

现在,打开vnc查看器并连接到端口5900.如果要通过密码保护vnc服务,请设置环境变量VNC_PASSWORD,例如

代码语言:javascript
复制
docker run -it --rm -p 6080:80 -p 5900:5900 -e VNC_PASSWORD=mypassword dorowu/ubuntu-desktop-lxde-vnc

提示将在浏览器或vnc查看器中询问密码。

故障排除

  1. boot2docker连接问题,https://github.com/fcwu/docker-ubuntu-vnc-desktop/issues/2

----补充局域网(外网访问)----

获取IP信息:

两种方法:

1 $ docker exec ec8a8836ea5f ifconfig eth0 | grep "inet addr:"

注意,ec8a8836ea5f为ID,依据实际情况进行调整。

代码语言:javascript
复制
relaybot@relaybot-desktop:~$ docker exec fdfc8eda1 ifconfig eth0 | grep "inet addr:"
          inet addr:172.17.0.2  Bcast:0.0.0.0  Mask:255.255.0.0
relaybot@relaybot-desktop:~$ ifconfig -a
docker0   Link encap:Ethernet  HWaddr 02:42:16:25:5a:77  
          inet addr:172.17.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::42:16ff:fe25:5a77/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:21801 errors:0 dropped:0 overruns:0 frame:0
          TX packets:31279 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:6093261 (6.0 MB)  TX bytes:30175014 (30.1 MB)

enp3s0    Link encap:Ethernet  HWaddr 20:6a:8a:03:40:6b  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:16 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:23603 errors:0 dropped:0 overruns:0 frame:0
          TX packets:23603 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:6543144 (6.5 MB)  TX bytes:6543144 (6.5 MB)

vethd735054 Link encap:Ethernet  HWaddr f6:0a:d2:7f:58:70  
          inet6 addr: fe80::f40a:d2ff:fe7f:5870/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:21801 errors:0 dropped:0 overruns:0 frame:0
          TX packets:31319 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:6398475 (6.3 MB)  TX bytes:30180429 (30.1 MB)

wlp5s0    Link encap:Ethernet  HWaddr 70:f1:a1:ca:75:52  
          inet addr:192.168.1.101  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::3c12:a5b2:8cf9:246/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1167103 errors:0 dropped:0 overruns:0 frame:0
          TX packets:965289 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1572330174 (1.5 GB)  TX bytes:97246007 (97.2 MB)

----

2 在novnc网页中启动命令行ifconfig -a

----vnc-ros----

参考资料:

----https://hub.docker.com/r/kaixhin/vnc-ros/----

简短的介绍

Ubuntu Core 14.04 + LXDE桌面+ Firefox浏览器+ TightVNC服务器+ ROS Jade Desktop Full。

完整描述

VNC-ROS

Ubuntu Core 14.04 + LXDE桌面+ Firefox浏览器+ TightVNC服务器+ ROSJade桌面版。默认使用尾部运行作为守护进程。

建立

包括密码txt与TightVNC的密码(默认情况下这是“密码”)。这个长度必须至少为8个字符,如果更长,则会被截断。

用法

应该更改默认密码。这样做启动一个容器然后运行docker exec <id> bash -c "echo -e '<password>\n<password>\nn' | vncpasswd"

用于自动映射VNC端口使用docker run -dP kaixhin/vnc-rosdocker port <id>检索端口。 用于指定端口手动使用docker run -d -p <port>:5901 kaixhin/vnc-ros。 外壳可以照常使用docker run -it kaixhin/vnc-ros bash

引文

如果您发现这在研究中有用,请考虑引用这项工作

----https://hub.docker.com/_/ros/----

简短的介绍

机器人操作系统(ROS)是构建机器人应用程序的开源项目。

完整描述

支持的标签和相应的Dockerfile链接

快速参考

什么是ROS

机器人操作系统(ROS)是一组可帮助您构建机器人应用程序的软件库和工具。从驱动程序到最先进的算法,以及强大的开发人员工具,ROS具有您下一个机器人项目所需的功能。这一切都是开源的。

wikipedia.org/wiki/Robot_Operating_System

如何使用此图像

Dockerfile在您的ROS应用程序项目中创建一个

代码语言:javascript
复制
FROM ros:indigo
# place here your application's setup specifics
CMD [ "roslaunch", "my-ros-app my-ros-app.launch" ]

然后,您可以构建并运行Docker映像:

代码语言:javascript
复制
$ docker build -t my-ros-app .
$ docker run -it --rm --name my-running-app my-ros-app

部署用例

ROS的这种停泊图像旨在提供一个简化和一致的平台来构建和部署分布式机器人应用程序。由官方Ubuntu镜像和ROS官方Debian软件包组成,它包括最近支持的快速访问和下载版本。这为机器人研究和工业界提供了一个简单的方法来开发,重用和运送软件,用于自主操作和任务规划,控制动态,本地化和映射,群体行为以及一般系统集成。

开发具有前所未有的算法的复杂系统仍然具有挑战性,因为机器人软件的重复性和可重复性可能会在创新竞争中脱颖而出。随着编码,调优和部署跨越许多工程学科的多个软件组件的难度增加,更加协作的方法变得具有吸引力。然而,在多个机器人和平台上共享和维护软件集合的技术难题比许多较小的实验室和企业承担的时间和精力要长一些。

随着软件容器的进步和标准化,机器人专家被准备获得大量改进的开发工具来构建和发布软件。为了减轻采用新实践的不断增长的痛苦和技术挑战,我们专注于为ROS提供这些新技术的官方资源。

部署建议

可用的标签包括支持的发行版,以及基于最常见的元包依赖关系的层次标签,旨在具有小的占位面积和简单的配置:

  • ros-core:barebone ROS安装
  • ros-base:基本工具和库(也标记为具有LTS版本的发行版名称latest
  • robot:机器人的基本安装
  • perception:感知任务的基本安装

共同元套餐,如休息desktop,并desktop-full使用自动生成的回购协议下OSRF的泊坞枢纽轮廓托管在这里。这些元数据包包括图形依赖关系,并挂接许多其他大型软件包,如X11,X服务器等。因此,为了保持官方映像的精简和安全性,桌面软件包仅由OSRF的配置文件托管。

ROS使用~/.ros/存储日志的目录和调试信息。如果希望将这些文件保留在生成它们的容器的生命周期之外,则该~/.ros/文件夹可以挂载到主机上的外部卷上,或者派生的映像可以指定由Docker引擎管理的卷。默认情况下,容器作为root用户运行,因此/root/.ros/将是这些文件的完整路径。

例如,如果希望使用.ros已经驻留在其本地主目录中的自己的文件夹,使用用户名ubuntu,则可以使用附加的卷参数简单地启动该容器:

代码语言:javascript
复制
$ docker run -v "/home/ubuntu/.ros/:/root/.ros/" ros

设备

某些应用程序可能需要设备访问以从连接的摄像机获取图像,控制人机接口设备的输入或用于硬件加速的GPUS。这可以使用--device运行参数来将设备安装在容器内,从而提供硬件访问中的进程。

网络

ROS运行时“图”是使用ROS通信基础设施松散耦合的进程对等网络(可能分布在机器之间)。ROS实现了多种不同的通信方式,包括通过服务进行的同步RPC式通信,主题数据的异步流传输以及参数服务器上数据的存储。为了遵守每个容器一个进程的最佳做法,Docker网络可以用于将几个正在运行的ROS进程串联在一起。有关ROS NetworkSetup wik文章的更多详细信息,或请参阅下面的部署示例。

部署示例

如果我们希望我们的所有ROS节点彼此轻松交谈,我们可以使用虚拟网络连接单独的容器。在这短短的例子中,我们将创建一个虚拟网络,旋转了一个新的容器中运行roscore标榜master的新网络服务,然后生成一个信息发布者和预订过程在同一网络上的服务。

构建图像

构建包含使用此ROS教程的ROS映像 Dockerfile:

代码语言:javascript
复制
FROM ros:indigo-ros-base
# install ros tutorials packages
RUN apt-get update && apt-get install -y
    ros-indigo-ros-tutorials \
    ros-indigo-common-tutorials \
    && rm -rf /var/lib/apt/lists/

然后从同一目录中构建图像:

代码语言:javascript
复制
$ docker build --tag ros:ros-tutorials .
创建网络

要创建一个新的网络foo,我们使用network命令:

代码语言:javascript
复制
docker network create foo

现在我们有一个网络,我们可以创建服务。服务在网络上广告位置,可以方便地解析服务特定容器的位置/地址。我们将使用这个确保我们的ROS节点可以找到并连接到我们的ROS master

运行服务

为ROS主机创建一个容器并通告它的服务:

代码语言:javascript
复制
$ docker run -it --rm \
    --net foo \
    --name master \
    ros:ros-tutorials \
    roscore

现在,您可以看到主机正在运行,并准备好管理我们的其他ROS节点。要添加我们的talker节点,我们需要将相关环境变量指向主服务:

代码语言:javascript
复制
$ docker run -it --rm \
    --net foo \
    --name talker \
    --env ROS_HOSTNAME=talker \
    --env ROS_MASTER_URI=http://master:11311 \
    ros:ros-tutorials \
    rosrun roscpp_tutorials talker

然后在另一个终端中,listener类似地运行节点:

代码语言:javascript
复制
$ docker run -it --rm \
    --net foo \
    --name listener \
    --env ROS_HOSTNAME=listener \
    --env ROS_MASTER_URI=http://master:11311 \
    ros:ros-tutorials \
    rosrun roscpp_tutorials listener

好的!你应该看到listener现在正在回应每个消息的talker广播。然后,您可以列出容器并查看如下内容:

代码语言:javascript
复制
$ docker service ls
SERVICE ID          NAME                NETWORK             CONTAINER
67ce73355e67        listener            foo                 a62019123321
917ee622d295        master              foo                 f6ab9155fdbe
7f5a4748fb8d        talker              foo                 e0da2ee7570a

并为服务:

代码语言:javascript
复制
$ docker ps
CONTAINER ID        IMAGE               COMMAND                CREATED              STATUS              PORTS               NAMES
a62019123321        ros:ros-tutorials   "/ros_entrypoint.sh    About a minute ago   Up About a minute   11311/tcp           listener
e0da2ee7570a        ros:ros-tutorials   "/ros_entrypoint.sh    About a minute ago   Up About a minute   11311/tcp           talker
f6ab9155fdbe        ros:ros-tutorials   "/ros_entrypoint.sh    About a minute ago   Up About a minute   11311/tcp           master
内省

好的,现在我们看到两个节点正在沟通,让我们进入一个容器,做一些内省,究竟是什么主题:

代码语言:javascript
复制
$ docker exec -it master bash
$ source /ros_entrypoint.sh

如果我们然后使用rostopic列出发布的消息主题,我们应该看到如下:

代码语言:javascript
复制
$ rostopic list
/chatter
/rosout
/rosout_agg
拆除

为了拆除我们所做的结构,我们只需要停止容器和服务。我们可以使用Ctrl^C我们启动容器的位置停止并移除容器,或者使用我们给它们的名称的stop命令:

代码语言:javascript
复制
$ docker stop master talker listener
$ docker rm master talker listener

撰写

现在,您已经对手动引导分布式ROS示例感到欣慰,我们可以尝试使用它自动化docker-compose

首先创建一个名为的文件夹rostutorials,并将我们之前使用的Dockerfile移动到此目录中。然后创建一个docker-compose.yml在同一目录中命名的yaml文件,然后粘贴以下内容:

代码语言:javascript
复制
version: '2'
services:
  master:
    build: .
    container_name: master
    command:
      - roscore

  talker:
    build: .
    container_name: talker
    environment:
      - "ROS_HOSTNAME=talker"
      - "ROS_MASTER_URI=http://master:11311"
    command: rosrun roscpp_tutorials talker

  listener:
    build: .
    container_name: listener
    environment:
      - "ROS_HOSTNAME=listener"
      - "ROS_MASTER_URI=http://master:11311"
    command: rosrun roscpp_tutorials listener

现在从同一个文件夹中,使用docker-copose启动我们的ROS节点,并指定它们在自己的网络上共存:

代码语言:javascript
复制
$ docker-compose up -d

请注意,rostutorials_default现在已经创建了一个名为的新网络,您可以进一步检查:

代码语言:javascript
复制
$ docker network inspect rostutorials_default

我们可以监视每个服务的记录输出,如监听器节点,如下所示:

代码语言:javascript
复制
$ docker-compose logs listener

最后,我们可以使用docker-copose从同一个目录中停止并删除所有相关的容器:

代码语言:javascript
复制
$ docker-compose stop
$ docker-compose rm

注意:自动生成的网络rostutorials_default将会停留在docker引擎的整个生命周期中,或者直到您使用它来显式删除它docker network rm

更多资源

ROS.org:主ROS网站 维基:查找教程并了解更多 ROS答案:提问。获取答案 博客:保持最新的 OSRF:开源机器人基金会

执照

ROS的核心是根据标准的三条BSD许可证进行许可。这是一个非常宽松的开放许可证,允许在商业和封闭源产品中重复使用。您可以从Opensource.org BSD 3-Clause页面和维基百科的BSD许可证条目中找到有关BSD许可证的更多信息。

虽然ROS的核心部分根据BSD许可证获得许可,但其他许可证通常用于社区软件包,例如Apache 2.0许可证,GPL许可证,MIT许可证,甚至专有许可证。ROS生态系统中的每个包都需要指定许可证,以便您能够快速识别包装是否符合您的许可需求。

----https://hub.docker.com/r/osrf/ros/----

简短的介绍

机器人操作系统(ROS)是构建机器人应用程序的开源项目。

完整描述

OSRF Docker图像

这个repo托管Dockerfiles用于生成OSRF项目的官方图像,包括Docker Hub上的onbuild存储库:

官方图书馆

ROS
Gazebo

OSRF资料

ROS
ROS2
Gazebo
SROS

这个repo还包括必要的脚本和配置文件来自动生成Dockerfiles。有关进一步的文档,请参阅doc目录。

----ROS在线学习---

The ROS Autonomous Vehicles 101 and ROS-Industrial 101 courses are now available. Ready to built the future today? Keep advancing your ROS!ROS Autonomous Vehicles 101Learn the essentials for doing autonomous cars control using ROS. You are going to learn:    ✓ what are the sensors required for an autonomous car and how to access them using ROS    ✓ how to do autonomous navigation using a GPS    ✓ how to create an obstacle avoider for an autonomous car    ✓ how to interface ROS with a car that follows the DBW interface*Watch the ROS Autonomous Vehicles 101  Video TutorialsStart Learning NowROS-Industrial 101Learn ROS-Industrial to extend the advanced capabilities of ROS software to manufacturing. After this course you will be able to:    ✓ know the basics of URDF for industrial robots    ✓ create a MoveIt package for your industrial robot.    ✓ perform motion planning using Python.*Watch the ROS-Industrial 101  Video Tutorials.Start Learning NowREFER & EARN free courseYou can earn 1 year course for free by inviting your teacher to use Robot Ignite Academy to teach ROS effectively.​​​​​​​Happy Learning!The Construct team

ROS Autonomous Vehicles 101Learn the essentials for doing autonomous cars control using ROS. You are going to learn:    ✓ what are the sensors required for an autonomous car and how to access them using ROS    ✓ how to do autonomous navigation using a GPS    ✓ how to create an obstacle avoider for an autonomous car    ✓ how to interface ROS with a car that follows the DBW interface*Watch the ROS Autonomous Vehicles 101  Video TutorialsStart Learning Now

ROS Autonomous Vehicles 101Learn the essentials for doing autonomous cars control using ROS. You are going to learn:    ✓ what are the sensors required for an autonomous car and how to access them using ROS    ✓ how to do autonomous navigation using a GPS    ✓ how to create an obstacle avoider for an autonomous car    ✓ how to interface ROS with a car that follows the DBW interface*Watch the ROS Autonomous Vehicles 101  Video TutorialsStart Learning Now

ROS Autonomous Vehicles 101Learn the essentials for doing autonomous cars control using ROS. You are going to learn:    ✓ what are the sensors required for an autonomous car and how to access them using ROS    ✓ how to do autonomous navigation using a GPS    ✓ how to create an obstacle avoider for an autonomous car    ✓ how to interface ROS with a car that follows the DBW interface*Watch the ROS Autonomous Vehicles 101  Video TutorialsStart Learning Now

ROS Autonomous Vehicles 101

Learn the essentials for doing autonomous cars control using ROS. You are going to learn:    ✓ what are the sensors required for an autonomous car and how to access them using ROS    ✓ how to do autonomous navigation using a GPS    ✓ how to create an obstacle avoider for an autonomous car    ✓ how to interface ROS with a car that follows the DBW interface*Watch the ROS Autonomous Vehicles 101  Video Tutorials

Start Learning Now

Start Learning Now

Start Learning Now

Start Learning Now

ROS-Industrial 101Learn ROS-Industrial to extend the advanced capabilities of ROS software to manufacturing. After this course you will be able to:    ✓ know the basics of URDF for industrial robots    ✓ create a MoveIt package for your industrial robot.    ✓ perform motion planning using Python.*Watch the ROS-Industrial 101  Video Tutorials.Start Learning Now

ROS-Industrial 101Learn ROS-Industrial to extend the advanced capabilities of ROS software to manufacturing. After this course you will be able to:    ✓ know the basics of URDF for industrial robots    ✓ create a MoveIt package for your industrial robot.    ✓ perform motion planning using Python.*Watch the ROS-Industrial 101  Video Tutorials.Start Learning Now

ROS-Industrial 101Learn ROS-Industrial to extend the advanced capabilities of ROS software to manufacturing. After this course you will be able to:    ✓ know the basics of URDF for industrial robots    ✓ create a MoveIt package for your industrial robot.    ✓ perform motion planning using Python.*Watch the ROS-Industrial 101  Video Tutorials.Start Learning Now

ROS-Industrial 101

Learn ROS-Industrial to extend the advanced capabilities of ROS software to manufacturing. After this course you will be able to:    ✓ know the basics of URDF for industrial robots    ✓ create a MoveIt package for your industrial robot.    ✓ perform motion planning using Python.*Watch the ROS-Industrial 101  Video Tutorials.

Start Learning Now

Start Learning Now

Start Learning Now

Start Learning Now

REFER & EARN free courseYou can earn 1 year course for free by inviting your teacher to use Robot Ignite Academy to teach ROS effectively.​​​​​​​

REFER & EARN free courseYou can earn 1 year course for free by inviting your teacher to use Robot Ignite Academy to teach ROS effectively.​​​​​​​

REFER & EARN free courseYou can earn 1 year course for free by inviting your teacher to use Robot Ignite Academy to teach ROS effectively.​​​​​​​

REFER & EARN free course

You can earn 1 year course for free by inviting your teacher to use Robot Ignite Academy to teach ROS effectively.​​​​​​​

ROS Autonomous Vehicles 101Learn the essentials for doing autonomous cars control using ROS. You are going to learn:    ✓ what are the sensors required for an autonomous car and how to access them using ROS    ✓ how to do autonomous navigation using a GPS    ✓ how to create an obstacle avoider for an autonomous car    ✓ how to interface ROS with a car that follows the DBW interface*Watch the ROS Autonomous Vehicles 101  Video TutorialsStart Learning Now

ROS Autonomous Vehicles 101Learn the essentials for doing autonomous cars control using ROS. You are going to learn:    ✓ what are the sensors required for an autonomous car and how to access them using ROS    ✓ how to do autonomous navigation using a GPS    ✓ how to create an obstacle avoider for an autonomous car    ✓ how to interface ROS with a car that follows the DBW interface*Watch the ROS Autonomous Vehicles 101  Video TutorialsStart Learning Now

ROS Autonomous Vehicles 101Learn the essentials for doing autonomous cars control using ROS. You are going to learn:    ✓ what are the sensors required for an autonomous car and how to access them using ROS    ✓ how to do autonomous navigation using a GPS    ✓ how to create an obstacle avoider for an autonomous car    ✓ how to interface ROS with a car that follows the DBW interface*Watch the ROS Autonomous Vehicles 101  Video TutorialsStart Learning Now

ROS Autonomous Vehicles 101

Learn the essentials for doing autonomous cars control using ROS. You are going to learn:    ✓ what are the sensors required for an autonomous car and how to access them using ROS    ✓ how to do autonomous navigation using a GPS    ✓ how to create an obstacle avoider for an autonomous car    ✓ how to interface ROS with a car that follows the DBW interface*Watch the ROS Autonomous Vehicles 101  Video Tutorials

Start Learning Now

Start Learning Now

Start Learning Now

Start Learning Now

ROS Autonomous Vehicles 101Learn the essentials for doing autonomous cars control using ROS. You are going to learn:    ✓ what are the sensors required for an autonomous car and how to access them using ROS    ✓ how to do autonomous navigation using a GPS    ✓ how to create an obstacle avoider for an autonomous car    ✓ how to interface ROS with a car that follows the DBW interface*Watch the ROS Autonomous Vehicles 101  Video TutorialsStart Learning Now

ROS Autonomous Vehicles 101Learn the essentials for doing autonomous cars control using ROS. You are going to learn:    ✓ what are the sensors required for an autonomous car and how to access them using ROS    ✓ how to do autonomous navigation using a GPS    ✓ how to create an obstacle avoider for an autonomous car    ✓ how to interface ROS with a car that follows the DBW interface*Watch the ROS Autonomous Vehicles 101  Video TutorialsStart Learning Now

ROS Autonomous Vehicles 101

Learn the essentials for doing autonomous cars control using ROS. You are going to learn:    ✓ what are the sensors required for an autonomous car and how to access them using ROS    ✓ how to do autonomous navigation using a GPS    ✓ how to create an obstacle avoider for an autonomous car    ✓ how to interface ROS with a car that follows the DBW interface*Watch the ROS Autonomous Vehicles 101  Video Tutorials

Start Learning Now

Start Learning Now

Start Learning Now

Start Learning Now

ROS Autonomous Vehicles 101Learn the essentials for doing autonomous cars control using ROS. You are going to learn:    ✓ what are the sensors required for an autonomous car and how to access them using ROS    ✓ how to do autonomous navigation using a GPS    ✓ how to create an obstacle avoider for an autonomous car    ✓ how to interface ROS with a car that follows the DBW interface*Watch the ROS Autonomous Vehicles 101  Video TutorialsStart Learning Now

ROS Autonomous Vehicles 101

Learn the essentials for doing autonomous cars control using ROS. You are going to learn:    ✓ what are the sensors required for an autonomous car and how to access them using ROS    ✓ how to do autonomous navigation using a GPS    ✓ how to create an obstacle avoider for an autonomous car    ✓ how to interface ROS with a car that follows the DBW interface*Watch the ROS Autonomous Vehicles 101  Video Tutorials

Start Learning Now

Start Learning Now

Start Learning Now

Start Learning Now

ROS Autonomous Vehicles 101

Learn the essentials for doing autonomous cars control using ROS. You are going to learn:    ✓ what are the sensors required for an autonomous car and how to access them using ROS    ✓ how to do autonomous navigation using a GPS    ✓ how to create an obstacle avoider for an autonomous car    ✓ how to interface ROS with a car that follows the DBW interface*Watch the ROS Autonomous Vehicles 101  Video Tutorials

Start Learning Now

Start Learning Now

Start Learning Now

Start Learning Now

Start Learning Now

Start Learning Now

Start Learning Now

Start Learning Now

Start Learning Now

Start Learning Now

ROS-Industrial 101Learn ROS-Industrial to extend the advanced capabilities of ROS software to manufacturing. After this course you will be able to:    ✓ know the basics of URDF for industrial robots    ✓ create a MoveIt package for your industrial robot.    ✓ perform motion planning using Python.*Watch the ROS-Industrial 101  Video Tutorials.Start Learning Now

ROS-Industrial 101Learn ROS-Industrial to extend the advanced capabilities of ROS software to manufacturing. After this course you will be able to:    ✓ know the basics of URDF for industrial robots    ✓ create a MoveIt package for your industrial robot.    ✓ perform motion planning using Python.*Watch the ROS-Industrial 101  Video Tutorials.Start Learning Now

ROS-Industrial 101Learn ROS-Industrial to extend the advanced capabilities of ROS software to manufacturing. After this course you will be able to:    ✓ know the basics of URDF for industrial robots    ✓ create a MoveIt package for your industrial robot.    ✓ perform motion planning using Python.*Watch the ROS-Industrial 101  Video Tutorials.Start Learning Now

ROS-Industrial 101

Learn ROS-Industrial to extend the advanced capabilities of ROS software to manufacturing. After this course you will be able to:    ✓ know the basics of URDF for industrial robots    ✓ create a MoveIt package for your industrial robot.    ✓ perform motion planning using Python.*Watch the ROS-Industrial 101  Video Tutorials.

Start Learning Now

Start Learning Now

Start Learning Now

Start Learning Now

ROS-Industrial 101Learn ROS-Industrial to extend the advanced capabilities of ROS software to manufacturing. After this course you will be able to:    ✓ know the basics of URDF for industrial robots    ✓ create a MoveIt package for your industrial robot.    ✓ perform motion planning using Python.*Watch the ROS-Industrial 101  Video Tutorials.Start Learning Now

ROS-Industrial 101Learn ROS-Industrial to extend the advanced capabilities of ROS software to manufacturing. After this course you will be able to:    ✓ know the basics of URDF for industrial robots    ✓ create a MoveIt package for your industrial robot.    ✓ perform motion planning using Python.*Watch the ROS-Industrial 101  Video Tutorials.Start Learning Now

ROS-Industrial 101

Learn ROS-Industrial to extend the advanced capabilities of ROS software to manufacturing. After this course you will be able to:    ✓ know the basics of URDF for industrial robots    ✓ create a MoveIt package for your industrial robot.    ✓ perform motion planning using Python.*Watch the ROS-Industrial 101  Video Tutorials.

Start Learning Now

Start Learning Now

Start Learning Now

Start Learning Now

ROS-Industrial 101Learn ROS-Industrial to extend the advanced capabilities of ROS software to manufacturing. After this course you will be able to:    ✓ know the basics of URDF for industrial robots    ✓ create a MoveIt package for your industrial robot.    ✓ perform motion planning using Python.*Watch the ROS-Industrial 101  Video Tutorials.Start Learning Now

ROS-Industrial 101

Learn ROS-Industrial to extend the advanced capabilities of ROS software to manufacturing. After this course you will be able to:    ✓ know the basics of URDF for industrial robots    ✓ create a MoveIt package for your industrial robot.    ✓ perform motion planning using Python.*Watch the ROS-Industrial 101  Video Tutorials.

Start Learning Now

Start Learning Now

Start Learning Now

Start Learning Now

ROS-Industrial 101

Learn ROS-Industrial to extend the advanced capabilities of ROS software to manufacturing. After this course you will be able to:    ✓ know the basics of URDF for industrial robots    ✓ create a MoveIt package for your industrial robot.    ✓ perform motion planning using Python.*Watch the ROS-Industrial 101  Video Tutorials.

Start Learning Now

Start Learning Now

Start Learning Now

Start Learning Now

Start Learning Now

Start Learning Now

Start Learning Now

Start Learning Now

Start Learning Now

Start Learning Now

REFER & EARN free courseYou can earn 1 year course for free by inviting your teacher to use Robot Ignite Academy to teach ROS effectively.​​​​​​​

REFER & EARN free courseYou can earn 1 year course for free by inviting your teacher to use Robot Ignite Academy to teach ROS effectively.​​​​​​​

REFER & EARN free courseYou can earn 1 year course for free by inviting your teacher to use Robot Ignite Academy to teach ROS effectively.​​​​​​​

REFER & EARN free course

You can earn 1 year course for free by inviting your teacher to use Robot Ignite Academy to teach ROS effectively.​​​​​​​

REFER & EARN free courseYou can earn 1 year course for free by inviting your teacher to use Robot Ignite Academy to teach ROS effectively.​​​​​​​

REFER & EARN free courseYou can earn 1 year course for free by inviting your teacher to use Robot Ignite Academy to teach ROS effectively.​​​​​​​

REFER & EARN free course

You can earn 1 year course for free by inviting your teacher to use Robot Ignite Academy to teach ROS effectively.​​​​​​​

REFER & EARN free courseYou can earn 1 year course for free by inviting your teacher to use Robot Ignite Academy to teach ROS effectively.​​​​​​​

REFER & EARN free course

You can earn 1 year course for free by inviting your teacher to use Robot Ignite Academy to teach ROS effectively.​​​​​​​

REFER & EARN free course

You can earn 1 year course for free by inviting your teacher to use Robot Ignite Academy to teach ROS effectively.​​​​​​​

----End----

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2017年06月20日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Ubuntu的VNC桌面
    • 快速开始
      • 连接VNC Viewer并通过VNC密码进行保护
      • 故障排除
      • VNC-ROS
        • 建立
          • 用法
            • 引文
            • 支持的标签和相应的Dockerfile链接
            • 快速参考
            • 什么是ROS?
            • 如何使用此图像
              • Dockerfile在您的ROS应用程序项目中创建一个
                • 部署用例
                  • 部署建议
                    • 设备
                    • 网络
                  • 部署示例
                    • 构建图像
                    • 撰写
                    • 官方图书馆
                    • OSRF资料
                • 更多资源
                • 执照
                • OSRF Docker图像
                相关产品与服务
                容器镜像服务
                容器镜像服务(Tencent Container Registry,TCR)为您提供安全独享、高性能的容器镜像托管分发服务。您可同时在全球多个地域创建独享实例,以实现容器镜像的就近拉取,降低拉取时间,节约带宽成本。TCR 提供细颗粒度的权限管理及访问控制,保障您的数据安全。
                领券
                问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档