Gazebo 简介

Quick Start

Run Gazebo

These three steps will run Gazebo with a default world.

1.Install Gazebo.

2.Open a terminal. On most Ubuntu systems you can press CTRL+ALT+t

3.Start Gazebo by entering the following at the command prompt.

gazebo

Run Gazebo with a robot

Let's simulate something a bit more interesting by loading a world with a pioneer2dx.

Open a terminal and enter the following command.

gazebo worlds/pioneer2dx.world

Where are the worlds located?

You may have noticed the mysterious worlds/pioneer2dx.world argument in the above command. This instructs gazebo to find the pioneer2dx.world file, and load it on start.

World files are located in a versioned system directory, for example /usr/share/gazebo-7 on Ubuntu. If you have Gazebo 7.0 installed on Ubuntu, in a terminal type the following to see a complete list of worlds.

ls /usr/share/gazebo-7/worlds

For a Gazebo 7.0 installation on OS X using Homebrew, type the following to see a complete list of worlds.

ls /usr/local/share/gazebo-7/worlds

Client and server separation

The gazebo command actually runs two different executables for you. The first is called gzserver, and the second gzclient.

The gzserver executable runs the physics update-loop and sensor data generation. This is the core of Gazebo, and can be used independently of a graphical interface. You may see the phrase "run headless" thrown about. This phrase equates to running only the gzserver. An example use case would involve running gzserver on a cloud computer where a user interface is not needed.

The gzclient executable runs a QT based user interface. This application provides a nice visualization of simulation, and convenient controls over various simulation properties.

Try running each of these executables. Open a terminal and run the server:

gzserver

Open another terminal and run the graphical client:

gzclient

At this point you should see the Gazebo user interface. You restart the gzclient application as often as you want, and even run multiple interfaces.

Gazebo Components


Table of Contents

  • World Files
  • Model Files
  • Environment Variables
  • Gazebo Server
  • Graphical Client
  • Server + Graphical Client in one
  • Plugins

This page describes each of the items involved in running a Gazebo simulation.

World Files

The world description file contains all the elements in a simulation, including robots, lights, sensors, and static objects. This file is formatted using SDF (Simulation Description Format), and typically has a .world extension.

The Gazebo server (gzserver) reads this file to generate and populate a world.

A number of example worlds are shipped with Gazebo. These worlds are located in <install_path>/share/gazebo-<version>/worlds.

Model Files

A model file uses the same SDF format as world files, but should only contain a single <model> ... </model>. The purpose of these files is to facilitate model reuse, and simplify world files. Once a model file is created, it can be included in a world file using the following SDF syntax:

<include>
  <uri>model://model_file_name</uri></include>

A number of models are provided in the online model database (in previous versions, some example models were shipped with Gazebo). Assuming that you have an Internet connection when running Gazebo, you can insert any model from the database and the necessary content will be downloaded at runtime.

Environment Variables

Gazebo uses a number of environment variables to locate files, and set up communications between the server and clients. Default values that work for most cases are compiled in. This means you don't need to set any variables.

Here are the variables:

GAZEBO_MODEL_PATH: colon-separated set of directories where Gazebo will search for models

GAZEBO_RESOURCE_PATH: colon-separated set of directories where Gazebo will search for other resources such as world and media files.

GAZEBO_MASTER_URI: URI of the Gazebo master. This specifies the IP and port where the server will be started and tells the clients where to connect to.

GAZEBO_PLUGIN_PATH: colon-separated set of directories where Gazebo will search for the plugin shared libraries at runtime.

GAZEBO_MODEL_DATABASE_URI: URI of the online model database where Gazebo will download models from.

These defaults are also included in a shell script:

source <install_path>/share/gazebo/setup.sh

If you want to modify Gazebo's behavior, e.g., by extending the path it searches for models, you should first source the shell script listed above, then modify the variables that it sets.

Gazebo Server

The server is the workhorse of Gazebo. It parses a world description file given on the command line, and then simulates the world using a physics and sensor engine.

The server can be started using the following command. Note that the server does not include any graphics; it's meant to run headless.

gzserver <world_filename>

The <world_filename> can be:

  1. relative to the current directory,
  2. an absolute path, or
  3. relative to a path component in GAZEBO_RESOURCE_PATH.

Worlds that are shipped with Gazebo are located in <install_path>/share/gazebo-<version_number>/worlds.

For example, to use the empty.world which is shipped with Gazebo, use the following command

gzserver worlds/empty.world

Graphical Client

The graphical client connects to a running gzserver and visualizes the elements. This is also a tool which allows you to modify the running simulation.

The graphical client is run using:

gzclient

Server + Graphical Client in one

The gazebo command combines server and client in one executable. Instead of running gzserver worlds/empty.world and then gzclient, you can do this:

gazebo worlds/empty.world

Plugins

Plugins provide a simple and convenient mechanism to interface with Gazebo. Plugins can either be loaded on the command line, or specified in a world/model file (see the SDF format). Plugins specified on the command line are loaded first, then plugins specified in the world/model files are loaded. Most plugins are loaded by the server; however, plugins can also be loaded by the graphical client to facilitate custom GUI generation.

Example of loading a plugin on the command line:

gzserver -s <plugin_filename> <world_file>

The same mechanism is used by the graphical client:

gzclient -g <plugin_filename>

For more information refer to the plugins overview page.

本文分享自微信公众号 - CreateAMind(createamind)

原文出处及转载信息见文内详细说明,如有侵权,请联系 yunjia_community@tencent.com 删除。

原始发表时间:2017-08-24

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • 解决RL好奇心探索后遗忘的问题

    Amplifying the Imitation Effect for Reinforcement Learning of

    用户1908973
  • NIPS的最佳论文 强化学习Value iteration Network 及代码

    TensorFlow实现:https://github.com/TheAbhiKumar/tensorflow-value-iteration-networks

    用户1908973
  • 强化学习中的情景好奇心

    https://github.com/google-research/episodic-curiosity

    用户1908973
  • Genesis框架从入门到精通(5):框架的内置动作(又续)

    现在你已经了解了什么是动作,已经如何使用它们来添加新内容、移动和删除现有内容,可能你还会用到一个更有用的技巧。那就是:

    丘壑
  • Poor man's grid search穷举网格搜索

    In this recipe, we're going to introduce grid search with basic Python, though w...

    到不了的都叫做远方
  • Deepfakes 的产生和检测:调查报告(CS CV)

    生成式深度学习算法已经发展到了难以分辨真假的地步。2018年,人们发现这种技术很容易被用于不道德和恶意的应用,如传播错误信息、冒充政治领导人和诽谤无辜的个体等。...

    刘持诚
  • Tomcat 9访问 Host Manager

    由于机器环境是win7 旗舰版 64位,所以选择下载64-bit windows .zip。

    拓荒者
  • Android 相机功能模块相关库

    Android’s video recording APIs are very difficult to figure out, especially sinc...

    用户3004328
  • CodeForces 665A Buses Between Cities

    A. Buses Between Cities time limit per test 1 second memory limit per test ...

    ShenduCC
  • Codeforces 626D Jerry's Protest(暴力枚举+概率)

    D. Jerry's Protest time limit per test:2 seconds memory limit per test:256 megab...

    Angel_Kitty

扫码关注云+社区

领取腾讯云代金券