当前位置: 首页 > article >正文

gazebo_world 基本围墙。

如何使用?
参考gazebo harmonic的官方教程。

本人使用harmonic的template,在里面进行修改就可以分流畅地使用下去。
在这里插入图片描述

以下是world 文件.

<?xml version="1.0" ?>
<!--
  Try sending commands:
    gz topic -t "/model/diff_drive/cmd_vel" -m gz.msgs.Twist -p "linear: {x: 1.0}, angular: {z: -0.1}"
    ros2 topic pub /diff_drive/cmd_vel geometry_msgs/msg/Twist "{linear: {x: 5.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: -0.1}}"
  Listen to odometry:
    gz topic -e -t /model/diff_drive/odometry
    ros2 topic echo /model/diff_drive/odometry
-->
<sdf version="1.8">
  <world name="slam_demo">
    <plugin
      filename="gz-sim-physics-system"
      name="gz::sim::systems::Physics">
    </plugin>
    <plugin
      filename="gz-sim-sensors-system"
      name="gz::sim::systems::Sensors">
      <render_engine>ogre2</render_engine>
    </plugin>
    <plugin
      filename="gz-sim-scene-broadcaster-system"
      name="gz::sim::systems::SceneBroadcaster">
    </plugin>
    <plugin
      filename="gz-sim-user-commands-system"
      name="gz::sim::systems::UserCommands">
    </plugin>
    <plugin
      filename="BasicSystem"
      name="ros_gz_example_gazebo::BasicSystem">
    </plugin>
    <plugin
      filename="FullSystem"
      name="ros_gz_example_gazebo::FullSystem">
    </plugin>

    <light name="sun" type="directional">
      <cast_shadows>true</cast_shadows>
      <pose>0 0 10 0 0 0</pose>
      <diffuse>0.8 0.8 0.8 1</diffuse>
      <specular>0.2 0.2 0.2 1</specular>
      <attenuation>
        <range>1000</range>
        <constant>0.9</constant>
        <linear>0.01</linear>
        <quadratic>0.001</quadratic>
      </attenuation>
      <direction>-0.5 0.1 -0.9</direction>
    </light>

    <model name="ground_plane">
      <static>true</static>
      <link name="link">
        <collision name="collision">
          <geometry>
            <plane>
              <normal>0 0 1</normal>
              <size>100 100</size>
            </plane>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <plane>
              <normal>0 0 1</normal>
              <size>100 100</size>
            </plane>
          </geometry>
          <material>
            <ambient>0.8 0.8 0.8 1</ambient>
            <diffuse>0.8 0.8 0.8 1</diffuse>
            <specular>0.8 0.8 0.8 1</specular>
          </material>
        </visual>
      </link>
    </model>

    <model name="diff_drive">
      <self_collide>true</self_collide>
      <pose>0 0 0.35 0 0 0</pose>
      <include merge="true">
        <uri>package://ros_gz_example_description/models/diff_drive</uri>
      </include>

      <plugin
        filename="gz-sim-joint-state-publisher-system"
        name="gz::sim::systems::JointStatePublisher">
      </plugin>

      <plugin
        filename="gz-sim-pose-publisher-system"
        name="gz::sim::systems::PosePublisher">
        <publish_link_pose>true</publish_link_pose>
        <use_pose_vector_msg>true</use_pose_vector_msg>
        <static_publisher>true</static_publisher>
        <static_update_frequency>1</static_update_frequency>
      </plugin>

      <plugin
        filename="gz-sim-odometry-publisher-system"
        name="gz::sim::systems::OdometryPublisher">
        <odom_frame>diff_drive/odom</odom_frame>
        <robot_base_frame>diff_drive</robot_base_frame>
      </plugin>
    </model>

