Gazebo机器人仿真学习探索笔记基本使用说明_第1页
Gazebo机器人仿真学习探索笔记基本使用说明_第2页
Gazebo机器人仿真学习探索笔记基本使用说明_第3页
已阅读5页,还剩17页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Gazebo机器人仿真学习探索笔记(二)基本使用说明Gazebo機器人仿真學習探索筆記(二)基本使用說明在完成Gazebo7安裝後,需要熟悉Gazebo,方便之後使用。htmlviewplaincopyprint?在CODE上查看代码片派生到我的代码片$gazebo/usr/share/gazebo-7/worlds/actor.worldpr2.worldpioneer2dx.worldblank.worldplane_demo.worldcamera.worldplugin.worldcart_demo.worldpolyline.worldcessna_demo.worldpopulat

2、ion.worldcontact.worlddepth_camera.worldpresentation.worldelevator.worldpressure_sensor.worldempty_1_0.worldprojector.worldempty_bullet.worldquad_rotor_demo_2.worldempty_sky.worldquad_rotor_demo.worldempty.worldroad.worldrandom_velocity.worldeverything.worldray_cpu.worldflocking.worldray_noise_plugi

3、n.worldforce_torque_demo.worldroad_textures.worldfriction_demo.worldgripper.worldrobocup09_spl_field.worldheightmap_dem.worldrobocup14_spl_field.worldheightmap.worldrobocup_3Dsim.worldhydra_demo.worldrubble.worldimu_demo.worldseesaw.worldinitial_velocity.worldshapes_bitmask.worldjoint_damping_demo.w

4、orldshapes.worldshapes_layers.worldjoint_friction_demo.worldjoints.worldsim_events.worldlift_drag_demo.worldsimple_arm.worldlights.worldsimple_gripper.worldlinear_battery_demo.worldsingle_rotor_demo.worldlogical_camera.worldsonar_demo.worldmagnetometer.worldsphere_atlas_demo.worldmud_bitmask.worldst

5、acks.worldmud.worldtimer_gui.worldmultilink_shape.worldtorsional_friction_demo.worldnested_model.worldtransporter.worldtrigger.worldopenal.worldortho.worldtwin_rotor_demo.worldosrf_elevator.worldunderwater.worldpioneer2dx_camera.worldwillowgarage.worldpioneer2dx_laser_camera.worldwireless_sensors.wo

6、rldpioneer2dx_laser.world在ubuntu下默認的路徑爲/usr/share/gazebo-7/worlds/。t-deskt&pz讥边yM*1doki0p;F$nZtbo/、T/d4iktj-I1net.wrl-db1*nk.worldcnrtdna.wrIdt曹*i无超申申旷1硝contact.worldd4?ptjhrld&r谿补勺upT料旳.LCKCin*-11,wQ|fIdg.&jppfrhoiijhtfip.worldhoughtup.wrldhyifr#,1疋1Q3mudcnOrVoridinitialvtloclty.worldjcinTdaflpindm

