当前位置:   article > 正文

使用ROS2机器人操作系统进行多机器人编程技术实践(Multi-Robot Programming Via ROS2 )_ros2机器人编程实战 pdf

ros2机器人编程实战 pdf

简介

ROS2机器人操作系统简介2021英文字幕版本

使用机器人操作系统ROS2和机器人中间件框架系统RMF进行多机器人系统集成,高层规划及其应用等。

上图所示机器人按规划路径进行物流运输或场地巡逻任务

引用:rmf_demo

专用名词:

  • 机器人操作系统 Robot Operating System (ROS) 
  • 机器人中间件框架 Robotics Middleware Framework (RMF)

ROS 2

机器人操作系统(ROS)是用于构建机器人应用程序的一组软件库和工具。从驱动程序到最新算法,再到强大的开发人员工具,ROS可以满足下一代机器人项目的需求,而且都是开源的。

自从ROS于2007年启动以来,机器人技术和ROS社区已发生了许多变化。 ROS 1,最初只是“ ROS”,开始是Willow Garage PR2机器人的开发环境。主要目标是为用户提供PR2进行新颖的研发项目所需的软件工具。同时,ROS 1开发团队知道PR2既不是世界上唯一的机器人,也不是最重要的机器人,因此开发团队也希望ROS 1对其他机器人也有用途。最初的重点是定义抽象级别(通常通过消息接口),该级别将允许许多软件在其他地方重用。

ROS 1满足了PR2案例的需求,并且在各种机器人上也得到广泛应用。其中包括类似于PR2的机器人,还包括各种尺寸的轮式机器人,腿足式的人形机器人,工业机械手臂,户外地面车辆(包括自动驾驶汽车),空中车辆,地面车辆等。 ROS 1的采用也发生了令人惊叹的转变,主要是最初关注者由学术研究界转向其以外的领域。基于ROS 1的产品已进入市场,包括制造生产机器人,农业机器人,商业清洁机器人等。政府机构也正在密切关注ROS在其现场系统中的使用;例如,美国国家航空航天局(NASA)有望在部署到国际空间站的Robonaut 2上运行ROS。

所有这些应用程序无疑以出乎意料的方式发展了ROS平台。尽管使用情况良好,但ROS 1团队相信开发人员可以通过直接应对新用例来更好地满足更广泛的ROS社区的需求。因此,ROS 2诞生了。

ROS 2项目的最初目标是适应不断变化的形势,利用ROS 1的优点并改善有问题的部件。但是,机器人开发者也希望保留ROS 1的存在,以继续工作并不受ROS 2的开发的影响。因此,ROS 2被构建为一组并行的软件包,可以与ROS 1并排安装并与它们互操作(例如,通过消息桥)。

在撰写本博文时,已经达到了第13个也是最后一个正式的ROS 1版本Noetic Ninjemys,并且是ROS 2的第一个LTS版本Foxy Fitzroy。

简要了解ROS 1 Noetic Ninjemys和ROS 2 Foxy Fitzroy,请参考如下博文:

在网络上可以找到大量且不断增长的ROS 2资源。一个很好的入门方式是浏览学习ROS 2的网页索引页面,以及后续博文中的ROS 2详解。祝学习ROS2之旅轻松愉快!

RMF

RMF的起源

想象一下,在这个我们生活的世界中,来自不同公司和制造商的机器人可以在同一设施中共存;优雅地共享重要资源,例如走廊,电梯(电梯),门和其他基础设施,以实现更高效的整体系统。想象一下,通过一种允许任何机器人可靠受控和安全的方式使用共享资源的方式集成到一起。想象一下,在共享走廊中没有机器人困境的世界。今天,使用称为RMF的惊艳系统可以实现这些想法。

如今,生产环境中的当前一代机器人能够提供服务,包括批量和单件流量交付,清洁,消毒,安全性,监控等等。这些多样化的用例很可能意味着针对每个任务的最佳机器人将来自不同的机器人提供商或系统集成商。这种现代的现实状况对于使用适当的通用软件框架来管理这些异构资源并确保有效地利用不同平台上的信息以提高整体系统效率至关重要。

