Gazebo机器人仿真学习探索笔记四模型编辑.docx
《Gazebo机器人仿真学习探索笔记四模型编辑.docx》由会员分享,可在线阅读,更多相关《Gazebo机器人仿真学习探索笔记四模型编辑.docx(20页珍藏版)》请在冰豆网上搜索。
Gazebo机器人仿真学习探索笔记四模型编辑
Gazebo機器人仿真學習探索筆記(四)模型編輯
模型編輯主要是自定義編輯物體模型構建環境,也可以將多種模型組合爲新模型等,支持外部模型導入,
需要注意的導入模型格式有相應要求,否在無法導入成功,
COLLADA(dae),STereoLithography(stl),ScalableVectorGraphics(svg)。
模型導入界面如下:
以ScalableVectorGraphics(svg)爲例,直接使用下面命令安裝使用:
[html]viewplaincopyprint?
在CODE上查看代码片派生到我的代码片
~$sudoapt-getinstallinkscape
也可以編輯組合模型:
這部分內容都是可視化操作,簡潔易學,可直接參考附錄中的官方文檔。
編輯好的模型可以重命名,然後另存,twotable,會自動生成如下文件。
自動生成的代碼如下所示:
model.config
[html]viewplaincopyprint?
在CODE上查看代码片派生到我的代码片
xmlversion="1.0"?
>
twotable
1.0
model.sdf
model.sdf
[html]viewplaincopyprint?
在CODE上查看代码片派生到我的代码片
xmlversion='1.0'?
>
0
0010-00
1.50.80.03
0.6
0.6
0010-00
1.40.80.04
file:
//media/materials/scripts/gazebo.material
Gazebo/Wood
0.680.380.50-00
0.02
1
0.680.380.50-00
0.02
1
file:
//media/materials/scripts/gazebo.material
Gazebo/Grey
0.68-0.380.50-00
0.02
1
0.68-0.380.50-00
0.02
1
file:
//media/materials/scripts/gazebo.material
Gazebo/Grey
-0.68-0.380.50-00
0.02
1
-0.68-0.380.50-00
0.02
1
file:
//media/materials/scripts/gazebo.material
Gazebo/Grey
-0.680.380.50-00
0.02
1
-0.680.380.50-00
0.02
1
file:
//media/materials/scripts/gazebo.material
Gazebo/Grey
01.23981-0.3240-00
1
0-1.239810.3240-00
model:
///table_marble/meshes/table_lightmap.dae
0.250.250.25
model:
//table_marble/meshes/table_lightmap.dae
0.250.250.25
model:
//table_marble/materials/scripts
model:
//table_marble/materials/textures
Table/Marble_Lightmap
0
0
1
可知,sdf爲1.6版本了。
附錄:
官方文檔
ModelEditor
Overview
ThistutorialdescribestheprocessofcreatingamodelusingtheModelEditor.
OpentheModelEditor
MakesureGazeboisinstalled.
Startupgazebo.
$gazebo
OntheEditmenu,GotoModelEditor,orhitCtrl+Mtoopentheeditor.
Graphicaluserinterface
Theeditoriscomposedofthefollowing2areas:
ThePaletteonthelefthastwotabs.TheInserttabletsyouinsertparts(linksandothermodels)intothescenetobuildthemodel.TheModeltabdisplaysalistofallthepartsthatmakeupthemodelyouarebuilding.
The3DViewontherightwhereyoucanseeapreviewofyourmodelandinteractwithittoedititspropertiesandcreatejointsbetweenlinks.
TheGUItoolsonthetoptoolbarcanbeusedtomanipulatejointsandlinksinthe3DView.
AddLinks
Addsimpleshapes
Themodeleditorhasthreesimpleprimitivegeometriesthattheusercaninsertintothe3Dviewtomakealinkofthemodel.
OnthePalette,clickonthebox,sphere,orcylindericonunderSimpleShapes.
Moveyourmousecursoroverthe3Dviewtoseethevisualappear,andclick/releaseanywheretoaddittothemodel.
Tip:
YoucanpressEsctocanceladdingthecurrentlinkattachedtothemousecursor.
Addmeshes
Toaddacustommesh,
ClickontheAddbuttonunderCustomShapes,whichpopsupadialogthatletsyoufindthemeshyouwanttoadd.
ClickonBrowsebuttonandusethefilebrowsertofindthemeshfileonyourlocalmachine.Ifyouknowthepathofthemeshfile,youcanenteritdirectlyinthetextfieldboxnexttotheBrowsebutton.NoteGazebocurrentlyonlysupportsimportingCOLLADA(dae),STereoLithography(stl),andScalableVectorGraphics(svg)files.
ClickImporttoloadthemeshfile.Then,addittothe3Dview.
CreateJoints
Themodeleditorsupportscreatingseveraltypesofjointsbetweenlinksinthemodelbeingedited.Tocreateajoint:
Clickonthejointicononthetoolbar.ThisbringsuptheJointCreationDialogwhichallowsyoutospecifydifferentpropertiesofthejointyouwanttocreate.Asyoucanseeinthedialog,thedefaultjointtypeisaRevolutejoint.
Beginbymovingyourmouseoverthelinkyouwishtocreateajointfortoseeitbeinghighlightedandclickonit.Thislinkwillbetheparentlinkofthejoint.
Next,moveyourmousetothelinkwhichyouwouldliketobethechildlinkofthejoint.Clickonittoseeacoloredlineconnectingthetwolinksandajointvisualattachedtothechildlink.
Thelinerepresentingthejointiscolor-coded.Playaroundwithdifferentjointtypestoseethecolors.
ThejointvisualconsistsofRGBaxeswhichhelptogiveanideaofthecoordinateframeofthejoint.Theyellowarrowindicatestheprimaryaxisofthejoint.Forexample,inthecaseofarevolutejoint,thisistheaxisofrotation.
OnceyouhavespecifiedallthedesiredpropertiesofthejointintheJointCreationDialog,clickontheCreatebuttonatthebottomtofinalizejointcreation.
Tip:
YoucanpressEscanytimetocancelthejointcreationprocess.
Edityourmodel
Note:
Becarefulwheneditingyourmodel;theeditorcurrentlyhasnooptiontoundoyouractions.
Tip:
Allmeasurementsareinmeters.
Editlinks
ThemodeleditorsupportseditingpropertiesofalinkwhichyouwouldalsofindinitsSDF.
Note:
Gazebo6+supportseditinglinks,visuals,andcollisions.Theabilitytoeditsensorsandpluginsaretobeimplementedinlaterversions.
Toeditalink'sproperties:
Double-clickonthelinkorrightclickandselectOpenLinkInspector.AdialogwindowwillappearwhichcontainsLink,Visual,andCollisionpropertytabs.
Asanexample,trychangingthelinkposeandvisualcolors.Onceyouaredone,clickonOKtoclosetheinspector.
Editjoints
Asmentionedearlier,jointpropertiescanalsobeedited.ThesearepropertiesthatyouwouldfindinthejointSDF.
Toeditajoint:
Double-clickonthelineconnectingthelinksorrightclickonitandselectOpenJointInspector.Thejointinspectorwillappear.
Asanexample,trychangingthejointposeandjointtype.Onceyouaredone,clickonOKtoclosetheinspector.
Savingyourmodel
Savingwillcreateadirectory,SDFandconfigfilesforyourmodel.
Asanexercise,let'sbuildasimplecarandsaveit.Thecarwillhaveaboxchassisandfourcylinderwheels.Eachwheelwillbeconnectedtothechassiswitharevolutejoint:
Onceyou'rehappywiththemodelyoucreated,gototheModeltabintheleftpanelandgiveitaname.
Exit
Whenyou'redonecreatingthemodelandyou'vesavedit,gotoFileandthenExitModelEditor.
Yourmodelwillshowupinthemainwindow.
Editexistingmodels
Ratherthancreatingamodelfromthegroundup;youcanalsoeditexistingmodelsthatarealreadyinthesimulation.
Toeditanexistingmodel:
Makesureyouhavesavedthemodelyoucreated,andyouhaveexitedthemodeleditor.Alternatively,startfromafreshGazeboinstance.
InsertamodelfromtheInserttabontheleft.Forexample,let'sinsertaSimpleArm.
RightclickonthemodelyoujustinsertedandselectEditModel.
Nowyouareinthemodeleditorandyouarefreetoaddnewlinkstothemodeloreditexistingones.
ExtrudeSVGfiles
Overview
Thistutorialdescribestheprocessofextrudi