7、o.tafOirldji.wcirl-dHntdrba(t*rydMQ.MrldliOqiicil抽應a.worlddtr亡EG-wt1dndlhstnwIk.BfQ!rIdiidiWGrldultilink讣叩肌mrWn窃Lt*dl血中M略Ij輛口于zip串ml,-口F*军orthn番住rid奠匚亶e詩plrl霜中2廿算l罩丫护于rwQrplan*I*.2。囂Itwrworldt*liyhB0rljybot-dt-ktpi|/u各r/4bAr1寺/用扁上誉局-?w4rld、pionfrcr*Jda:Krlripiarieflo,wrlidpluqmwplMPqLIin*.mrIdlpopul

8、iti$Hi.算厂I1pk机irldp1411zworlHprtss.yre4n-r-网1(10町啊*护-屮IQquidr0!orlmoZ.worldquid/fit由r划刎时j*IMrAiHidAV#1L4CIt-WOl朋tAycpuhqtWrAynolleplugmn.worldr6AtQupWt!.wcrid|T2鞫l事rfria,匕r.irWOrid护、bifmik-MrFl忌乎h=松许Iayvr-$.worldX砂氣視i-Idslevtfiits.wcprluJ1些1色扣-TFldslinpltr_x;ppr.wKirldratordrag.worldtoirurdrto,srliC

9、lt乂忙鲁-丹ridgiii.wDrldtdriiDA*!frictlMdtw.vQirldtSpot之号睜,worIdifl町#*H专门,。亍丫i“中0啓動一個示例,如下:htmlviewplaincopyprint?在CODE上查看代码片派生到我的代码片/usr/share/gazebo-7/worlds$gazebolift_drag_demo.worldI尸啓動一個帶有天空的環境:htmlviewplaincopyprint?在CODE上查看代码片派生到我的代码片/usr/share/gazebo-7/worlds$gazeboempty_sky.worldhtmlviewplainc

10、opyprint?在CODE上查看代码片派生到我的代码片v?xmlversion=1.0?vsdfversion=1.5vworldname=default12v/cloudsvincludemodel:/sunv/includemodel:/ground_planev/include場景中還有光源和大地啓動一個帶有機器人模型的環境:htmlviewplaincopyprint?在CODE上查看代码片派生到我的代码片/usr/share/gazebo-7/worlds$gazebopioneer2dx_laser_camera.worldhtmlviewplaincopyprint?在CODE

11、上查看代码片派生到我的代码片vincludemodel:/ground_planev/includemodel:/sunv/includevmodelname=pioneer2dxmodel:/pioneer2dxv/includevurimodel:hokuyo0.20.38000model:/camera0.20.3000vjointtype=revolutename=camera_jointvparentpioneer2dx:pioneer2dx:chassispioneer2dx:camera:link001O0pioneer2dx:pioneer2dx:chassispioneer2

12、dx:hokuyo:link001vlower00參考上述模板,可以學習環境文件,主要由大地,光源,機器人模型,機器人模型包括本體,激光和攝像頭等具體配置。除此之外,還有gzserver禾口gzclient。gazebo命令实际上运行两个不同的可执行文件。第一个称为gzserver,第二个称为gzclient。gzserver可执行程序运行物理更新循环和传感器数据生成。这是Gazebo的核心,可以独立于图形界面使用。您可能会在论坛中看到“runheadless”这个短语。这个短语相当于只运行gzserver。一个示例用例将涉及在不需要用户界面的云计算机上运行gzserver。gzclient可

13、执行文件运行基于QT的用户界面。此应用程序提供了一个很好的可视化的模拟,并在各种模拟属性方便的控制。當然,這兩個可以分別啓動。gazebo使用的快捷鍵:ActionOperationInstructionMODEEnterSelectionmode(defaultmode)EscpressEscformodetoselectmodelsandright-clickforcontextmenuEnterRotatemoderpressrforRotate(model)modeEnterTranslatemodetpresstforTranslate(model)modeEnterScalemod

14、espresssforScale(model)modeEnterSnapmodenpressnforSnap(model)modeMODELSDeletemodelDeletepressDeletewhenamodelisselectedtodeletefromsceneCopymodelCtrl+cpressCtrl+cwhenmodelisselectedtocopyPastemodelCtrl+vpressCtrl+vtopastecopiedmodelMANIPULATINGMODELSRotatemodelrpressrforRotatemode;clickmodel&rotateu

15、singmarkersTranslatemodeltpresstforTranslatemode;clickmodel&translateusingmarkersScalemodelspresssforScalemode;clickmodel&scaleusingmarkersConstrainalongaxisx/y/zholdkeywhilemanipulatingmodeltoconstrainmovementalongthataxisSnapto45WhenrotatingCtrl+dragholdCtrlwhilerotatingmodeltorotatein45increments

16、SnaptogridwhentranslatingCtrl+dragholdCtrlwhiletranslatingmodeltosnaptogridSnapto1mwhenscalingCtrl+dragholdCtrlwhilescalingmodetoscalein1mincrementsSnapwheninsertingCtrl+dragholdCtrlwhileinsertingmodeltoenablesnaptogridSnapmodelstogethernpressnforSnapmode;clickonelink,thenasecondtosnapfirstlinktosec

17、ondGUILAYOUTHidetoolbarsCtrl+hhide/showtoptoolbarandbottomtimepanelEnterfullscreenF11enter/exitfullscreenActionOperationInstructionEDITORSOpenModelEditorCtrl+mopenModelEditortoconstructoreditmodelsOpenSchematicView(ModelEditor)Ctrl+eopenSchematicViewinModelEditorOpenBuildingEditorCtrl+bopenBuildingE

18、ditortoconstructbuildingsShowfloorplan(BuildingEditor)fshow/hidefloorplaninBuildingEditor2DViewShowbuildingfeatures(BuildingEditor)gshow/hidebuildingfeaturesinBuildingEditor2DViewNewcanvas(bothEditors)Ctrl+ncreatenewcanvasSavemodel(bothEditors)Ctrl+ssavemodeforlateruseSaveas(bothEditors)Ctrl+Shift+s

19、modelforlateruse&giveitanamesaveExit(bothEditors)Ctrl+xexitEditorWORLDSaveworldCtrl+spressCtrl+stosaveworldforlateruseSaveasCtrl+Shift+spressCtrl+Shift+stosaveworldforlateruse&giveitaResetworldCtrl+rpressCtrl+namertoresetpressCtrltoresetmodelstotheiroriginalworldtoitsoriginalstateResetmodelposesCtrl

20、+Shift+r+Shift+rposesDATAVisualizetopicsCtrl+topendialogwithlistoftopicscurrentlyadvertizedLogdataCtrl+dopendialogtorecordlogfilesMISCELLANEOUSQuitGazeboCtrl+qpressCtrl+qtoquitGazeboGazebo鼠樽控制堤盘視轴改堑Drag-panDrag+Shih-rotateDouble-clidc=moyetopointDrag=rotale注意這裏gazebo並不能與ROS通訊,如果需要可以使用下面命令:htmlviewpl

21、aincopyprint?在CODE上查看代码片派生到我的代码片rosrungazebo_rosgazeborosrungazebo_rosgzserverrosrungazebo_rosgzclientrosrungazebo_rosspawn_modelrosrungazebo_rosperfrosrungazebo_rosdebug啓動後可以看到:htmlviewplaincopyprint?在CODE上查看代码片派生到我的代码片$rostopiclist/clock/gazebo/link_states/gazebo/model_states/gazebo/parameter_desc

22、riptions/gazebo/parameter_updates/gazebo/set_link_state/gazebo/set_model_state/rosout/rosout_agg具體在之後筆記中再補充。附件:官網教程。RunGazeboThesethreestepswillrunGazebowithadefaultworld.InstallGazebo.Openaterminal.OnmostUbuntusystemsyoucanpressCTRL+ALT+tStartGazebobyenteringthefollowingatthecommandprompt.gazeboRun

23、GazebowitharobotLetssimulatesomethingabitmoreinterestingbyloadingaworldwithapioneer2dx.Openaterminalandenterthefollowingcommand.gazeboworlds/pioneer2dx.worldWherearetheworldslocated?Youmayhavenoticedthemysteriousworlds/pioneer2dx.worldargumentintheabovecommand.Thisinstructsgazebotofindthepioneer2dx.

24、worldfile,andloaditonstart.Worldfilesarelocatedinaversionedsystemdirectory,forexample/usr/share/gazebo-7onUbuntu.IfyouhaveGazebo7.0installedonUbuntu,inaterminaltypethefollowingtoseeacompletelistofworlds.ls/usr/share/gazebo-7/worldsForaGazebo7.0installationonOSXusingHomebrew,typethefollowingtoseeacom

25、pletelistofworlds.ls/usr/local/share/gazebo-7/worldsClientandserverseparationThegazebocommandactuallyrunstwodifferentexecutablesforyou.Thefirstiscalledgzserver,andthesecondgzclient.Thegzserverexecutablerunsthephysicsupdate-loopandsensordatageneration.ThisisthecoreofGazebo,andcanbeusedindependentlyof

26、agraphicalinterface.Youmayseethephraserunheadlessthrownaboutintheforums.Thisphraseequatestorunningonlythegzserver.Anexampleusecasewouldinvolverunninggzserveronacloudcomputerwhereauserinterfaceisnotneeded.ThegzclientexecutablerunsaQTbaseduserinterface.Thisapplicationprovidesanicevisualizationofsimula

27、tion,nvenientcontrolsovervarioussimulationproperties.Tryrunningeachoftheseexecutables.Openaterminalandruntheserver:gzserverOpenanotherterminalandrunthegraphicalclient:gzclientAtthispointyoushouldseetheGazebouserinterface.Yourestartthegzclientapplicationasoftenasyouwant,andevenrunmultipleinterfaces.T

28、hispagedescribeseachoftheitemsinvolvedinrunningaGazebosimulation.WorldFilesTheworlddescriptionfilecontainsalltheelementsinasimulation,includingrobots,lights,sensors,andstaticobjects.ThisfileisformattedusingSDF(SimulationDescriptionFormat),andtypicallyhasa.worldextension.TheGazeboserver(gzserver)read

29、sthisfiletogenerateandpopulateaworld.AnumberofexampleworldsareshippedwithGazebo.Theseworldsarelocatedinvinstall_path/share/gazebo-/worldsModelFilesAmodelfileusesthesameSDFformatasworldfiles,butshouldonlycontainasingle.Thepurposeofthesefilesistofacilitatemodelreuse,andsimplifyworldfiles.Onceamodelfil

30、eiscreated,itcanbeincludedinaworldfileusingthefollowingSDFsyntax:model:/model_file_namev/includeAnumberofmodelsareprovidedintheonlinemodeldatabase(inpreviousversions,someexamplemodelswereshippedwithGazebo).AssumingthatyouhaveanInternetconnectionwhenrunningGazebo,youcaninsertanymodelfromthedatabasean

31、dthenecessarycontentwillbedownloadedatruntime.EnvironmentVariablesGazebousesanumberofenvironmentvariablestolocatefiles,andsetupcommunicationsbetweentheserverandclients.StartingwithGazebo1.9.0,defaultvaluesthatworkformostcasesarecompiledin.Thisyoudontneedtosetanyvariables.meansHerearethevariables:GAZ

32、EBOMODELPATHcolon-separatedsetofdirectorieswhereGazebowillsearchformodelsGAZEBORESOURCEPATHcolon-separatedsetofdirectorieswhereGazebowillsearchforotherresourcessuchasworldandmediafiles.GAZEBOMASTERURI:URIoftheGazebomaster.ThisspecifiestheIPandportwheretheserverwillbestartedandtellstheclientswheretoc

33、onnectto.GAZEBOPLUGINPATHcolon-separatedsetofdirectorieswhereGazebowillsearchforthepluginsharedlibrariesatruntime.GAZEBO_MODEL_DATABASE_URI:URIoftheonlinemodeldatabasewhereGazebowilldownloadmodelsfrom.Thesedefaultsarealsoincludedinashellscript:source/share/gazebo/setup.shIfyouwanttomodifyGazebosbeha

34、vior,eg,byextendingthepathitsearchesformodels,youshouldfirstsourcetheshellscriptlistedabove,thenmodifythevariablesthatitsets.GazeboServerTheserveristheworkhorseofGazebo.Itparsesaworlddescriptionfilegivenonthecommandline,andthensimulatestheworldusingaphysicsandsensorengine.Theservercanbestartedusingt

35、hefollowingcommand.Notethattheserverdoesnotincludeanygraphics;itsmeanttorunheadless.gzserverThecanbe:relativetothecurrentdirectory,anabsolutepath,orrelativetoapathcomponentinGAZEBO_RESOURCE_PATHWorldsthatareshippedwithGazeboarelocatedinvinstall_path/share/gazebo-/worldsForexample,tousetheempty.world

36、whichisshippedwithGazebo,usethefollowingcommandgzserverworlds/empty.worldGraphicalClientThegraphicalclientconnectstoarunninggzserverandvisualizestheelements.Thisisalsoatoolwhichallowsyoutomodifytherunningsimulation.Thegraphicalclientisrunusing:gzclientServer+GraphicalClientinoneThegazebocommandcombi

37、nesserverandclientinoneexecutable.Insteadofrunninggzserverworlds/empty.worldandthengzclient,youcandothis:gazeboworlds/empty.worldPluginsPluginsprovideasimpleandconvenientmechanismtointerfacewithGazebo.Pluginscaneitherbeloadedonthecommandline,orspecifiedinaworld/modelfile(seetheSDFformat).Pluginsspec

38、ifiedonthecommandlineareloadedfirst,thenpluginsspecifiedintheworld/modelfilesareloaded.Mostpluginsareloadedbytheserver;however,pluginscanalsobeloadedbythegraphicalclienttofacilitatecustomGUIgeneration.Exampleofloadingapluginonthecommandline:gzserver-sThesamemechanismisusedbythegraphicalclient:gzclie

39、nt-gvplugin_filenameFormoreinformationrefertothepluginsoverviewpage.IntroductionGazebousesadistributedarchitecturewithexecutableprogramsforrunningsimulations:aservergzserverseparatelibrariessimulation,rendering,communication,generation.Additionally,foruserinterface,andsensogazeboprovidestwoforsimula

40、tingthephysics,rendering,andsensorsaclientgzclientthatprovidesagraphicalinterfacetovisualizeandinteractwiththesimulationTheclientandservercommunicateusingthegazebocommunicationlibrary.CommunicationBetweenProcessesThecommunicationlibrarycurrentlyusestheopensourceGoogleProtobufforthemessageserializati

41、onandboost:ASIOforthetransportmechanism.ltsupportsthepublish/subscribecommunicationparadigm.Forexample,asimulatedworldpublishesbodyposeupdates,andsensorgenerationandGUIwillconsumethesemessagestoproduceoutput.Thismechanismallowsforintrospectionofarunningsimulation,andprovidesaconvenientmechanismtocon

42、trolaspectsofGazebo.SystemGazeboMasterThisisessentiallyatopicnameserver.Itprovidesnamelookup,andtopicmanagement.Asinglemastercanhandlemultiplephysicssimulations,sensorgenerators,andGUIs.CommunicationLibraryDependencies:Protobufandboost:ASIOExternalAPI:InternalAPI:NoneAdvertisedTopics:NoneSubscribedT

43、opics:NoneThislibraryisusedbyalmostallsubsequentlibraries.ItactsasthecommunicationandtransportmechanismforGazebo.Itcurrentlysupportsonlypublish/subscribe,butitispossibletouseRPCwithminimaleffort.PhysicsLibraryDependencies:Dynamicsengine(withinternalcollisiondetection)ExternalAPI:Providesasimpleandge

44、nericinterfacetophysicssimulationInternalAPI:Definesafundamentalinterfacetothephysicslibraryfor3rdpartydynamicengines.Thephysicslibraryprovidesasimpleandgenericinterfacetofundamentalsimulationengines:components,includingrigidbodies,collisionshapes,andjointsarticulationeonstraints.Thisintegratedwithf

45、ourforrepresentinginterfaceopen-sourcephysicsOpenDynamicsEngine(ODE)BulletSimbodyDynamicAnimationandRoboticsToolkit(DART)AmodeldescribedintheSimulationDescriptionFormat(SDF)usingXMLcanbeloadedbyeachofthesephysicsengines.Thisprovidesaccesstodifferentalgorithmimplementationsandsimulationfeatures.RenderingLibraryDependencies:OGR

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论