如果没有针对整体高效的机器人系统的计划,那么最终用户在向单个系统或平台提供商承诺时可能会面临重大但隐藏的风险。隐藏的风险可能会迫使最终用户限制用户从该特定提供商那里选择将来的解决方案,以最大程度地降低运营风险并避免多余的集成成本。随着机器人部署范围的扩大和规模的扩大,这个问题更加严重,使客户感到除了留在当前供应商之外,没有其他好的选择。

除了与不同提供商进行扩展部署而增加的成本风险之外,共享资源(例如电梯,门口,走廊,网络带宽,充电器,运营中心屏幕“不动产”)和人力资源(例如IT人员)也存在内在冲突和维护技术人员。随着机器人规模的扩大,运营团队考虑管理大型的,异构的,多供应商的机器人环境变得更加麻烦。

这些问题陈述是RMF开发的基本动力。从历史上看,ROS的开发主要集中在单个机器人上或附近运行的软件。 RMF旨在在更高的抽象层上运行,以创建与建筑基础设施系统,企业服务,物联网设备和人机界面互操作的网络化机器人团队。

使用RMF使开发者的选择、设备和未来不再受限。

感谢新加坡政府为启动这个雄心勃勃的研发项目“开发标准化机器人中间件框架-RMF详细设计和通用服务,大规模虚拟测试场基础设施以及仿真建模”的愿景和支持。该项目得到卫生部和国家资源计划的支持

博文表达的任何观点,发现和结论或建议均为RMF作者的观点,并不反映NR2PO和MOH的观点。

那什么是RMF?

RMF是在ROS 2之上构建的可重用,可伸缩的库和工具的集合,这些库和工具可实现任何类型的机器人系统的异构团队的互操作性。 RMF利用与基础设施,环境和自动化的标准化通信协议,在这些基础设施,环境和自动化中部署机器人来优化关键资源(即机器人,电梯,门,通道等)的使用。它通过资源分配和通过RMF核心防止共享资源之间的冲突为系统增加了智能,这将博文的后续内容中进行详细介绍。

RMF具有足够的灵活性和鲁棒性,几乎可以在任何通信层上运行,并且可以与任何数量的IOT设备集成。 RMF的体系结构设计为允许随着环境中自动化水平的提高而具有可伸缩性。系统和用户可以通过API和可自定义的用户界面通过多种方式与RMF进行交互。一旦部署到环境中,RMF将通过允许共享资源和最小化集成来节省成本。这就是机器人开发人员和机器人客户一直在寻找的东西。简而言之,RMF架构如下:

RMF之神奇魔法?

RMF设计的原则之一是尽可能简化和标准化消息传递。 在下图的RMF Core中,可以看到当前所有复杂的交互和协调,归纳为14条标准消息:

在博文的后续章节中,将更详细地探讨每个功能领域,但是此时还需要介绍一些对RMF开发和集成有用的实用程序。

机器人中间件框架RMF示例演示

此案例演示了RMF在各种环境中的功能。该库是与RMF进行工作和集成的最佳入门指南。

交通编辑器Traffic Editor

Traffic Editor是用于创建和注释在RMF中使用的平面图的GUI。通过流量编辑器,可以创建用于RMF的流量模式,并引入仿真模型来增强虚拟仿真环境。 .yaml文件可以轻松导出并在Gazebo中使用。

自由队列Free Fleet

Free Fleet是一个开放源代码的机器人队列管理系统,适用于没有自己的队列管理器或者更愿意使用并为开源队列管理实用程序做出贡献的机器人开发人员。

系统合成器系统(Systems of Systems Synthesizer,SOSS)

机器人开发人员梦寐以求的SOSS! SOSS可以轻松地在各种消息格式和类型之间传递消息,包括ROS 1,ROS 2,WebSocket,REST,FiWare,DDS,OPC-UA等。

RMF进程可视化Schedule Visualizer

该可视化工具是基于rviz的rmf_core可视化工具和控制面板。它旨在成为RMF或RoMi-H开发人员的功能工具。

RoMi仪表板

医疗保健机器人中间件(RoMi-H)是RMF的医疗保健特定实现。该仪表板是一个Web应用程序,可提供对RoMi-H系统的整体可视化和控制。与前面提到的时间表可视化程序相比,仪表板在设计上更加“友好操作员”。

