­

在Win10中使用Gazebo9+進行機器人模擬

  • 2020 年 3 月 18 日
  • 筆記

還有一些小夥伴回饋我部落格翻譯或者搬運過程有缺失,為了防止誤導,儘力避免此類情況出現:

  • 更加仔細核查博文
  • 以原文鏈接為主

其實所有搬運博文都附有引用的鏈接。

Gazebo(Win10)

Gazebo在windows的安裝參考如下鏈接:


這裡重點介紹一下,它在ROS1Melodic中的使用~

為了確保ROS1Melodic能夠使用Gazebo,需具備如下功能包:

gazebo_ros功能包​

使用如下命令開啟Gazebo:

  • roslaunch gazebo_ros empty_world.launch

其中,empty_world.launch,可用如下替換為其他環境。

  1. roslaunch gazebo_ros elevator_world.launch
  2. roslaunch gazebo_ros mud_world.launch
  3. roslaunch gazebo_ros range_world.launch
  4. roslaunch gazebo_ros rubble_world.launch
  5. roslaunch gazebo_ros shapes_world.launch
  6. roslaunch gazebo_ros willowgarage_world.launch

為啥?看如下文件夾就明白啦~

gazebo_world

gazebo_ros核心節點如下:

gazebo_ros節點

以roslaunch gazebo_ros shapes_world.launch為例:

<?xml version="1.0"?>  <launch>      <!-- We resume the logic in empty_world.launch, changing only the name of the world to be launched -->    <include file="$(find gazebo_ros)/launch/empty_world.launch">      <arg name="world_name" value="worlds/shapes.world"/> <!-- Note: the world_name is with respect to GAZEBO_RESOURCE_PATH environmental variable -->      <arg name="paused" value="false"/>      <arg name="use_sim_time" value="true"/>      <arg name="gui" value="true"/>      <arg name="headless" value="false"/> <!-- Inert - see gazebo_ros_pkgs issue #491 -->      <arg name="recording" value="false"/>      <arg name="debug" value="false"/>    </include>    </launch>

注意,這是ROS1的launch文件寫法哦。

更多使用說明課程中講解。

如果需要模擬turtlebot3參考如下鏈接:

如果需要使用此案例,需確保:

  1. choco upgrade ros-melodic-desktop_full -y
  2. choco upgrade ros-melodic-cartographer_ros -y
  3. C:ros_wsturtlebot3

如上過程安裝或者catkin_make不能出錯哦。

catkin_make(100%)

使用如下命令啟動帶有turtlebot3的gazebo和rviz示例吧:

先更新環境:

  • call c:optrosmelodicx64setup.bat
  • call c:ros_wsturtlebot3develsetup.bat 
  • set TURTLEBOT3_MODEL=waffle 

最後,啟動:

  • roslaunch turtlebot3_gazebo turtlebot3_gazebo_cartographer_demo.launch

如果正常可以看到如下:

rviz:

rviz-turtlebot3

gazebo:

gazebo-turtlebot3

cmd:

INFO

更多內容,探索實現吧~~