Gazebo機器人仿真學(xué)習(xí)探索筆記(二)基本使用說明_第1頁
Gazebo機器人仿真學(xué)習(xí)探索筆記(二)基本使用說明_第2頁
Gazebo機器人仿真學(xué)習(xí)探索筆記(二)基本使用說明_第3頁
Gazebo機器人仿真學(xué)習(xí)探索筆記(二)基本使用說明_第4頁
Gazebo機器人仿真學(xué)習(xí)探索筆記(二)基本使用說明_第5頁
已閱讀5頁,還剩7頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、Gazebo機器人仿真學(xué)習(xí)探索筆記(二)基本使用說明在完成Gazebo7安裝後,需要熟悉Gazebo,方便之後使用。actor.worldblank.worldcamera.worldcart_demo.worldcessna_demo.worldcontact.worlddepth_camera.worldelevator.worldempty_1_0.worldempty_bullet.worldempty_sky.worldempty.worldeverything.worldflocking.worldhtmlviewplaincopyprint?在CODE上查看代碼片派生到我的代碼片

2、$gazebofrelaybotreLaybot-desktop:-rtlsybo煽硯1jybotdcsfctop:Gazebo7自帶了很多構(gòu)建好的環(huán)境模型,可以直接使用,這些模型位置和安裝路徑相關(guān):htmlviewplaincopyprint?在CODE上查看代碼片派生到我的代碼片relaybotrelaybot-desktop:$ls/usr/share/gazebo-7/worlds/pioneer2dx.worldplane_demo.worldplugin.worldpolyline.worldpopulation.worldpr2.worldpresentation.worldpr

3、essure_sensor.worldprojector.worldquad_rotor_demo_2.worldquad_rotor_demo.worldrandom_velocity.worldray_cpu.worldray_noise_plugin.worldforce_torque_demo.worldfriction_demo.worldgripper.worldheightmap_dem.worldheightmap.worldhydra_demo.worldimu_demo.worldroad_textures.worldroad.worldrobocup09_spl_fiel

4、d.worldrobocup14_spl_field.worldrobocup_3Dsim.worldrubble.worldseesaw.worldinitial_velocity.worldshapes_bitmask.worldjoint_damping_demo.worldjoint_friction_demo.worldjoints.worldlift_drag_demo.worldlights.worldlinear_battery_demo.worldlogical_camera.worldmagnetometer.worldmud_bitmask.worldmud.worldm

5、ultilink_shape.worldnested_model.worldopenal.worldortho.worldshapes_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_rot

6、or_demo.worldunderwater.worldwillowgarage.worldwireless_sensors.worldosrf_elevator.worldpioneer2dx_camera.worldpioneer2dx_laser_camera.worldpioneer2dx_laser.world在ubuntu下默認(rèn)的路徑爲(wèi):/usr/share/gazebo-7/worlds/。zrelaybotLaybot-desktop:-J|謚押bo壇SDx44relaysybotIt/usf/shsr-ifr/gajebc9$Z4-ba7/reljybotreljyhotd

7、*sktcip-r$弘/u$r/$hrtfr-7/w&rldj/pi4nr2dx,worldfet9k-virlworldlotion七口fl日cnUctswerldprS-worlddepthrl,4tfipty1i0-warldprojtctijr.wrtoptybwlWt-weri.4qud口t口r時吐m口2rwiilLdtptyshwortnjiqyd口*口W巧幣口-gridr*ckhd4iiv4l0Clty.wr1Idevtythirtgswoldr*聶簞CpU.wOildflocking.world心簞noifeplugin.worldfofeetorque狀g-grid!rotd

8、.world日啊口,塚口曠1日rosd.worldgripper.wgrldrobocup#?splfitldworldh啻ght筒pICGi.iNQr-lldr0bocup!4$plfj,帝Id七口1日heightaCbp.w口Zdcup3Df$Ba廣1日hyd時日佃口.wQif-ldFiibbliuMrIdiMuseesaw-worldweiocity.weildItffiSkrWCH-ldjo2ni日腫pi“g*orlyrs,worldfrictiondj*5BwaridjifitS.wgrWsints.worldlif|日詩g.WCblBC|islsU*i-B,wrcllightSi.

