1、Gazebo 機器人仿真學習探索筆記(二)基本使用說明在完成 Gazebo7 安裝後,需要熟悉 Gazebo,方便之後使用。html view plain copy print?在 CODE 上查看代码片派生到我的代码片$ gazebo Gazebo7 自帶了很多構建好的環境模型,可以直接使用,這些模型位置和安裝路徑相關:html view plain copy print?在 CODE 上查看代码片派生到我的代码片relaybotrelaybot-desktop:$ ls /usr/share/gazebo-7/worlds/ actor.world pioneer2dx.world bla
2、nk.world plane_demo.world camera.world plugin.world cart_demo.world polyline.world cessna_demo.world population.world contact.world pr2.world depth_camera.world presentation.world elevator.world pressure_sensor.world empty_1_0.world projector.world empty_bullet.world quad_rotor_demo_2.world empty_sk
3、y.world quad_rotor_demo.world empty.world random_velocity.world everything.world ray_cpu.world flocking.world ray_noise_plugin.world force_torque_demo.world road_textures.world friction_demo.world road.world gripper.world robocup09_spl_field.world heightmap_dem.world robocup14_spl_field.world height
4、map.world robocup_3Dsim.world hydra_demo.world rubble.world imu_demo.world seesaw.world initial_velocity.world shapes_bitmask.world joint_damping_demo.world shapes_layers.world joint_friction_demo.world shapes.world joints.world sim_events.world lift_drag_demo.world simple_arm.world lights.world sim
5、ple_gripper.world linear_battery_demo.world single_rotor_demo.world logical_camera.world sonar_demo.world magnetometer.world sphere_atlas_demo.world mud_bitmask.world stacks.world mud.world timer_gui.world multilink_shape.world torsional_friction_demo.world nested_model.world transporter.world opena
6、l.world trigger.world ortho.world twin_rotor_demo.world osrf_elevator.world underwater.world pioneer2dx_camera.world willowgarage.world pioneer2dx_laser_camera.world wireless_sensors.world pioneer2dx_laser.world 在 ubuntu 下默認的路徑爲: /usr/share/gazebo-7/worlds/。啓動一個示例,如下:html view plain copy print?在 COD
7、E 上查看代码片派生到我的代码片/usr/share/gazebo-7/worlds$ gazebo lift_drag_demo.world 啓動一個帶有天空的環境:html view plain copy print?在 CODE 上查看代码片派生到我的代码片/usr/share/gazebo-7/worlds$ gazebo empty_sky.world html view plain copy print?在 CODE 上查看代码片派生到我的代码片12 model:/sun model:/ground_plane 注意這個環境中,天空中只有雲彩速度爲 12,場景中還有光源和大地。啓動
8、一個帶有機器人模型的環境:html view plain copy print?在 CODE 上查看代码片派生到我的代码片/usr/share/gazebo-7/worlds$ gazebo pioneer2dx_laser_camera.world html view plain copy print?在 CODE 上查看代码片派生到我的代码片model:/ground_plane model:/sun model:/pioneer2dx model:/hokuyo 0.2 0 .38 0 0 0 model:/camera 0.2 0 .3 0 0 0 pioneer2dx:pioneer
9、2dx:chassis pioneer2dx:camera:link 0 0 1 0 0 pioneer2dx:pioneer2dx:chassis pioneer2dx:hokuyo:link 0 0 1 0 0 參考上述模板,可以學習環境文件,主要由大地,光源,機器人模型,機器人模型包括本體,激光和攝像頭等具體配置。除此之外,還有 gzserver 和 gzclient。gazebo 命令实际上运行两个不同的可执行文件。 第一个称为 gzserver,第二个称为gzclient。gzserver 可执行程序运行物理更新循环和传感器数据生成。 这是 Gazebo 的核心,可以独立于图形界面使
10、用。 您可能会在论坛中看到“run headless”这个短语。 这个短语相当于只运行 gzserver。 一个示例用例将涉及在不需要用户界面的云计算机上运行 gzserver。gzclient 可执行文件运行基于 QT 的用户界面。 此应用程序提供了一个很好的可视化的模拟,并在各种模拟属性方便的控制。當然,這兩個可以分別啓動。gazebo 使用的快捷鍵:Action OperationInstructionMODEEnter Selection mode (default mode) Esc press Esc for mode to select models and right-clic
11、k for context menuEnter Rotate mode r press “r“ for Rotate (model) modeEnter Translate mode t press “t“ for Translate (model) modeEnter Scale mode s press “s“ for Scale (model) modeEnter Snap mode n press “n“ for Snap (model) modeMODELSDelete model Delete press Delete when a model is selected to del
12、ete from sceneCopy model Ctrl + c press Ctrl + “c“ when model is selected to copyPaste model Ctrl + v press Ctrl + “v“ to paste copied modelMANIPULATING MODELSRotate model r press “r“ for Rotate mode; click model click model click model click one link, then a second to snap first link to secondGUI L
13、AYOUTHide toolbars Ctrl + h hide/show top toolbar and bottom time panelEnter fullscreen F11 enter/exit fullscreenAction OperationInstructionEDITORSOpen Model Editor Ctrl + m open Model Editor to construct or edit modelsOpen Schematic View (Model Editor) Ctrl + e open Schematic View in Model EditorOp
14、en Building Editor Ctrl + b open Building Editor to construct buildingsShow floor plan (Building Editor) f show/hide floor plan in Building Editor 2D ViewShow building features (Building Editor) g show/hide building features in Building Editor 2D ViewNew canvas (both Editors) Ctrl + n create new can
15、vasSave model (both Editors) Ctrl + s save model for later useSave as (both Editors) Ctrl + Shift + s save model for later use its meant to run headless.gzserver The can be:relative to the current directory,an absolute path, orrelative to a path component in GAZEBO_RESOURCE_PATH.Worlds that are ship
16、ped with Gazebo are located in /share/gazebo-/worlds.For example, to use the empty.worldwhich is shipped with Gazebo, use the following commandgzserver worlds/empty.worldGraphical ClientThe graphical client connects to a running gzserverand visualizes the elements. This is also a tool which allows y
17、ou to modify the running simulation.The graphical client is run using:gzclientServer + Graphical Client in oneThe gazebocommand combines server and client in one executable. Instead of running gzserver worlds/empty.world and then gzclient, you can do this:gazebo worlds/empty.worldPluginsPlugins prov
18、ide 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
19、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 The same mechanism is used by the graphical client:gzclient -g For more information refer to the plugins overview page
20、.IntroductionGazebo uses a distributed architecturewith separate libraries for physics simulation,rendering, user interface, communication, and sensor generation.Additionally, gazebo provides two executable programs for running simulations:a server gzserverfor simulating the physics, rendering, and
21、sensorsa client gzclientthat provides a graphical interface tovisualize and interact with the simulationThe client and server communicate using the gazebo communication library.Communication Between ProcessesThe communication library currently uses the open sourceGoogle Protobuffor the message seria
22、lizationand boost:ASIO for the transport mechanism.It supports the publish/subscribe communication paradigm.For example, a simulated world publishes body pose updates,and sensor generation and GUI will consume these messages to produce output.This mechanism allows for introspection of a running simu
23、lation,and provides a convenient mechanism to control aspectsof Gazebo.SystemGazebo MasterThis is essentially a topic name server.It provides namelookup, and topic management.A single master can handle multiple physics simulations,sensor generators, and GUIs.Communication LibraryDependencies: Protob
24、uf and boost:ASIOExternal API:Internal API: NoneAdvertised Topics: NoneSubscribed Topics: NoneThis library is used by almost all subsequent libraries.It acts as the communication and transport mechanism for Gazebo.It currently supports only publish/subscribe,but it is possible to useRPCwith minimal
25、effort.Physics LibraryDependencies: Dynamics engine (with internal collision detection)External API: Provides a simple and generic interface to physics simulationInternal API: Defines a fundamental interface to the physics library for 3rd party dynamic engines.The physics library provides a simple a
26、nd generic interface tofundamental simulation components, including rigid bodies,collision shapes, and joints for representing articulationconstraints.This interface has been integrated with four open-sourcephysics engines:Open Dynamics Engine (ODE)BulletSimbodyDynamic Animation and Robotics Toolkit
27、 (DART)A model described in theSimulation Description Format (SDF)using XML can be loaded by each of these physics engines.This provides access to different algorithm implementationsand simulation features.Rendering LibraryDependencies: OGREExternal API: Allows for loading, initialization, and scene
28、 creationInternal API: Store metadata for visualization, call the OGRE API for rendering.The rendering library uses OGRE to provide a simple interfacefor rendering 3D scenes to both the GUI and sensor libraries.It includes lighting, textures, and sky simulation.It is possible to write plugins for th
29、e rendering engine.Sensor GenerationDependencies: Rendering Library, Physics LibraryExternal API: Provide functionality to initialize and run a set of sensorsInternal API: TBDThe sensor generation library implements all the various types of sensors,listens to world state updates from a physics simul
30、ator andproduces output specified by the instantiated sensors.GUIDependencies: Rendering Library, QtExternal API: NoneInternal API: NoneThe GUI library uses Qt to create graphical widgets for users to interact with the simulation.The user may control the flow of time by pausing or changing time step
31、 sizevia GUI widgets.The user may also modify the scene by adding, modifying, or removing models.Additionally there are some tools for visualizing andlogging simulated sensor data.PluginsThe physics, sensor, and rendering libraries support plugins.These plugins provide users with access to the respe
32、ctive librarieswithout using the communication system.Capture screenshotsTo capture a screenshot of the scene displayed in the Gazebo 3D render window, find and click on the camera icon on the toolbar above the render window.Screenshot save locationThe captured image will be saved to /.gazebo/pictures with a timestamped filename.