模拟仿真设施

创建并共享开放源代码和可自由分发的仿真设施,加速仿真工作。

安装RMF必备条件

RMF的当前版本为1.0.2。 针对ROS Eloquent,并且针对Ubuntu Bionic 18.04 LTS发行了Debian二进制软件包。

RMF利用ROS和Gazebo-Ignition生态系统。 作为RMF安装过程的第一步,将必须设置它们的库。 由于当前的二进制发行版是针对Ubuntu Bionic的,因此在继续安装之前,请确保匹配系统和版本。 如果安装了ROS 2和Gazebo,则可以直接跳至“设置源和RMF的安装”部分。

设定地区

确保语言环境支持UTF-8。 如果处于最小环境中(例如docker容器),则语言环境可能像POSIX一样最小。 可以通过直接在终端中运行区域设置来检查区域设置。

使用以下设置进行测试。 如果使用的是其他受UTF-8支持的语言环境,那应该没问题。 如下是关于如何切换到美国英语UTF-8语言环境的示例:

sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8

设置和安装ROS 2

需要在系统中添加ROS 2 apt库。 为此,请首先使用如下所示的apt授权GPG密钥:

sudo apt update && sudo apt install curl gnupg2 lsb-release
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -

然后将库添加到源列表中:

sudo sh -c 'echo "deb [arch=$(dpkg --print-architecture)] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list'

如果未使用ros-eloquent-ros-base安装ROS 2,则需要以下软件包来运行RMF演示:

sudo apt-get install ros-eloquent-ros2cli ros-eloquent-ros2run ros-eloquent-ros2launch

为了运行ROS 2命令,导入setup.bash文件:

source /opt/ros/eloquent/setup.bash

设置Ignition-Gazebo

还需要添加类似于ROS 2设置的Ignition-Gazebo apt库。 授权密钥:

curl -s http://packages.osrfoundation.org/gazebo.key | sudo apt-key add -

还需要将库添加到源列表中:

sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'

设置源和安装RMF

接下来,需要设置RMF软件包的源,类似于前两个步骤。 首先授权密钥:

curl -s http://rmf.servehttp.com/repos.key | sudo apt-key add -

其次,将库添加到apt源:

sudo sh -c 'echo "deb http://rmf.servehttp.com/ubuntu/main/ bionic main" > /etc/apt/sources.list.d/rmf.list'

更新:

sudo apt-get update

安装:

sudo apt-get install ros-eloquent-ament-cmake-catch2 ros-eloquent-building-gazebo-plugins ros-eloquent-building-map-msgs ros-eloquent-building-map-tools ros-eloquent-rmf-cmake-uncrustify ros-eloquent-rmf-dispenser-msgs ros-eloquent-rmf-door-msgs ros-eloquent-rmf-fleet-adapter ros-eloquent-rmf-fleet-msgs ros-eloquent-rmf-lift-msgs ros-eloquent-rmf-task-msgs ros-eloquent-rmf-traffic-msgs ros-eloquent-rmf-traffic-ros2 ros-eloquent-rmf-traffic ros-eloquent-rmf-utils ros-eloquent-traffic-editor

安装并运行RMF演示

从Debian软件包中安装提供的RMF演示:

sudo apt-get install ros-eloquent-demos

安装完所有内容后,可以选择下载3D模型,从而完成模拟效果。 可以针对任何可用的演示执行此操作。 这是关于如何为机场航站楼模型执行此操作的示例:

