A-A+

ROS 1.0 和 ROS 2.0 的前世、今生、安装使用说明与资料汇总

2017年11月11日 ROS 暂无评论 阅读 174 次

本文是易科机器人实验室张瑞雷老师整理的ROS机器人操作系统的相关书籍、资料和学习路径,想学习这方面技术的同学一定要收藏了。

 

现在,最常用的ROS indigo或ROS Kinetic等都是1.0时代的ROS,这个时代的ROS有一个master(roscore)。

历经10年发展,不断壮大。那么问题来了为什么会有ROS 2.0?

要想搞清楚这个问题,需要参考ROS 2.0设计网址:http://design.ros2.org/

这里摘录一段话,选自Why ROS 2.0:

Why not just enhance ROS 1

In principle, the changes described above could be integrated into the existing core ROS code. E.g., new transport technologies could be added to roscpp and rospy. We considered this option and concluded that, given the intrusive nature of the changes that would be required to achieve the benefits that we are seeking, there is too much risk associated with changing the current ROS system that is relied upon by so many people. We want ROS 1 as it exists today to keep working and be unaffected by the development of ROS 2. So ROS 2 will be built as a parallel set of packages that can be installed alongside and interoperate with ROS 1 (e.g., through message bridges).

----

为什么不改进完善ROS 1.0?

从本质上来说,上面描述的更改都可以集成到现有的ROS核心代码中。如,新的传输机制可以添加到roscpp和rospy中。但是当我们考虑到下面问题时,就能理解这个结论,即这些改进和优化对原有系统会造成入侵式的变化,改变当前ROS系统有非常大的风险,当前有很多功能是开发人员依赖原ROS系统开发的。于是,我们既继续维护ROS 1.0,不受ROS 2.0的影响,同时进行ROS 2.0的设计。ROS 2.0与ROS 1.0并行不悖,同时通过消息桥接进行通信。

----

下面放几张图,大家感受一下两者的差别:

图1,架构图

Master没了,节点平等了,无主节点了。DDS是什么?数据分发服务。我想到了微软的DSS(分布式软件服务)。

图2,数据发布与订阅

    

需要了解更多内容,推荐古月居ROS 2.0探索总结+ROS 1.0和ROS 2.0到底用哪个呢?

~~~~

小乌龟动起来

  1. relaybot@relaybot-desktop:~$ rosnode list
  2. /ros_bridge
  3. /rosout
  4. /turtlesim
  5. relaybot@relaybot-desktop:~$ ros2 node list
  6. teleop_turtle
  7. ros_bridge
  8. ros_bridge
  9. teleop_turtle
  10. relaybot@relaybot-desktop:~$ ros2 topic list
  11. /color_sensor
  12. /parameter_events
  13. /pose
  14. /turtle1/cmd_vel
  15. relaybot@relaybot-desktop:~$ rostopic list
  16. /rosout
  17. /rosout_agg
  18. /turtle1/cmd_vel
  19. /turtle1/color_sensor
  20. /turtle1/pose

 

  1. $ ros2 run ros1_bridge dynamic_bridge
  2. Created 2 to 1 bridge for service /clear
  3. Created 2 to 1 bridge for service /reset
  4. created 2to1 bridge for topic '/turtle1/cmd_vel' with ROS 2 type 'geometry_msgs/Twist' and ROS 1 type ''
  5. [INFO] [ros1_bridge]: Passing message from ROS 2 ROS2_T to ROS 1 ROS1_T (showing msg only once per type) (ros2_callback() at /tmp/binarydeb/ros-r2b3-ros1-bridge-0.0.3/include/ros1_bridge/factory.hpp:144)

 

下面介绍一下ROS 2.0的安装和使用

官方wiki: https://github.com/ros2/ros2/wiki

这里有一点需要特别说明,ROS 2.0是支持Linux,Mac OS X和Windows,但仍然是使用Ubuntu最方便。

安装过程比较简单,直接使用Debian包即可,简单说一下,参考链接:https://github.com/ros2/ros2/wiki/Installation

设置安装源:

sudo apt update && sudo apt install curl
curl http://repo.ros2.org/repos.key | sudo apt-key add -
sudo sh -c 'echo "deb http://repo.ros2.org/ubuntu/main xenial main" > /etc/apt/sources.list.d/ros2-latest.list'

 

安装ROS 2.0软件包:

sudo apt update
sudo apt install `apt list ros-r2b3-* 2> /dev/null | grep "/" | awk -F/ '{print $1}' | grep -v -e ros-r2b3-ros1-bridge -e ros-r2b3-turtlebot2- | tr "\n" " "`

 

环境配置:

source /opt/ros/r2b3/setup.bash

 