<!-- 北墙 -->
    <model name="wall_north">
      <static>true</static>
      <pose>0 11 1 0 0 0</pose> <!-- Y 坐标从 8 增加到 11 -->
      <link name="link">
        <collision name="collision">
          <geometry>
            <box>
              <size>22 0.4 2</size> <!-- 长度从 16 增加到 22 -->
            </box>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <box>
              <size>22 0.4 2</size>
            </box>
          </geometry>
          <material>
            <ambient>0.5 0.5 0.5 1</ambient>
            <diffuse>0.6 0.6 0.6 1</diffuse>
            <specular>0.7 0.7 0.7 1</specular>
          </material>
        </visual>
      </link>
    </model>

    <!-- 南墙 -->
    <model name="wall_south">
      <static>true</static>
      <pose>0 -11 1 0 0 0</pose> <!-- Y 坐标从 -8 减少到 -11 -->
      <link name="link">
        <collision name="collision">
          <geometry>
            <box>
              <size>22 0.4 2</size>
            </box>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <box>
              <size>22 0.4 2</size>
            </box>
          </geometry>
          <material>
            <ambient>0.5 0.5 0.5 1</ambient>
            <diffuse>0.6 0.6 0.6 1</diffuse>
            <specular>0.7 0.7 0.7 1</specular>
          </material>
        </visual>
      </link>
    </model>

    <!-- 东墙 -->
    <model name="wall_east">
      <static>true</static>
      <pose>11 0 1 0 0 1.5708</pose> <!-- X 坐标从 8 增加到 11 -->
      <link name="link">
        <collision name="collision">
          <geometry>
            <box>
              <size>22 0.4 2</size> <!-- 长度从 16 增加到 22 -->
            </box>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <box>
              <size>22 0.4 2</size>
            </box>
          </geometry>
          <material>
            <ambient>0.5 0.5 0.5 1</ambient>
            <diffuse>0.6 0.6 0.6 1</diffuse>
            <specular>0.7 0.7 0.7 1</specular>
          </material>
        </visual>
      </link>
    </model>

    <!-- 西墙 -->
    <model name="wall_west">
      <static>true</static>
      <pose>-11 0 1 0 0 1.5708</pose> <!-- X 坐标从 -8 减少到 -11 -->
      <link name="link">
        <collision name="collision">
          <geometry>
            <box>
              <size>22 0.4 2</size>
            </box>
          </geometry>
        </collision>
        <visual name="visual">
          <geometry>
            <box>
              <size>22 0.4 2</size>
            </box>
          </geometry>
          <material>
            <ambient>0.5 0.5 0.5 1</ambient>
            <diffuse>0.6 0.6 0.6 1</diffuse>
            <specular>0.7 0.7 0.7 1</specular>
          </material>
        </visual>
      </link>
    </model>

    <!-- 分隔客厅和上方房间 -->
<model name="partition_living_to_rooms">
  <static>true</static>
  <pose>0 2.5 1 0 0 0</pose> <!-- 墙体中心位置:X=0, Y=2.5, Z=1 -->
  <link name="link">
    <collision name="collision">
      <geometry>
        <box>
          <size>12 0.4 2</size> <!-- 墙体长度=12, 厚度=0.4, 高度=2 -->
        </box>
      </geometry>
    </collision>
    <visual name="visual">
      <geometry>
        <box>
          <size>12 0.4 2</size>
        </box>
      </geometry>
      <material>
        <ambient>0.5 0.5 0.5 1</ambient>
        <diffuse>0.6 0.6 0.6 1</diffuse>
        <specular>0.7 0.7 0.7 1</specular>
      </material>
    </visual>
  </link>
</model>

<!-- 分隔左边房间和小走廊 -->
<model name="partition_left_room_to_corridor">
  <static>true</static>
  <pose>-1.5 5 1 0 0 0</pose> <!-- 墙体中心位置:X=-1.5, Y=5, Z=1 -->
  <link name="link">
    <collision name="collision">
      <geometry>
        <box>
          <size>3 0.4 2</size> <!-- 墙体长度=3, 厚度=0.4, 高度=2 -->
        </box>
      </geometry>
    </collision>
    <visual name="visual">
      <geometry>
        <box>
          <size>3 0.4 2</size>
        </box>
      </geometry>
      <material>
        <ambient>0.5 0.5 0.5 1</ambient>
        <diffuse>0.6 0.6 0.6 1</diffuse>
        <specular>0.7 0.7 0.7 1</specular>
      </material>
    </visual>
  </link>
</model>

  </world>
</sdf>
``

http://www.kler.cn/a/457690.html

相关文章:

  • gitlab runner 实现 微信小程序自动化部署
  • Flutter 插件开发入门
  • frameworks 之 WMS添加窗口流程
  • 嵌入式开发 的循环实现
  • 牛客周赛 Round 66 E题 小苯的蓄水池(hard)
  • 【电路复习--选择题】
  • 【汇编】关于函数调用过程的若干问题
  • 选择排序cYuyan
  • 破解无人机能源瓶颈:优化调度与智能布局的实践
  • mongdb的简介和使用
  • 面向机器学习的Java库与平台
  • cellphoneDB进行CCI以及可视化
  • TCP网络编程(二)—— 服务器端的编写
  • Upload-labs 靶场(学习)
  • 【Linux】Socket编程-UDP构建自己的C++服务器
  • 3.微服务灰度发布落地实践(组件灰度增强)
  • AI 自动化编程的现状与局限
  • delete,drop,truncate的区别
  • ChatGPT与Postman协作完成接口测试(四)
  • sql注入杂谈(一)--union select