9、worldSsiiipl亡gripMigrl日11穴音聶!;)t(CydCtiORwgr4Idsingler,-ot0iB日曲4gridUgiclcutne&.wfia翻dctio.world位汁gm曹tam色t啻r-w口rI#母wo,wil日muSbitai$kRtHrld$tks,wari|mild-miqridtirgvi-w口1劇ttuitiiink$w*Ndtrsiariilfriticnadeno,wfl-rldma日tl_屏口1我t片巾fportgrid口戸曲力聶I-cirl打triggerswold“rth”wol|tMlnl口tQ時吩恒口-曲ridtUvitorewaifld

10、口血dtFgterswoi*ldg*iorteerjiK乾ee札grid;wliierai!wrldwirtle$f.stms&rs,wrdpl口rter?Sxls$cr.werld啓動一個示例,如下:htmlviewplaincopyprint?在CODE上查看代碼片派生到我的代碼片/usr/share/gazebo-7/worlds$gazebolift_drag_demo.world啓動一個帶有天空的環(huán)境:htmlviewplaincopyprint?在CODE上查看代碼片派生到我的代碼片/usr/share/gazebo-7/worlds$gazeboempty_sky.worldht

11、mlviewplaincopyprint?在CODE上查看代碼片派生到我的代碼片12model:/sunmodel:/ground_plane注意這個環(huán)境中,天空中只有雲(yún)彩速度爲(wèi)12,場景中還有光源和大地。啓動一個帶有機器人模型的環(huán)境:htmlviewplaincopyprint?在CODE上查看代碼片派生到我的代碼片/usr/share/gazebo-7/worlds$gazebopioneer2dx_laser_camera.worldhtmlviewplaincopyprint?在CODE上查看代碼片派生到我的代碼片model:/ground_planemodel:/sunmodel:/

12、pioneer2dxmodel:/hokuyo0.20.38000model:/camera0.20.3000pioneer2dx:pioneer2dx:chassispioneer2dx:camera:link00100pioneer2dx:pioneer2dx:chassispioneer2dx:hokuyo:link00100參考上述模板,可以學(xué)習(xí)環(huán)境文件,主要由大地,光源,機器人模型,機器人模型包括本體,激光和攝像頭等具體配置。除此之外,還有g(shù)zserver和gzclient。gazebo命令實際上運行兩個不同的可執(zhí)行文件。第一個稱為gzserver,第二個稱為gzclient。gzs

13、erver可執(zhí)行程序運行物理更新循環(huán)和傳感器數(shù)據(jù)生成。這是Gazebo的核心,可以獨立于圖形界面使用。您可能會在論壇中看到“runheadless”這個短語。這個短語相當(dāng)于只運行g(shù)zserver。一個示例用例將涉及在不需要用戶界面的云計算機上運行g(shù)zserver。gzclient可執(zhí)行文件運行基于QT的用戶界面。此應(yīng)用程序提供了一個很好的可視化的模擬,并在各種模擬屬性方便的控制。當(dāng)然,這兩個可以分別啓動。gazebo使用的快捷鍵:ActionOperationInstructionMODEEnterSelectionmode(defaultmode)EscpressEscformodetose

14、lectmodelsandright-clickforcontextmenuEnterRotatemoderEnterTranslatemodeEnterScalemodesEnterSnapmodenMODELSDeletemodelDeleteCopymodelCtrl+cpressrforRotate(model)modetpresstforTranslate(model)modepresssforScale(model)modepressnforSnap(model)modepressDeletewhenamodelisselectedtodeletefromscenepressCtr

15、l+cwhenmodelisselectedtocopyPastemodelCtrl+vpressCtrl+vtopastecopiedmodelMANIPULATINGMODELSRotatemodelrpressrforRotatemode;clickmodel&rotateusingmarkersTranslatemodeltpresstforTranslatemode;clickmodel&translateusingmarkersScalemodelspresssforScalemode;clickmodel&scaleusingmarkersConstrainalongaxisx/

16、y/zholdkeywhilemanipulatingmodeltoconstrainmovementalongthataxisholdCtrlwhilerotatingmodeltorotatein45holdCtrlwhiletranslatingmodeltosnaptogridholdCtrlwhilescalingmodetoscalein1mSnapto45whenrotatingCtrl+dragincrementsSnaptogridwhentranslatingCtrl+dragSnapto1mwhenscalingCtrl+dragincrementsSnapwhenins

17、ertingSnapmodelstogetherlinktosecondCtrl+dragholdCtrlwhileinsertingmodeltoenablesnaptogridnpressnforSnapmode;clickonelink,thenasecondtosnapfirstGUILAYOUTHidetoolbarsCtrl+hhide/showtoptoolbarandbottomtimepanelEnterfullscreenF11enter/exitfullscreenActionOperationInstructionEDITORSOpenModelEditorCtrl+m

18、openModelEditortoconstructoreditmodelsOpenSchematicView(ModelEditor)Ctrl+eopenSchematicViewinModelEditorOpenBuildingEditorCtrl+bopenBuildingEditortoconstructbuildingsShowfloorplan(BuildingEditor)fshow/hidefloorplaninBuildingEditor2DViewShowbuildingfeatures(BuildingEditor)gshow/hidebuildingfeaturesin

19、BuildingEditor2DViewNewcanvas(bothEditors)Ctrl+ncreatenewcanvasSavemodel(bothEditors)Ctrl+ssavemodelforlateruseSaveas(bothEditors)Ctrl+Shift+ssavemodelforlateruse&giveitanameExit(bothEditors)Ctrl+xexitEditorWORLDSaveworldCtrl+spressCtrl+stosaveworldforlateruseSaveasCtrl+Shift+spressCtrl+Shift+stosav

20、eworldforlateruse&giveitanameResetworldCtrl+rpressCtrl+rtoresetworldtoitsoriginalstateResetmodelposesCtrl+Shift+rpressCtrl+Shift+rtoresetmodelstotheiroriginalposesDATAVisualizetopicsCtrl+topendialogwithlistoftopicscurrentlyadvertizedLogdataCtrl+dopendialogtorecordlogfilesMISCELLANEOUSQuitGazeboCtrl+

21、qpressCtrl+qtoquitGazeboGazebo鼠標(biāo)控制場昌視角改變Drag=rotateDrag-=panDrag+Shift=rotatEDouble-cfick=movetopointDragup=zaafntnDragdown=zoomoutSingle-clickopensoontejilmenuScroll=zoomin/oul注意這裏gazebo並不能與ROS通訊,如果需要可以使用下面命令:htmlviewplaincopyprint?在CODE上查看代碼片派生到我的代碼片rosrungazebo_rosgazeborosrungazebo_rosgzserverro

22、srungazebo_rosgzclientrosrungazebo_rosspawn_modelrosrungazebo_rosperfrosrungazebo_rosdebug啓動後可以看到:htmlviewplaincopyprint?在CODE上查看代碼片派生到我的代碼片$rostopiclist/clock/gazebo/link_states/gazebo/model_states/gazebo/parameter_descriptions/gazebo/parameter_updates/gazebo/set_link_state/gazebo/set_model_state/r

23、osout/rosout_agg具體在之後筆記中再補充。附件:官網(wǎng)教程。RunGazeboThesethreestepswillrunGazebowithadefaultworld.InstallGazebo.Openaterminal.OnmostUbuntusystemsyoucanpressCTRL+ALT+tStartGazebobyenteringthefollowingatthecommandprompt.gazeboRunGazebowitharobotLetssimulatesomethingabitmoreinterestingbyloadingaworldwithapion

24、eer2dx.Openaterminalandenterthefollowingcommand.gazeboworlds/pioneer2dx.worldWherearetheworldslocated?Youmayhavenoticedthemysteriousworlds/pioneer2dx.worldargumentintheabovecommand.Thisinstructsgazebotofindthepioneer2dx.worldfile,andloaditonstart.Worldfilesarelocatedinaversionedsystemdirectory,forex

25、ample/usr/share/gazebo-7onUbuntu.IfyouhaveGazebo7.0installedonUbuntu,inaterminaltypethefollowingtoseeacompletelistofworlds.ls/usr/share/gazebo-7/worldsForaGazebo7.0installationonOSXusingHomebrew,typethefollowingtoseeacompletelistofworlds.ls/usr/local/share/gazebo-7/worldsClientandserverseparationThe

26、gazebocommandactuallyrunstwodifferentexecutablesforyou.Thefirstiscalledgzserver,andthesecondgzclient.Thegzserverexecutablerunsthephysicsupdate-loopandsensordatageneration.ThisisthecoreofGazebo,andcanbeusedindependentlyofagraphicalinterface.Youmayseethephraserunheadlessthrownaboutintheforums.Thisphra

27、seequatestorunningonlythegzserver.Anexampleusecasewouldinvolverunninggzserveronacloudcomputerwhereauserinterfaceisnotneeded.ThegzclientexecutablerunsaQTbaseduserinterface.Thisapplicationprovidesanicevisualizationofsimulation,andco HYPERLINK nvenient nvenientcontrolsovervarioussimulationproperties.Tr

28、yrunningeachoftheseexecutables.Openaterminalandruntheserver:gzserverOpenanotherterminalandrunthegraphicalclient:gzclientAtthispointyoushouldseetheGazebouserinterface.Yourestartthegzclientapplicationasoftenasyouwant,andevenrunmultipleinterfaces.ThispagedescribeseachoftheitemsinvolvedinrunningaGazebos

29、imulation.WorldFilesTheworlddescriptionfilecontainsalltheelementsinasimulation,includingrobots,lights,sensors,andstaticobjects.ThisfileisformattedusingSDF(SimulationDescriptionFormat),andtypicallyhasa.worldextension.TheGazeboserver(gzserver)readsthisfiletogenerateandpopulateaworld.Anumberofexamplewo

30、rldsareshippedwithGazebo.Theseworldsarelocatedin/share/gazebo-/worldsModelFilesAmodelfileusesthesameSDFformatasworldfiles,butshouldonlycontainasingle.Thepurposeofthesefilesistofacilitatemodelreuse,andsimplifyworldfiles.Onceamodelfileiscreated,itcanbeincludedinaworldfileusingthefollowingSDFsyntax:mod

31、el:/model_file_nameAnumberofmodelsareprovidedintheonlinemodeldatabase(inpreviousversions,someexamplemodelswereshippedwithGazebo).AssumingthatyouhaveanInternetconnectionwhenrunningGazebo,youcaninsertanymodelfromthedatabaseandthenecessarycontentwillbedownloadedatruntime.EnvironmentVariablesGazebousesa

32、numberofenvironmentvariablestolocatefiles,andsetupcommunicationsbetweentheserverandclients.StartingwithGazebo1.9.0,defaultvaluesthatworkformostcasesarecompiledin.Thismeansyoudontneedtosetanyvariables.Herearethevariables:GAZEBO_MODEL_PATH:colon-separatedsetofdirectorieswhereGazebowillsearchformodelsG

33、AZEBO_RESOURCE_PATH:colon-separatedsetofdirectorieswhereGazebowillsearchforotherresourcessuchasworldandmediafiles.GAZEBO_MASTER_URI:URIoftheGazebomaster.ThisspecifiestheIPandportwheretheserverwillbestartedandtellstheclientswheretoconnectto.GAZEBO_PLUGIN_PATH:colon-separatedsetofdirectorieswhereGazeb

34、owillsearchforthepluginsharedlibrariesatruntime.GAZEBO_MODEL_DATABASE_URI:URIoftheonlinemodeldatabasewhereGazebowilldownloadmodelsfrom.Thesedefaultsarealsoincludedinashellscript:source/share/gazebo/setup.shIfyouwanttomodifyGazebosbehavior,e.g.,byextendingthepathitsearchesformodels,youshouldfirstsour

35、cetheshellscriptlistedabove,thenmodifythevariablesthatitsets.GazeboServerTheserveristheworkhorseofGazebo.Itparsesaworlddescriptionfilegivenonthecommandline,andthensimulatestheworldusingaphysicsandsensorengine.Theservercanbestartedusingthefollowingcommand.Notethattheserverdoesnotincludeanygraphics;it

36、smeanttorunheadless.gzserverThecanbe:relativetothecurrentdirectory,anabsolutepath,orrelativetoapathcomponentinGAZEBO_RESOURCE_PATHWorldsthatareshippedwithGazeboarelocatedin/share/gazebo-/worldsForexample,tousetheempty.worldwhichisshippedwithGazebo,usethefollowingcommandgzserverworlds/empty.worldGrap

37、hicalClientThegraphicalclientconnectstoarunninggzserverandvisualizestheelements.Thisisalsoatoolwhichallowsyoutomodifytherunningsimulation.Thegraphicalclientisrunusing:gzclientServer+GraphicalClientinoneThegazebocommandcombinesserverandclientinoneexecutable.Insteadofrunninggzserverworlds/empty.worlda

38、ndthengzclient,youcandothis:gazeboworlds/empty.worldPluginsPluginsprovideasimpleandconvenientmechanismtointerfacewithGazebo.Pluginscaneitherbeloadedonthecommandline,orspecifiedinaworld/modelfile(seetheSDFformat).Pluginsspecifiedonthecommandlineareloadedfirst,thenpluginsspecifiedintheworld/modelfiles

39、areloaded.Mostpluginsareloadedbytheserver;however,pluginscanalsobeloadedbythegraphicalclienttofacilitatecustomGUIgeneration.Exampleofloadingapluginonthecommandline:gzserver-sThesamemechanismisusedbythegraphicalclient:gzclient-gFormoreinformationrefertothepluginsoverviewpage.IntroductionGazebousesadi

40、stributedarchitecturewithseparatelibrariesforphysicssimulation,rendering,userinterface,communication,andsensorgeneration.Additionally,gazeboprovidestwoexecutableprogramsforrunningsimulations:aservergzserverforsimulatingthephysics,rendering,andsensorsaclientgzclientthatprovidesagraphicalinterfacetovi

41、sualizeandinteractwiththesimulationTheclientandservercommunicateusingthegazebocommunicationlibrary.CommunicationBetweenProcessesThecommunicationlibrarycurrentlyusestheopensourceGoogleProtobufforthemessageserializationandboost:ASIOforthetransportmechanism.Itsupportsthepublish/subscribecommunicationpa

42、radigm.Forexample,asimulatedworldpublishesbodyposeupdates,andsensorgenerationandGUIwillconsumethesemessagestoproduceoutput.Thismechanismallowsforintrospectionofarunningsimulation,andprovidesaconvenientmechanismtocontrolaspectsofGazebo.SystemGazeboMasterThisisessentiallyatopicnameserver.Itprovidesnam

43、elookup,andtopicmanagement.Asinglemastercanhandlemultiplephysicssimulations,sensorgenerators,andGUIs.CommunicationLibraryDependencies:Protobufandboost:ASIOExternalAPI:InternalAPI:NoneAdvertisedTopics:NoneSubscribedTopics:NoneThislibraryisusedbyalmostallsubsequentlibraries.Itactsasthecommunicationand

44、transportmechanismforGazebo.Itcurrentlysupportsonlypublish/subscribe,butitispossibletouseRPCwithminimaleffort.PhysicsLibraryDependencies:Dynamicsengine(withinternalcollisiondetection)ExternalAPI:ProvidesasimpleandgenericinterfacetophysicssimulationInternalAPI:Definesafundamentalinterfacetothephysics

45、libraryfor3rdpartydynamicengines.Thephysicslibraryprovidesasimpleandgenericinterfacetofundamentalsimulationcomponents,includingrigidbodies,collisionshapes,andjointsforrepresentingarticulationconstraints.Thisinterfacehasbeenintegratedwithfouropen-sourcephysicsengines:OpenDynamicsEngine(ODE)BulletSimbodyDynamicAnimationandRoboticsToolkit(DART)AmodeldescribedintheSimulationDescriptionFormat(SDF)usingXMLcanbeloa

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論