11.2.2.1. 如何使用 Gazebo Plugin 插件

1) 安裝 Gazebo7 程式庫

$ sudo apt-get install libgazebo7-dev

2) 從 Github 下載插件原始碼

$ git clone https://github.com/ROBOTIS-GIT/turtlebot3_gazebo_plugin

3) 將 Gazebo 插件路徑加入 .bashrc 檔

$ nano ~/.bashrc

Tip:turtlebot3_gazebo_plugin path = ~/turtlebot3_gazebo_plugin

export GAZEBO_PLUGIN_PATH=$GAZEBO_PLUGIN_PATH:${turtlebot3_gazebo_plugin path}/build
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:${turtlebot3_gazebo_plugin path}/models

4) Make 及 Build

$ cd ${turtlebot3_gazebo_plugin path}
$ mkdir build
$ cd build
$ cmake ..
$ make

5) 執行 plugin 插件

Tip:在執行指令前,必須先指定 TurtleBot3 的 model 模型名稱。${TB3_MODEL} 是表示所使用的 burger, waffle, waffle_pi 模型的名稱。如果你要永久設定 export setting,請參考 Export TURTLEBOT3_MODEL 網頁。

$ cd ${turtlebot3_gazebo_plugin}
$ gazebo worlds/turtlebot3_${TB3_MODEL}.world

6) 鍵盤遙控操作

w - set linear velocity up
x - set linear velocity down
d - set angular velocity up
a - set angular velocity down
s - set all velocity to zero

7) Topic Subscribe 訂閱 topic 指令

  • 顯示全部 topic

$ gz topic -l
  • 訂閱光達 scan 數據

$ gz topic -e /gazebo/default/user/turtlebot3_${TB3_MODEL}/lidar/hls_lfcd_lds/scan
  • 訂閱攝影機影像數據

Waffle 鬆餅款 (Intel RealSense R200)

$ gz topic -e /gazebo/default/user/turtlebot3_waffle/image/intel_realsense_r200/image

Waffle Pi 鬆餅 Pi 款 (Raspberry Pi camera)

$ gz topic -e /gazebo/default/user/turtlebot3_waffle_pi/image/raspberry_pi_cam/image

8) 執行 listener

$ cd ${turtlebot3_gazebo_plugin}/build
$ ./lidar_listener ${TB3_MODEL}

打開新的 terminal 視窗輸入下方指令。

$ cd ${turtlebot3_gazebo_plugin}/build
$ ./image_listener ${TB3_MODEL}

參考資源:

Last updated