天天看點

機器人作業系統二(ROS2)- 啟程 Departure

版權聲明:署名,允許他人基于本

是時候放下ROS1,開啟ROS2的旅程了。It's time to put down ROS1 and start the journey of ROS2.

ROS2官方線上文檔連結 ROS2 official online documentation:https://index.ros.org/doc/ros2/

ROS2教程文檔使用說明與為什麼選擇ROS2?ROS2 tutorial documentation instructions and why choose ROS2?https://blog.csdn.net/ZhangRelay/article/details/93601114

ROS2正常學習路徑 ROS2 regular learning path:

機器人作業系統二(ROS2)- 啟程 Departure

demos、navigation2 and moveit2

ROS2進階學習路徑 ROS2 advanced learning path:

機器人作業系統二(ROS2)- 啟程 Departure

others

學習分享從安裝配置開始,首先詳細介紹教程,然後是兩個專題:Navigation2和MoveIt!2。This article starts with ROS2 installation and configuration, first introduces the tutorial in detail, then two topics: Navigation2 and MoveIt!2.

安裝詳細過程 Installation detailed tutorial:ROS 2 Dashing Diademata安裝和使用文檔(含Linux、Windows和OS X)ROS 2 Dashing Diademata installation and documentation (including Linux, Windows and OS X)

ROS教程 ROS 2 tutorials:https://github.com/zhangrelay/ros2_tutorials

配置教程包 Tutorial package configuration:

  1. 下載下傳:git clone
  2. 編譯:colcon build
  3. 使用:ros2 run
機器人作業系統二(ROS2)- 啟程 Departure

colcon build

導入編譯的環境 Import the compiled environment:

source install/setup.bash

輸入ros2 run turtlesim,可以看到如下節點 Enter ros2 run turtlesim, you can see the following nodes:

draw_square --prefix turtle_teleop_key

mimic turtlesim_node

常用指令如下 Common commands are as follows:

  1. ros2 run turtlesim turtlesim_node
  2. ros2 topic list
  3. ros2 run turtlesim draw_square
  4. ros2 topic echo /turtle1/pose
  5. ……

更多内容參考下圖 For more details, please refer to the following figure:

機器人作業系統二(ROS2)- 啟程 Departure

歡迎大家下載下傳案例調試玩耍, 更多内容後續介紹。You are welcome to download the case, debug and play, more will be introduced in subsequent articles.

思考題 Thinking:

回顧roslaunch, 寫一個ros2 launch,同時啟動turtlesim_node和draw_spuare。Looking back at roslaunch, write a ros2 launch and start both the turtlesim_node and draw_spuare node.

擴充題 Extended:

對比ROS1和ROS2的turtlesim包,分析和思考兩代ROS程式設計和使用中的差異。Compare the turbulsim package of ROS1 and ROS2, analyze and think about the difference between the two generations of ROS in programming and use.

draw_square.launch.py

from launch import LaunchDescription
import launch_ros.actions

def generate_launch_description():
    return LaunchDescription([
        launch_ros.actions.Node(
            node_namespace= "ros2", package='turtlesim', node_executable='turtlesim_node', output='screen'),
        launch_ros.actions.Node(
            node_namespace= "ros2", package='turtlesim', node_executable='draw_square', output='screen'),
    ])           

複制

機器人作業系統二(ROS2)- 啟程 Departure
機器人作業系統二(ROS2)- 啟程 Departure