如果需要与ROS 1.0通信

sudo apt update
sudo apt install ros-r2b3-ros1-bridge ros-r2b3-turtlebot2-*

 

具体安装请参考英文原版网址。

----

下面我们来测试一下ROS 2.0。

老方法在一个终端发送消息,另一个终端接受消息:

ros2 run demo_nodes_cpp talker

 

ros2 run demo_nodes_py listener

 

发布TF数据:

ros2 run tf2_ros static_transform_publisher -- 1 2 3 0.5 0.1 -1.0 foo bar

 

ros2 run tf2_ros tf2_echo -- foo bar

 

测试USB摄像头:

ros2 run image_tools cam2image

ros2 run image_tools showimage

----

ROS 1.0和ROS 2.0的示例:

1. 简单的发布和订阅

需要四个终端,需要注意环境配置:

2.  图像传输

3. 服务

ros2.0的命令与ros1.0保持了比较好的兼容性。示例如下:

  1. relaybot@relaybot-desktop:~$ ros2 pkg executables
  2. amcl amcl
  3. astra_camera astra_camera_node
  4. astra_camera create_udev_rules
  5. cartographer_ros cartographer_node
  6. composition api_composition
  7. composition api_composition_cli
  8. composition dlopen_composition
  9. composition linktime_composition
  10. composition manual_composition
  11. demo_nodes_cpp add_two_ints_client
  12. demo_nodes_cpp add_two_ints_client_async
  13. demo_nodes_cpp add_two_ints_server
  14. demo_nodes_cpp allocator_tutorial
  15. demo_nodes_cpp imu_listener
  16. demo_nodes_cpp list_parameters
  17. demo_nodes_cpp list_parameters_async
  18. demo_nodes_cpp listener
  19. demo_nodes_cpp listener_best_effort
  20. demo_nodes_cpp one_off_timer
  21. demo_nodes_cpp parameter_events
  22. demo_nodes_cpp parameter_events_async
  23. demo_nodes_cpp parameter_node
  24. demo_nodes_cpp reuse_timer
  25. demo_nodes_cpp ros2param
  26. demo_nodes_cpp set_and_get_parameters
  27. demo_nodes_cpp set_and_get_parameters_async
  28. demo_nodes_cpp talker
  29. demo_nodes_cpp_native talker
  30. demo_nodes_py add_two_ints_client
  31. demo_nodes_py add_two_ints_client_async
  32. demo_nodes_py add_two_ints_server
  33. demo_nodes_py listener
  34. demo_nodes_py listener_qos
  35. demo_nodes_py talker
  36. demo_nodes_py talker_qos
  37. depthimage_to_laserscan depthimage_to_laserscan_node
  38. depthimage_to_pointcloud2 depthimage_to_pointcloud2_node
  39. dummy_map_server dummy_map_server
  40. dummy_sensors dummy_joint_states
  41. dummy_sensors dummy_laser
  42. examples_rclcpp_minimal_client client_main
  43. examples_rclcpp_minimal_composition composition_composed
  44. examples_rclcpp_minimal_composition composition_publisher
  45. examples_rclcpp_minimal_composition composition_subscriber
  46. examples_rclcpp_minimal_publisher publisher_lambda
  47. examples_rclcpp_minimal_publisher publisher_member_function
  48. examples_rclcpp_minimal_publisher publisher_not_composable
  49. examples_rclcpp_minimal_service service_main
  50. examples_rclcpp_minimal_subscriber subscriber_lambda
  51. examples_rclcpp_minimal_subscriber subscriber_member_function
  52. examples_rclcpp_minimal_subscriber subscriber_not_composable
  53. examples_rclcpp_minimal_timer timer_lambda
  54. examples_rclcpp_minimal_timer timer_member_function
  55. examples_rclpy_executors callback_group
  56. examples_rclpy_executors composed
  57. examples_rclpy_executors custom_callback_group
  58. examples_rclpy_executors custom_executor
  59. examples_rclpy_executors listener
  60. examples_rclpy_executors talker
  61. examples_rclpy_minimal_client client
  62. examples_rclpy_minimal_client client_async
  63. examples_rclpy_minimal_client client_async_member_function
  64. examples_rclpy_minimal_publisher publisher_local_function
  65. examples_rclpy_minimal_publisher publisher_member_function
  66. examples_rclpy_minimal_publisher publisher_old_school
  67. examples_rclpy_minimal_service service
  68. examples_rclpy_minimal_service service_member_function
  69. examples_rclpy_minimal_subscriber subscriber_lambda
  70. examples_rclpy_minimal_subscriber subscriber_member_function
  71. examples_rclpy_minimal_subscriber subscriber_old_school
  72. image_tools cam2image
  73. image_tools showimage
  74. intra_process_demo camera_node
  75. intra_process_demo cyclic_pipeline
  76. intra_process_demo image_pipeline_all_in_one
  77. intra_process_demo image_pipeline_with_two_image_view
  78. intra_process_demo image_view_node
  79. intra_process_demo two_node_pipeline
  80. intra_process_demo watermark_node
  81. joy joy_node
  82. lifecycle lifecycle_listener
  83. lifecycle lifecycle_service_client
  84. lifecycle lifecycle_service_client_py.py
  85. lifecycle lifecycle_talker
  86. map_server map_saver
  87. map_server map_server
  88. robot_state_publisher robot_state_publisher
  89. ros1_bridge dynamic_bridge
  90. ros1_bridge ros1_bridge_generate_factories
  91. ros1_bridge parameter_bridge
  92. ros1_bridge simple_bridge
  93. ros1_bridge simple_bridge_1_to_2
  94. ros1_bridge simple_bridge_2_to_1
  95. ros1_bridge static_bridge
  96. ros1_bridge test_ros2_client_cpp
  97. ros1_bridge test_ros2_server_cpp
  98. rosidl_generator_c rosidl_generator_c
  99. rosidl_generator_cpp rosidl_generator_cpp
  100. rosidl_generator_dds_idl rosidl_generator_dds_idl
  101. rosidl_generator_py rosidl_generator_py
  102. rosidl_typesupport_c rosidl_typesupport_c
  103. rosidl_typesupport_cpp rosidl_typesupport_cpp
  104. rosidl_typesupport_introspection_c rosidl_typesupport_introspection_c
  105. rosidl_typesupport_introspection_cpp rosidl_typesupport_introspection_cpp
  106. rosidl_typesupport_opensplice_c rosidl_typesupport_opensplice_c
  107. rosidl_typesupport_opensplice_cpp rosidl_typesupport_opensplice_cpp
  108. teleop_twist_joy teleop_node
  109. teleop_twist_keyboard teleop_twist_keyboard
  110. tf2_ros static_transform_publisher
  111. tf2_ros tf2_echo
  112. tf2_ros tf2_monitor
  113. topic_monitor data_publisher
  114. topic_monitor launch_depth_demo
  115. topic_monitor launch_fragmentation_demo
  116. topic_monitor launch_reliability_demo
  117. topic_monitor topic_monitor
  118. turtlebot2_drivers dumb_teleop
  119. turtlebot2_drivers kobuki_node
  120. turtlebot2_follower follower
  121. relaybot@relaybot-desktop:~$

 

  1. relaybot@relaybot-desktop:~$ ros2 topic -h
  2. usage: ros2 topic [-h] [--include-hidden-topics]
  3.                   Call `ros2 topic <command> -h` for more detailed usage. ...
  4. Various topic related sub-commands
  5. optional arguments:
  6.   -h, --help            show this help message and exit
  7.   --include-hidden-topics
  8.                         Consider hidden topics as well
  9. Commands:
  10.   echo  Output messages from a topic
  11.   list  Output a list of available topics
  12.   pub   Publish a message to a topic
  13.   Call `ros2 topic <command> -h` for more detailed usage.
  14. relaybot@relaybot-desktop:~$ ros2 topic list
  15. /parameter_events
  16. relaybot@relaybot-desktop:~$ ros2 node list
  17. ros_bridge
  18. relaybot@relaybot-desktop:~$
  19. relaybot@relaybot-desktop:~$ ros2 --help
  20. usage: ros2 [-h] Call `ros2 <command> -h` for more detailed usage. ...
  21. ros2 is an extensible command-line tool for ROS 2.
  22. optional arguments:
  23.   -h, --help            show this help message and exit
  24. Commands:
  25.   daemon    Various daemon related sub-commands
  26.   msg       Various msg related sub-commands
  27.   node      Various node related sub-commands
  28.   pkg       Various package related sub-commands
  29.   run       Run a package specific executable
  30.   security  Various security related sub-commands
  31.   service   Various service related sub-commands
  32.   srv       Various srv related sub-commands
  33.   topic     Various topic related sub-commands
  34.   Call `ros2 <command> -h` for more detailed usage.

 

资料汇总:

------

机器人操作系统(ROS)的2.0时代(ROS 2.0)

一个精心设计的机器人操作系统2.0版本(ROS 2.0)资源和库的列表

内容

软件包(或库)

文档

图书

没有书出版

培训班

还没有课程

演讲

 

------

~End~

标签:

给我留言

Copyright © ExBot易科机器人实验室 保留所有权利.   Theme   Robin modified by poyoten

用户登录

分享到: