Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/wwwroot/phxin.top/usr/themes/Joe/public/config.php on line 19

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/wwwroot/phxin.top/usr/themes/Joe/public/config.php on line 20

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/wwwroot/phxin.top/usr/themes/Joe/public/config.php on line 21

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/wwwroot/phxin.top/usr/themes/Joe/public/config.php on line 22

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/wwwroot/phxin.top/usr/themes/Joe/public/config.php on line 23
Gazebo仿真环境 - Hello World

Gazebo仿真环境

清歌
2023-02-07 / 0 评论 / 0 阅读 / 正在检测是否收录...

内置组件创建仿真环境

启动 Gazebo 并添加组件

请输入图片描述

保存仿真环境

请输入图片描述
添加完毕后,选择 file ---> Save World as 选择保存路径(功能包下: worlds 目录),文件名自定义,后缀名设置为 .world

启动
<launch>

    <!-- 将 Urdf 文件的内容加载到参数服务器 -->
    <param name="robot_description" command="$(find xacro)/xacro $(find demo02_urdf_gazebo)/urdf/xacro/my_base_camera_laser.urdf.xacro" />
    <!-- 启动 gazebo -->
    <include file="$(find gazebo_ros)/launch/empty_world.launch">
        <arg name="world_name" value="$(find demo02_urdf_gazebo)/worlds/hello.world" />
    </include>

    <!-- 在 gazebo 中显示机器人模型 -->
    <node pkg="gazebo_ros" type="spawn_model" name="model" args="-urdf -model mycar -param robot_description"  />
</launch>

核心代码: 启动 empty_world 后,再根据arg加载自定义的仿真环境

<include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="$(find demo02_urdf_gazebo)/worlds/hello.world" />
</include>

自定义仿真环境

启动 gazebo 打开构建面板,绘制仿真环境

请输入图片描述
请输入图片描述

保存构建的环境

点击: 左上角 file ---> Save (保存路径功能包下的: models)
然后 file ---> Exit Building Editor

保存为 world 文件

请输入图片描述

启动

同方式1
可以像方式1一样再添加一些插件,然后保存为 world 文件(保存路径功能包下的: worlds)

使用官方提供的插件

当前 Gazebo 提供的仿真道具有限,还可以下载官方支持,可以提供更为丰富的仿真实现

下载官方模型库
git clone https://github.com/osrf/gazebo_models

之前是:hg clone https://bitbucket.org/osrf/gazebo_models但是已经不可用
注意: 此过程可能比较耗时

将模型库复制进 gazebo

将得到的gazebo_models文件夹内容复制到 /usr/share/gazebo-*/models

应用

重启 Gazebo,选择左侧菜单栏的 insert 可以选择并插入相关道具了

0

评论 (0)

取消