Gazebo机器人仿真学习探索笔记二基本使用说明.docx
- 文档编号:11423108
- 上传时间:2023-03-01
- 格式:DOCX
- 页数:18
- 大小:204.13KB
Gazebo机器人仿真学习探索笔记二基本使用说明.docx
《Gazebo机器人仿真学习探索笔记二基本使用说明.docx》由会员分享,可在线阅读,更多相关《Gazebo机器人仿真学习探索笔记二基本使用说明.docx(18页珍藏版)》请在冰豆网上搜索。
Gazebo机器人仿真学习探索笔记二基本使用说明
Gazebo機器人仿真學習探索筆記
(二)
基本使用說明
在完成Gazebo7安裝後,需要熟悉Gazebo,方便之後使用。
actor.worldblank.worldcamera.worldcart_demo.worldcessna_demo.worldcontact.worlddepth_camera.worldelevator.worldempty_1_0.worldempty_bullet.worldempty_sky.worldempty.worldeverything.worldflocking.world
[html]viewplaincopyprint?
在CODE上查看代码片派生到我的代码片~$gazebo
Gazebo7自帶了很多構建好的環境模型,可以直接使用,這些模型位置和安裝路徑相關:
[html]viewplaincopyprint?
在CODE上查看代码片派生到我的代码片relaybot@relaybot-desktop:
~$ls/usr/share/gazebo-7/worlds/
pioneer2dx.world
plane_demo.world
plugin.world
polyline.world
population.world
pr2.world
presentation.world
pressure_sensor.world
projector.worldquad_rotor_demo_2.worldquad_rotor_demo.worldrandom_velocity.worldray_cpu.worldray_noise_plugin.world
force_torque_demo.worldfriction_demo.worldgripper.worldheightmap_dem.worldheightmap.worldhydra_demo.world
road_textures.world
road.world
robocup09_spl_field.world
robocup14_spl_field.world
robocup_3Dsim.world
rubble.world
initial_velocity.worldjoint_damping_demo.worldjoint_friction_demo.worldjoints.worldlift_drag_demo.worldlights.worldlinear_battery_demo.worldlogical_camera.worldmagnetometer.worldmud_bitmask.worldmud.worldmultilink_shape.worldnested_model.worldopenal.worldortho.worldosrf_elevator.worldpioneer2dx_camera.world
seesaw.world
imu_demo.world
shapes_bitmask.world
shapes_layers.worldshapes.worldsim_events.worldsimple_arm.worldsimple_gripper.worldsingle_rotor_demo.worldsonar_demo.worldsphere_atlas_demo.worldstacks.worldtimer_gui.worldtorsional_friction_demo.worldtransporter.worldtrigger.worldtwin_rotor_demo.worldunderwater.worldwillowgarage.world
wireless_sensors.world
pioneer2dx_laser_camera.worldpioneer2dx_laser.world
在ubuntu下默認的路徑爲:
/usr/share/gazebo-7/worlds/。
啓動一個示例,如下:
[html]viewplaincopyprint?
在CODE上查看代码片派生到我的代码片/usr/share/gazebo-7/worlds$gazebolift_drag_demo.world
啓動一個帶有天空的環境:
[html]viewplaincopyprint?
在CODE上查看代码片派生到我的代码片/usr/share/gazebo-7/worlds$gazeboempty_sky.world
[html]viewplaincopyprint?
在CODE上查看代码片派生到我的代码片
xmlversion="1.0"?
>
--Agloballightsource-->
//sun
--Agroundplane-->
//ground_plane
注意這個環境中,天空中只有雲彩速度爲12,場景中還有光源和大地。
啓動一個帶有機器人模型的環境:
[html]viewplaincopyprint?
在CODE上查看代码片派生到我的代码片/usr/share/gazebo-7/worlds$gazebopioneer2dx_laser_camera.world
[html]viewplaincopyprint?
在CODE上查看代码片派生到我的代码片
xmlversion="1.0"?
>
--Ground-->
//ground_plane
--Agloballightsource-->
//sun
--Pioneer2dxmodel-->
//pioneer2dx
//hokuyo
//camera
:
pioneer2dx:
:
chassis
:
camera:
:
link
:
pioneer2dx:
:
chassis
:
hokuyo:
:
link
參考上述模板,可以學習環境文件,主要由大地,光源,機器人模型,機器人模型包括本體,激光和攝像頭等具體配置。
除此之外,還有gzserver和gzclient。
gazebo命令实际上运行两个不同的可执行文件。
第一个称为gzserver,第二个称为gzclient。
gzserver可执行程序运行物理更新循环和传感器数据生成。
这是Gazebo的核心,可以独立
于图形界面使用。
您可能会在论坛中看到“runheadless”这个短语。
这个短语相当于只运行gzserver。
一个示例用例将涉及在不需要用户界面的云计算机上运行gzserver。
gzclient可执行文件运行基于QT的用户界面。
此应用程序提供了一个很好的可视化的模拟,并在各种模拟属性方便的控制。
當然,這兩個可以分別啓動。
gazebo使用的快捷鍵:
ActionOperationInstruction
MODE
EnterSelectionmode(defaultmode)EscpressEscformodetoselectmodelsandright-clickforcontextmenu
press"r"forRotate(model)modetpress"t"forTranslate(model)modepress"s"forScale(model)modepress"n"forSnap(model)mode
LogdataCtrl+dopendialogtorecordlogfilesMISCELLANEOUS
QuitGazeboCtrl+qpressCtrl+"q"toquitGazebo
注意這裏gazebo並不能與ROS通訊,如果需要可以使用下面命令:
[html]viewplaincopyprint?
在CODE上查看代码片派生到我的代码片rosrungazebo_rosgazeborosrungazebo_rosgzserverrosrungazebo_rosgzclientrosrungazebo_rosspawn_modelrosrungazebo_rosperfrosrungazebo_rosdebug啓動後可以看到:
[html]viewplaincopyprint?
在CODE上查看代码片派生到我的代码片~$rostopiclist
/clock
/gazebo/link_states
/gazebo/model_states
/gazebo/parameter_descriptions
/gazebo/parameter_updates
/gazebo/set_link_state
/gazebo/set_model_state
/rosout
/rosout_agg具體在之後筆記中再補充。
附件:
官網教程。
RunGazebo
ThesethreestepswillrunGazebowithadefaultworld.
InstallGazebo.
Openaterminal.OnmostUbuntusystemsyoucanpressCTRL+ALT+tStartGazebobyenteringthefollowingatthecommandprompt.
gazebo
RunGazebowitharobot
Let'ssimulatesomethingabitmoreinterestingbyloadingaworldwithapioneer2dx.
Openaterminalandenterthefollowingcommand.
gazeboworlds/pioneer2dx.world
Wherearetheworldslocated?
Youmayhavenoticedthemysteriousworlds/pioneer2dx.world
argumentintheabovecommand.Thisinstructsgazebotofindthepioneer2dx.worldfile,andloaditonstart.
Worldfilesarelocatedinaversionedsystemdirectory,forexample/usr/share/gazebo-7onUbuntu.IfyouhaveGazebo7.0installedonUbuntu,inaterminaltypethefollowingtoseeacompletelistofworlds.
ls/usr/share/gazebo-7/worlds
ForaGazebo7.0installationonOSXusingHomebrew,typethefollowingtoseeacompletelistofworlds.
ls/usr/local/share/gazebo-7/worlds
Clientandserverseparation
Thegazebo
commandactuallyrunstwodifferentexecutablesforyou.Thefirstiscalledgzserver,andthesecondgzclient.
Thegzserver
executablerunsthephysicsupdate-loopandsensordatageneration.ThisisthecoreofGazebo,andcanbeusedindependentlyofagraphicalinterface.Youmayseethephrase"runheadless"thrownaboutintheforums.Thisphraseequatestorunningonlythegzserver.Anexampleusecasewouldinvolverunninggzserveronacloudcomputerwhereauserinterfaceisnotneeded.
Thegzclient
executablerunsaQTbaseduserinterface.Thisapplicationprovidesanicevisualizationofsimulation,nvenientcontrolsovervarioussimulationproperties.
Tryrunningeachoftheseexecutables.Openaterminalandruntheserver:
gzserver
Openanotherterminalandrunthegraphicalclient:
gzclient
AtthispointyoushouldseetheGazebouserinterface.Yourestartthegzclientapplicationasoftenasyouwant,andevenrunmultipleinterfaces.
ThispagedescribeseachoftheitemsinvolvedinrunningaGazebosimulation.
WorldFiles
Theworlddescriptionfilecontainsalltheelementsinasimulation,includingrobots,lights,sensors,andstaticobjects.ThisfileisformattedusingSDF(SimulationDescriptionFormat),andtypicallyhasa.worldextension.
TheGazeboserver(gzserver
)readsthisfiletogenerateandpopulateaworld.
AnumberofexampleworldsareshippedwithGazebo.Theseworldsarelocatedin
ModelFiles
AmodelfileusesthesameSDFformatasworldfiles,butshouldonlycontainasingle
.Thepurposeofthesefilesistofacilitatemodelreuse,andsimplifyworldfiles.Onceamodelfileiscreated,itcanbeincludedinaworldfileusingthefollowingSDFsyntax:
//model_file_name
Anumberofmodelsareprovidedintheonlinemodeldatabase(inpreviousversions,someexamplemodelswereshippedwithGazebo).AssumingthatyouhaveanInternetconnectionwhenrunningGazebo,youcaninsertanymodelfromthedatabaseandthenecessarycontentwillbedownloadedatruntime.
EnvironmentVariables
Gazebousesanumberofenvironmentvariablestolocatefiles,andsetupcommunicationsbetweentheserverandclients.
StartingwithGazebo1.9.0,defaultvaluesthatworkformostcasesarecompiledin.Thismeansyoudon'tneedtosetanyvariables.
Herearethevariables:
GAZEBO_MODEL_PATH
:
colon-separatedsetofdirectorieswhereGazebowillsearchformodelsGAZEBO_RESOURCE_PATH
:
colon-separatedsetofdirectorieswhereGazebowillsearchforotherresourcessuchasworldandmediafiles.
GAZEBO_MASTER_URI
:
URIoftheGazebomaster.ThisspecifiestheIPandportwheretheserverwillbestartedandtellstheclientswheretoconnectto.
GAZEBO_PLUGIN_PATH
:
colon-separatedsetofdirectorieswhereGazebowillsearchforthepluginsharedlibrariesatruntime.
GAZEBO_MODEL_DATABASE_URI
:
URIoftheonlinemodeldatabasewhereGazebowilldownloadmodelsfrom.
Thesedefaultsarealsoincludedinashellscript:
source
IfyouwanttomodifyGazebo'sbehavior,e.g.,byextendingthepathitsearchesformodels,youshouldfirstsourcetheshellscriptlistedabove,thenmodifythevariablesthatitsets.
GazeboServer
TheserveristheworkhorseofGazebo.Itparsesaworlddescriptionfilegivenonthecommandline,andthensimulatestheworldusingaphysicsandsensorengine.
Theservercanbestartedusingthefollowingcommand.Notethattheserverdoesnotincludeanygraphics;it'smeanttorunheadless.
gzserver
The
relative
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Gazebo 机器人 仿真 学习 探索 笔记 基本 使用说明