Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

ROS Kinetic 與 Kamtoa Simulation 入門:Gazebo、RViz 與導航分析

本文以 Kamtoa Simulation 專案為例,說明 ROS Kinetic 中 Gazebo、RViz、rqt 工具與導航功能的基本使用方式。

原始碼:https://github.com/Tutorgaming/kamtoa-simulation

ROS Kinetic 與 Kamtoa Simulation 入門:Gazebo、RViz 與導航分析 ROS Kinetic 與 Kamtoa Simulation 入門:Gazebo、RViz 與導航分析

專案結構

閱讀原始碼時,可先查看 README、CMakeLists.txt 與各功能包結構。Catkin 工作區通常由多個功能包組成,每個功能包會定義自己的依賴與建置規則。

ROS Kinetic 與 Kamtoa Simulation 入門:Gazebo、RViz 與導航分析

Gazebo 功能包

kamtoa_gazebo 中會宣告所需依賴,例如 gazebo_msgs、gazebo_plugins、gazebo_ros、gazebo_ros_control 與 kamtoa_description。

ROS Kinetic 與 Kamtoa Simulation 入門:Gazebo、RViz 與導航分析

若缺少功能包,可使用 apt 安裝對應的 ros-kinetic 套件。package.xml 中的 build_depend 與 run_depend 分別對應編譯與執行期依賴,兩者都需要完整。

世界與模型檔案

world 資料夾存放 Gazebo 場景,模型通常由 model.config 與 model.sdf 組成,用於描述牆面、門、窗與其他物件屬性。

ROS Kinetic 與 Kamtoa Simulation 入門:Gazebo、RViz 與導航分析

Launch 檔案

gazebo_kamtoa.launch 會載入機器人描述、初始化 RViz、啟動 Gazebo 世界,並將機器人模型生成到場景中。

ROS Kinetic 與 Kamtoa Simulation 入門:Gazebo、RViz 與導航分析

可執行:

roslaunch kamtoa_gazebo gazebo_kamtoa.launch

啟動後會出現 roscore、RViz、Gazebo 與相關節點。

ROS Kinetic 與 Kamtoa Simulation 入門:Gazebo、RViz 與導航分析 ROS Kinetic 與 Kamtoa Simulation 入門:Gazebo、RViz 與導航分析

使用 rqt 工具分析節點

ROS 提供多種 rqt 工具,例如:

rqt_topic
rqt_graph
rqt_image_view
rqt_console
rqt_plot

使用 rqt_topic 可查看主題:

rosrun rqt_topic rqt_topic
ROS Kinetic 與 Kamtoa Simulation 入門:Gazebo、RViz 與導航分析

使用 rqt_image_view 可查看相機影像:

rosrun rqt_image_view rqt_image_view
ROS Kinetic 與 Kamtoa Simulation 入門:Gazebo、RViz 與導航分析

使用 rqt_graph 可檢視節點間連線:

rosrun rqt_graph rqt_graph
ROS Kinetic 與 Kamtoa Simulation 入門:Gazebo、RViz 與導航分析

鍵盤控制機器人

可啟動遙操功能:

roslaunch kamtoa_teleop teleop_keyboard.launch
ROS Kinetic 與 Kamtoa Simulation 入門:Gazebo、RViz 與導航分析

此功能會透過 cmd_vel 主題控制機器人移動。

手機控制

可先查詢電腦 IP:

ifconfig -a

再讓手機端連線到相同網段,即可進行遠端控制。

ROS Kinetic 與 Kamtoa Simulation 入門:Gazebo、RViz 與導航分析

自主導航

啟動導航:

roslaunch kamtoa_navigation kamtoa_navigation.launch

此 launch 通常包含地圖伺服器、AMCL 定位、速度平滑與 move_base 路徑規劃。

ROS Kinetic 與 Kamtoa Simulation 入門:Gazebo、RViz 與導航分析 ROS Kinetic 與 Kamtoa Simulation 入門:Gazebo、RViz 與導航分析 ROS Kinetic 與 Kamtoa Simulation 入門:Gazebo、RViz 與導航分析

最後可觀察路徑規劃與機器人導航效果。

ROS Kinetic 與 Kamtoa Simulation 入門:Gazebo、RViz 與導航分析 ROS Kinetic 與 Kamtoa Simulation 入門:Gazebo、RViz 與導航分析
Copyright © Linux教程網 All Rights Reserved