ros2 run building_map_tools model_downloader rmf_demo_maps -s airport_terminal

  1. :~/RobTool/rmf_demos$ ros2 run building_map_tools model_downloader rmf_demo_maps -s airport_terminal
  2. == STARTING: Downloading models for airport_terminal ==
  3. building name: airport_terminal
  4. parsing level L1
  5. calculating levels relative to L1
  6. level L1 scale: 0.0821218733149518
  7. Load success!
  8. Cache found! Model count: 875
  9. Updating cache...
  10. Topping up Fuel (updating cache) from: https://fuel.ignitionrobotics.org/1.0/models
  11. Fetching page: 1
  12. Cached model found! Halting Fuel traversal...
  13. Writing to cache: /home/relaybot/.pit_crew/model_cache.json
  14. New models cached: 0
  15. ERROR::pit_crew.get_model_name_tuple():328: Could not parse model.config file! 'NoneType' object has no attribute 'find'
  16. WARNING::pit_crew.get_missing_models():186: Model playground in local model directory is not by the requested author openrobotics!
  17. WARNING::pit_crew.get_missing_models():186: Model kitchensink in local model directory is not by the requested author openrobotics!
  18. WARNING::pit_crew.get_missing_models():186: Model lampandstand in local model directory is not by the requested author openrobotics!
  19. WARNING::pit_crew.get_missing_models():186: Model gazebo in local model directory is not by the requested author openrobotics!
  20. WARNING::pit_crew.get_missing_models():186: Model chair in local model directory is not by the requested author openrobotics!
  21. WARNING::pit_crew.get_missing_models():186: Model standing person in local model directory is not by the requested author openrobotics!
  22. WARNING::pit_crew.get_missing_models():186: Model lamp post in local model directory is not by the requested author openrobotics!
  23. WARNING::pit_crew.get_missing_models():186: Model fridge in local model directory is not by the requested author openrobotics!
  24. WARNING::pit_crew.get_missing_models():186: Model electronicsrecycling in local model directory is not by the requested author openrobotics!
  25. WARNING::pit_crew.get_missing_models():186: Model visitorkidsit in local model directory is not by the requested author openrobotics!
  26. WARNING::pit_crew.get_missing_models():186: Model maintable in local model directory is not by the requested author openrobotics!
  27. WARNING::pit_crew.get_missing_models():186: Model table in local model directory is not by the requested author openrobotics!
  28. WARNING::pit_crew.get_missing_models():186: Model malevisitorsit in local model directory is not by the requested author openrobotics!
  29. WARNING::pit_crew.get_missing_models():186: Model suv in local model directory is not by the requested author openrobotics!
  30. WARNING::pit_crew.get_missing_models():186: Model fountain in local model directory is not by the requested author openrobotics!
  31. WARNING::pit_crew.get_missing_models():186: Model femalevisitor in local model directory is not by the requested author openrobotics!
  32. WARNING::pit_crew.get_missing_models():186: Model mopcart3 in local model directory is not by the requested author openrobotics!
  33. WARNING::pit_crew.get_missing_models():186: Model construction cone in local model directory is not by the requested author openrobotics!
  34. WARNING::pit_crew.get_missing_models():186: Model kitchencountertop in local model directory is not by the requested author openrobotics!
  35. WARNING::pit_crew.get_missing_models():186: Model minisofa in local model directory is not by the requested author openrobotics!
  36. WARNING::pit_crew.get_missing_models():186: Model femalevisitorsit in local model directory is not by the requested author openrobotics!
  37. WARNING::pit_crew.get_missing_models():186: Model pine tree in local model directory is not by the requested author openrobotics!
  38. WARNING::pit_crew.get_missing_models():186: Model oak tree in local model directory is not by the requested author openrobotics!
  39. WARNING::pit_crew.get_missing_models():186: Model cafe table in local model directory is not by the requested author openrobotics!
  40. WARNING::pit_crew.get_missing_models():186: Model cafe in local model directory is not by the requested author openrobotics!
  41. WARNING::pit_crew.get_missing_models():186: Model bookshelf in local model directory is not by the requested author openrobotics!
  42. == REQUESTED MODEL REPORT ==
  43. {'available': ['playground',
  44. 'kitchensink',
  45. 'lampandstand',
  46. 'gazebo',
  47. 'chair',
  48. 'standing person',
  49. 'lamp post',
  50. 'fridge',
  51. 'electronicsrecycling',
  52. 'visitorkidsit',
  53. 'maintable',
  54. 'table',
  55. 'malevisitorsit',
  56. 'suv',
  57. 'fountain',
  58. 'femalevisitor',
  59. 'mopcart3',
  60. 'construction cone',
  61. 'kitchencountertop',
  62. 'minisofa',
  63. 'femalevisitorsit',
  64. 'pine tree',
  65. 'oak tree',
  66. 'cafe table',
  67. 'cafe',
  68. 'bookshelf'],
  69. 'downloadable': [('whitechipchair', ['openrobotics']),
  70. ('parkingtrolleymax', ['openrobotics']),
  71. ('storagerack', ['openrobotics']),
  72. ('potatochipchair', ['openrobotics'])],
  73. 'missing': ['teleportingestor', 'teleportdispenser']}
  74. == THE FOLLOWING MODELS HAVE SPECIFIED AUTHORS ==
  75. {'bookshelf': 'openrobotics',
  76. 'cafe': 'openrobotics',
  77. 'cafe table': 'openrobotics',
  78. 'chair': 'openrobotics',
  79. 'construction cone': 'openrobotics',
  80. 'electronicsrecycling': 'openrobotics',
  81. 'femalevisitor': 'openrobotics',
  82. 'femalevisitorsit': 'openrobotics',
  83. 'fountain': 'openrobotics',
  84. 'fridge': 'openrobotics',
  85. 'gazebo': 'openrobotics',
  86. 'kitchencountertop': 'openrobotics',
  87. 'kitchensink': 'openrobotics',
  88. 'lamp post': 'openrobotics',
  89. 'lampandstand': 'openrobotics',
  90. 'maintable': 'openrobotics',
  91. 'malevisitorsit': 'openrobotics',
  92. 'minisofa': 'openrobotics',
  93. 'mopcart3': 'openrobotics',
  94. 'oak tree': 'openrobotics',
  95. 'parkingtrolleymax': 'openrobotics',
  96. 'pine tree': 'openrobotics',
  97. 'playground': 'openrobotics',
  98. 'potatochipchair': 'openrobotics',
  99. 'standing person': 'openrobotics',
  100. 'storagerack': 'openrobotics',
  101. 'suv': 'openrobotics',
  102. 'table': 'openrobotics',
  103. 'teleportdispenser': 'openrobotics',
  104. 'teleportingestor': 'openrobotics',
  105. 'visitorkidsit': 'openrobotics',
  106. 'whitechipchair': 'openrobotics'}
  107. Downloading whitechipchair by openrobotics from Fuel
  108. WhiteChipChair downloaded to: /home/relaybot/.gazebo/models/WhiteChipChair
  109. Downloading parkingtrolleymax by openrobotics from Fuel
  110. ParkingTrolleyMax downloaded to: /home/relaybot/.gazebo/models/ParkingTrolleyMax
  111. WARNING::pit_crew.download_model():578: Synced SDF names for ParkingTrolleyMax! Changed from ParkingTrolleyMin to ParkingTrolleyMax
  112. WARNING::pit_crew.download_model():621: Synced SDF names for ParkingTrolleyMax! Changed from ParkingTrolleyMin to ParkingTrolleyMax
  113. Downloading storagerack by openrobotics from Fuel
  114. StorageRack downloaded to: /home/relaybot/.gazebo/models/StorageRack
  115. Downloading potatochipchair by openrobotics from Fuel
  116. PotatoChipChair downloaded to: /home/relaybot/.gazebo/models/PotatoChipChair
  117. WARNING::building_map_model_downloader.download_models():94:
  118. Missing models (not in local or Fuel):
  119. ['teleportingestor', 'teleportdispenser']
  120. == COMPLETE: Downloaded models for airport_terminal ==

了解有关正在运行的模型下载器工具的更多信息:

ros2 run building_map_tools model_downloader -h

最后运行这个的演示。 在这种情况下,启动机场航站楼仿真:

ros2 launch demos airport_terminal.launch.xml

全景

ros2启动airport_terminal.launch.xml演示创建机场世界时不会添加机器人。

生成机器人,请运行以下命令:

ros2 run demos airport_terminal_spawn_robots.sh

现在应该可以在Gazebo看到带有机器人的机场航站楼了:

局部

其他功能截图,如rviz2:

使用如下命令,启动机器人巡逻:

ros2 run rmf_demo_tasks request_loop -s magni_n09 -f magni_s07 -r magni -n 1

过程截图如下:

总结

恭喜多机器人编程已经完全入门啦!
至此已经了解RMF的全部含义。后续将进行更加丰富细致的内容学习,一起加油吧。

参考文献:


声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号