在Win10中使用Gazebo9+进行机器人仿真

Win10系统兼容ROS1和ROS2,目标是全功能支持,2020年2月已经支持大部分主流功能。完全满足入门学习需求哦~

博客已经发布Ubuntu+Arduino+ROS1+ROS2+SLAM学习镜像,Linux下教程基本针对ROS2展开。

近期有大量留言和反馈提出希望补充ROS1教程,如windows下的,其实大部分教程与Linux几乎一致,只是系统换了

还有一些小伙伴反馈我博客翻译或者搬运过程有缺失,为了防止误导,尽力避免此类情况出现:

  • 更加仔细核查博文
  • 以原文链接为主

其实所有搬运博文都附有引用的链接。

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_ws\turtlebot3

如上过程安装或者catkin_make不能出错哦。

catkin_make(100%)

使用如下命令启动带有turtlebot3的gazebo和rviz示例吧:

先更新环境:

  • call c:\opt\ros\melodic\x64\setup.bat
  • call c:\ros_ws\turtlebot3\devel\setup.bat 
  • set TURTLEBOT3_MODEL=waffle 

最后,启动:

  • roslaunch turtlebot3_gazebo turtlebot3_gazebo_cartographer_demo.launch

如果正常可以看到如下:

rviz:

rviz-turtlebot3

gazebo:

gazebo-turtlebot3

cmd:

INFO

更多内容,探索实现吧~~


发布了476 篇原创文章 · 获赞 1344 · 访问量 217万+

猜你喜欢

转载自blog.csdn.net/ZhangRelay/article/details/104900528