XMLreference.rst 366 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819
  1. =============
  2. XML Reference
  3. =============
  4. Introduction
  5. ------------
  6. This chapter is the reference manual for the MJCF modeling language used in MuJoCo.
  7. .. _CSchema:
  8. XML schema
  9. ~~~~~~~~~~
  10. The table below summarizes the XML elements and their attributes in MJCF. Note that all information in MJCF is entered
  11. through elements and attributes. Text content in elements is not used; if present, the parser ignores it.
  12. .. collapse:: Collapse schema table
  13. :open:
  14. The symbols in the second column of the table have the following meaning:
  15. ====== ===================================================
  16. **!** required element, can appear only once
  17. **?** optional element, can appear only once
  18. **\*** optional element, can appear many times
  19. **R** optional element, can appear many times recursively
  20. ====== ===================================================
  21. .. cssclass:: schema-small
  22. .. include:: XMLschema.rst
  23. .. _CType:
  24. Attribute types
  25. ~~~~~~~~~~~~~~~
  26. | Each attribute has a data type enforced by the parser. The available data types are:
  27. ========= ==============================================================================================
  28. string An arbitrary string, usually specifying a file name or a user-defined name of a model element.
  29. int(N) An array of N integers. If N is omitted it equals 1.
  30. real(N) An array of N real-valued numbers. If N is omitted it equals 1.
  31. [...] Keyword attribute. The list of valid keywords is given in brackets.
  32. ========= ==============================================================================================
  33. |
  34. | For array-type attributes, the length of the array is enforced by the parser unless specified otherwise in the
  35. reference documentation below.
  36. | In addition to having a data type, attributes can be required or optional. Optional attributes can have internal
  37. defaults or not. Optional attributes that do not have internal defaults are initialized in a special undefined state.
  38. This state is different from any valid setting that can be entered in the XML. This mechanism enables the compiler to
  39. determine if the attribute has been "touched" by the user, either explicitly or through defaults, and take
  40. appropriate action. Some attributes have internal defaults (usually 0) which are not actually allowed by the
  41. compiler. When such attributes become relevant in a given context, they must be set to allowed values.
  42. +-------------+--------------------------------------------------------------------------------------------------+
  43. | required | The attribute is required by the parser. If it is not present the parser will generate an error. |
  44. +-------------+--------------------------------------------------------------------------------------------------+
  45. | optional | The attribute is optional. There is no internal default. The attribute is initialized in the |
  46. | | undefined state. |
  47. +-------------+--------------------------------------------------------------------------------------------------+
  48. | "..." | The attribute is optional. The internal default is given in quotes. |
  49. +-------------+--------------------------------------------------------------------------------------------------+
  50. In the reference documentation below the attribute name is shown in boldface, followed by its data type, followed by the
  51. required/optional status including the internal default if any. For example, the attribute angle is a keyword attribute
  52. whose value can be "radian" or "degree". It is an optional attribute and has internal default "degree". Therefore it
  53. will appear in the reference documentation as
  54. :at:`angle`: :at-val:`[radian, degree], "degree"`
  55. .. raw:: html
  56. <p style="display: none"></p>
  57. .. _Reference:
  58. MJCF Reference
  59. --------------
  60. MJCF files have a unique top-level element :ref:`mujoco <mujoco>`. The next-level elements are referred to as
  61. *sections*. They are all optional. Some sections are merely used for grouping and have no attributes. Sections can be
  62. repeated, to facilitate merging of models via the :ref:`include <include>` element. The *order* of attributes within an
  63. element can be arbitrary. The order of child elements within a parent element can also be arbitrary, with four
  64. exceptions:
  65. - The order of :ref:`joint <body-joint>` elements within a :ref:`body <body>` matters because joint transformations are
  66. performed in sequence.
  67. - The order of elements in a :ref:`spatial <tendon-spatial>` tendon matters because it determines the sequence of
  68. objects that the tendon passes through or wraps around.
  69. - The order of repeated sections matters when the same attribute is set multiple times to different values. In that
  70. case the last setting takes effect for the entire model.
  71. - The order of multiple actuator shortcuts in the same defaults class matters, because each shortcut sets the
  72. attributes of the single :ref:`general <actuator-general>` element in that defaults class, overriding the previous
  73. settings.
  74. In the remainder of this chapter we describe all valid MJCF elements and their attributes. Some elements can be used in
  75. multiple contexts, in which case their meaning depends on the parent element. This is why we always show the parent as a
  76. prefix in the documentation below.
  77. .. _meta-element:
  78. Meta elements
  79. ~~~~~~~~~~~~~
  80. These elements are not strictly part of the low-level MJCF format definition, but rather instruct the compiler to
  81. perform some operation on the model. A general property of meta-elements is that they disappear from the model upon
  82. saving the XML. There are currently six meta-elements in MJCF:
  83. - :ref:`include<include>`, :ref:`frame<frame>`, and :ref:`replicate<replicate>` which are outside of the schema.
  84. - :ref:`composite<body-composite>`, :ref:`flexcomp<body-flexcomp>` and :ref:`attach<body-attach>` which are part of the
  85. schema, but serve to procedurally generate other MJCF elements.
  86. .. _frame:
  87. **frame** (R)
  88. ^^^^^^^^^^^^^
  89. The frame meta-element is a pure coordinate transformation that can wrap any group of elements in the kinematic tree
  90. (under :ref:`worldbody<body>`). After compilation, frame elements disappear and their transformation is accumulated
  91. in their direct children. The attributes of the frame meta-element are documented :ref:`below<body-frame>`.
  92. .. collapse:: Usage example of frame
  93. Loading this model and saving it:
  94. .. code-block:: xml
  95. <mujoco>
  96. <worldbody>
  97. <frame quat="0 0 1 0">
  98. <geom name="Alice" quat="0 1 0 0" size="1"/>
  99. </frame>
  100. <frame pos="0 1 0">
  101. <geom name="Bob" pos="0 1 0" size="1"/>
  102. <body name="Carl" pos="1 0 0">
  103. ...
  104. </body>
  105. </frame>
  106. </worldbody>
  107. </mujoco>
  108. Results in this model:
  109. .. code-block:: xml
  110. <mujoco>
  111. <worldbody>
  112. <geom name="Alice" quat="0 0 0 1" size="1"/>
  113. <geom name="Bob" pos="0 2 0" size="1"/>
  114. <body name="Carl" pos="1 1 0">
  115. ...
  116. </body>
  117. </worldbody>
  118. </mujoco>
  119. Note that in the saved model, the frame elements have disappeared but their transformation was accumulated with those
  120. of their child elements.
  121. .. _replicate:
  122. **replicate** (R)
  123. ^^^^^^^^^^^^^^^^^
  124. The replicate element duplicates the enclosed kinematic tree elements with incremental translational and rotational
  125. offsets, adding namespace suffixes to avoid name collisions. Appended suffix strings are integers in the
  126. range ``[0...count-1]`` with the minimum number of digits required to represent the total element count (i.e., if
  127. replicating 200 times, suffixes will be ``000, 001, ...`` etc). All referencing elements are automatically replicated
  128. and namespaced appropriately. Detailed examples of models using replicate can be found in the
  129. `model/replicate/ <https://github.com/google-deepmind/mujoco/tree/main/model/replicate>`__ directory.
  130. There is a caveat concerning :ref:`keyframes<keyframe>` when using replicate. Since :ref:`mjs_attachFrame` is used to
  131. self-attach multiple times the enclosed kinematic tree, if this tree contains further :ref:`attach<body-attach>`
  132. elements, keyframes will not be replicated nor namespaced by :ref:`replicate<replicate>`, but they will be attached and
  133. namespaced once by the innermost call of :ref:`mjs_attachFrame` or :ref:`mjs_attachBody`. See the limitations discussed
  134. in :ref:`attach<body-attach>`.
  135. .. _replicate-count:
  136. :at:`count`: :at-val:`int, required`
  137. The number of replicas. Must be positive.
  138. .. _replicate-sep:
  139. :at:`sep`: :at-val:`string, optional`
  140. The namespace separator. This optional string is prepended to the namespace suffix string. Note that for nested
  141. replicate elements, the innermost namespace suffixes are appended first.
  142. .. _replicate-offset:
  143. :at:`offset`: :at-val:`real(3), optional`
  144. Translational offset along the three coordinate axes. In general, the frame of the offset is with respect to the
  145. previous replica, except for the first one which is with respect to the replicate element's parent.
  146. If there is no rotation, these values are always in the frame of the replicate element's parent.
  147. .. _replicate-euler:
  148. :at:`euler`: :at-val:`real(3), optional`
  149. Rotation angles around three coordinate axes between two subsequent replicas. The angular units and rotation sequence
  150. respect the global :ref:`angle<compiler-angle>` and :ref:`eulerseq<compiler-eulerseq>` settings. Rotation is always
  151. with respect to the frame of the previous replica, so total rotation is cumulative.
  152. .. collapse:: Usage example of replicate
  153. Loading this model and saving it:
  154. .. code-block:: xml
  155. <mujoco>
  156. <worldbody>
  157. <replicate count="2" offset="0 1 0" euler="90 0 0">
  158. <replicate count="2" sep="-" offset="1 0 0" euler="0 90 0">
  159. <geom name="Alice" size=".1"/>
  160. </replicate>
  161. </replicate>
  162. </worldbody>
  163. <sensor>
  164. <accelerometer name="Bob" site="Alice"/>
  165. </sensor>
  166. </mujoco>
  167. Results in this model:
  168. .. code-block:: xml
  169. <mujoco>
  170. <worldbody>
  171. <geom name="Alice-00" size="0.1"/>
  172. <geom name="Alice-10" size="0.1" pos="1 0 0" quat="1 0 1 0"/>
  173. <geom name="Alice-01" size="0.1" pos="0 1 0" quat="1 1 0 0"/>
  174. <geom name="Alice-11" size="0.1" pos="1 1 0" quat="0.5 0.5 0.5 0.5"/>
  175. </worldbody>
  176. <sensor>
  177. <accelerometer name="Bob-00" site="Alice-00"/>
  178. <accelerometer name="Bob-10" site="Alice-10"/>
  179. <accelerometer name="Bob-01" site="Alice-01"/>
  180. <accelerometer name="Bob-11" site="Alice-11"/>
  181. </sensor>
  182. </mujoco>
  183. .. _include:
  184. **include** (*)
  185. ^^^^^^^^^^^^^^^
  186. This element does not strictly belong to MJCF. Instead it is a meta-element, used to assemble multiple XML
  187. files in a single document object model (DOM) before parsing. The included file must be a valid XML file with a unique
  188. top-level element. This top-level element is removed by the parser, and the elements below it are inserted at the
  189. location of the :el:`include` element. At least one element must be inserted as a result of this procedure. The
  190. :el:`include` element can be used where ever an XML element is expected in the MJCF file. Nested includes are allowed,
  191. however a given XML file can be included at most once in the entire model. After all the included XML files have been
  192. assembled into a single DOM, it must correspond to a valid MJCF model. Other than that, it is up to the user to decide
  193. how to use includes and how to modularize large files if desired.
  194. :at:`file`: :at-val:`string, required`
  195. The name of the XML file to be included. The file location is relative to the directory of the main MJCF file. If the
  196. file is not in the same directory, it should be prefixed with a relative path.
  197. .. _mujoco:
  198. **mujoco** (!)
  199. ~~~~~~~~~~~~~~
  200. The unique top-level element, identifying the XML file as an MJCF model file.
  201. .. _mujoco-model:
  202. :at:`model`: :at-val:`string, "MuJoCo Model"`
  203. The name of the model. This name is shown in the title bar of :ref:`simulate.cc <saSimulate>`.
  204. .. _option:
  205. **option** (*)
  206. ~~~~~~~~~~~~~~
  207. This element is in one-to-one correspondence with the low level structure mjOption contained in the field mjModel.opt of
  208. mjModel. These are simulation options and do not affect the compilation process in any way; they are simply copied into
  209. the low level model. Even though mjOption can be modified by the user at runtime, it is nevertheless a good idea to
  210. adjust it properly through the XML.
  211. .. _option-timestep:
  212. :at:`timestep`: :at-val:`real, "0.002"`
  213. Simulation time step in seconds. This is the single most important parameter affecting the speed-accuracy trade-off
  214. which is inherent in every physics simulation. Smaller values result in better accuracy and stability. To achieve
  215. real-time performance, the time step must be larger than the CPU time per step (or 4 times larger when using the RK4
  216. integrator). The CPU time is measured with internal timers. It should be monitored when adjusting the time step.
  217. MuJoCo can simulate most robotic systems a lot faster than real-time, however models with many floating objects
  218. (resulting in many contacts) are more demanding computationally. Keep in mind that stability is determined not only
  219. by the time step but also by the :ref:`CSolver`; in particular softer constraints can be simulated with larger time
  220. steps. When fine-tuning a challenging model, it is recommended to experiment with both settings jointly. In
  221. optimization-related applications, real-time is no longer good enough and instead it is desirable to run the
  222. simulation as fast as possible. In that case the time step should be made as large as possible.
  223. .. _option-apirate:
  224. :at:`apirate`: :at-val:`real, "100"`
  225. This parameter determines the rate (in Hz) at which an external API allows the update function to be executed. This
  226. mechanism is used to simulate devices with limited communication bandwidth. It only affects the socket API and not
  227. the physics simulation.
  228. .. _option-impratio:
  229. :at:`impratio`: :at-val:`real, "1"`
  230. This attribute determines the ratio of frictional-to-normal constraint impedance for elliptic friction cones. The
  231. setting of solimp determines a single impedance value for all contact dimensions, which is then modulated by this
  232. attribute. Settings larger than 1 cause friction forces to be "harder" than normal forces, having the general effect
  233. of preventing slip, without increasing the actual friction coefficient. For pyramidal friction cones the situation is
  234. more complex because the pyramidal approximation mixes normal and frictional dimensions within each basis vector; it
  235. is not recommended to use high impratio values with pyramidal cones.
  236. .. _option-gravity:
  237. :at:`gravity`: :at-val:`real(3), "0 0 -9.81"`
  238. Gravitational acceleration vector. In the default world orientation the Z-axis points up. The MuJoCo GUI is organized
  239. around this convention (both the camera and perturbation commands are based on it) so we do not recommend deviating
  240. from it.
  241. .. _option-wind:
  242. :at:`wind`: :at-val:`real(3), "0 0 0"`
  243. Velocity vector of the medium (i.e., wind). This vector is subtracted from the 3D translational velocity of each
  244. body, and the result is used to compute viscous, lift and drag forces acting on the body; recall :ref:`Passive forces
  245. <gePassive>` in the Computation chapter. The magnitude of these forces scales with the values of the next two
  246. attributes.
  247. .. _option-magnetic:
  248. :at:`magnetic`: :at-val:`real(3), "0 -0.5 0"`
  249. Global magnetic flux. This vector is used by magnetometer sensors, which are defined as sites and return the magnetic
  250. flux at the site position expressed in the site frame.
  251. .. _option-density:
  252. :at:`density`: :at-val:`real, "0"`
  253. Density of the medium, not to be confused with the geom density used to infer masses and inertias. This parameter is
  254. used to simulate lift and drag forces, which scale quadratically with velocity. In SI units the density of air is
  255. around 1.2 while the density of water is around 1000 depending on temperature. Setting density to 0 disables lift and
  256. drag forces.
  257. .. _option-viscosity:
  258. :at:`viscosity`: :at-val:`real, "0"`
  259. Viscosity of the medium. This parameter is used to simulate viscous forces, which scale linearly with velocity. In SI
  260. units the viscosity of air is around 0.00002 while the viscosity of water is around 0.0009 depending on temperature.
  261. Setting viscosity to 0 disables viscous forces. Note that the default Euler :ref:`integrator <geIntegration>` handles
  262. damping in the joints implicitly – which improves stability and accuracy. It does not presently do this with body
  263. viscosity. Therefore, if the goal is merely to create a damped simulation (as opposed to modeling the specific
  264. effects of viscosity), we recommend using joint damping rather than body viscosity, or switching to the
  265. :at:`implicit` or :at:`implicitfast` integrators.
  266. .. _option-o_margin:
  267. :at:`o_margin`: :at-val:`real, "0"`
  268. This attribute replaces the margin parameter of all active contact pairs when :ref:`Contact override <COverride>` is
  269. enabled. Otherwise MuJoCo uses the element-specific margin attribute of :ref:`geom<body-geom>` or
  270. :ref:`pair<contact-pair>` depending on how the contact pair was generated. See also :ref:`Collision` in the
  271. Computation chapter. The related gap parameter does not have a global override.
  272. .. _option-o_solref:
  273. .. _option-o_solimp:
  274. .. _option-o_friction:
  275. :at:`o_solref`, :at:`o_solimp`, :at:`o_friction`
  276. These attributes replace the solref, solimp and friction parameters of all active contact pairs when contact override is
  277. enabled. See :ref:`CSolver` for details.
  278. .. _option-integrator:
  279. :at:`integrator`: :at-val:`[Euler, RK4, implicit, implicitfast], "Euler"`
  280. This attribute selects the numerical :ref:`integrator <geIntegration>` to be used. Currently the available
  281. integrators are the semi-implicit Euler method, the fixed-step 4-th order Runge Kutta method, the
  282. Implicit-in-velocity Euler method, and :at:`implicitfast`, which drops the Coriolis and centrifugal terms. See
  283. :ref:`Numerical Integration<geIntegration>` for more details.
  284. .. _option-cone:
  285. :at:`cone`: :at-val:`[pyramidal, elliptic], "pyramidal"`
  286. The type of contact friction cone. Elliptic cones are a better model of the physical reality, but pyramidal cones
  287. sometimes make the solver faster and more robust.
  288. .. _option-jacobian:
  289. :at:`jacobian`: :at-val:`[dense, sparse, auto], "auto"`
  290. The type of constraint Jacobian and matrices computed from it. Auto resolves to dense when the number of degrees of
  291. freedom is up to 60, and sparse over 60.
  292. .. _option-solver:
  293. :at:`solver`: :at-val:`[PGS, CG, Newton], "Newton"`
  294. This attribute selects one of the constraint solver :ref:`algorithms <soAlgorithms>` described in the Computation
  295. chapter. Guidelines for solver selection and parameter tuning are available in the :ref:`Algorithms <CAlgorithms>`
  296. section above.
  297. .. _option-iterations:
  298. :at:`iterations`: :at-val:`int, "100"`
  299. Maximum number of iterations of the constraint solver. When the warmstart attribute of :ref:`flag <option-flag>` is
  300. enabled (which is the default), accurate results are obtained with fewer iterations. Larger and more complex systems
  301. with many interacting constraints require more iterations. Note that mjData.solver contains statistics about solver
  302. convergence, also shown in the profiler.
  303. .. _option-tolerance:
  304. :at:`tolerance`: :at-val:`real, "1e-8"`
  305. Tolerance threshold used for early termination of the iterative solver. For PGS, the threshold is applied to the cost
  306. improvement between two iterations. For CG and Newton, it is applied to the smaller of the cost improvement and the
  307. gradient norm. Set the tolerance to 0 to disable early termination.
  308. .. _option-ls_iterations:
  309. :at:`ls_iterations`: :at-val:`int, "50"`
  310. Maximum number of linesearch iterations performed by CG/Newton constraint solvers. Ensures that at most
  311. :ref:`iterations<option-iterations>` times :ref:`ls_iterations<option-ls_iterations>` linesearch iterations are
  312. performed during each constraint solve.
  313. .. _option-ls_tolerance:
  314. :at:`ls_tolerance`: :at-val:`real, "0.01"`
  315. Tolerance threshold used for early termination of the linesearch algorithm.
  316. .. _option-noslip_iterations:
  317. :at:`noslip_iterations`: :at-val:`int, "0"`
  318. Maximum number of iterations of the Noslip solver. This is a post-processing step executed after the main solver. It
  319. uses a modified PGS method to suppress slip/drift in friction dimensions resulting from the soft-constraint model.
  320. The default setting 0 disables this post-processing step.
  321. .. _option-noslip_tolerance:
  322. :at:`noslip_tolerance`: :at-val:`real, "1e-6"`
  323. Tolerance threshold used for early termination of the Noslip solver.
  324. .. _option-ccd_iterations:
  325. :at:`ccd_iterations`: :at-val:`int, "50"`
  326. Maximum number of iterations of the algorithm used for convex collisions. This rarely needs to be adjusted,
  327. except in situations where some geoms have very large aspect ratios.
  328. .. _option-ccd_tolerance:
  329. :at:`ccd_tolerance`: :at-val:`real, "1e-6"`
  330. Tolerance threshold used for early termination of the convex collision algorithm.
  331. .. _option-sdf_iterations:
  332. :at:`sdf_iterations`: :at-val:`int, "10"`
  333. Number of iterations used for Signed Distance Field collisions (per initial point).
  334. .. _option-sdf_initpoints:
  335. :at:`sdf_initpoints`: :at-val:`int, "40"`
  336. Number of starting points used for finding contacts with Signed Distance Field collisions.
  337. .. youtube:: H9qG9Zf2W44
  338. :align: right
  339. :width: 240px
  340. .. _option-actuatorgroupdisable:
  341. :at:`actuatorgroupdisable`: :at-val:`int(31), optional`
  342. List of actuator groups to disable. Actuators whose :ref:`group<actuator-general-group>` is in this list will produce
  343. no force. If they are stateful, their activation states will not be integrated. Internally this list is
  344. implemented as an integer bitfield, so values must be in the range ``0 <= group <= 30``. If not set, all actuator
  345. groups are enabled. See `example model
  346. <https://github.com/google-deepmind/mujoco/blob/main/test/engine/testdata/actuation/actuator_group_disable.xml>`__
  347. and associated screen-capture on the right.
  348. .. _option-flag:
  349. :el-prefix:`option/` |-| **flag** (?)
  350. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  351. This element sets the flags that enable and disable different parts of the simulation pipeline. The actual flags used at
  352. runtime are represented as the bits of two integers, namely mjModel.opt.disableflags and mjModel.opt.enableflags, used
  353. to disable standard features and enable optional features respectively. The reason for this separation is that setting
  354. both integers to 0 restores the default. In the XML we do not make this separation explicit, except for the default
  355. attribute values - which are "enable" for flags corresponding to standard features, and "disable" for flags
  356. corresponding to optional features. In the documentation below, we explain what happens when the setting is different
  357. from its default.
  358. .. _option-flag-constraint:
  359. :at:`constraint`: :at-val:`[disable, enable], "enable"`
  360. This flag disables all standard computations related to the constraint solver. As a result, no constraint forces are
  361. applied. Note that the next four flags disable the computations related to a specific type of constraint. Both this
  362. flag and the type-specific flag must be set to "enable" for a given computation to be performed.
  363. .. _option-flag-equality:
  364. :at:`equality`: :at-val:`[disable, enable], "enable"`
  365. This flag disables all standard computations related to equality constraints.
  366. .. _option-flag-frictionloss:
  367. :at:`frictionloss`: :at-val:`[disable, enable], "enable"`
  368. This flag disables all standard computations related to friction loss constraints.
  369. .. _option-flag-limit:
  370. :at:`limit`: :at-val:`[disable, enable], "enable"`
  371. This flag disables all standard computations related to joint and tendon limit constraints.
  372. .. _option-flag-contact:
  373. :at:`contact`: :at-val:`[disable, enable], "enable"`
  374. This flag disables collision detection and all standard computations related to contact constraints.
  375. .. _option-flag-passive:
  376. :at:`passive`: :at-val:`[disable, enable], "enable"`
  377. This flag disables the simulation of joint and tendon spring-dampers, fluid dynamics forces, and custom passive
  378. forces computed by the :ref:`mjcb_passive` callback. As a result, no passive forces are applied.
  379. .. _option-flag-gravity:
  380. :at:`gravity`: :at-val:`[disable, enable], "enable"`
  381. This flag causes the gravitational acceleration vector in mjOption to be replaced with (0 0 0) at runtime, without
  382. changing the value in mjOption. Once the flag is re-enabled, the value in mjOption is used.
  383. .. _option-flag-clampctrl:
  384. :at:`clampctrl`: :at-val:`[disable, enable], "enable"`
  385. This flag disables the clamping of control inputs to all actuators, even if the actuator-specific attributes are set
  386. to enable clamping.
  387. .. _option-flag-warmstart:
  388. :at:`warmstart`: :at-val:`[disable, enable], "enable"`
  389. This flag disables warm-starting of the constraint solver. By default the solver uses the solution (i.e., the
  390. constraint force) from the previous time step to initialize the iterative optimization. This feature should be
  391. disabled when evaluating the dynamics at a collection of states that do not form a trajectory - in which case warm
  392. starts make no sense and are likely to slow down the solver.
  393. .. _option-flag-filterparent:
  394. :at:`filterparent`: :at-val:`[disable, enable], "enable"`
  395. This flag disables the filtering of contact pairs where the two geoms belong to a parent and child body; recall
  396. contact :ref:`selection <coSelection>` in the Computation chapter.
  397. .. _option-flag-actuation:
  398. :at:`actuation`: :at-val:`[disable, enable], "enable"`
  399. This flag disables all standard computations related to actuator forces, including the actuator dynamics. As a
  400. result, no actuator forces are applied to the simulation.
  401. .. _option-flag-refsafe:
  402. :at:`refsafe`: :at-val:`[disable, enable], "enable"`
  403. This flag enables a safety mechanism that prevents instabilities due to solref[0] being too small compared to the
  404. simulation timestep. Recall that solref[0] is the stiffness of the virtual spring-damper used for constraint
  405. stabilization. If this setting is enabled, the solver uses max(solref[0], 2*timestep) in place of solref[0]
  406. separately for each active constraint.
  407. .. _option-flag-sensor:
  408. :at:`sensor`: :at-val:`[disable, enable], "enable"`
  409. This flag disables all computations related to sensors. When disabled, sensor values will remain constant, either
  410. zeros if disabled at the start of simulation, or, if disabled at runtime, whatever value was last computed.
  411. .. _option-flag-midphase:
  412. :at:`midphase`: :at-val:`[disable, enable], "enable"`
  413. This flag disables the mid-phase collision filtering using a static AABB bounding volume hierarchy (a BVH binary
  414. tree). If disabled, all geoms pairs that are allowed to collide are checked for collisions.
  415. .. _option-flag-eulerdamp:
  416. :at:`eulerdamp`: :at-val:`[disable, enable], "enable"`
  417. This flag disables implicit integration with respect to joint damping in the Euler integrator. See the
  418. :ref:`Numerical Integration<geIntegration>` section for more details.
  419. .. _option-flag-autoreset:
  420. :at:`autoreset`: :at-val:`[disable, enable], "enable"`
  421. This flag disables the automatic reseting of the simulation state when numerical issues are detected.
  422. .. _option-flag-override:
  423. :at:`override`: :at-val:`[disable, enable], "disable"`
  424. This flag enables to :ref:`Contact override <COverride>` mechanism explained above.
  425. .. _option-flag-energy:
  426. :at:`energy`: :at-val:`[disable, enable], "disable"`
  427. This flag enables the computation of kinetic and potential energy, stored in mjData.energy and displayed in the GUI.
  428. This feature adds some CPU time but it is usually negligible. Monitoring energy for a system that is supposed to be
  429. energy-conserving is one of the best ways to assess the accuracy of a complex simulation.
  430. .. _option-flag-fwdinv:
  431. :at:`fwdinv`: :at-val:`[disable, enable], "disable"`
  432. This flag enables the automatic comparison of forward and inverse dynamics. When enabled, the inverse dynamics is
  433. invoked after mj_forward (or internally within mj_step) and the difference in applied forces is recorded in
  434. mjData.solver_fwdinv[2]. The first value is the relative norm of the discrepancy in joint space, the next is in
  435. constraint space.
  436. .. _option-flag-invdiscrete:
  437. :at:`invdiscrete`: :at-val:`[disable, enable], "disable"`
  438. This flag enables discrete-time inverse dynamics with :ref:`mj_inverse` for all
  439. :ref:`integrators<option-integrator>` other than ``RK4``. Recall from the
  440. :ref:`numerical integration<geIntegration>` section that the one-step integrators (``Euler``, ``implicit`` and
  441. ``implicitfast``), modify the mass matrix :math:`M \rightarrow M-hD`. This implies that finite-differenced
  442. accelerations :math:`(v_{t+h} - v_t)/h` will not correspond to the continuous-time acceleration ``mjData.qacc``.
  443. When this flag is enabled, :ref:`mj_inverse` will interpret ``qacc`` as having been computed from the difference of
  444. two sequential velocities, and undo the above modification.
  445. .. _option-flag-multiccd:
  446. :at:`multiccd`: :at-val:`[disable, enable], "disable"` |nbsp| |nbsp| |nbsp| (experimental feature)
  447. This flag enables multiple-contact collision detection for geom pairs that use a general-purpose convex-convex
  448. collider e.g., mesh-mesh collisions. This can be useful when the contacting geoms have a flat surface, and the
  449. single contact point generated by the convex-convex collider cannot accurately capture the surface contact, leading
  450. to instabilities that typically manifest as sliding or wobbling. Multiple contact points are found by rotating the
  451. two geoms by ±1e-3 radians around the tangential axes and re-running the collision function. If a new contact is
  452. detected it is added, allowing for up to 4 additional contact points. This feature is currently considered
  453. experimental, and both the behavior and the way it is activated may change in the future.
  454. .. _option-flag-island:
  455. :at:`island`: :at-val:`[disable, enable], "disable"`
  456. This flag enables discovery of constraint islands: disjoint sets of constraints and
  457. degrees-of-freedom that do not interact. The flag currently has no effect on the physics pipeline, but enabling it
  458. allows for `island visualization <https://youtu.be/Vc1tq0fFvQA>`__.
  459. In a future release, the constraint solver will exploit the disjoint nature of constraint islands.
  460. .. _option-flag-nativeccd:
  461. :at:`nativeccd`: :at-val:`[disable, enable], "disable"`
  462. This flag enables the native convex collision detection pipeline instead of using the
  463. `libccd library <https://github.com/danfis/libccd>`__.
  464. .. _compiler:
  465. **compiler** (*)
  466. ~~~~~~~~~~~~~~~~
  467. This element is used to set options for the built-in parser and compiler. After parsing and compilation it no longer
  468. has any effect. The settings here are global and apply to the entire model.
  469. .. _compiler-autolimits:
  470. :at:`autolimits`: :at-val:`[false, true], "true"`
  471. This attribute affects the behavior of attributes such as "limited" (on <body-joint> or <tendon>), "forcelimited",
  472. "ctrllimited", and "actlimited" (on <actuator>). If "true", these attributes are unnecessary and their value
  473. will be inferred from the presence of their corresponding "range" attribute.
  474. If "false", no such inference will happen: For a joint to be limited, both limited="true" and range="min max" must
  475. be specified. In this mode, it is an error to specify a range without a limit.
  476. .. _compiler-boundmass:
  477. :at:`boundmass`: :at-val:`real, "0"`
  478. This attribute imposes a lower bound on the mass of each body except for the world body. Setting this attribute to
  479. a value greater than 0 can be used as a quick fix for poorly designed models that contain massless moving bodies,
  480. such as the dummy bodies often used in URDF models to attach sensors. Note that in MuJoCo there is no need to create
  481. dummy bodies.
  482. .. _compiler-boundinertia:
  483. :at:`boundinertia`: :at-val:`real, "0"`
  484. This attribute imposes a lower bound on the diagonal inertia components of each body except for the world body. Its
  485. use is similar to boundmass above.
  486. .. _compiler-settotalmass:
  487. :at:`settotalmass`: :at-val:`real, "-1"`
  488. If this value is positive, the compiler will scale the masses and inertias of all bodies in the model, so that the
  489. total mass equals the value specified here. The world body has mass 0 and does not participate in any mass-related
  490. computations. This scaling is performed last, after all other operations affecting the body mass and inertia. The
  491. same scaling operation can be applied at runtime to the compiled mjModel with the function
  492. :ref:`mj_setTotalmass`.
  493. .. _compiler-balanceinertia:
  494. :at:`balanceinertia`: :at-val:`[false, true], "false"`
  495. A valid diagonal inertia matrix must satisfy A+B>=C for all permutations of the three diagonal elements. Some poorly
  496. designed models violate this constraint, which will normally result in a compile error. If this attribute is set to
  497. "true", the compiler will silently set all three diagonal elements to their average value whenever the above
  498. condition is violated.
  499. .. _compiler-strippath:
  500. :at:`strippath`: :at-val:`[false, true], "false" for MJCF, "true" for URDF`
  501. When this attribute is "true", the parser will remove any path information in file names specified in the model. This
  502. is useful for loading models created on a different system using a different directory structure.
  503. .. _compiler-coordinate:
  504. :at:`coordinate`: :at-val:`[local, global], "local"`
  505. In previous versions, this attribute could be used to specify whether frame positions and orientations are expressed
  506. in local or global coordinates, but the "global" option has since been removed, and will cause an error to be
  507. generated. In order to convert older models which used the "global" option, load and save them in MuJoCo 2.3.3 or
  508. older.
  509. .. _compiler-angle:
  510. :at:`angle`: :at-val:`[radian, degree], "degree" for MJCF, always "radian" for URDF`
  511. This attribute specifies whether the angles in the MJCF model are expressed in units of degrees or radians. The
  512. compiler converts degrees into radians, and mjModel always uses radians. For URDF models the parser sets this
  513. attribute to "radian" internally, regardless of the XML setting.
  514. .. _compiler-fitaabb:
  515. :at:`fitaabb`: :at-val:`[false, true], "false"`
  516. The compiler is able to replace a mesh with a geometric primitive fitted to that mesh; see :ref:`geom <body-geom>`
  517. below. If this attribute is "true", the fitting procedure uses the axis-aligned bounding box (aabb) of the mesh.
  518. Otherwise it uses the equivalent-inertia box of the mesh. The type of geometric primitive used for fitting is
  519. specified separately for each geom.
  520. .. _compiler-eulerseq:
  521. :at:`eulerseq`: :at-val:`string, "xyz"`
  522. This attribute specifies the sequence of Euler rotations for all :at:`euler` attributes of elements that have spatial
  523. frames, as explained in :ref:`COrientation`. This must be a string with exactly 3 characters from the set {x, y, z,
  524. X, Y, Z}. The character at position n determines the axis around which the n-th rotation is performed. Lower case
  525. letters denote axes that rotate with the frame (intrinsic), while upper case letters denote axes that remain fixed in
  526. the parent frame (extrinsic). The "rpy" convention used in URDF corresponds to "XYZ" in MJCF.
  527. .. _compiler-meshdir:
  528. :at:`meshdir`: :at-val:`string, optional`
  529. This attribute instructs the compiler where to look for mesh and height field files. The full path to a file is
  530. determined as follows. If the strippath attribute described above is "true", all path information from the file name
  531. is removed. The following checks are then applied in order: (1) if the file name contains an absolute path, it is
  532. used without further changes; (2) if this attribute is set and contains an absolute path, the full path is the string
  533. given here appended with the file name; (3) the full path is the path to the main MJCF model file, appended with the
  534. value of this attribute if specified, appended with the file name.
  535. .. _compiler-texturedir:
  536. :at:`texturedir`: :at-val:`string, optional`
  537. This attribute is used to instruct the compiler where to look for texture files. It works in the same way as meshdir
  538. above.
  539. .. _compiler-assetdir:
  540. :at:`assetdir`: :at-val:`string, optional`
  541. This attribute sets the values of both :at:`meshdir` and :at:`texturedir` above. Values in the latter attributes take
  542. precedence over :at:`assetdir`.
  543. .. _compiler-discardvisual:
  544. :at:`discardvisual`: :at-val:`[false, true], "false" for MJCF, "true" for URDF`
  545. This attribute instructs the compiler to discard all model elements which are purely visual and have no effect on the
  546. physics (with one exception, see below). This often enables smaller :ref:`mjModel` structs and faster simulation.
  547. - All materials are discarded.
  548. - All textures are discarded.
  549. - All geoms with :ref:`contype<body-geom-contype>` |-| = |-| :ref:`conaffinity<body-geom-conaffinity>` |-| =0 are
  550. discarded, if they are not referenced in another MJCF element. If a discarded geom was used for inferring body
  551. inertia, an explicit :ref:`inertial<body-inertial>` element is added to the body.
  552. - All meshes which are not referenced by any geom (in particular those discarded above) are discarded.
  553. The resulting compiled model will have exactly the same dynamics as the original model. The only engine-level
  554. computation which might change is the output of :ref:`raycasting<mj_ray>` computations, as used for example by
  555. :ref:`rangefinder<sensor-rangefinder>` sensors, since raycasting reports distances to visual geoms. When visualizing
  556. models compiled with this flag, it is important to remember that collision geoms are often placed in a
  557. :ref:`group<body-geom-group>` which is invisible by default.
  558. .. _compiler-convexhull:
  559. :at:`convexhull`: :at-val:`[false, true], "true"`
  560. If this attribute is "true", the compiler will automatically generate a convex hull for every mesh that is used in at
  561. least one non-visual geom (in the sense of the discardvisual attribute above). This is done to speed up collision
  562. detection; recall :ref:`Collision` section in the Computation chapter. Even if the mesh is already convex, the hull
  563. contains edge information that is not present in the mesh file, so it needs to be constructed. The only reason to
  564. disable this feature is to speed up re-loading of a model with large meshes during model editing (since the convex
  565. hull computation is the slowest operation performed by the compiler). However once model design is finished, this
  566. feature should be enabled, because the availability of convex hulls substantially speeds up collision detection with
  567. large meshes.
  568. .. _compiler-usethread:
  569. :at:`usethread`: :at-val:`[false, true], "true"`
  570. If this attribute is "true", the model compiler will run in multi-threaded mode. Currently multi-threading is used
  571. for computing the length ranges of actuators and for loading meshes.
  572. .. _compiler-fusestatic:
  573. :at:`fusestatic`: :at-val:`[false, true], "false" for MJCF, "true" for URDF`
  574. This attribute controls a compiler optimization feature where static bodies are fused with their parent, and any
  575. elements defined in those bodies are reassigned to the parent. This feature can only be used in models which do not
  576. have elements capable of named references inside the kinematic tree - namely skins, contact pairs, excludes, tendons,
  577. actuators, sensors, tuples, cameras, lights. If a model has any these elements, fusestatic does nothing even if
  578. enabled. This optimization is particularly useful when importing URDF models which often have many dummy bodies, but
  579. can also be used to optimize MJCF models. After optimization, the new model has identical kinematics and dynamics as
  580. the original but is faster to simulate.
  581. .. _compiler-inertiafromgeom:
  582. :at:`inertiafromgeom`: :at-val:`[false, true, auto], "auto"`
  583. This attribute controls the automatic inference of body masses and inertias from geoms attached to the body. If this
  584. setting is "false", no automatic inference is performed. In that case each body must have explicitly defined mass and
  585. inertia with the :ref:`inertial <body-inertial>` element, or else a compile error will be generated. If this setting is
  586. "true", the mass and inertia of each body will be inferred from the geoms attached to it, overriding any values
  587. specified with the :el:`inertial` element. The default setting "auto" means that masses and inertias are inferred
  588. automatically only when the :el:`inertial` element is missing in the body definition. One reason to set this
  589. attribute to "true" instead of "auto" is to override inertial data imported from a poorly designed model. In
  590. particular, a number of publicly available URDF models have seemingly arbitrary inertias which are too large compared
  591. to the mass. This results in equivalent inertia boxes which extend far beyond the geometric boundaries of the model.
  592. Note that the built-in OpenGL visualizer can render equivalent inertia boxes.
  593. .. _compiler-exactmeshinertia:
  594. :at:`exactmeshinertia`: :at-val:`[false, true], "false"`
  595. If this attribute is set to false, computes mesh inertia with the legacy algorithm, which is exact only for convex
  596. meshes. If set to true, it is exact for any closed mesh geometry.
  597. .. _compiler-alignfree:
  598. :at:`alignfree`: :at-val:`[false, true], "false"`
  599. This attribute toggles the default behaviour of an optimization that applies to bodies with a
  600. :ref:`free joint<body-freejoint>` and no child bodies.
  601. When true, the body frame and free joint will automatically be aligned with inertial frame, which leads to both
  602. faster and more stable simulation. See :ref:`freejoint/align<body-freejoint-align>` for details.
  603. .. _compiler-inertiagrouprange:
  604. :at:`inertiagrouprange`: :at-val:`int(2), "0 5"`
  605. This attribute specifies the range of geom groups that are used to infer body masses and inertias (when such
  606. inference is enabled). The group attribute of :ref:`geom <body-geom>` is an integer. If this integer falls in the range
  607. specified here, the geom will be used in the inertial computation, otherwise it will be ignored. This feature is
  608. useful in models that have redundant sets of geoms for collision and visualization. Note that the world body does not
  609. participate in the inertial computations, so any geoms attached to it are automatically ignored. Therefore it is not
  610. necessary to adjust this attribute and the geom-specific groups so as to exclude world geoms from the inertial
  611. computation.
  612. .. _compiler-lengthrange:
  613. :el-prefix:`compiler/` |-| **lengthrange** (?)
  614. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  615. This element controls the computation of actuator length ranges. For an overview of this functionality see :ref:`Length
  616. range <CLengthRange>` section. Note that if this element is omitted the defaults shown below still apply. In order to
  617. disable length range computations altogether, include this element and set mode="none".
  618. .. _compiler-lengthrange-mode:
  619. :at:`mode`: :at-val:`[none, muscle, muscleuser, all], "muscle"`
  620. Determines the type of actuators to which length range computation is applied. "none" disables this functionality.
  621. "all" applies it to all actuators. "muscle" applies it to actuators whose gaintype or biastype is set to "muscle".
  622. "muscleuser" applies it to actuators whose gaintype or biastype is set to either "muscle" or "user". The default is
  623. "muscle" because MuJoCo's muscle model requires actuator length ranges to be defined.
  624. .. _compiler-lengthrange-useexisting:
  625. :at:`useexisting`: :at-val:`[false, true], "true"`
  626. If this attribute is "true" and the length range for a given actuator is already defined in the model, the existing
  627. value will be used and the automatic computation will be skipped. The range is considered defined if the first number
  628. is smaller than the second number. The only reason to set this attribute to "false" is to force re-computation of
  629. actuator length ranges - which is needed when the model geometry is modified. Note that the automatic computation
  630. relies on simulation and can be slow, so saving the model and using the existing values when possible is recommended.
  631. .. _compiler-lengthrange-uselimit:
  632. :at:`uselimit`: :at-val:`[false, true], "false"`
  633. If this attribute is "true" and the actuator is attached to a joint or a tendon which has limits defined, these
  634. limits will be copied into the actuator length range and the automatic computation will be skipped. This may seem
  635. like a good idea but note that in complex models the feasible range of tendon actuators depends on the entire model,
  636. and may be smaller than the user-defined limits for that tendon. So the safer approach is to set this to "false", and
  637. let the automatic computation discover the feasible range.
  638. .. _compiler-lengthrange-accel:
  639. :at:`accel`: :at-val:`real, "20"`
  640. This attribute scales the forces applied to the simulation in order to push each actuator to its smallest and largest
  641. length. The force magnitude is computed so that the resulting joint-space acceleration vector has norm equal to this
  642. attribute.
  643. .. _compiler-lengthrange-maxforce:
  644. :at:`maxforce`: :at-val:`real, "0"`
  645. The force computed via the accel attribute above can be very large when the actuator has very small moments. Such a
  646. force will still produce reasonable acceleration (by construction) but large numbers could cause numerical issues.
  647. Although we have never observed such issues, the present attribute is provided as a safeguard. Setting it to a value
  648. larger than 0 limits the norm of the force being applied during simulation. The default setting of 0 disables this
  649. safeguard.
  650. .. _compiler-lengthrange-timeconst:
  651. :at:`timeconst`: :at-val:`real, "1"`
  652. The simulation is damped in a non-physical way so as to push the actuators to their limits without the risk of
  653. instabilities. This is done by simply scaling down the joint velocity at each time step. In the absence of new
  654. accelerations, such scaling will decrease the velocity exponentially. The timeconst attribute specifies the time
  655. constant of this exponential decrease, in seconds.
  656. .. _compiler-lengthrange-timestep:
  657. :at:`timestep`: :at-val:`real, "0.01"`
  658. The timestep used for the internal simulation. Setting this to 0 will cause the model timestep to be used. The latter
  659. is not the default because models that can go unstable usually have small timesteps, while the simulation here is
  660. artificially damped and very stable. To speed up the length range computation, users can attempt to increase this
  661. value.
  662. .. _compiler-lengthrange-inttotal:
  663. :at:`inttotal`: :at-val:`real, "10"`
  664. The total time interval (in seconds) for running the internal simulation, for each actuator and actuator direction.
  665. Each simulation is initialized at qpos0. It is expected to settle after inttotal time has passed.
  666. .. _compiler-lengthrange-interval:
  667. :at:`interval`: :at-val:`real, "2"`
  668. The time interval at the end of the simulation over which length data is collected and analyzed. The maximum (or
  669. respectively minimum) length achieved during this interval is recorded. The difference between the maximum and
  670. minimum is also recorded and is used as a measure of divergence. If the simulation settles, this difference will be
  671. small. If it is not small, this could be because the simulation has not yet settled - in which case the above
  672. attributes should be adjusted - or because the model does not have sufficient joint and tendon limits and so the
  673. actuator range is effectively unlimited. Both of these conditions cause the same compiler error. Recall that contacts
  674. are disabled in this simulation, so joint and tendon limits as well as overall geometry are the only things that can
  675. prevent actuators from having infinite length.
  676. .. _compiler-lengthrange-tolrange:
  677. :at:`tolrange`: :at-val:`real, "0.05"`
  678. This determines the threshold for detecting divergence and generating a compiler error. The range of actuator lengths
  679. observed during interval is divided by the overall range computed via simulation. If that value is larger than
  680. tolrange, a compiler error is generated. So one way to suppress compiler errors is to simply make this attribute
  681. larger, but in that case the results could be inaccurate.
  682. .. _size:
  683. **size** (*)
  684. ~~~~~~~~~~~~
  685. This element specifies size parameters that cannot be inferred from the number of elements in the model. Unlike the
  686. fields of mjOption which can be modified at runtime, sizes are structural parameters and should not be modified after
  687. compilation.
  688. .. _size-memory:
  689. :at:`memory`: :at-val:`string, "-1"`
  690. This attribute specifies the size of memory allocated for dynamic arrays in the ``mjData.arena`` memory space, in
  691. bytes. The default setting of ``-1`` instructs the compiler to guess how much space to allocate. Appending the digits
  692. with one of the letters {K, M, G, T, P, E} sets the unit to be {kilo, mega, giga, tera, peta, exa}-byte,
  693. respectively. Thus "16M" means "allocate 16 megabytes of ``arena`` memory".
  694. See the :ref:`Memory allocation <CSize>` section for details.
  695. .. _size-njmax:
  696. :at:`njmax`: :at-val:`int, "-1"` |nbsp| |nbsp| |nbsp| (legacy)
  697. This is a deprecated legacy attribute. In versions prior to 2.3.0, it determined the maximum allowed number
  698. of constraints. Currently it means "allocate as much memory as would have previously been required for this number of
  699. constraints". Specifying both :at:`njmax` and :at:`memory` leads to an error.
  700. .. _size-nconmax:
  701. :at:`nconmax`: :at-val:`int, "-1"` |nbsp| |nbsp| |nbsp| (legacy)
  702. This attribute specifies the maximum number of contacts that will be generated at runtime. If the number of active
  703. contacts is about to exceed this value, the extra contacts are discarded and a warning is generated. This is a
  704. deprecated legacy attribute which prior to version 2.3.0 affected memory allocation. It is kept for backwards
  705. compatibillity and debugging purposes.
  706. .. _size-nstack:
  707. :at:`nstack`: :at-val:`int, "-1"` |nbsp| |nbsp| |nbsp| (legacy)
  708. This is a deprecated legacy attribute. In versions prior to 2.3.0, it determined the maximum size of the
  709. :ref:`stack <siStack>`. After version 2.3.0, if :at:`nstack` is specified, then the size of ``mjData.narena`` is
  710. ``nstack * sizeof(mjtNum)`` bytes, plus an additional space for the constraint solver. Specifying both :at:`nstack`
  711. and :at:`memory` leads to an error.
  712. .. _size-nuserdata:
  713. :at:`nuserdata`: :at-val:`int, "0"`
  714. The size of the field mjData.userdata of mjData. This field should be used to store custom dynamic variables. See
  715. also :ref:`CUser`.
  716. .. _size-nkey:
  717. :at:`nkey`: :at-val:`int, "0"`
  718. The number of key frames allocated in mjModel is the larger of this value and the number of :ref:`key <keyframe-key>`
  719. elements below. Note that the interactive simulator has the ability to take snapshots of the system state and save
  720. them as key frames.
  721. .. _size-nuser_body:
  722. :at:`nuser_body`: :at-val:`int, "-1"`
  723. The number of custom user parameters added to the definition of each body. See also :ref:`User parameters <CUser>`.
  724. The parameter values are set via the user attribute of the :ref:`body <body>` element. These values are not accessed
  725. by MuJoCo. They can be used to define element properties needed in user callbacks and other custom code.
  726. .. _size-nuser_jnt:
  727. :at:`nuser_jnt`: :at-val:`int, "-1"`
  728. The number of custom user parameters added to the definition of each :ref:`joint <body-joint>`.
  729. .. _size-nuser_geom:
  730. :at:`nuser_geom`: :at-val:`int, "-1"`
  731. The number of custom user parameters added to the definition of each :ref:`geom <body-geom>`.
  732. .. _size-nuser_site:
  733. :at:`nuser_site`: :at-val:`int, "-1"`
  734. The number of custom user parameters added to the definition of each :ref:`site <body-site>`.
  735. .. _size-nuser_cam:
  736. :at:`nuser_cam`: :at-val:`int, "-1"`
  737. The number of custom user parameters added to the definition of each :ref:`camera <body-camera>`.
  738. .. _size-nuser_tendon:
  739. :at:`nuser_tendon`: :at-val:`int, "-1"`
  740. The number of custom user parameters added to the definition of each :ref:`tendon <tendon>`.
  741. .. _size-nuser_actuator:
  742. :at:`nuser_actuator`: :at-val:`int, "-1"`
  743. The number of custom user parameters added to the definition of each :ref:`actuator <actuator>`.
  744. .. _size-nuser_sensor:
  745. :at:`nuser_sensor`: :at-val:`int, "-1"`
  746. The number of custom user parameters added to the definition of each :ref:`sensor <sensor>`.
  747. .. _statistic:
  748. **statistic** (*)
  749. ~~~~~~~~~~~~~~~~~
  750. This element is used to override model statistics computed by the compiler. These statistics are not only informational
  751. but are also used to scale various components of the rendering and perturbation. We provide an override mechanism in the
  752. XML because it is sometimes easier to adjust a small number of model statistics than a larger number of visual
  753. parameters.
  754. .. _statistic-meanmass:
  755. :at:`meanmass`: :at-val:`real, optional`
  756. If this attribute is specified, it replaces the value of mjModel.stat.meanmass computed by the compiler. The computed
  757. value is the average body mass, not counting the massless world body. At runtime this value scales the perturbation
  758. force.
  759. .. _statistic-meaninertia:
  760. :at:`meaninertia`: :at-val:`real, optional`
  761. If this attribute is specified, it replaces the value of mjModel.stat.meaninertia computed by the compiler. The
  762. computed value is the average diagonal element of the joint-space inertia matrix when the model is in qpos0. At
  763. runtime this value scales the solver cost and gradient used for early termination.
  764. .. _statistic-meansize:
  765. :at:`meansize`: :at-val:`real, optional`
  766. If this attribute is specified, it replaces the value of ``mjModel.stat.meansize`` computed by the compiler. At
  767. runtime this value multiplies the attributes of the :ref:`scale <visual-scale>` element above, and acts as their
  768. length unit. If specific lengths are desired, it can be convenient to set :at:`meansize` to a round number like 1 or
  769. 0.01 so that :ref:`scale <visual-scale>` values are in recognized length units. This is the only semantic of
  770. :at:`meansize` and setting it has no other side-effect. The automatically computed value is heuristic, representing
  771. the average body radius. The heuristic is based on geom sizes when present, the distances between joints when
  772. present, and the sizes of the body equivalent inertia boxes.
  773. .. _statistic-extent:
  774. :at:`extent`: :at-val:`real, optional`
  775. If this attribute is specified, it replaces the value of mjModel.stat.extent computed by the compiler. The computed
  776. value is half the side of the bounding box of the model in the initial configuration. At runtime this value is
  777. multiplied by some of the attributes of the :ref:`map <visual-map>` element above. When the model is first loaded,
  778. the free camera's initial distance from the :at:`center` (see below) is 1.5 times the :at:`extent`. Must be strictly
  779. positive.
  780. .. _statistic-center:
  781. :at:`center`: :at-val:`real(3), optional`
  782. If this attribute is specified, it replaces the value of mjModel.stat.center computed by the compiler. The computed
  783. value is the center of the bounding box of the entire model in the initial configuration. This 3D vector is used to
  784. center the view of the free camera when the model is first loaded.
  785. .. _asset:
  786. **asset** (*)
  787. ~~~~~~~~~~~~~
  788. This is a grouping element for defining assets. It does not have attributes. Assets are created in the model so that
  789. they can be referenced from other model elements; recall the discussion of :ref:`Assets <Assets>` in the Overview
  790. chapter. Assets opened from a file can be identified in two different ways: filename extensions or the ``content_type``
  791. attribute. MuJoCo will attempt to open a file specified by the content type provided, and only defaults to the filename
  792. extension if no ``content_type`` attribute is specified. The content type is ignored if the asset isn't loaded from a
  793. file.
  794. .. _asset-mesh:
  795. :el-prefix:`asset/` |-| **mesh** (*)
  796. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  797. This element creates a mesh asset, which can then be referenced from geoms. If the referencing geom type is
  798. :at-val:`mesh` the mesh is instantiated in the model, otherwise a geometric primitive is automatically fitted to it; see
  799. the :ref:`geom <body-geom>` element below.
  800. MuJoCo works with triangulated meshes. They can be loaded from binary STL files, OBJ files or MSH files with custom
  801. format described below, or vertex and face data specified directly in the XML. Software such as MeshLab can be used to
  802. convert from other mesh formats to STL or OBJ. While any collection of triangles can be loaded as a mesh and rendered,
  803. collision detection works with the convex hull of the mesh as explained in :ref:`Collision`. See also the convexhull
  804. attribute of the :ref:`compiler <compiler>` element which controls the automatic generation of convex hulls. The mesh
  805. appearance (including texture mapping) is controlled by the :at:`material` and :at:`rgba` attributes of the referencing
  806. geom, similarly to height fields.
  807. Meshes can have explicit texture coordinates instead of relying on the automated texture
  808. mapping mechanism. When provided, these explicit coordinates have priority. Note that texture coordinates can be
  809. specified with OBJ files and MSH files, as well as explicitly in the XML with the :at:`texcoord` attribute, but not via
  810. STL files. These mechanism cannot be mixed. So if you have an STL mesh, the only way to add texture coordinates to it is
  811. to convert to one of the other supported formats.
  812. .. _legacy-msh-docs:
  813. .. collapse:: Legacy MSH file format
  814. The binary MSH file starts with 4 integers specifying the number of vertex positions (nvertex), vertex normals
  815. (nnormal), vertex texture coordinates (ntexcoord), and vertex indices making up the faces (nface), followed by the
  816. numeric data. nvertex must be at least 4. nnormal and ntexcoord can be zero (in which case the corresponding data is
  817. not defined) or equal to nvertex. nface can also be zero, in which case faces are constructed automatically from the
  818. convex hull of the vertex positions. The file size in bytes must be exactly: 16 + 12*(nvertex + nnormal + nface) +
  819. 8*ntexcoord. The contents of the file must be as follows:
  820. .. code:: Text
  821. (int32) nvertex
  822. (int32) nnormal
  823. (int32) ntexcoord
  824. (int32) nface
  825. (float) vertex_positions[3*nvertex]
  826. (float) vertex_normals[3*nnormal]
  827. (float) vertex_texcoords[2*ntexcoord]
  828. (int32) face_vertex_indices[3*nface]
  829. Poorly designed meshes can display rendering artifacts. In particular, the shadow mapping mechanism relies on having
  830. some distance between front and back-facing triangle faces. If the faces are repeated, with opposite normals as
  831. determined by the vertex order in each triangle, this causes shadow aliasing. The solution is to remove the repeated
  832. faces (which can be done in MeshLab) or use a better designed mesh. Flipped faces are checked by MuJoCo for meshes
  833. specified as OBJ or XML and an error message is returned.
  834. The size of the mesh is determined by the 3D coordinates of the vertex data in the mesh file, multiplied by the
  835. components of the :at:`scale` attribute below. Scaling is applied separately for each coordinate axis. Note that
  836. negative scaling values can be used to flip the mesh; this is a legitimate operation. The size parameters of the
  837. referencing geoms are ignored, similarly to height fields. We also provide a mechanism to translate and
  838. rotate the 3D coordinates, using the attributes :ref:`refpos<asset-mesh-refpos>` and :ref:`refquat<asset-mesh-refquat>`.
  839. A mesh can also be defined without faces (a point cloud essentially). In that case
  840. the convex hull is constructed automatically, even if the compiler attribute :at:`convexhull` is
  841. false. This makes it easy to construct simple shapes directly in the XML. For example, a pyramid can
  842. be created as follows:
  843. .. code-block:: xml
  844. <asset>
  845. <mesh name="tetrahedron" vertex="0 0 0 1 0 0 0 1 0 0 0 1"/>
  846. </asset>
  847. Positioning and orienting is complicated by the fact that vertex data in the source asset are often relative to
  848. coordinate frames whose origin is not inside the mesh. In contrast, MuJoCo expects the origin of a geom's local frame to
  849. coincide with the geometric center of the shape. We resolve this discrepancy by pre-processing the mesh in the compiler,
  850. so that it is centered around (0,0,0) and its principal axes of inertia are the coordinate axes. We save the translation
  851. and rotation offsets applied to the source asset in :ref:`mjModel.mesh_pos<mjModel>` and
  852. :ref:`mjModel.mesh_quat<mjModel>`; these are required if one reads vertex data from the source and needs to re-apply the
  853. transform. These offsets are then composed with the referencing geom's position and orientation; see also the :at:`mesh`
  854. attribute of :ref:`geom <body-geom>` below. Fortunately most meshes used in robot models are designed in a coordinate
  855. frame centered at the joint. This makes the corresponding MJCF model intuitive: we set the body frame at the joint, so
  856. that the joint position is (0,0,0) in the body frame, and simply reference the mesh. Below is an MJCF model fragment of
  857. a forearm, containing all the information needed to put the mesh where one would expect it to be. The body position is
  858. specified relative to the parent body, namely the upper arm (not shown). It is offset by 35 cm which is the typical
  859. length of the human upper arm. If the mesh vertex data were not designed in the above convention, we would have to use
  860. the geom position and orientation (or the :at:`refpos`, :at:`refquat` mechanism) to compensate, but in practice this is
  861. rarely needed.
  862. .. code-block:: xml
  863. <asset>
  864. <mesh file="forearm.stl"/>
  865. </asset>
  866. <body pos="0 0 0.35"/>
  867. <joint type="hinge" axis="1 0 0"/>
  868. <geom type="mesh" mesh="forearm"/>
  869. </body>
  870. The inertial computation mentioned above is part of an algorithm used not only to center and align the mesh, but also to
  871. infer the mass and inertia of the body to which it is attached. This is done by computing the centroid of the triangle
  872. faces, connecting each face with the centroid to form a triangular pyramid, computing the mass and signed inertia of all
  873. pyramids (considered solid, or hollow if :at:`shellinertia` is true) and accumulating them. The sign ensures that
  874. pyramids on the outside of the surfaces are subtracted, as can occur with concave geometries. This algorithm can be
  875. found in section 1.3.8 of Computational Geometry in C (Second Edition) by Joseph O'Rourke.
  876. The full list of processing steps applied by the compiler to each mesh is as follows:
  877. #. For STL meshes, remove any repeated vertices and re-index the faces if needed. If the mesh is not STL, we assume that
  878. the desired vertices and faces have already been generated and do not apply removal or re-indexing;
  879. #. If vertex normals are not provided, generate normals automatically, using a weighted average of the surrounding face
  880. normals. If sharp edges are encountered, the renderer uses the face normals to preserve the visual information about
  881. the edge, unless :ref:`smoothnormal<asset-mesh-smoothnormal>` is true.
  882. Note that normals cannot be provided with STL meshes;
  883. #. Scale, translate and rotate the vertices and normals, re-normalize the normals in case of scaling. Save these
  884. transformations in ``mjModel.mesh_{pos, quat, scale}``.
  885. #. Construct the convex hull if specified;
  886. #. Find the centroid of all triangle faces, and construct the union-of-pyramids representation. Triangles whose area is
  887. too small (below the :ref:`mjMINVAL <glNumeric>` value of 1E-14) result in compile error;
  888. #. Compute the center of mass and inertia matrix of the union-of-pyramids. Use eigenvalue decomposition to find the
  889. principal axes of inertia. Center and align the mesh, saving the translational and rotational offsets for subsequent
  890. geom-related computations.
  891. .. _asset-mesh-name:
  892. :at:`name`: :at-val:`string, optional`
  893. Name of the mesh, used for referencing. If omitted, the mesh name equals the file name without the path and
  894. extension.
  895. .. _asset-mesh-class:
  896. :at:`class`: :at-val:`string, optional`
  897. Defaults class for setting unspecified attributes (only scale in this case).
  898. .. _asset-mesh-content_type:
  899. :at:`content_type`: :at-val:`string, optional`
  900. If the file attribute is specified, then this sets the
  901. `Media Type <https://www.iana.org/assignments/media-types/media-types.xhtml>`_ (formerly known as MIME type) of the
  902. file to be loaded. Any filename extensions will be overloaded. Currently ``model/vnd.mujoco.msh``, ``model/obj``,
  903. and ``model/stl`` are supported.
  904. .. _asset-mesh-file:
  905. :at:`file`: :at-val:`string, optional`
  906. The file from which the mesh will be loaded. The path is determined as described in the meshdir attribute of
  907. :ref:`compiler <compiler>`. The file extension must be "stl", "msh", or "obj" (not case sensitive) specifying the
  908. file type. If the file name is omitted, the vertex attribute becomes required.
  909. .. _asset-mesh-scale:
  910. :at:`scale`: :at-val:`real(3), "1 1 1"`
  911. This attribute specifies the scaling that will be applied to the vertex data along each coordinate axis. Negative
  912. values are allowed, resulting in flipping the mesh along the corresponding axis.
  913. .. _asset-mesh-smoothnormal:
  914. :at:`smoothnormal`: :at-val:`[false, true], "false"`
  915. Controls the automatic generation of vertex normals when normals are not given explicitly. If true, smooth normals
  916. are generated by averaging the face normals at each vertex, with weight proportional to the face area. If false,
  917. faces at large angles relative to the average normal are excluded from the average. In this way, sharp edges (as in
  918. cube edges) are not smoothed.
  919. .. _asset-mesh-maxhullvert:
  920. :at:`maxhullvert`: :at-val:`int, "-1"`
  921. Maximum number of vertices in a mesh's convex hull. Currently this is implemented by asking qhull
  922. `to teminate <http://www.qhull.org/html/qh-optt.htm#TAn>`__ after :at:`maxhullvert` vertices. The default
  923. value of -1 means "unlimited". Positive values must be larger than 3.
  924. .. _asset-mesh-vertex:
  925. :at:`vertex`: :at-val:`real(3*nvert), optional`
  926. Vertex 3D position data. You can specify position data in the XML using this attribute, or using a binary file, but
  927. not both.
  928. .. _asset-mesh-normal:
  929. :at:`normal`: :at-val:`real(3*nvert), optional`
  930. Vertex 3D normal data. If specified, the number of normals must equal the number of vertices. The model compiler
  931. normalizes the normals automatically.
  932. .. _asset-mesh-texcoord:
  933. :at:`texcoord`: :at-val:`real(2*nvert), optional`
  934. Vertex 2D texture coordinates, which are numbers between 0 and 1. If specified, the number of texture coordinate
  935. pairs must equal the number of vertices.
  936. .. _asset-mesh-face:
  937. :at:`face`: :at-val:`int(3*nface), optional`
  938. Faces of the mesh. Each face is a sequence of 3 vertex indices, in counter-clockwise order. The indices must be
  939. integers between 0 and nvert-1.
  940. .. _asset-mesh-refpos:
  941. :at:`refpos`: :at-val:`real(3), "0 0 0"`
  942. Reference position relative to which the 3D vertex coordinates are defined. This vector is subtracted from the
  943. positions.
  944. .. _asset-mesh-refquat:
  945. :at:`refquat`: :at-val:`real(4), "1 0 0 0"`
  946. Reference orientation relative to which the 3D vertex coordinates and normals are defined. The conjugate of this
  947. quaternion is used to rotate the positions and normals. The model compiler normalizes the quaternion automatically.
  948. .. _mesh-plugin:
  949. :el-prefix:`mesh/` |-| **plugin** (?)
  950. '''''''''''''''''''''''''''''''''''''
  951. Associate this mesh with an :ref:`engine plugin<exPlugin>`. Either :at:`plugin` or :at:`instance` are required.
  952. .. _mesh-plugin-plugin:
  953. :at:`plugin`: :at-val:`string, optional`
  954. Plugin identifier, used for implicit plugin instantiation.
  955. .. _mesh-plugin-instance:
  956. :at:`instance`: :at-val:`string, optional`
  957. Instance name, used for explicit plugin instantiation.
  958. .. _asset-hfield:
  959. :el-prefix:`asset/` |-| **hfield** (*)
  960. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  961. This element creates a height field asset, which can then be referenced from geoms with type "hfield". A height field,
  962. also known as terrain map, is a 2D matrix of elevation data. The data can be specified in one of three ways:
  963. #. The elevation data can be loaded from a PNG file. The image is converted internally to gray scale, and the intensity
  964. of each pixel is used to define elevation; white is high and black is low.
  965. #. The elevation data can be loaded from a binary file in the custom format described below. As with all other matrices
  966. used in MuJoCo, the data ordering is row-major, like pixels in an image. If the data size is nrow-by-ncol, the file
  967. must have 4*(2+nrow*ncol) bytes:
  968. ::
  969. (int32) nrow
  970. (int32) ncol
  971. (float32) data[nrow*ncol]
  972. #. The elevation data can be left undefined at compile time. This is done by specifying the attributes nrow and ncol.
  973. The compiler allocates space for the height field data in mjModel and sets it to 0. The user can then generate a
  974. custom height field at runtime, either programmatically or using sensor data.
  975. | Regardless of which method is used to specify the elevation data, the compiler always normalizes it to the range [0
  976. 1]. However if the data is left undefined at compile time and generated later at runtime, it is the user's
  977. responsibility to normalize it.
  978. | The position and orientation of the height field is determined by the geom that references it. The spatial extent on
  979. the other hand is specified by the height field asset itself via the size attribute, and cannot be modified by the
  980. referencing geom (the geom size parameters are ignored in this case). The same approach is used for meshes below:
  981. positioning is done by the geom while sizing is done by the asset. This is because height fields and meshes involve
  982. sizing operations that are not common to other geoms.
  983. | For collision detection, a height field is treated as a union of triangular prisms. Collisions between height fields
  984. and other geoms (except for planes and other height fields which are not supported) are computed by first selecting
  985. the sub-grid of prisms that could collide with the geom based on its bounding box, and then using the general convex
  986. collider. The number of possible contacts between a height field and a geom is limited to 50
  987. (:ref:`mjMAXCONPAIR <glNumeric>`); any contacts beyond that are discarded. To avoid penetration due to discarded
  988. contacts, the spatial features of the height field should be large compared to the geoms it collides with.
  989. .. _asset-hfield-name:
  990. :at:`name`: :at-val:`string, optional`
  991. Name of the height field, used for referencing. If the name is omitted and a file name is specified, the height field
  992. name equals the file name without the path and extension.
  993. .. _asset-hfield-content_type:
  994. :at:`content_type`: :at-val:`string, optional`
  995. If the file attribute is specified, then this sets the
  996. `Media Type <https://www.iana.org/assignments/media-types/media-types.xhtml>`__ (formerly known as MIME types) of the
  997. file to be loaded. Any filename extensions will be overloaded. Currently ``image/png`` and
  998. ``image/vnd.mujoco.hfield`` are supported.
  999. .. _asset-hfield-file:
  1000. :at:`file`: :at-val:`string, optional`
  1001. If this attribute is specified, the elevation data is loaded from the given file. If the file extension is ".png",
  1002. not case-sensitive, the file is treated as a PNG file. Otherwise it is treated as a binary file in the above custom
  1003. format. The number of rows and columns in the data are determined from the file contents. Loading data from a file
  1004. and setting nrow or ncol below to non-zero values results is compile error, even if these settings are consistent
  1005. with the file contents.
  1006. .. _asset-hfield-nrow:
  1007. :at:`nrow`: :at-val:`int, "0"`
  1008. This attribute and the next are used to allocate a height field in mjModel. If the :at:`elevation` attribute is not
  1009. set, the elevation data is set to 0. This attribute specifies the number of rows in the elevation data matrix. The
  1010. default value of 0 means that the data will be loaded from a file, which will be used to infer the size of the
  1011. matrix.
  1012. .. _asset-hfield-ncol:
  1013. :at:`ncol`: :at-val:`int, "0"`
  1014. This attribute specifies the number of columns in the elevation data matrix.
  1015. .. _asset-hfield-elevation:
  1016. :at:`elevation`: :at-val:`real(nrow*ncol), optional`
  1017. This attribute specifies the elevation data matrix. Values are automatically normalized to lie between 0 and 1 by
  1018. first subtracting the minimum value and then dividing by the (maximum-minimum) difference, if not 0. If not provided,
  1019. values are set to 0.
  1020. .. _asset-hfield-size:
  1021. :at:`size`: :at-val:`real(4), required`
  1022. .. figure:: images/XMLreference/peaks.png
  1023. :width: 350px
  1024. :align: right
  1025. The four numbers here are (radius_x, radius_y, elevation_z, base_z). The height field is centered at the referencing
  1026. geom's local frame. Elevation is in the +Z direction. The first two numbers specify the X and Y extent (or "radius")
  1027. of the rectangle over which the height field is defined. This may seem unnatural for rectangles, but it is natural
  1028. for spheres and other geom types, and we prefer to use the same convention throughout the model. The third number is
  1029. the maximum elevation; it scales the elevation data which is normalized to [0-1]. Thus the minimum elevation point is
  1030. at Z=0 and the maximum elevation point is at Z=elevation_z. The last number is the depth of a box in the -Z direction
  1031. serving as a "base" for the height field. Without this automatically generated box, the height field would have zero
  1032. thickness at places there the normalized elevation data is zero. Unlike planes which impose global unilateral
  1033. constraints, height fields are treated as unions of regular geoms, so there is no notion of being "under" the height
  1034. field. Instead a geom is either inside or outside the height field - which is why the inside part must have non-zero
  1035. thickness. The example on the right is the MATLAB "peaks" surface saved in our custom height field format, and loaded
  1036. as an asset with size = "1 1 1 0.1". The horizontal size of the box is 2, the difference between the maximum and
  1037. minimum elevation is 1, and the depth of the base added below the minimum elevation point is 0.1.
  1038. .. _asset-skin:
  1039. :el-prefix:`asset/` |-| **skin** (*)
  1040. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1041. .. _asset-skin-name:
  1042. .. _asset-skin-file:
  1043. .. _asset-skin-vertex:
  1044. .. _asset-skin-texcoord:
  1045. .. _asset-skin-face:
  1046. .. _asset-skin-inflate:
  1047. .. _asset-skin-material:
  1048. .. _asset-skin-rgba:
  1049. .. _asset-skin-group:
  1050. :ref:`Skins<deformable-skin>` have been moved under the new grouping element :ref:`deformable<deformable>`. They can
  1051. still be specified here but this functionality is now deprecated and will be removed in the future.
  1052. .. _asset-texture:
  1053. :el-prefix:`asset/` |-| **texture** (*)
  1054. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1055. | This element creates a texture asset, which is then referenced from a :ref:`material <asset-material>` asset, which is
  1056. finally referenced from a model element that needs to be textured. MuJoCo provides access to the texture mapping
  1057. mechanism in OpenGL. Texture coordinates are generated automatically in GL_OBJECT_PLANE mode, using either 2D or cube
  1058. mapping. MIP maps are always enabled in GL_LINEAR_MIPMAP_LINEAR mode. The texture color is combined with the object
  1059. color in GL_MODULATE mode. The texture data can be loaded from PNG files, with provisions for loading cube and skybox
  1060. textures. Alternatively the data can be generated by the compiler as a procedural texture. Because different texture
  1061. types require different parameters, only a subset of the attributes below are used for any given texture.
  1062. | A second file format is supported for loading textures, in addition to PNG. If the file name extension is
  1063. different from .png or .PNG, or if the ``content_type`` attribute is set to ``image/vnd.mujoco.texture``, then MuJoCo
  1064. assumes that the texture is in this format. This is a custom binary file format, containing the following data:
  1065. .. code:: Text
  1066. (int32) width
  1067. (int32) height
  1068. (byte) rgb_data[3*width*height]
  1069. .. _asset-texture-name:
  1070. :at:`name`: :at-val:`string, optional`
  1071. As with all other assets, a texture must have a name in order to be referenced. However if the texture is loaded from
  1072. a single file with the file attribute, the explicit name can be omitted and the file name (without the path and
  1073. extension) becomes the texture name. If the name after parsing is empty and the texture type is not "skybox", the
  1074. compiler will generate an error.
  1075. .. _asset-texture-type:
  1076. :at:`type`: :at-val:`[2d, cube, skybox], "cube"`
  1077. This attribute determines how the texture is represented and mapped to objects. It also determines which of the
  1078. remaining attributes are relevant. The keywords have the following meaning:
  1079. The **cube** type has the effect of shrink-wrapping a texture cube over an object. Apart from
  1080. the adjustment provided by the texuniform attribute of :ref:`material <asset-material>`, the process is automatic.
  1081. Internally the GPU constructs a ray from the center of the object to each pixel (or rather fragment), finds the
  1082. intersection of this ray with the cube surface (the cube and the object have the same center), and uses the
  1083. corresponding texture color. The six square images defining the cube can be the same or different; if they are the
  1084. same, only one copy is stored in mjModel. There are four mechanisms for specifying the texture data:
  1085. #. Single file (PNG or custom) specified with the file attribute, containing a square image which is repeated on each
  1086. side of the cube. This is the most common approach. If for example the goal is to create the appearance of wood,
  1087. repeating the same image on all sides is sufficient.
  1088. #. Single file containing a composite image from which the six squares are extracted by the compiler. The layout of
  1089. the composite image is determined by the gridsize and gridlayout attributes.
  1090. #. Six separate files specified with the attributes fileright, fileleft etc, each containing one square image.
  1091. #. Procedural texture generated internally. The type of procedural texture is determined by the builtin attribute.
  1092. The texture data also depends on a number of parameters documented below.
  1093. The **skybox** type is very similar to cube mapping, and in fact the texture data is specified in exactly the same
  1094. way. The only difference is that the visualizer uses the first such texture defined in the model to render a skybox.
  1095. This is a large box centered at the camera and always moving with it, with size determined automatically from the far
  1096. clipping plane. The idea is that images on the skybox appear stationary, as if they are infinitely far away. If such
  1097. a texture is referenced from a material applied to a regular object, the effect is equivalent to a cube map. Note
  1098. however that the images suitable for skyboxes are rarely suitable for texturing objects.
  1099. The **2d** type maps a 2D image to a 3D object using :ref:`texture coordinates<asset-mesh-texcoord>` (a.k.a UV
  1100. coordinates). However, UV coordinates are only available for meshes. For primitive geoms, the texture is mapped to
  1101. the object surface using the local XY coordinates of the geom, effectively projecting the texture along the Z axis.
  1102. This sort of mapping is only suitable for planes and height fields, since their top surfaces always face the Z axis.
  1103. 2d textures can be rectangular, unlike the sides of cube textures which must be square. The scaling can be controlled
  1104. with the texrepeat attribute of :ref:`material <asset-material>`. The data can be loaded from a single file or
  1105. created procedurally.
  1106. .. _asset-texture-content_type:
  1107. :at:`content_type`: :at-val:`string, optional`
  1108. If the file attribute is specified, then this sets the
  1109. `Media Type <https://www.iana.org/assignments/media-types/media-types.xhtml>`_ (formerly known as MIME types) of the
  1110. file to be loaded. Any filename extensions will be ignored. Currently ``image/png`` and ``image/vnd.mujoco.texture``
  1111. are supported.
  1112. .. _asset-texture-file:
  1113. :at:`file`: :at-val:`string, optional`
  1114. If this attribute is specified, and the builtin attribute below is set to "none", the texture data is loaded from a
  1115. single file. See the texturedir attribute of :ref:`compiler <compiler>` regarding the file path.
  1116. .. _asset-texture-gridsize:
  1117. :at:`gridsize`: :at-val:`int(2), "1 1"`
  1118. When a cube or skybox texture is loaded from a single file, this attribute and the next specify how the six square
  1119. sides of the texture cube are obtained from the single image. The default setting "1 1" means that the same image is
  1120. repeated on all sides of the cube. Otherwise the image is interpreted as a grid from which the six sides are
  1121. extracted. The two integers here correspond to the number of rows and columns in the grid. Each integer must be
  1122. positive and the product of the two cannot exceed 12. The number of rows and columns in the image must be integer
  1123. multiples of the number of rows and columns in the grid, and these two multiples must be equal, so that the extracted
  1124. images are square.
  1125. .. _asset-texture-gridlayout:
  1126. :at:`gridlayout`: :at-val:`string, "............"`
  1127. .. figure:: images/XMLreference/skybox.png
  1128. :width: 250px
  1129. :align: right
  1130. When a cube or skybox texture is loaded from a single file, and the grid size is different from "1 1", this attribute
  1131. specifies which grid cells are used and which side of the cube they correspond to. There are many skybox textures
  1132. available online as composite images, but they do not use the same convention, which is why we have designed a
  1133. flexible mechanism for decoding them. The string specified here must be composed of characters from the set {'.',
  1134. 'R', 'L', 'U', 'D', 'F', 'B'}. The number of characters must equal the product of the two grid sizes. The grid is
  1135. scanned in row-major order. The '.' character denotes an unused cell. The other characters are the first letters of
  1136. Right, Left, Up, Down, Front, Back; see below for coordinate frame description. If the symbol for a given side
  1137. appears more than once, the last definition is used. If a given side is omitted, it is filled with the color
  1138. specified by the rgb1 attribute. For example, the desert landscape below can be loaded as a skybox or a cube map
  1139. using gridsize = "3 4" and gridlayout = ".U..LFRB.D.." The full-resolution image file without the markings can be
  1140. downloaded `here <_static/desert.png>`__.
  1141. .. _asset-texture-fileright:
  1142. .. _asset-texture-fileleft:
  1143. .. _asset-texture-fileup:
  1144. .. _asset-texture-filedown:
  1145. .. _asset-texture-filefront:
  1146. .. _asset-texture-fileback:
  1147. :at:`fileright`, :at:`fileleft`, :at:`fileup`, :at:`filedown`, :at:`filefront`, :at:`fileback` : string, optional
  1148. These attributes are used to load the six sides of a cube or skybox texture from separate files, but only if the file
  1149. attribute is omitted and the builtin attribute is set to "none". If any one of these attributes are omitted, the
  1150. corresponding side is filled with the color specified by the rgb1 attribute. The coordinate frame here is unusual.
  1151. When a skybox is viewed with the default free camera in its initial configuration, the Right, Left, Up, Down sides
  1152. appear where one would expect them. The Back side appears in front of the viewer, because the viewer is in the middle
  1153. of the box and is facing its back. There is however a complication. In MuJoCo the +Z axis points up, while existing
  1154. skybox textures (which are non-trivial to design) tend to assume that the +Y axis points up. Changing coordinates
  1155. cannot be done by merely renaming files; instead one would have to transpose and/or mirror some of the images. To
  1156. avoid this complication, we render the skybox rotated by 90 deg around the +X axis, in violation of our convention.
  1157. However we cannot do the same for regular objects. Thus the mapping of skybox and cube textures on regular objects,
  1158. expressed in the local frame of the object, is as follows:
  1159. Right = +X, Left = -X, Up = +Y, Down = -Y, Front = +Z, Back = -Z.
  1160. .. _asset-texture-builtin:
  1161. :at:`builtin`: :at-val:`[none, gradient, checker, flat], "none"`
  1162. This and the remaining attributes control the generation of procedural textures. If the value of this attribute is
  1163. different from "none", the texture is treated as procedural and any file names are ignored. The keywords have the
  1164. following meaning:
  1165. **gradient**
  1166. Generates a color gradient from rgb1 to rgb2. The interpolation in color space is done through
  1167. a sigmoid function. For cube and skybox textures the gradient is along the +Y axis, i.e., from top to bottom for
  1168. skybox rendering.
  1169. **checker**
  1170. Generates a 2-by-2 checker pattern with alternating colors given by rgb1 and rgb2. This is suitable for rendering
  1171. ground planes and also for marking objects with rotational symmetries. Note that 2d textures can be scaled so as
  1172. to repeat the pattern as many times as necessary. For cube and skybox textures, the checker pattern is painted on
  1173. each side of the cube.
  1174. **flat**
  1175. Fills the entire texture with rgb1, except for the bottom face of cube and skybox textures which is
  1176. filled with rgb2.
  1177. .. _asset-texture-rgb1:
  1178. :at:`rgb1`: :at-val:`real(3), "0.8 0.8 0.8"`
  1179. The first color used for procedural texture generation. This color is also used to fill missing sides of cube and
  1180. skybox textures loaded from files. The components of this and all other RGB(A) vectors should be in the range [0 1].
  1181. .. _asset-texture-rgb2:
  1182. :at:`rgb2`: :at-val:`real(3), "0.5 0.5 0.5"`
  1183. The second color used for procedural texture generation.
  1184. .. _asset-texture-mark:
  1185. :at:`mark`: :at-val:`[none, edge, cross, random], "none"`
  1186. Procedural textures can be marked with the markrgb color, on top of the colors determined by the builtin type. "edge"
  1187. means that the edges of all texture images are marked. "cross" means that a cross is marked in the middle of each
  1188. image. "random" means that randomly chosen pixels are marked. All markings are one-pixel wide, thus the markings
  1189. appear larger and more diffuse on smaller textures.
  1190. .. _asset-texture-markrgb:
  1191. :at:`markrgb`: :at-val:`real(3), "0 0 0"`
  1192. The color used for procedural texture markings.
  1193. .. _asset-texture-random:
  1194. :at:`random`: :at-val:`real, "0.01"`
  1195. When the mark attribute is set to "random", this attribute determines the probability of turning on each pixel. Note
  1196. that larger textures have more pixels, and the probability here is applied independently to each pixel -- thus the
  1197. texture size and probability need to be adjusted jointly. Together with a gradient skybox texture, this can create
  1198. the appearance of a night sky with stars. The random number generator is initialized with a fixed seed.
  1199. .. _asset-texture-width:
  1200. :at:`width`: :at-val:`int, "0"`
  1201. The width of a procedural texture, i.e., the number of columns in the image. Larger values usually result in higher
  1202. quality images, although in some cases (e.g. checker patterns) small values are sufficient. For textures loaded from
  1203. files, this attribute is ignored.
  1204. .. _asset-texture-height:
  1205. :at:`height`: :at-val:`int, "0"`
  1206. The height of the procedural texture, i.e., the number of rows in the image. For cube and skybox textures, this
  1207. attribute is ignored and the height is set to 6 times the width. For textures loaded from files, this attribute is
  1208. ignored.
  1209. .. _asset-texture-hflip:
  1210. :at:`hflip`: :at-val:`[false, true], "false"`
  1211. If true, images loaded from file are flipped in the horizontal direction. Does not affect procedural textures.
  1212. .. _asset-texture-vflip:
  1213. :at:`vflip`: :at-val:`[false, true], "false"`
  1214. If true, images loaded from file are flipped in the vertical direction. Does not affect procedural textures.
  1215. .. _asset-texture-nchannel:
  1216. :at:`nchannel`: :at-val:`int, "3"`
  1217. The number of channels in the texture image file. This allows loading 4-channel textures (RGBA) or single-channel
  1218. textures (e.g., for Physics-Based Rendering properties such as roughness or metallic).
  1219. .. _asset-material:
  1220. :el-prefix:`asset/` |-| **material** (*)
  1221. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1222. This element creates a material asset. It can be referenced from :ref:`skins <deformable-skin>`, :ref:`geoms <body-geom>`,
  1223. :ref:`sites <body-site>` and :ref:`tendons <tendon>` to set their appearance. Note that all these elements also have a
  1224. local rgba attribute, which is more convenient when only colors need to be adjusted, because it does not require
  1225. creating materials and referencing them. Materials are useful for adjusting appearance properties beyond color. However
  1226. once a material is created, it is more natural the specify the color using the material, so that all appearance
  1227. properties are grouped together.
  1228. .. _asset-material-name:
  1229. :at:`name`: :at-val:`string, required`
  1230. Name of the material, used for referencing.
  1231. .. _asset-material-class:
  1232. :at:`class`: :at-val:`string, optional`
  1233. Defaults class for setting unspecified attributes.
  1234. .. _asset-material-texture:
  1235. :at:`texture`: :at-val:`string, optional`
  1236. If this attribute is specified, the material has a texture associated with it. Referencing the material from a model
  1237. element will cause the texture to be applied to that element. Note that the value of this attribute is the name of a
  1238. texture asset, not a texture file name. Textures cannot be loaded in the material definition; instead they must be
  1239. loaded explicitly via the :ref:`texture <asset-texture>` element and then referenced here. The texture referenced
  1240. here is used for specifying the RGB values. For advanced rendering (e.g., Physics-Based Rendering), more texture
  1241. types need to be specified (e.g., roughness, metallic). In this case, this texture attribute should be omitted, and
  1242. the texture types should be specified explicitly via the specific role child elements, e.g.,
  1243. :ref:`texture <material-orm>`. Note however that the built-in renderer does not support PBR properties, so these
  1244. advanced rendering features are only available when using an external renderer.
  1245. .. _asset-material-texrepeat:
  1246. :at:`texrepeat`: :at-val:`real(2), "1 1"`
  1247. This attribute applies to textures of type "2d". It specifies how many times the texture image is repeated, relative
  1248. to either the object size or the spatial unit, as determined by the next attribute.
  1249. .. _asset-material-texuniform:
  1250. :at:`texuniform`: :at-val:`[false, true], "false"`
  1251. For cube textures, this attribute controls how cube mapping is applied. The default value "false" means apply cube
  1252. mapping directly, using the actual size of the object. The value "true" maps the texture to a unit object before
  1253. scaling it to its actual size (geometric primitives are created by the renderer as unit objects and then scaled). In
  1254. some cases this leads to more uniform texture appearance, but in general, which settings produces better results
  1255. depends on the texture and the object. For 2d textures, this attribute interacts with texrepeat above. Let texrepeat
  1256. be N. The default value "false" means that the 2d texture is repeated N times over the (z-facing side of the) object.
  1257. The value "true" means that the 2d texture is repeated N times over one spatial unit, regardless of object size.
  1258. .. _asset-material-emission:
  1259. :at:`emission`: :at-val:`real, "0"`
  1260. Emission in OpenGL has the RGBA format, however we only provide a scalar setting. The RGB components of the OpenGL
  1261. emission vector are the RGB components of the material color multiplied by the value specified here. The alpha
  1262. component is 1.
  1263. .. _asset-material-specular:
  1264. :at:`specular`: :at-val:`real, "0.5"`
  1265. Specularity in OpenGL has the RGBA format, however we only provide a scalar setting. The RGB components of the OpenGL
  1266. specularity vector are all equal to the value specified here. The alpha component is 1. This value should be in the
  1267. range [0 1].
  1268. .. _asset-material-shininess:
  1269. :at:`shininess`: :at-val:`real, "0.5"`
  1270. Shininess in OpenGL is a number between 0 and 128. The value given here is multiplied by 128 before passing it to
  1271. OpenGL, so it should be in the range [0 1]. Larger values correspond to tighter specular highlight (thus reducing the
  1272. overall amount of highlight but making it more salient visually). This interacts with the specularity setting; see
  1273. OpenGL documentation for details.
  1274. .. _asset-material-reflectance:
  1275. :at:`reflectance`: :at-val:`real, "0"`
  1276. This attribute should be in the range [0 1]. If the value is greater than 0, and the material is applied to a plane
  1277. or a box geom, the renderer will simulate reflectance. The larger the value, the stronger the reflectance. For boxes,
  1278. only the face in the direction of the local +Z axis is reflective. Simulating reflectance properly requires
  1279. ray-tracing which cannot (yet) be done in real-time. We are using the stencil buffer and suitable projections
  1280. instead. Only the first reflective geom in the model is rendered as such. This adds one extra rendering pass through
  1281. all geoms, in addition to the extra rendering pass added by each shadow-casting light.
  1282. .. _asset-material-metallic:
  1283. :at:`metallic`: :at-val:`real, "0"`
  1284. This attribute corresponds to uniform metallicity coefficient applied to the entire material. This attribute has no
  1285. effect in MuJoCo's native renderer, but it can be useful when rendering scenes with an external renderer.
  1286. .. _asset-material-roughness:
  1287. :at:`roughness`: :at-val:`real, "1"`
  1288. This attribute corresponds to uniform roughness coefficient applied to the entire material. This attribute has no
  1289. effect in MuJoCo's native renderer, but it can be useful when rendering scenes with an external renderer.
  1290. .. _asset-material-rgba:
  1291. :at:`rgba`: :at-val:`real(4), "1 1 1 1"`
  1292. Color and transparency of the material. All components should be in the range [0 1]. Note that textures are applied
  1293. in GL_MODULATE mode, meaning that the texture color and the color specified here are multiplied component-wise. Thus
  1294. the default value of "1 1 1 1" has the effect of leaving the texture unchanged. When the material is applied to a
  1295. model element which defines its own local rgba attribute, the local definition has precedence. Note that this "local"
  1296. definition could in fact come from a defaults class. The remaining material properties always apply.
  1297. .. _material-rgb:
  1298. :el-prefix:`material/` |-| **rgb** (?)
  1299. ''''''''''''''''''''''''''''''''''''''
  1300. This element references a texture asset used to specify base color / albedo values.
  1301. .. _material-rgb-texture:
  1302. :at:`texture`: :at-val:`string, required`
  1303. Name of the texture, expected to have exactly 3 channels.
  1304. .. _material-normal:
  1305. :el-prefix:`material/` |-| **normal** (?)
  1306. '''''''''''''''''''''''''''''''''''''''''
  1307. This element references a texture asset used to specify the bump map (surface normals).
  1308. .. _material-normal-texture:
  1309. :at:`texture`: :at-val:`string, required`
  1310. Name of the texture, expected to have exactly 3 channels.
  1311. .. _material-occlusion:
  1312. :el-prefix:`material/` |-| **occlusion** (?)
  1313. ''''''''''''''''''''''''''''''''''''''''''''
  1314. This element references a texture asset used to specify ambient occlusion.
  1315. .. _material-occlusion-texture:
  1316. :at:`texture`: :at-val:`string, required`
  1317. Name of the texture, expected to have exactly one channel.
  1318. .. _material-roughness:
  1319. :el-prefix:`material/` |-| **roughness** (?)
  1320. ''''''''''''''''''''''''''''''''''''''''''''
  1321. This element references a texture asset used to specify the roughness map.
  1322. .. _material-roughness-texture:
  1323. :at:`texture`: :at-val:`string, required`
  1324. Name of the texture, expected to have exactly one channel.
  1325. .. _material-metallic:
  1326. :el-prefix:`material/` |-| **metallic** (?)
  1327. '''''''''''''''''''''''''''''''''''''''''''
  1328. This element references a texture asset used to specify the metallic map.
  1329. .. _material-metallic-texture:
  1330. :at:`texture`: :at-val:`string, required`
  1331. Name of the texture, expected to have exactly one channel.
  1332. .. _material-opacity:
  1333. :el-prefix:`material/` |-| **opacity** (?)
  1334. ''''''''''''''''''''''''''''''''''''''''''
  1335. This element references a texture asset used to specify the opacity map (alpha channel, transparency).
  1336. .. _material-opacity-texture:
  1337. :at:`texture`: :at-val:`string, required`
  1338. Name of the texture, expected to have exactly one channel.
  1339. .. _material-emissive:
  1340. :el-prefix:`material/` |-| **emissive** (?)
  1341. '''''''''''''''''''''''''''''''''''''''''''
  1342. This element references a texture asset used to specify light emission.
  1343. .. _material-emissive-texture:
  1344. :at:`texture`: :at-val:`string, required`
  1345. Name of the texture, expected to have exactly 4 channels.
  1346. .. _material-orm:
  1347. :el-prefix:`material/` |-| **orm** (?)
  1348. ''''''''''''''''''''''''''''''''''''''
  1349. This element references a texture asset used to specify a packed ORM map, where occlusion, roughness, and metallic
  1350. are joined into the corresponding RGB values of a single texture.
  1351. .. _material-orm-texture:
  1352. :at:`texture`: :at-val:`string, required`
  1353. Name of the texture, expected to have exactly 3 channels.
  1354. .. _material-rgba:
  1355. :el-prefix:`material/` |-| **rgba** (?)
  1356. '''''''''''''''''''''''''''''''''''''''
  1357. This element references a texture asset used to specify a packed map where albedo and opacity are joined into the same
  1358. 4-channel texture.
  1359. .. _material-rgba-texture:
  1360. :at:`texture`: :at-val:`string, required`
  1361. Name of the texture, expected to have exactly 4 channels.
  1362. .. _asset-model:
  1363. :el-prefix:`asset/` |-| **model** (*)
  1364. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1365. This element specifies other MJCF models which may be used for :ref:`attachment<body-attach>` in the current model.
  1366. .. _asset-model-name:
  1367. :at:`name`: :at-val:`string, optional`
  1368. Name of the sub-model, used for referencing in :ref:`attach<body-attach>`. If unspecified, the
  1369. :ref:`model name<mujoco-model>` is used.
  1370. .. _asset-model-file:
  1371. :at:`file`: :at-val:`string, required`
  1372. The file from which the sub-model will be loaded. Note that the sub-model must be a valid MJCF model.
  1373. .. _asset-model-content_type:
  1374. :at:`content_type` :at-val:`string, optional`
  1375. The file type to be loaded into a model. Currently only text/xml is supported.
  1376. .. _body:
  1377. **(world)body** (R)
  1378. ~~~~~~~~~~~~~~~~~~~
  1379. This element is used to construct the :ref:`kinematic tree <CTree>` via nesting. The element :el:`worldbody` is used for
  1380. the top-level body, while the element :el:`body` is used for all other bodies. The top-level body is a restricted type
  1381. of body: it cannot have child elements :ref:`inertial <body-inertial>` and :ref:`joint <body-joint>`, and also cannot
  1382. have any attributes. It corresponds to the origin of the world frame, within which the rest of the kinematic tree is
  1383. defined. Its body name is automatically defined as "world".
  1384. .. _body-name:
  1385. :at:`name`: :at-val:`string, optional`
  1386. Name of the body.
  1387. .. _body-childclass:
  1388. :at:`childclass`: :at-val:`string, optional`
  1389. If this attribute is present, all descendant elements that admit a defaults class will use the class specified here,
  1390. unless they specify their own class or another body or frame with a childclass attribute is encountered along the
  1391. chain of nested bodies and frames. Recall :ref:`CDefault`.
  1392. .. _body-mocap:
  1393. :at:`mocap`: :at-val:`[false, true], "false"`
  1394. If this attribute is "true", the body is labeled as a mocap body. This is allowed only for bodies that are children
  1395. of the world body and have no joints. Such bodies are fixed from the viewpoint of the dynamics, but nevertheless the
  1396. forward kinematics set their position and orientation from the fields mjData.mocap_pos and mjData.mocap_quat at each
  1397. time step. The size of these arrays is adjusted by the compiler so as to match the number of mocap bodies in the
  1398. model. This mechanism can be used to stream motion capture data into the simulation. Mocap bodies can also be moved
  1399. via mouse perturbations in the interactive visualizer, even in dynamic simulation mode. This can be useful for
  1400. creating props with adjustable position and orientation. See also the mocap attribute of :ref:`flag <option-flag>`.
  1401. .. _body-pos:
  1402. :at:`pos`: :at-val:`real(3), optional`
  1403. The 3D position of the body frame, in the parent coordinate frame. If undefined it defaults to (0,0,0).
  1404. .. _body-quat:
  1405. .. _body-axisangle:
  1406. .. _body-xyaxes:
  1407. .. _body-zaxis:
  1408. .. _body-euler:
  1409. :at:`quat`, :at:`axisangle`, :at:`xyaxes`, :at:`zaxis`, :at:`euler`
  1410. See :ref:`COrientation`.
  1411. .. _body-gravcomp:
  1412. :at:`gravcomp`: :at-val:`real, "0"`
  1413. Gravity compensation force, specified as fraction of body weight. This attribute creates an upwards force applied to
  1414. the body's center of mass, countering the force of gravity. As an example, a value of ``1`` creates an upward force
  1415. equal to the body's weight and compensates for gravity exactly. Values greater than ``1`` will create a net upwards
  1416. force or buoyancy effect.
  1417. .. _body-user:
  1418. :at:`user`: :at-val:`real(nbody_user), "0 0 ..."`
  1419. See :ref:`CUser`.
  1420. .. _body-inertial:
  1421. :el-prefix:`body/` |-| **inertial** (?)
  1422. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1423. This element specifies the mass and inertial properties of the body. If this element is not included in a given body,
  1424. the inertial properties are inferred from the geoms attached to the body. When a compiled MJCF model is saved, the XML
  1425. writer saves the inertial properties explicitly using this element, even if they were inferred from geoms. The inertial
  1426. frame is such that its center coincides with the center of mass of the body, and its axes coincide with the principal
  1427. axes of inertia of the body. Thus the inertia matrix is diagonal in this frame.
  1428. .. _body-inertial-pos:
  1429. :at:`pos`: :at-val:`real(3), required`
  1430. Position of the inertial frame. This attribute is required even when the inertial properties can be inferred from
  1431. geoms. This is because the presence of the :el:`inertial` element itself disables the automatic inference mechanism.
  1432. .. _body-inertial-quat:
  1433. .. _body-inertial-axisangle:
  1434. .. _body-inertial-xyaxes:
  1435. .. _body-inertial-zaxis:
  1436. .. _body-inertial-euler:
  1437. :at:`quat`, :at:`axisangle`, :at:`xyaxes`, :at:`zaxis`, :at:`euler`
  1438. Orientation of the inertial frame. See :ref:`COrientation`.
  1439. .. _body-inertial-mass:
  1440. :at:`mass`: :at-val:`real, required`
  1441. Mass of the body. Negative values are not allowed. MuJoCo requires the inertia matrix in generalized coordinates to
  1442. be positive-definite, which can sometimes be achieved even if some bodies have zero mass. In general however there is
  1443. no reason to use massless bodies. Such bodies are often used in other engines to bypass the limitation that joints
  1444. cannot be combined, or to attach sensors and cameras. In MuJoCo primitive joint types can be combined, and we have
  1445. sites which are a more efficient attachment mechanism.
  1446. .. _body-inertial-diaginertia:
  1447. :at:`diaginertia`: :at-val:`real(3), optional`
  1448. Diagonal inertia matrix, expressing the body inertia relative to the inertial frame. If this attribute is omitted,
  1449. the next attribute becomes required.
  1450. .. _body-inertial-fullinertia:
  1451. :at:`fullinertia`: :at-val:`real(6), optional`
  1452. Full inertia matrix M. Since M is 3-by-3 and symmetric, it is specified using only 6 numbers in the following order:
  1453. M(1,1), M(2,2), M(3,3), M(1,2), M(1,3), M(2,3). The compiler computes the eigenvalue decomposition of M and sets the
  1454. frame orientation and diagonal inertia accordingly. If non-positive eigenvalues are encountered (i.e., if M is not
  1455. positive definite) a compile error is generated.
  1456. .. _body-joint:
  1457. :el-prefix:`body/` |-| **joint** (*)
  1458. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1459. This element creates a joint. As explained in :ref:`Kinematic tree <CTree>`, a joint creates motion degrees of freedom
  1460. between the body where it is defined and the body's parent. If multiple joints are defined in the same body, the
  1461. corresponding spatial transformations (of the body frame relative to the parent frame) are applied in order. If no
  1462. joints are defined, the body is welded to its parent. Joints cannot be defined in the world body. At runtime the
  1463. positions and orientations of all joints defined in the model are stored in the vector ``mjData.qpos``, in the order in
  1464. which the appear in the kinematic tree. The linear and angular velocities are stored in the vector ``mjData.qvel``.
  1465. These two vectors have different dimensionality when free or ball joints are used, because such joints represent
  1466. rotations as unit quaternions.
  1467. .. _body-joint-name:
  1468. :at:`name`: :at-val:`string, optional`
  1469. Name of the joint.
  1470. .. _body-joint-class:
  1471. :at:`class`: :at-val:`string, optional`
  1472. Defaults class for setting unspecified attributes.
  1473. .. _body-joint-type:
  1474. :at:`type`: :at-val:`[free, ball, slide, hinge], "hinge"`
  1475. Type of the joint. The keywords have the following meaning:
  1476. The **free** type creates a free "joint" with three translational degrees of freedom followed by three rotational
  1477. degrees of freedom. In other words it makes the body floating. The rotation is represented as a unit quaternion. This
  1478. joint type is only allowed in bodies that are children of the world body. No other joints can be defined in the body
  1479. if a free joint is defined. Unlike the remaining joint types, free joints do not have a position within the body
  1480. frame. Instead the joint position is assumed to coincide with the center of the body frame. Thus at runtime the
  1481. position and orientation data of the free joint correspond to the global position and orientation of the body frame.
  1482. Free joints cannot have limits.
  1483. The **ball** type creates a ball joint with three rotational degrees of freedom. The rotation is represented as a
  1484. unit quaternion. The quaternion (1,0,0,0) corresponds to the initial configuration in which the model is defined. Any
  1485. other quaternion is interpreted as a 3D rotation relative to this initial configuration. The rotation is around the
  1486. point defined by the :ref:`pos<body-joint-pos>` attribute. If a body has a ball joint, it cannot have other
  1487. rotational joints (ball or hinge). Combining ball joints with slide joints in the same body is allowed.
  1488. The **slide** type creates a sliding or prismatic joint with one translational degree of freedom. Such joints are
  1489. defined by a position and a sliding direction. For simulation purposes only the direction is needed; the joint
  1490. position is used for rendering purposes.
  1491. The **hinge** type creates a hinge joint with one rotational degree of freedom. The rotation takes place around a
  1492. specified axis through a specified position. This is the most common type of joint and is therefore the default. Most
  1493. models contain only hinge and free joints.
  1494. .. _body-joint-group:
  1495. :at:`group`: :at-val:`int, "0"`
  1496. Integer group to which the joint belongs. This attribute can be used for custom tags. It is also used by the
  1497. visualizer to enable and disable the rendering of entire groups of joints.
  1498. .. _body-joint-pos:
  1499. :at:`pos`: :at-val:`real(3), "0 0 0"`
  1500. Position of the joint, specified in the frame of the body where the joint is defined.
  1501. For free joints this attribute is ignored.
  1502. .. _body-joint-axis:
  1503. :at:`axis`: :at-val:`real(3), "0 0 1"`
  1504. This attribute specifies the axis of rotation for hinge joints and the direction of translation for slide joints. It
  1505. is ignored for free and ball joints. The vector specified here is automatically normalized to unit length as long as
  1506. its length is greater than 10E-14; otherwise a compile error is generated.
  1507. .. _body-joint-springdamper:
  1508. :at:`springdamper`: :at-val:`real(2), "0 0"`
  1509. When both numbers are positive, the compiler will override any stiffness and damping values specified with the
  1510. attributes below, and will instead set them automatically so that the resulting mass-spring-damper for this joint has
  1511. the desired time constant (first value) and damping ratio (second value). This is done by taking into account the
  1512. joint inertia in the model reference configuration. Note that the format is the same as the solref parameter of the
  1513. constraint solver.
  1514. .. _body-joint-solreflimit:
  1515. .. _body-joint-solimplimit:
  1516. :at:`solreflimit`, :at:`solimplimit`
  1517. Constraint solver parameters for simulating joint limits. See :ref:`CSolver`.
  1518. .. _body-joint-solreffriction:
  1519. .. _body-joint-solimpfriction:
  1520. :at:`solreffriction`, :at:`solimpfriction`
  1521. Constraint solver parameters for simulating dry friction. See :ref:`CSolver`.
  1522. .. _body-joint-stiffness:
  1523. :at:`stiffness`: :at-val:`real, "0"`
  1524. Joint stiffness. If this value is positive, a spring will be created with equilibrium position given by springref
  1525. below. The spring force is computed along with the other passive forces.
  1526. .. _body-joint-range:
  1527. :at:`range`: :at-val:`real(2), "0 0"`
  1528. The joint limits. Limits can be imposed on all joint types except for free joints. For hinge and ball joints, the
  1529. range is specified in degrees or radians depending on the angle attribute of :ref:`compiler <compiler>`. For ball
  1530. joints, the limit is imposed on the angle of rotation (relative to the reference configuration) regardless of the
  1531. axis of rotation. Only the second range parameter is used for ball joints; the first range parameter should be set to
  1532. 0. See the :ref:`Limit <coLimit>` section in the Computation chapter for more information.
  1533. |br| Setting this attribute without specifying :at:`limited` is an error if :at:`autolimits` is "false" in
  1534. :ref:`compiler <compiler>`.
  1535. .. _body-joint-limited:
  1536. :at:`limited`: :at-val:`[false, true, auto], "auto"`
  1537. This attribute specifies if the joint has limits. It interacts with the :ref:`range<body-joint-range>` attribute. If
  1538. this attribute is "false", joint limits are disabled. If this attribute is "true", joint limits are enabled. If this
  1539. attribute is "auto", and :at:`autolimits` is set in :ref:`compiler <compiler>`, joint limits will be enabled if range
  1540. is defined.
  1541. .. _body-joint-actuatorfrcrange:
  1542. :at:`actuatorfrcrange`: :at-val:`real(2), "0 0"`
  1543. Range for clamping total actuator forces acting on this joint. See :ref:`CForceRange` for details. It is available
  1544. only for scalar joints (hinge and slider) and ignored for ball and free joints. |br| The compiler expects the first
  1545. value to be smaller than the second value. |br| Setting this attribute without specifying :at:`actuatorfrclimited`
  1546. is an error if :at:`compiler-autolimits` is "false".
  1547. .. _body-joint-actuatorfrclimited:
  1548. :at:`actuatorfrclimited`: :at-val:`[false, true, auto], "auto"`
  1549. This attribute specifies whether actuator forces acting on the joint should be clamped. See :ref:`CForceRange` for
  1550. details. It is available only for scalar joints (hinge and slider) and ignored for ball and free joints. |br| This
  1551. attribute interacts with the :ref:`actuatorfrcrange<body-joint-actuatorfrcrange>` attribute. If this attribute is
  1552. "false", actuator force clamping is disabled. If it is "true", actuator force clamping is enabled. If this attribute
  1553. is "auto", and :at:`autolimits` is set in :ref:`compiler <compiler>`, actuator force clamping will be enabled if
  1554. :at:`actuatorfrcrange` is defined.
  1555. .. _body-joint-actuatorgravcomp:
  1556. :at:`actuatorgravcomp`: :at-val:`[false, true], "false"`
  1557. If this flag is enabled, gravity compensation applied to this joint is added to actuator forces
  1558. (``mjData.qfrc_actuator``) rather than passive forces (``mjData.qfrc_passive``). Notionally, this means that gravity
  1559. compensation is the result of a control system rather than natural buoyancy. In practice, enabling this flag is
  1560. useful when joint-level actuator force clamping is used. In this case, the total actuation force applied on a joint,
  1561. including gravity compensation, is guaranteed to not exceeed the specified limits. See :ref:`CForceRange` and
  1562. :ref:`actuatorfrcrange<body-joint-actuatorfrcrange>` for more details on this type of force limit.
  1563. .. _body-joint-margin:
  1564. :at:`margin`: :at-val:`real, "0"`
  1565. The distance threshold below which limits become active. Recall that the :ref:`Constraint solver <Solver>` normally
  1566. generates forces as soon as a constraint becomes active, even if the margin parameter makes that happen at a
  1567. distance. This attribute together with solreflimit and solimplimit can be used to model a soft joint limit.
  1568. .. _body-joint-ref:
  1569. :at:`ref`: :at-val:`real, "0"`
  1570. The reference position or angle of the joint. This attribute is only used for slide and hinge joints. It defines the
  1571. joint value corresponding to the initial model configuration. The amount of spatial transformation that the joint
  1572. applies at runtime equals the current joint value stored in mjData.qpos minus this reference value stored in
  1573. mjModel.qpos0. The meaning of these vectors was discussed in the :ref:`Stand-alone <Standalone>` section in
  1574. the Overview chapter.
  1575. .. _body-joint-springref:
  1576. :at:`springref`: :at-val:`real, "0"`
  1577. The joint position or angle in which the joint spring (if any) achieves equilibrium. Similar to the vector
  1578. mjModel.qpos0 which stores all joint reference values specified with the ref attribute above, all spring reference
  1579. values specified with this attribute are stored in the vector mjModel.qpos_spring. The model configuration
  1580. corresponding to mjModel.qpos_spring is also used to compute the spring reference lengths of all tendons, stored in
  1581. mjModel.tendon_lengthspring. This is because :ref:`tendons <tendon>` can also have springs.
  1582. .. _body-joint-armature:
  1583. :at:`armature`: :at-val:`real, "0"`
  1584. Additional inertia associated with movement of the joint that is not due to body mass. This added inertia is usually
  1585. due to a rotor (a.k.a `armature <https://en.wikipedia.org/wiki/Armature_(electrical)>`__) spinning faster than the
  1586. joint itself due to a geared transmission; in this case the added inertia is known as "reflected inertia" and its
  1587. value is the rotational inertia of the spinning element multiplied by the square of the gear ratio. The value applies
  1588. to all degrees of freedom created by this joint.
  1589. Besides increasing the realism of joints with geared transmission, positive :at:`armature` significantly improves
  1590. simulation stability, even for small values, and is a recommended possible fix when encountering stability issues.
  1591. .. _body-joint-damping:
  1592. :at:`damping`: :at-val:`real, "0"`
  1593. Damping applied to all degrees of freedom created by this joint. Unlike friction loss which is computed by the
  1594. constraint solver, damping is simply a force linear in velocity. It is included in the passive forces. Despite this
  1595. simplicity, larger damping values can make numerical integrators unstable, which is why our Euler integrator handles
  1596. damping implicitly. See :ref:`Integration <geIntegration>` in the Computation chapter.
  1597. .. _body-joint-frictionloss:
  1598. :at:`frictionloss`: :at-val:`real, "0"`
  1599. Friction loss due to dry friction. This value is the same for all degrees of freedom created by this joint.
  1600. Semantically friction loss does not make sense for free joints, but the compiler allows it. To enable friction loss,
  1601. set this attribute to a positive value.
  1602. .. _body-joint-user:
  1603. :at:`user`: :at-val:`real(njnt_user), "0 0 ..."`
  1604. See :ref:`CUser`.
  1605. .. _body-freejoint:
  1606. :el-prefix:`body/` |-| **freejoint** (*)
  1607. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1608. This element creates a free joint whose only attributes are :at:`name` and :at:`group`. The :el:`freejoint` element is
  1609. an XML shortcut for
  1610. .. code-block:: xml
  1611. <joint type="free" stiffness="0" damping="0" frictionloss="0" armature="0"/>
  1612. While this joint can evidently be created with the :ref:`joint <body-joint>` element, default joint settings could
  1613. affect it. This is usually undesirable as physical free bodies do not have nonzero stiffness, damping, friction or
  1614. armature. To avoid this complication, the :el:`freejoint` element was introduced, ensuring joint defaults are *not
  1615. inherited*. If the XML model is saved, it will appear as a regular joint of type :at:`free`.
  1616. .. _body-freejoint-name:
  1617. :at:`name`: :at-val:`string, optional`
  1618. Name of the joint.
  1619. .. _body-freejoint-group:
  1620. :at:`group`: :at-val:`int, "0"`
  1621. Integer group to which the joint belongs. This attribute can be used for custom tags. It is also used by the
  1622. visualizer to enable and disable the rendering of entire groups of joints.
  1623. .. _body-freejoint-align:
  1624. :at:`align`: :at-val:`[false, true, auto], "auto"`
  1625. When set to :at-val:`true`, the body frame and free joint will automatically be aligned with inertial frame. When set
  1626. to :at-val:`false`, no alignment will occur. When set to :at-val:`auto`, the compiler's
  1627. :ref:`alignfree<compiler-alignfree>` global attribute will be respected.
  1628. Inertial frame alignment is an optimization only applies to bodies with a free joint and no child bodies ("simple
  1629. free bodies"). The alignment diagonalizes the 6x6 inertia matrix and minimizes bias forces, leading to faster and
  1630. more stable simulation. While this behaviour is a strict improvement, it modifies the semantics of the free joint,
  1631. making ``qpos`` and ``qvel`` values saved in older versions (for example, in :ref:`keyframes<keyframe>`) invalid.
  1632. Note that the :at:`align` attribute is never saved to XML. Instead, the pose of simple free bodies and their children
  1633. will be modified such that the body frame and inertial frame are aligned.
  1634. .. _body-geom:
  1635. :el-prefix:`body/` |-| **geom** (*)
  1636. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1637. This element creates a geom, and attaches it rigidly to the body within which the geom is defined. Multiple geoms can
  1638. be attached to the same body. At runtime they determine the appearance and collision properties of the body. At
  1639. compile time they can also determine the inertial properties of the body, depending on the presence of the
  1640. :ref:`inertial <body-inertial>` element and the setting of the inertiafromgeom attribute of :ref:`compiler <compiler>`.
  1641. This is done by summing the masses and inertias of all geoms attached to the body with geom group in the range
  1642. specified by the inertiagrouprange attribute of :ref:`compiler <compiler>`. The geom masses and inertias are computed
  1643. using the geom shape, a specified density or a geom mass which implies a density, and the assumption of uniform
  1644. density.
  1645. Geoms are not strictly required for physics simulation. One can create and simulate a model that only has bodies and
  1646. joints. Such a model can even be visualized, using equivalent inertia boxes to represent bodies. Only contact forces
  1647. would be missing from such a simulation. We do not recommend using such models, but knowing that this is possible
  1648. helps clarify the role of bodies and geoms in MuJoCo.
  1649. .. _body-geom-name:
  1650. :at:`name`: :at-val:`string, optional`
  1651. Name of the geom.
  1652. .. _body-geom-class:
  1653. :at:`class`: :at-val:`string, optional`
  1654. Defaults class for setting unspecified attributes.
  1655. .. _body-geom-type:
  1656. :at:`type`: :at-val:`[plane, hfield, sphere, capsule, ellipsoid, cylinder, box, mesh, sdf], "sphere"`
  1657. Type of geometric shape. The keywords have the following meaning: The **plane** type defines a plane which is
  1658. infinite for collision detection purposes. It can only be attached to the world body or static children of the world.
  1659. The plane passes through a point specified via the pos attribute. It is normal to the Z axis of the geom's local
  1660. frame. The +Z direction corresponds to empty space. Thus the position and orientation defaults of (0,0,0) and
  1661. (1,0,0,0) would create a ground plane at Z=0 elevation, with +Z being the vertical direction in the world (which is
  1662. MuJoCo's convention). Since the plane is infinite, it could have been defined using any other point in the plane. The
  1663. specified position however has additional meaning with regard to rendering. If either of the first two size
  1664. parameters are positive, the plane is rendered as a rectangle of finite size (in the positive dimensions). This
  1665. rectangle is centered at the specified position. Three size parameters are required. The first two specify the half-
  1666. size of the rectangle along the X and Y axes. The third size parameter is unusual: it specifies the spacing between
  1667. the grid subdivisions of the plane for rendering purposes. The subdivisions are revealed in wireframe rendering mode,
  1668. but in general they should not be used to paint a grid over the ground plane (textures should be used for that
  1669. purpose). Instead their role is to improve lighting and shadows, similar to the subdivisions used to render boxes.
  1670. When planes are viewed from the back, the are automatically made semi-transparent. Planes and the +Z faces of boxes
  1671. are the only surfaces that can show reflections, if the :ref:`material <asset-material>` applied to the geom has
  1672. positive reflection. To render an infinite plane, set the first two size parameters to zero.
  1673. The **hfield** type defines a height field geom. The geom must reference the desired height field asset with the
  1674. hfield attribute below. The position and orientation of the geom set the position and orientation of the height
  1675. field. The size of the geom is ignored, and the size parameters of the height field asset are used instead. See the
  1676. description of the :ref:`hfield <asset-hfield>` element. Similar to planes, height field geoms can only be attached
  1677. to the world body or to static children of the world.
  1678. The **sphere** type defines a sphere. This and the next four types correspond to built-in geometric primitives. These
  1679. primitives are treated as analytic surfaces for collision detection purposes, in many cases relying on custom pair-
  1680. wise collision routines. Models including only planes, spheres, capsules and boxes are the most efficient in terms of
  1681. collision detection. Other geom types invoke the general-purpose convex collider. The sphere is centered at the
  1682. geom's position. Only one size parameter is used, specifying the radius of the sphere. Rendering of geometric
  1683. primitives is done with automatically generated meshes whose density can be adjusted via
  1684. :ref:`quality <visual-quality>`. The sphere mesh is triangulated along the lines of latitude and longitude,
  1685. with the Z axis passing through the north and south pole. This can be useful in wireframe mode for visualizing frame
  1686. orientation.
  1687. The **capsule** type defines a capsule, which is a cylinder capped with two half-spheres. It is oriented along the Z
  1688. axis of the geom's frame. When the geom frame is specified in the usual way, two size parameters are required: the
  1689. radius of the capsule followed by the half-height of the cylinder part. However capsules as well as cylinders can
  1690. also be thought of as connectors, allowing an alternative specification with the fromto attribute below. In that case
  1691. only one size parameter is required, namely the radius of the capsule.
  1692. The **ellipsoid** type defines a ellipsoid. This is a sphere scaled separately along the X, Y and Z axes of the local
  1693. frame. It requires three size parameters, corresponding to the three radii. Note that even though ellipsoids are
  1694. smooth, their collisions are handled via the general-purpose convex collider. The only exception are plane-ellipsoid
  1695. collisions which are computed analytically.
  1696. The **cylinder** type defines a cylinder. It requires two size parameters: the radius and half-height of the
  1697. cylinder. The cylinder is oriented along the Z axis of the geom's frame. It can alternatively be specified with the
  1698. fromto attribute below.
  1699. The **box** type defines a box. Three size parameters are required, corresponding to the half-sizes of the box along
  1700. the X, Y and Z axes of the geom's frame. Note that box-box collisions are the only pair-wise collision type that can
  1701. generate a large number of contact points, up to 8 depending on the configuration. The contact generation itself is
  1702. fast but this can slow down the constraint solver. As an alternative, we provide the boxconvex attribute in
  1703. :ref:`flag <option-flag>` which causes the general-purpose convex collider to be used instead, yielding at most one
  1704. contact point per geom pair.
  1705. The **mesh** type defines a mesh. The geom must reference the desired mesh asset with the mesh attribute. Note that
  1706. mesh assets can also be referenced from other geom types, causing primitive shapes to be fitted; see below. The size
  1707. is determined by the mesh asset and the geom size parameters are ignored. Unlike all other geoms, the position and
  1708. orientation of mesh geoms after compilation do not equal the settings of the corresponding attributes here. Instead
  1709. they are offset by the translation and rotation that were needed to center and align the mesh asset in its own
  1710. coordinate frame. Recall the discussion of centering and alignment in the :ref:`mesh <asset-mesh>` element.
  1711. The **sdf** type defines a signed distance field (SDF, also referred to as signed distance function). In order to
  1712. visualize the SDF, a custom mesh must be specified using the :ref:`mesh/plugin <mesh-plugin>` attribute. See the
  1713. `model/plugin/sdf/ <https://github.com/google-deepmind/mujoco/tree/main/model/plugin/sdf>`__ directory for example models
  1714. with SDF geometries. For more details regarding SDF plugins, see the :ref:`Extensions chapter<exWriting>`.
  1715. .. _body-geom-contype:
  1716. :at:`contype`: :at-val:`int, "1"`
  1717. This attribute and the next specify 32-bit integer bitmasks used for contact filtering of dynamically generated
  1718. contact pairs. See :ref:`Collision` in the Computation chapter. Two geoms can collide if the contype of one geom
  1719. is compatible with the conaffinity of the other geom or vice versa. Compatible means that the two bitmasks have
  1720. a common bit set to 1.
  1721. .. _body-geom-conaffinity:
  1722. :at:`conaffinity`: :at-val:`int, "1"`
  1723. Bitmask for contact filtering; see contype above.
  1724. .. _body-geom-condim:
  1725. :at:`condim`: :at-val:`int, "3"`
  1726. The dimensionality of the contact space for a dynamically generated contact pair is set to the maximum of the condim
  1727. values of the two participating geoms. See :ref:`coContact` in the Computation chapter. The allowed values and their
  1728. meaning are:
  1729. +--------+----------------------------------------------------------------------------------------------------------+
  1730. | condim | Description |
  1731. +========+==========================================================================================================+
  1732. | 1 | Frictionless contact. |
  1733. +--------+----------------------------------------------------------------------------------------------------------+
  1734. | 3 | Regular frictional contact, opposing slip in the tangent plane. |
  1735. +--------+----------------------------------------------------------------------------------------------------------+
  1736. | 4 | Frictional contact, opposing slip in the tangent plane and rotation around the contact normal. This is |
  1737. | | useful for modeling soft contacts (independent of contact penetration). |
  1738. +--------+----------------------------------------------------------------------------------------------------------+
  1739. | 6 | Frictional contact, opposing slip in the tangent plane, rotation around the contact normal and rotation |
  1740. | | around the two axes of the tangent plane. The latter frictional effects are useful for preventing |
  1741. | | objects from indefinite rolling. |
  1742. +--------+----------------------------------------------------------------------------------------------------------+
  1743. .. _body-geom-group:
  1744. :at:`group`: :at-val:`int, "0"`
  1745. This attribute specifies an integer group to which the geom belongs. The only effect on the physics is at compile
  1746. time, when body masses and inertias are inferred from geoms selected based on their group; see inertiagrouprange
  1747. attribute of :ref:`compiler <compiler>`. At runtime this attribute is used by the visualizer to enable and disable
  1748. the rendering of entire geom groups. It can also be used as a tag for custom computations.
  1749. .. _body-geom-priority:
  1750. :at:`priority`: :at-val:`int, "0"`
  1751. The geom priority determines how the properties of two colliding geoms are combined to form the properties of the
  1752. contact. This interacts with the solmix attribute. See :ref:`CContact`.
  1753. .. _body-geom-size:
  1754. :at:`size`: :at-val:`real(3), "0 0 0"`
  1755. Geom size parameters. The number of required parameters and their meaning depends on the geom type as documented
  1756. under the type attribute. Here we only provide a summary. All required size parameters must be positive; the internal
  1757. defaults correspond to invalid settings. Note that when a non-mesh geom type references a mesh, a geometric primitive
  1758. of that type is fitted to the mesh. In that case the sizes are obtained from the mesh, and the geom size parameters
  1759. are ignored. Thus the number and description of required size parameters in the table below only apply to geoms that
  1760. do not reference meshes.
  1761. +---------+--------+------------------------------------------------------------------------------------------------+
  1762. | Type | Number | Description |
  1763. +=========+========+================================================================================================+
  1764. | plane | 3 | X half-size; Y half-size; spacing between square grid lines for rendering. If either the X or Y|
  1765. | | | half-size is 0, the plane is rendered as infinite in the dimension(s) with 0 size. |
  1766. +---------+--------+------------------------------------------------------------------------------------------------+
  1767. | hfield | 0 | The geom sizes are ignored and the height field sizes are used instead. |
  1768. +---------+--------+------------------------------------------------------------------------------------------------+
  1769. | sphere | 1 | Radius of the sphere. |
  1770. +---------+--------+------------------------------------------------------------------------------------------------+
  1771. | capsule | 1 or 2 | Radius of the capsule; half-length of the cylinder part when not using the :at:`fromto` |
  1772. | | | specification. |
  1773. +---------+--------+------------------------------------------------------------------------------------------------+
  1774. |ellipsoid| 3 | X radius; Y radius; Z radius. |
  1775. +---------+--------+------------------------------------------------------------------------------------------------+
  1776. |cylinder | 1 or 2 | Radius of the cylinder; half-length of the cylinder when not using the :at:`fromto` |
  1777. | | | specification. |
  1778. +---------+--------+------------------------------------------------------------------------------------------------+
  1779. | box | 3 | X half-size; Y half-size; Z half-size. |
  1780. +---------+--------+------------------------------------------------------------------------------------------------+
  1781. | mesh | 0 | The geom sizes are ignored and the mesh sizes are used instead. |
  1782. +---------+--------+------------------------------------------------------------------------------------------------+
  1783. .. _body-geom-material:
  1784. :at:`material`: :at-val:`string, optional`
  1785. If specified, this attribute applies a material to the geom. The material determines the visual properties of the
  1786. geom. The only exception is color: if the rgba attribute below is different from its internal default, it takes
  1787. precedence while the remaining material properties are still applied. Note that if the same material is referenced
  1788. from multiple geoms (as well as sites and tendons) and the user changes some of its properties at runtime, these
  1789. changes will take effect immediately for all model elements referencing the material. This is because the compiler
  1790. saves the material and its properties as a separate element in mjModel, and the elements using this material only
  1791. keep a reference to it.
  1792. .. _body-geom-rgba:
  1793. :at:`rgba`: :at-val:`real(4), "0.5 0.5 0.5 1"`
  1794. Instead of creating material assets and referencing them, this attribute can be used to set color and transparency
  1795. only. This is not as flexible as the material mechanism, but is more convenient and is often sufficient. If the value
  1796. of this attribute is different from the internal default, it takes precedence over the material.
  1797. .. _body-geom-friction:
  1798. :at:`friction`: :at-val:`real(3), "1 0.005 0.0001"`
  1799. Contact friction parameters for dynamically generated contact pairs. The first number is the sliding friction, acting
  1800. along both axes of the tangent plane. The second number is the torsional friction, acting around the contact normal.
  1801. The third number is the rolling friction, acting around both axes of the tangent plane. The friction parameters for
  1802. the contact pair are combined depending on the solmix and priority attributes, as explained in :ref:`Contact
  1803. parameters <CContact>`. See the general :ref:`Contact<coContact>` section for descriptions of the semantics of this
  1804. attribute.
  1805. .. _body-geom-mass:
  1806. :at:`mass`: :at-val:`real, optional`
  1807. If this attribute is specified, the density attribute below is ignored and the geom density is computed from the
  1808. given mass, using the geom shape and the assumption of uniform density. The computed density is then used to obtain
  1809. the geom inertia. Recall that the geom mass and inertia are only used during compilation, to infer the body mass and
  1810. inertia if necessary. At runtime only the body inertial properties affect the simulation; the geom mass and inertia
  1811. are not saved in mjModel.
  1812. .. _body-geom-density:
  1813. :at:`density`: :at-val:`real, "1000"`
  1814. Material density used to compute the geom mass and inertia. The computation is based on the geom shape and the
  1815. assumption of uniform density. The internal default of 1000 is the density of water in SI units. This attribute is
  1816. used only when the mass attribute above is unspecified. If `shellinertia` is "false" (the default), density has
  1817. semantics of mass/volume; if "true", it has semantics of mass/area.
  1818. .. _body-geom-shellinertia:
  1819. :at:`shellinertia` :at-val:`[false, true], "false"`
  1820. If true, the geom's inertia is computed assuming that all the mass is concentrated on the boundary. In this case
  1821. :at:`density` is interpreted as surface density rather than volumetric density.
  1822. .. _body-geom-solmix:
  1823. :at:`solmix`: :at-val:`real, "1"`
  1824. This attribute specifies the weight used for averaging of contact parameters, and interacts with the priority
  1825. attribute. See :ref:`CContact`.
  1826. .. _body-geom-solref:
  1827. .. _body-geom-solimp:
  1828. :at:`solref`, :at:`solimp`
  1829. Constraint solver parameters for contact simulation. See :ref:`CSolver`.
  1830. .. _body-geom-margin:
  1831. :at:`margin`: :at-val:`real, "0"`
  1832. Distance threshold below which contacts are detected and included in the global array mjData.contact. This however
  1833. does not mean that contact force will be generated. A contact is considered active only if the distance between the
  1834. two geom surfaces is below margin-gap. Recall that constraint impedance can be a function of distance, as explained
  1835. in :ref:`CSolver`. The quantity this function is applied to is the distance between
  1836. the two geoms minus the margin plus the gap.
  1837. .. _body-geom-gap:
  1838. :at:`gap`: :at-val:`real, "0"`
  1839. This attribute is used to enable the generation of inactive contacts, i.e., contacts that are ignored by the
  1840. constraint solver but are included in mjData.contact for the purpose of custom computations. When this value is
  1841. positive, geom distances between margin and margin-gap correspond to such inactive contacts.
  1842. .. _body-geom-fromto:
  1843. :at:`fromto`: :at-val:`real(6), optional`
  1844. .. figure:: images/XMLreference/fromto.png
  1845. :width: 350px
  1846. :align: right
  1847. This attribute can only be used with capsule, box, cylinder and ellipsoid geoms. It provides an alternative
  1848. specification of the geom length as well as the frame position and orientation. The six numbers are the 3D
  1849. coordinates of one point followed by the 3D coordinates of another point. The elongated part of the geom connects
  1850. these two points, with the +Z axis of the geom's frame oriented from the first towards the second point, while in the
  1851. perpendicular direction, the geom sizes are both equal to the first value of the :at:`size` attribute. The frame
  1852. orientation is obtained with the same procedure as the :at:`zaxis` attribute described in :ref:`Frame orientations
  1853. <COrientation>`. The frame position is in the middle between the end points. If this attribute is specified, the
  1854. remaining position and orientation-related attributes are ignored. The image on the right demonstrates use of
  1855. :at:`fromto` with the four supported geoms, using identical Z values. The model is `here <_static/fromto.xml>`__.
  1856. Note that the :at:`fromto` semantics of *capsule* are unique: the two end points specify the segement around which
  1857. the radius defines the capsule surface.
  1858. .. _body-geom-pos:
  1859. :at:`pos`: :at-val:`real(3), "0 0 0"`
  1860. Position of the geom, specified in the frame of the body where the geom is defined.
  1861. .. _body-geom-quat:
  1862. .. _body-geom-axisangle:
  1863. .. _body-geom-xyaxes:
  1864. .. _body-geom-zaxis:
  1865. .. _body-geom-euler:
  1866. :at:`quat`, :at:`axisangle`, :at:`xyaxes`, :at:`zaxis`, :at:`euler`
  1867. Orientation of the geom frame. See :ref:`COrientation`.
  1868. .. _body-geom-hfield:
  1869. :at:`hfield`: :at-val:`string, optional`
  1870. This attribute must be specified if and only if the geom type is "hfield". It references the height field asset to be
  1871. instantiated at the position and orientation of the geom frame.
  1872. .. _body-geom-mesh:
  1873. :at:`mesh`: :at-val:`string, optional`
  1874. If the geom type is "mesh", this attribute is required. It references the mesh asset to be instantiated. This
  1875. attribute can also be specified if the geom type corresponds to a geometric primitive, namely one of "sphere",
  1876. "capsule", "cylinder", "ellipsoid", "box". In that case the primitive is automatically fitted to the mesh asset
  1877. referenced here. The fitting procedure uses either the equivalent inertia box or the axis-aligned bounding box of the
  1878. mesh, as determined by the attribute fitaabb of :ref:`compiler <compiler>`. The resulting size of the fitted geom is
  1879. usually what one would expect, but if not, it can be further adjusted with the fitscale attribute below. In the
  1880. compiled mjModel the geom is represented as a regular geom of the specified primitive type, and there is no reference
  1881. to the mesh used for fitting.
  1882. .. _body-geom-fitscale:
  1883. :at:`fitscale`: :at-val:`real, "1"`
  1884. This attribute is used only when a primitive geometric type is being fitted to a mesh asset. The scale specified here
  1885. is relative to the output of the automated fitting procedure. The default value of 1 leaves the result unchanged, a
  1886. value of 2 makes all sizes of the fitted geom two times larger.
  1887. .. _body-geom-fluidshape:
  1888. :at:`fluidshape`: :at-val:`[none, ellipsoid], "none"`
  1889. "ellipsoid" activates the geom-level fluid interaction model based on an ellipsoidal approximation of the geom
  1890. shape. When active, the model based on :ref:`body inertia sizes <flInertia>` is disabled for the body in which the
  1891. geom is defined. See section on :ref:`ellipsoid-based<flEllipsoid>` fluid interaction model for details.
  1892. .. _body-geom-fluidcoef:
  1893. :at:`fluidcoef`: :at-val:`real(5), "0.5 0.25 1.5 1.0 1.0"`
  1894. Dimensionless coefficients of fluid interaction model, as follows.
  1895. See section on :ref:`ellipsoid-based<flEllipsoid>` fluid interaction model for details.
  1896. .. list-table::
  1897. :width: 60%
  1898. :align: left
  1899. :widths: 1 5 2 1
  1900. :header-rows: 1
  1901. * - Index
  1902. - Description
  1903. - Symbol
  1904. - Default
  1905. * - 0
  1906. - Blunt drag coefficient
  1907. - :math:`C_{D, \text{blunt}}`
  1908. - 0.5
  1909. * - 1
  1910. - Slender drag coefficient
  1911. - :math:`C_{D, \text{slender}}`
  1912. - 0.25
  1913. * - 2
  1914. - Angular drag coefficient
  1915. - :math:`C_{D, \text{angular}}`
  1916. - 1.5
  1917. * - 3
  1918. - Kutta lift coefficient
  1919. - :math:`C_K`
  1920. - 1.0
  1921. * - 4
  1922. - Magnus lift coefficient
  1923. - :math:`C_M`
  1924. - 1.0
  1925. .. _body-geom-user:
  1926. :at:`user`: :at-val:`real(nuser_geom), "0 0 ..."`
  1927. See :ref:`CUser`.
  1928. .. _geom-plugin:
  1929. :el-prefix:`geom/` |-| **plugin** (?)
  1930. '''''''''''''''''''''''''''''''''''''
  1931. Associate this geom with an :ref:`engine plugin<exPlugin>`. Either :at:`plugin` or :at:`instance` are required.
  1932. .. _geom-plugin-plugin:
  1933. :at:`plugin`: :at-val:`string, optional`
  1934. Plugin identifier, used for implicit plugin instantiation.
  1935. .. _geom-plugin-instance:
  1936. :at:`instance`: :at-val:`string, optional`
  1937. Instance name, used for explicit plugin instantiation.
  1938. .. _body-site:
  1939. :el-prefix:`body/` |-| **site** (*)
  1940. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1941. This element creates a site, which is a simplified and restricted kind of geom. A small subset of the geom attributes
  1942. are available here; see the :ref:`geom <body-geom>` element for their detailed documentation. Semantically sites represent
  1943. locations of interest relative to the body frames. Sites do not participate in collisions and computation of body masses
  1944. and inertias. The geometric shapes that can be used to render sites are limited to a subset of the available geom types.
  1945. However sites can be used in some places where geoms are not allowed: mounting sensors, specifying via-points of spatial
  1946. tendons, constructing slider-crank transmissions for actuators.
  1947. .. _body-site-name:
  1948. :at:`name`: :at-val:`string, optional`
  1949. Name of the site.
  1950. .. _body-site-class:
  1951. :at:`class`: :at-val:`string, optional`
  1952. Defaults class for setting unspecified attributes.
  1953. .. _body-site-type:
  1954. :at:`type`: :at-val:`[sphere, capsule, ellipsoid, cylinder, box], "sphere"`
  1955. Type of geometric shape. This is used for rendering, and also determines the active sensor zone for :ref:`touch
  1956. sensors <sensor-touch>`.
  1957. .. _body-site-group:
  1958. :at:`group`: :at-val:`int, "0"`
  1959. Integer group to which the site belongs. This attribute can be used for custom tags. It is also used by the
  1960. visualizer to enable and disable the rendering of entire groups of sites.
  1961. .. _body-site-material:
  1962. :at:`material`: :at-val:`string, optional`
  1963. Material used to specify the visual properties of the site.
  1964. .. _body-site-rgba:
  1965. :at:`rgba`: :at-val:`real(4), "0.5 0.5 0.5 1"`
  1966. Color and transparency. If this value is different from the internal default, it overrides the corresponding material
  1967. properties.
  1968. .. _body-site-size:
  1969. :at:`size`: :at-val:`real(3), "0.005 0.005 0.005"`
  1970. Sizes of the geometric shape representing the site.
  1971. .. _body-site-fromto:
  1972. :at:`fromto`: :at-val:`real(6), optional`
  1973. This attribute can only be used with capsule, cylinder, ellipsoid and box sites. It provides an alternative
  1974. specification of the site length as well as the frame position and orientation. The six numbers are the 3D
  1975. coordinates of one point followed by the 3D coordinates of another point. The elongated part of the site connects
  1976. these two points, with the +Z axis of the site's frame oriented from the first towards the second point. The frame
  1977. orientation is obtained with the same procedure as the zaxis attribute described in :ref:`Frame orientations
  1978. <COrientation>`. The frame position is in the middle between the two points. If this attribute is specified, the
  1979. remaining position and orientation-related attributes are ignored.
  1980. .. _body-site-pos:
  1981. :at:`pos`: :at-val:`real(3), "0 0 0"`
  1982. Position of the site frame.
  1983. .. _body-site-quat:
  1984. .. _body-site-axisangle:
  1985. .. _body-site-xyaxes:
  1986. .. _body-site-zaxis:
  1987. .. _body-site-euler:
  1988. :at:`quat`, :at:`axisangle`, :at:`xyaxes`, :at:`zaxis`, :at:`euler`
  1989. Orientation of the site frame. See :ref:`COrientation`.
  1990. .. _body-site-user:
  1991. :at:`user`: :at-val:`real(nuser_site), "0 0 ..."`
  1992. See :ref:`CUser`.
  1993. .. _body-camera:
  1994. :el-prefix:`body/` |-| **camera** (*)
  1995. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1996. This element creates a camera, which moves with the body where it is defined. To create a fixed camera, define it in the
  1997. world body. The cameras created here are in addition to the default free camera which is always defined and is adjusted
  1998. via the :ref:`visual <visual>` element. Internally MuJoCo uses a flexible camera model, where the viewpoint and
  1999. projection surface are adjusted independently so as to obtain oblique projections needed for virtual environments. This
  2000. functionality however is not accessible through MJCF. Instead, the cameras created with this element (as well as the
  2001. free camera) have a viewpoint that is always centered in front of the projection surface. The viewpoint coincides with
  2002. the center of the camera frame. The camera is looking along the -Z axis of its frame. The +X axis points to the right,
  2003. and the +Y axis points up. Thus the frame position and orientation are the key adjustments that need to be made here.
  2004. .. _body-camera-name:
  2005. :at:`name`: :at-val:`string, optional`
  2006. Name of the camera.
  2007. .. _body-camera-class:
  2008. :at:`class`: :at-val:`string, optional`
  2009. Defaults class for setting unspecified attributes.
  2010. .. _body-camera-mode:
  2011. :at:`mode`: :at-val:`[fixed, track, trackcom, targetbody, targetbodycom], "fixed"`
  2012. This attribute specifies how the camera position and orientation in world coordinates are computed in forward
  2013. kinematics (which in turn determine what the camera sees). "fixed" means that the position and orientation specified
  2014. below are fixed relative to the the body where the camera is defined. "track" means that the camera position is at a
  2015. constant offset from the body in world coordinates, while the camera orientation is constant in world coordinates.
  2016. These constants are determined by applying forward kinematics in qpos0 and treating the camera as fixed. Tracking can
  2017. be used for example to position a camera above a body, point it down so it sees the body, and have it always remain
  2018. above the body no matter how the body translates and rotates. "trackcom" is similar to "track" but the constant
  2019. spatial offset is defined relative to the center of mass of the kinematic subtree starting at the body in which the
  2020. camera is defined. This can be used to keep an entire mechanism in view. Note that the subtree center of mass for the
  2021. world body is the center of mass of the entire model. So if a camera is defined in the world body in mode "trackcom",
  2022. it will track the entire model. "targetbody" means that the camera position is fixed in the body frame, while the
  2023. camera orientation is adjusted so that it always points towards the targeted body (which is specified with the target
  2024. attribute below). This can be used for example to model an eye that fixates a moving object; the object will be the
  2025. target, and the camera/eye will be defined in the body corresponding to the head. "targetbodycom" is the same as
  2026. "targetbody" but the camera is oriented towards the center of mass of the subtree starting at the target body.
  2027. .. _body-camera-target:
  2028. :at:`target`: :at-val:`string, optional`
  2029. When the camera mode is "targetbody" or "targetbodycom", this attribute becomes required. It specifies which body
  2030. should be targeted by the camera. In all other modes this attribute is ignored.
  2031. .. _body-camera-orthographic:
  2032. :at:`orthographic`: :at-val:`[false, true], "false"`
  2033. Whether the camera uses a perspective projection (the default) or an orthographic projection. Setting this attribute
  2034. changes the semantic of the :ref:`fovy<body-camera-fovy>` attribute, see below.
  2035. .. _body-camera-fovy:
  2036. :at:`fovy`: :at-val:`real, "45"`
  2037. Vertical field-of-view of the camera. If the camera uses a perspective projection, the field-of-view is expressed in
  2038. degrees, regardless of the global :ref:`compiler/angle <compiler-angle>` setting. If the camera uses an orthographic
  2039. projection, the field-of-view is expressed in units of length; note that in this case the default of 45 is too large
  2040. for most scenes and should likely be reduced. In either case, the horizontal field of view is computed automatically
  2041. given the window size and the vertical field of view.
  2042. .. _body-camera-resolution:
  2043. :at:`resolution`: :at-val:`int(2), "1 1"`
  2044. Resolution of the camera in pixels [width height]. Note that these values are not used for rendering since those
  2045. dimensions are determined by the size of the rendering context. This attribute serves as a convenient
  2046. location to save the required resolution when creating a context.
  2047. .. _body-camera-focal:
  2048. :at:`focal`: :at-val:`real(2), "0 0"`
  2049. Focal length of the camera in length units. It is mutually exclusive with :ref:`fovy <body-camera-fovy>`.
  2050. See :ref:`CCamera` for details.
  2051. .. _body-camera-focalpixel:
  2052. :at:`focalpixel`: :at-val:`int(2), "0 0"`
  2053. Focal length of the camera in pixel units. If both :at:`focal`: and :at:`focalpixel`: are specified, the former is
  2054. ignored.
  2055. .. _body-camera-principal:
  2056. :at:`principal`: :at-val:`real(2), "0 0"`
  2057. Principal point of the camera in length units. It is mutually exclusive with :ref:`fovy <body-camera-fovy>`.
  2058. .. _body-camera-principalpixel:
  2059. :at:`principalpixel`: :at-val:`real(2), "0 0"`
  2060. Principal point of the camera in pixel units. If both :at:`principal`: and :at:`principalpixel`: are specified, the
  2061. former is ignored.
  2062. .. _body-camera-sensorsize:
  2063. :at:`sensorsize`: :at-val:`real(2), "0 0"`
  2064. Size of the camera sensor in length units. It is mutually exclusive with :ref:`fovy <body-camera-fovy>`. If
  2065. specified, :ref:`resolution <body-camera-resolution>` and :ref:`focal <body-camera-focal>` are required.
  2066. .. _body-camera-ipd:
  2067. :at:`ipd`: :at-val:`real, "0.068"`
  2068. Inter-pupilary distance. This attribute only has an effect during stereoscopic rendering. It specifies the distance
  2069. between the left and right viewpoints. Each viewpoint is shifted by +/- half of the distance specified here, along
  2070. the X axis of the camera frame.
  2071. .. _body-camera-pos:
  2072. :at:`pos`: :at-val:`real(3), "0 0 0"`
  2073. Position of the camera frame.
  2074. .. _body-camera-quat:
  2075. .. _body-camera-axisangle:
  2076. .. _body-camera-xyaxes:
  2077. .. _body-camera-zaxis:
  2078. .. _body-camera-euler:
  2079. :at:`quat`, :at:`axisangle`, :at:`xyaxes`, :at:`zaxis`, :at:`euler`
  2080. Orientation of the camera frame. See :ref:`COrientation`.
  2081. Note that specifically for cameras, the :at:`xyaxes` attribute is semantically convenient as the X and Y axes
  2082. correspond to the directions "right" and "up" in pixel space, respectively.
  2083. .. _body-camera-user:
  2084. :at:`user`: :at-val:`real(nuser_cam), "0 0 ..."`
  2085. See :ref:`CUser`.
  2086. .. _body-light:
  2087. :el-prefix:`body/` |-| **light** (*)
  2088. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2089. This element creates a light, which moves with the body where it is defined. To create a fixed light, define it in the
  2090. world body. The lights created here are in addition to the default headlight which is always defined and is adjusted via
  2091. the :ref:`visual <visual>` element. MuJoCo relies on the standard lighting model in OpenGL (fixed functionality)
  2092. augmented with shadow mapping. The effects of lights are additive, thus adding a light always makes the scene brighter.
  2093. The maximum number of lights that can be active simultaneously is 8, counting the headlight. The light is shining along
  2094. the direction specified by the dir attribute. It does not have a full spatial frame with three orthogonal axes.
  2095. .. _body-light-name:
  2096. :at:`name`: :at-val:`string, optional`
  2097. Name of the light.
  2098. .. _body-light-class:
  2099. :at:`class`: :at-val:`string, optional`
  2100. Defaults class for setting unspecified attributes.
  2101. .. _body-light-mode:
  2102. :at:`mode`: :at-val:`[fixed, track, trackcom, targetbody, targetbodycom], "fixed"`
  2103. This is identical to the mode attribute of :ref:`camera <body-camera>` above. It specifies the how the light position
  2104. and orientation in world coordinates are computed in forward kinematics (which in turn determine what the light
  2105. illuminates).
  2106. .. _body-light-target:
  2107. :at:`target`: :at-val:`string, optional`
  2108. This is identical to the target attribute of :ref:`camera <body-camera>` above. It specifies which body should be
  2109. targeted in "targetbody" and "targetbodycom" modes.
  2110. .. _body-light-directional:
  2111. :at:`directional`: :at-val:`[false, true], "false"`
  2112. The light is directional if this attribute is "true", otherwise it is a spotlight.
  2113. .. _body-light-castshadow:
  2114. :at:`castshadow`: :at-val:`[false, true], "true"`
  2115. If this attribute is "true" the light will cast shadows. More precisely, the geoms illuminated by the light will cast
  2116. shadows, however this is a property of lights rather than geoms. Since each shadow-casting light causes one extra
  2117. rendering pass through all geoms, this attribute should be used with caution. Higher quality of the shadows is
  2118. achieved by increasing the value of the shadowsize attribute of :ref:`quality <visual-quality>`, as well as
  2119. positioning spotlights closer to the surface on which shadows appear, and limiting the volume in which shadows are
  2120. cast. For spotlights this volume is a cone, whose angle is the cutoff attribute below multiplied by the shadowscale
  2121. attribute of :ref:`map <visual-map>`. For directional lights this volume is a box, whose half-sizes in the directions
  2122. orthogonal to the light are the model extent multiplied by the shadowclip attribute of :ref:`map <visual-map>`. The
  2123. model extent is computed by the compiler but can also be overridden by specifying the extent attribute of
  2124. :ref:`statistic <statistic>`. Internally the shadow-mapping mechanism renders the scene from the light viewpoint (as
  2125. if it were a camera) into a depth texture, and then renders again from the camera viewpoint, using the depth texture
  2126. to create shadows. The internal rendering pass uses the same near and far clipping planes as regular rendering, i.e.,
  2127. these clipping planes bound the cone or box shadow volume in the light direction. As a result, some shadows
  2128. (especially those very close to the light) may be clipped.
  2129. .. _body-light-bulbradius:
  2130. :at:`radius`: :at-val:`real, "0.02"`
  2131. Radius of the light, affects shadow softness. This attribute has no effect in MuJoCo's native renderer, but it can be
  2132. useful when rendering scenes with an external renderer.
  2133. .. _body-light-active:
  2134. :at:`active`: :at-val:`[false, true], "true"`
  2135. The light is active if this attribute is "true". This can be used at runtime to turn lights on and off.
  2136. .. _body-light-pos:
  2137. :at:`pos`: :at-val:`real(3), "0 0 0"`
  2138. Position of the light. This attribute only affects the rendering for spotlights, but it should also be defined for
  2139. directional lights because we render the cameras as decorative elements.
  2140. .. _body-light-dir:
  2141. :at:`dir`: :at-val:`real(3), "0 0 -1"`
  2142. Direction of the light.
  2143. .. _body-light-attenuation:
  2144. :at:`attenuation`: :at-val:`real(3), "1 0 0"`
  2145. These are the constant, linear and quadratic attenuation coefficients in OpenGL. The default corresponds to no
  2146. attenuation. See the OpenGL documentation for more information on this and all other OpenGL-related properties.
  2147. .. _body-light-cutoff:
  2148. :at:`cutoff`: :at-val:`real, "45"`
  2149. Cutoff angle for spotlights, always in degrees regardless of the global angle setting.
  2150. .. _body-light-exponent:
  2151. :at:`exponent`: :at-val:`real, "10"`
  2152. Exponent for spotlights. This setting controls the softness of the spotlight cutoff.
  2153. .. _body-light-ambient:
  2154. :at:`ambient`: :at-val:`real(3), "0 0 0"`
  2155. The ambient color of the light.
  2156. .. _body-light-diffuse:
  2157. :at:`diffuse`: :at-val:`real(3), "0.7 0.7 0.7"`
  2158. The diffuse color of the light.
  2159. .. _body-light-specular:
  2160. :at:`specular`: :at-val:`real(3), "0.3 0.3 0.3"`
  2161. The specular color of the light.
  2162. .. _body-composite:
  2163. :el-prefix:`body/` |-| **composite** (*)
  2164. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2165. This is not a model element, but rather a macro which expands into multiple model elements representing a composite
  2166. object. These elements are bodies (with their own joints, geoms and sites) that become children of the parent body
  2167. containing the macro, as well as tendons and equality constraints added to the corresponding model sections. The
  2168. automatically-generated bodies are laid out in a regular grid in 1D, 2D or 3D depending on the object type and count
  2169. attributes. The macro expansion is done by the model compiler. If the resulting model is then saved, the macro will be
  2170. replaced with the actual model elements. The defaults mechanism used in the rest of MJCF does not apply here, even if
  2171. the parent body has a childclass attribute defined. Instead there are internal defaults adjusted automatically for each
  2172. composite object type. Composite objects can only be defined if the model is in local coordinates. Using them in global
  2173. coordinates results in compiler error. See :ref:`CComposite` in the modeling guide for more detailed explanation.
  2174. .. _body-composite-prefix:
  2175. :at:`prefix`: :at-val:`string, optional`
  2176. All automatically generated model elements have names indicating the element type and index. For example, the body at
  2177. coordinates (2, 0) in a 2D grid is named "B2_0" by default. If prefix="C" is specified, the same body is named
  2178. "CB2_0". The prefix is needed when multiple composite objects are used in the same model, to avoid name conflicts.
  2179. .. _body-composite-type:
  2180. :at:`type`: :at-val:`[particle, grid, cable, rope, loop, cloth, box, cylinder, ellipsoid], required`
  2181. This attribute determines the type of composite object. The remaining attributes and sub-elements are then
  2182. interpreted according to the type. Default settings are also adjusted depending on the type.
  2183. The **particle** type creates a 1D, 2D or 3D grid of equally-spaced bodies. By default, each body has a single sphere
  2184. geom and 3 orthogonal sliding joints, allowing translation but not rotation. The geom condim and priority attributes
  2185. are set to 1 by default. This makes the spheres have frictionless contacts with all other geoms (unless the priority
  2186. of some frictional geom is higher). The user can replace the default sliders with multiple joints of kind="particle"
  2187. and replace the default sphere with a custom geom. Note that the particle composite type is deprecated and might be
  2188. removed in a future version. Instead of particle, it is recommended to use :ref:`replicate`.
  2189. The **grid** type creates a 1D or 2D grid of bodies, each having a sphere geom, a sphere site, and 3 orthogonal
  2190. sliding joints by default. The :el:`pin` sub-element can be used to specify that some bodies should not have joints,
  2191. and instead should be pinned to the parent body. Unlike the particle type, here each two neighboring bodies are
  2192. connected with a spatial tendon whose length is equality-constrained to its initial value (the sites are needed to
  2193. define the tendons). The "main" tendons are parallel to the axes of the grid. In addition one can create diagonal
  2194. "shear" tendons, using the :el:`tendon` sub-element. This type is suitable for simulating strings as well as cloth.
  2195. The **rope** type creates a 1D grid of bodies, each having a geom with user-defined type (sphere, capsule or
  2196. ellipsoid) and 2 hinge joints with axes orthogonal to the grid, creating a universal joint with the previous body.
  2197. This corresponds to a kinematic chain which can bend but cannot stretch or twist. In addition, one can specify
  2198. stretch and twist joints (slide and hinge respectively) with the :el:`joint` sub-element. When specified, these extra
  2199. joints are equality-constrained, but the constraint is soft by default so that some stretch and twist are possible.
  2200. The rope can extend in one or both directions from the parent body. To specify the origin of the rope, the parent
  2201. body *must* be named so that it fits the automatic naming convention. For example, to make the parent be the first
  2202. body in the chain, and assuming we have prefix="C", the parent body should be named "CB0". When the parent is not at
  2203. the end, the rope consists of two kinematic chains starting at the parent and extending in opposite directions.
  2204. The **loop** type is the same as the rope type except the elements are arranged in a circle, and the first and last
  2205. elements are equality-constrained to remain connected (using the "connect" constraint type). The softness of this
  2206. equality constraint is adjusted with the attributes solrefsmooth and solimpsmooth.
  2207. The **cable** type creates a 1D chain of bodies connected with ball joints, each having a geom with user-defined type
  2208. (cylinder, capsule or box). The geometry can either be defined with an array of 3D vertex coordinates :at:`vertex`
  2209. or with prescribed functions with the option :at:`curve`. Currently, only linear and trigonometric functions are
  2210. supported. For example, an helix can be obtained with curve="cos(s) sin(s) s". The size is set with the option
  2211. :at:`size`, resulting in :math:`f(s)=\{\text{size}[1]\cdot\cos(2\pi\cdot\text{size}[2]),\;
  2212. \text{size}[1]\cdot\sin(2\pi\cdot\text{size}[2]),\; \text{size}[0]\cdot s\}`.
  2213. The **cloth** type is a different way to model cloth, beyond type="grid". Here the elements are connected with
  2214. universal joints and form a kinematic spanning tree. The root of the tree is the parent body, and its coordinates in
  2215. the grid are inferred from its name - similar to rope but here the naming format is "CB2_0". Neighboring bodies that
  2216. are not connected with joints are then connected with equality-constrained spatial tendons. The resulting cloth is
  2217. non-homogeneous, because the kinematic constraints cannot be violated while the tendon equality constraints are soft.
  2218. One can make it more homogeneous by adding stretch and twist joints (similar to rope) and adjusting the strength of
  2219. their equality constraints. Shear tendons can also be added. In addition to the different physics, cloth can do
  2220. things that a 2D grid cannot do. This is because the elements of cloth have both position and orientation, while the
  2221. elements of grid can only translate. The geoms used in cloth can be ellipsoids and capsules in addition to spheres.
  2222. When elongated geoms are used, they are rotated and interleaved in a pattern that fills the holes, preventing objects
  2223. from penetrating the cloth. Furthermore the inertia of the cloth elements can be modified with the flatinertia
  2224. attribute, and can then be used with lift and drag forces to simulate ripple effects.
  2225. The **box** type creates a 3D arrangement of bodies forming the outer shell of a (soft) box. The parent body is at
  2226. the center of the box. Each element body has a geom (sphere, ellipsoid or capsule) and a single sliding joint
  2227. pointing away from the center of the box. The sliding joints are equality-constrained to their initial value.
  2228. Furthermore, to achieve smooth deformations of the sides of the box, each joint is equality-constrained to remain
  2229. equal to its neighbor joints. To preserve the volume of the soft box approximately, a fixed tendon is used to
  2230. constrain the sum of all joints to remain constant. When the user specifies elongated geoms (capsules or ellipsoids)
  2231. their long axis is aligned with the sliding joint axis. This makes the shell thicker for collision detection
  2232. purposes, preventing objects from penetrating the box. It is important to disable contacts between the elements of
  2233. the box. This is done by setting the default geom contype to 0. The user can change it of course, but if the geoms
  2234. comprising the soft box are allowed to contact each other the model will not work as intended.
  2235. The **cylinder** and **ellipsoid** types are the same as box, except the elements are projected on the surface of an
  2236. ellipsoid or a cylinder respectively. Thus the composite soft body shape is different, while everything else is the
  2237. same as in the box type.
  2238. .. _body-composite-count:
  2239. :at:`count`: :at-val:`int(3), required`
  2240. The element count in each dimension of the grid. This can have 1, 2 or 3 numbers, specifying the element count along
  2241. the X, Y and Z axis of the parent body frame within. Any missing numbers default to 1. If any of these numbers is 1,
  2242. all subsequent numbers must also be 1, so that the leading dimensions of the grid are used. This means for example
  2243. that a 1D grid will always extend along the X axis. To achieve a different orientation, rotate the frame of the
  2244. parent body. Note that some types imply a grid of certain dimensionality, so the requirements for this attribute
  2245. depend on the specified type.
  2246. .. _body-composite-spacing:
  2247. :at:`spacing`: :at-val:`real, required`
  2248. The spacing between the centers of the grid elements. This spacing is the same in all dimensions. It should normally
  2249. be set to a value larger than the geom size, otherwise there will be a lot of contacts in the reference model
  2250. configuration (which is allowed but rarely desirable).
  2251. .. _body-composite-offset:
  2252. :at:`offset`: :at-val:`real(3), "0 0 0"`
  2253. This attribute affects particle and grid types, and is ignored for all other types. It specifies a 3D offset from the
  2254. center of the parent body to the center of the grid of elements. The offset is expressed in the local coordinate
  2255. frame of the parent body.
  2256. .. _body-composite-flatinertia:
  2257. :at:`flatinertia`: :at-val:`real, "0"`
  2258. This attribute affects the cloth type and is ignored for all other types. The default value 0 disables this
  2259. mechanism. When the value is positive, it specifies the ratio of the small-to-large axes of the modified diagonal
  2260. inertia. The idea is to set it to a small value, say 0.01, in which case the inertias of the body elements will
  2261. corresponds to flat boxes aligned with the cloth (which can then be used for lift forces). This will not change the
  2262. geom shapes, but instead will set the body inertias directly and disable the automatic computation of inertia from
  2263. geom shape for the composite body only.
  2264. .. _body-composite-solrefsmooth:
  2265. .. _body-composite-solimpsmooth:
  2266. :at:`solrefsmooth`, :at:`solimpsmooth`
  2267. These are the solref and solimp attributes of the loop-closure equality constraint for loop types, and the
  2268. smoothness-preserving equality constraint for box, cylinder and ellipsoid types. For all other types they have no
  2269. effect. They obey the same rules as all other solref and solimp attributes in MJCF, except their defaults here are
  2270. adjusted depending on the composite type. See :ref:`CSolver`.
  2271. .. _body-composite-vertex:
  2272. :at:`vertex`: :at-val:`real(3*nvert), optional`
  2273. Vertex 3D positions in global coordinates (cable only).
  2274. .. _body-composite-initial:
  2275. :at:`initial`: :at-val:`[free, ball, none], "0"`
  2276. Behavior of the first point (cable only). Free: free joint. Ball: ball joint. None: no dof.
  2277. .. _body-composite-curve:
  2278. :at:`curve`: :at-val:`string(3), optional`
  2279. Functions specifying the vertex positions (cable only). Available functions are `s`, `cos(s)`, and `sin(s)`, where
  2280. `s` is the arc length parameter.
  2281. .. _body-composite-size:
  2282. :at:`size`: :at-val:`int(3), optional`
  2283. Scaling of the curve functions (cable only). `size[0]` is the scaling of `s`, `size[1]` is the radius of `\cos(s)`
  2284. and `\sin(s)`, and `size[2]` is the speed of the argument (i.e. `\cos(2*\pi*size[2]*s)`).
  2285. .. _composite-joint:
  2286. :el-prefix:`composite/` |-| **joint** (*)
  2287. '''''''''''''''''''''''''''''''''''''''''
  2288. Depending on the composite type, some joints are created automatically (e.g. the universal joints in rope) while other
  2289. joints are optional (e.g. the stretch and twist joints in rope). This sub-element is used to specify which optional
  2290. joints should be created, as well as to adjust the attributes of both automatic and optional joints.
  2291. .. _composite-joint-kind:
  2292. :at:`kind`: :at-val:`[main, twist, stretch, particle], required`
  2293. The joint kind here is orthogonal to the joint type in the rest of MJCF. The joint kind refers to the function of the
  2294. joint within the mechanism comprising the composite body, while the joint type (hinge or slide) is implied by the
  2295. joint kind and composite body type.
  2296. The **main** kind corresponds to the main joints forming each composite type. These joints are automatically included
  2297. in the model even if the joint sub-element is missing. The main joints are 3D sliders for particle and grid; 1D
  2298. sliders for box, cylinder and rope; universal joints for cloth, rope and loop. Even though the main joints are
  2299. included automatically, this sub-element is still useful for adjusting their attributes.
  2300. The **twist** kind corresponds to hinge joints enabling rope, loop and cloth objects to twist. These are optional
  2301. joints and are only created if this sub-element is present. This sub-element is also used to adjust the attributes of
  2302. the optional twist joints. For other composite object types this sub-element has no effect.
  2303. The **stretch** kind corresponds to slide joints enabling rope, loop and cloth objects to stretch. These are optional
  2304. joints and are only created if this sub-element is present. This sub-element is also used to adjust the attributes of
  2305. the optional stretch joints. For other composite object types this sub-element has no effect.
  2306. The **particle** kind can only be used with the particle composite type. As opposed to all previous kinds, this kind
  2307. *replaces* the default 3 sliders with user-defined joints. User-defined joints can be repeated, for example
  2308. to create planar particles with two sliders and a hinge.
  2309. .. _composite-joint-solreffix:
  2310. .. _composite-joint-solimpfix:
  2311. :at:`solreffix`, :at:`solimpfix`
  2312. These are the solref and solimp attributes used to equality-constrain the joint. Whether or not a given joint is
  2313. quality-constrained depends on the joint kind and composite object type as explained above. For joints that are not
  2314. equality-constrained, this attribute has no effect. The defaults are adjusted depending on the composite type.
  2315. Otherwise these attributes obey the same rules as all other solref and solimp attributes in MJCF. See :ref:`Solver
  2316. parameters <CSolver>`.
  2317. .. _composite-joint-axis:
  2318. .. _composite-joint-group:
  2319. .. _composite-joint-stiffness:
  2320. .. _composite-joint-damping:
  2321. .. _composite-joint-armature:
  2322. .. _composite-joint-limited:
  2323. .. _composite-joint-range:
  2324. .. _composite-joint-margin:
  2325. .. _composite-joint-solreflimit:
  2326. .. _composite-joint-solimplimit:
  2327. .. _composite-joint-frictionloss:
  2328. .. _composite-joint-solreffriction:
  2329. .. _composite-joint-solimpfriction:
  2330. .. _composite-joint-type:
  2331. .. |body/composite/joint attrib list| replace::
  2332. :at:`axis`, :at:`group`, :at:`stiffness`, :at:`damping`, :at:`armature`, :at:`limited`, :at:`range`, :at:`margin`,
  2333. :at:`solreflimit`, :at:`solimplimit`, :at:`frictionloss`, :at:`solreffriction`, :at:`solimpfriction`, :at:`type`
  2334. |body/composite/joint attrib list|
  2335. Same meaning as regular :ref:`joint <body-joint>` attributes.
  2336. .. _composite-tendon:
  2337. :el-prefix:`composite/` |-| **tendon** (*)
  2338. ''''''''''''''''''''''''''''''''''''''''''
  2339. Tendons are treated similarly to joints in composite objects. The tendon kind specified here together with the composite
  2340. body type imply the tendon type as used in the rest of MJCF. This sub-element is used to both create optional tendons,
  2341. and adjust the attributes of automatic and optional tendons. One difference from joints is that all tendons used in
  2342. composite objects are equality-constrained.
  2343. .. _composite-tendon-kind:
  2344. :at:`kind`: :at-val:`[main, shear], required`
  2345. The **main** kind corresponds to tendons holding the composite body together. These are the spatial tendons that
  2346. connect neighboring bodies in grid and cloth, and the fixed tendon used to preserve the volume of box, cylinder and
  2347. ellipsoid. For other composite types this sub-element has no effect.
  2348. The **shear** kind corresponds to diagonal tendons that prevent shear (as opposed to enabling - which is the function
  2349. of optional joints). Such tendons can be created in 2D grid objects and cloth objects. For all other composite object
  2350. types this sub-element has no effect.
  2351. .. _composite-tendon-solreffix:
  2352. .. _composite-tendon-solimpfix:
  2353. :at:`solreffix`, :at:`solimpfix`
  2354. These are the solref and solimp attributes used to equality-constrain the tendon. The defaults are adjusted depending
  2355. on the composite type. Otherwise these attributes obey the same rules as all other solref and solimp attributes in
  2356. MJCF. See :ref:`CSolver`.
  2357. .. _composite-tendon-group:
  2358. .. _composite-tendon-stiffness:
  2359. .. _composite-tendon-damping:
  2360. .. _composite-tendon-limited:
  2361. .. _composite-tendon-range:
  2362. .. _composite-tendon-margin:
  2363. .. _composite-tendon-solreflimit:
  2364. .. _composite-tendon-solimplimit:
  2365. .. _composite-tendon-frictionloss:
  2366. .. _composite-tendon-solreffriction:
  2367. .. _composite-tendon-solimpfriction:
  2368. .. _composite-tendon-material:
  2369. .. _composite-tendon-rgba:
  2370. .. _composite-tendon-width:
  2371. .. |body/composite/tendon attrib list| replace::
  2372. :at:`group`, :at:`stiffness`, :at:`damping`, :at:`limited`, :at:`range`, :at:`margin`, :at:`solreflimit`,
  2373. :at:`solimplimit`, :at:`frictionloss`, :at:`solreffriction`, :at:`solimpfriction`, :at:`material`, :at:`rgba`,
  2374. :at:`width`
  2375. |body/composite/tendon attrib list|
  2376. Same meaning as regular :ref:`tendon <tendon>` attributes.
  2377. .. _composite-geom:
  2378. :el-prefix:`composite/` |-| **geom** (?)
  2379. ''''''''''''''''''''''''''''''''''''''''
  2380. This sub-element adjusts the attributes of the geoms in the composite object. The default attributes are the same as in
  2381. the rest of MJCF (except that user-defined defaults have no effect here). Note that the geom sub-element can appears
  2382. only once, unlike joint and tendon sub-elements which can appear multiple times. This is because different kinds of
  2383. joints and tendons have different sets of attributes, while all geoms in the composite object are identical.
  2384. .. _composite-geom-type:
  2385. .. _composite-geom-contype:
  2386. .. _composite-geom-conaffinity:
  2387. .. _composite-geom-condim:
  2388. .. _composite-geom-group:
  2389. .. _composite-geom-priority:
  2390. .. _composite-geom-size:
  2391. .. _composite-geom-material:
  2392. .. _composite-geom-rgba:
  2393. .. _composite-geom-friction:
  2394. .. _composite-geom-mass:
  2395. .. _composite-geom-density:
  2396. .. _composite-geom-solmix:
  2397. .. _composite-geom-solref:
  2398. .. _composite-geom-solimp:
  2399. .. _composite-geom-margin:
  2400. .. _composite-geom-gap:
  2401. .. |body/composite/geom attrib list| replace::
  2402. :at:`type`, :at:`contype`, :at:`conaffinity`, :at:`condim`, :at:`group`, :at:`priority`, :at:`size`, :at:`material`,
  2403. :at:`rgba`, :at:`friction`, :at:`mass`, :at:`density`, :at:`solmix`, :at:`solref`, :at:`solimp`, :at:`margin`,
  2404. :at:`gap`
  2405. |body/composite/geom attrib list|
  2406. Same meaning as regular :ref:`geom <body-geom>` attributes.
  2407. .. _composite-site:
  2408. :el-prefix:`composite/` |-| **site** (?)
  2409. ''''''''''''''''''''''''''''''''''''''''
  2410. This sub-element adjusts the attributes of the sites in the composite object. Otherwise it is the same as geom above.
  2411. .. _composite-site-group:
  2412. .. _composite-site-size:
  2413. .. _composite-site-material:
  2414. .. _composite-site-rgba:
  2415. :at:`group`, :at:`size`, :at:`material`, :at:`rgba`
  2416. Same meaning as regular :ref:`site <body-site>` attributes.
  2417. .. _composite-skin:
  2418. :el-prefix:`composite/` |-| **skin** (?)
  2419. ''''''''''''''''''''''''''''''''''''''''
  2420. If this element is included, the model compiler will generate a skinned mesh asset and attach it to the element bodies
  2421. of the composite object. Skin can be attached to 2D grid, cloth, box, cylinder and ellipsoid. For other composite types
  2422. it has no effect. Note that the skin created here is equivalent to a skin specified directly in the XML, as opposed to a
  2423. skin loaded from file. So if the model is saved as XML, it will contain a large section describing the
  2424. automatically-generated skin.
  2425. .. _composite-skin-texcoord:
  2426. :at:`texcoord`: :at-val:`[false, true], "false"`
  2427. If this is true, explicit texture coordinates will be generated, mapping the skin to the unit square in texture
  2428. space. This is needed when the material specifies a texture. If texcoord is false and the skin has texture, the
  2429. texture will appear fixed to the world instead of the skin. The reason for having this attribute in the first place
  2430. is because skins with texture coordinates upload these coordinates to the GPU even if no texture is applied later. So
  2431. this attribute should be set to false in cases where no texture will be applied via the material attribute.
  2432. .. _composite-skin-material:
  2433. .. _composite-skin-rgba:
  2434. .. _composite-skin-group:
  2435. :at:`material`, :at:`rgba`, :at:`group`:
  2436. Same meaning as in :ref:`geom <body-geom>`.
  2437. .. _composite-skin-inflate:
  2438. :at:`inflate`: :at-val:`real, "0"`
  2439. The default value of 0 means that the automatically-generated skin passes through the centers of the body elements
  2440. comprising the composite object. Positive values offset each skin vertex by the specified amount, in the direction
  2441. normal to the (non-inflated) skin at that vertex. This has two uses. First, in 2D objects, a small positive inflate
  2442. factor is needed to avoid aliasing artifacts. Second, collisions are done with geoms that create some thickness, even
  2443. for 2D objects. Inflating the skin with a value equal to the geom size will render the skin as a "mattress" that
  2444. better represents the actual collision geometry. The value of this attribute is copied into the corresponding
  2445. attribute of the :el:`skin` asset being created.
  2446. .. _composite-skin-subgrid:
  2447. :at:`subgrid`: :at-val:`int, "0"`
  2448. This is only applicable to cloth and 2D grid types, and has no effect for any other composite type. The default value
  2449. of 0 means that the skin has as many vertices as the number of element bodies. A positive value causes subdivision,
  2450. with the specified number of (additional) grid lines. In this case the model compiler generates a denser skin using
  2451. bi-cubic interpolation. This increases the quality of the rendering (especially in the absence of textures) but also
  2452. slows down the renderer, so use it with caution. Values above 3 are unlikely to be needed.
  2453. .. _composite-pin:
  2454. :el-prefix:`composite/` |-| **pin** (*)
  2455. '''''''''''''''''''''''''''''''''''''''
  2456. This sub-element can be used to pin some of the element bodies in grid objects (both 1D and 2D). Pinning means that the
  2457. corresponding body has no joints, and therefore it is rigidly fixed to the parent body. When the parent is the world,
  2458. this has the effect of hanging a string or a cloth in space. If the parent body is moving, this can be used to model a
  2459. handle where the composite object is attached. For other composite types this sub-element has no effect.
  2460. .. _composite-pin-coord:
  2461. :at:`coord`: :at-val:`int(2), required`
  2462. The grid coordinates of the element body which should be pinned. The coordinates are zero-based. For 1D grids this
  2463. attribute can have only one number, in which case the second number is automatically set to 0.
  2464. .. _composite-plugin:
  2465. :el-prefix:`composite/` |-| **plugin** (?)
  2466. ''''''''''''''''''''''''''''''''''''''''''
  2467. Associate this composite with an :ref:`engine plugin<exPlugin>`. Either :at:`plugin` or :at:`instance` are required.
  2468. .. _composite-plugin-plugin:
  2469. :at:`plugin`: :at-val:`string, optional`
  2470. Plugin identifier, used for implicit plugin instantiation.
  2471. .. _composite-plugin-instance:
  2472. :at:`instance`: :at-val:`string, optional`
  2473. Instance name, used for explicit plugin instantiation.
  2474. .. _body-flexcomp:
  2475. :el-prefix:`body/` |-| **flexcomp** (*)
  2476. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2477. Similar to :el:`composite`, this element (new in MuJoCo 3.0) is not a model element, but rather a macro which expands
  2478. into multiple model elements representing a deformable entity. In particular this macro creates one
  2479. :ref:`flex<deformable-flex>` element, a number of bodies that are children of the body in which the :el:`flexcomp` is
  2480. defined, and optionally one :ref:`flex equality<equality-flex>` which constrains all flex edges to their initial length.
  2481. A number of attributes are specified here and then passed through to the automatically-constructed flex. The primary
  2482. role of :el:`flexcomp` is to automate the creation of a (possibly large) collection of moving bodies with corresponding
  2483. joints, and connect them with stretchable flex elements. See :ref:`flex<deformable-flex>` and :ref:`deformable
  2484. objects<CDeformable>` documentation for specifics on how flexes work. Here we only describe the automated construction
  2485. process.
  2486. An important distinction between :el:`flex` and :el:`flexcomp` is that the flex references bodies and specifies vertex
  2487. coordinates in the frames of those bodies, while the flexcomp defines *points*. Each flexcomp point corresponds to one
  2488. body and one vertex in the underlying flex. If the flexcomp point is *pinned*, the corresponding flex body is the parent
  2489. body of the flexcomp, while the corresponding flex vertex coordinates equal the flexcomp point coordinates. If the
  2490. flexcomp point is not pinned, a new child body is created at the coordinates of the flexcomp point (within the flexcomp
  2491. parent body), and then the coordinates of the flex vertex within that new body are (0,0,0). The mechanism for
  2492. :ref:`pinning<flexcomp-pin>` flexcomp points is explained below.
  2493. Composite objects (available prior to MuJoCo 3.0) needed bodies with geoms for collisions, and sites for connecting
  2494. tendons which generated shape-preserving forces. In contrast, flexes generate their own collisions and shape-preserving
  2495. forces (as well as rendering), thus the bodies created here are much simpler: no geoms, sites or tendons are needed.
  2496. Most of the bodies created here have 3 orthogonal slider joints, corresponding to freely moving point masses. In some
  2497. cases we generate radial slider joints, allowing only expansion and contraction. Since no geoms are generated, the
  2498. bodies need to have explicit inertial parameters.
  2499. Below is a simple example of a flexcomp, modeling a (somewhat flexible) double pendulum with one end pinned to the
  2500. world:
  2501. .. code-block:: xml
  2502. <mujoco>
  2503. <worldbody>
  2504. <flexcomp name="FL" type="grid" dim="1" count="3 1 1" mass="3" spacing="0.2 0.2 0.2">
  2505. <pin id="0"/>
  2506. </flexcomp>
  2507. </worldbody>
  2508. </mujoco>
  2509. This flexcomp has 3 points, however the first point is pinned to the world (i.e. the parent of the flexcomp) and so only
  2510. two bodies are automatically created, namely FL_1 and FL_2. Here is what this flexcomp generates after loading and
  2511. saving the XML:
  2512. .. code-block:: xml
  2513. <mujoco>
  2514. <worldbody>
  2515. <body name="FL_1">
  2516. <inertial pos="0 0 0" mass="1" diaginertia="1.66667e-05 1.66667e-05 1.66667e-05"/>
  2517. <joint pos="0 0 0" axis="1 0 0" type="slide"/>
  2518. <joint pos="0 0 0" axis="0 1 0" type="slide"/>
  2519. <joint pos="0 0 0" axis="0 0 1" type="slide"/>
  2520. </body>
  2521. <body name="FL_2" pos="0.2 0 0">
  2522. <inertial pos="0 0 0" mass="1" diaginertia="1.66667e-05 1.66667e-05 1.66667e-05"/>
  2523. <joint pos="0 0 0" axis="1 0 0" type="slide"/>
  2524. <joint pos="0 0 0" axis="0 1 0" type="slide"/>
  2525. <joint pos="0 0 0" axis="0 0 1" type="slide"/>
  2526. </body>
  2527. </worldbody>
  2528. <deformable>
  2529. <flex name="FL" dim="1" body="world FL_1 FL_2" vertex="-0.2 0 0 0 0 0 0 0 0" element="0 1 1 2"/>
  2530. </deformable>
  2531. <equality>
  2532. <flex flex="FL"/>
  2533. </equality>
  2534. </mujoco>
  2535. .. _body-flexcomp-name:
  2536. :at:`name`: :at-val:`string, required`
  2537. The name of the flex element being generated automatically. This name is used as a prefix for all bodies that are
  2538. automatically generated here, and is also referenced by the corresponding flex equality constraint (if applicable).
  2539. .. _body-flexcomp-dim:
  2540. :at:`dim`: :at-val:`int(1), "2"`
  2541. Dimensionality of the flex object. This value must be 1, 2 or 3. The flex elements are capsules in 1D, triangles with
  2542. radius in 2D, and tetrahedra with radius in 3D. Certain flexcomp types imply a dimensionality, in which case the
  2543. value specified here is ignored.
  2544. .. _body-flexcomp-type:
  2545. :at:`type`: :at-val:`[grid, box, cylinder, ellipsoid, mesh, gmsh, direct], "grid"`
  2546. This attribute determines the type of :el:`flexcomp` object. The remaining attributes and sub-elements are then
  2547. interpreted according to the type. Default settings are also adjusted depending on the type. Different types
  2548. correspond to different methods for specifying the flexcomp points and the stretchable elements that connect them.
  2549. They fall in three categories: direct specification entered in the XML, direct specification loaded from file, and
  2550. automated generation from higher-level specification.
  2551. **grid** generates a rectangular grid of points in 1D, 2D or 3D as specified by :at:`dim`. The number of points in
  2552. each dimension is determined by :at:`count` while the grid spacing in each dimension is determined by :at:`spacing`.
  2553. Make sure the spacing is sufficiently large relative to :at:`radius` to avoid permanent contacts. In 2D and 3D the
  2554. grid is automatically triangulated, and corresponding flex elements are created (triangles or tetrahedra). In 1D the
  2555. elements are capsules connecting consecutive pairs of points.
  2556. **box** generates a 3D box object, however flex bodies are only generated on the outer shell. Each flex body has a
  2557. radial slider joint allowing it to move in and out from the center of the box. The parent body would normally be a
  2558. floating body. The box surface is triangulated, and each flex element is a tetrahedron connecting the center of the
  2559. box with one triangle face. :at:`count` and :at:`spacing` determine the count and spacing of the flex bodies, similar
  2560. to the **grid** type in 3D. Note that the resulting flex has the same topology as the box generated by
  2561. :el:`composite`.
  2562. **cylinder** is the same as **box**, except the points are projected on the surface of a cylinder.
  2563. **ellipsoid** is the same as **box**, except the points are projected on the surface of an ellipsoid.
  2564. **mesh** loads the flexcomp points and elements (i.e. triangles) from a mesh file, in the same file formats as mesh
  2565. assets. A mesh asset is not actually added to the model. Instead the vertex and face data from the mesh file are used
  2566. to populate the point and element data of the flexcomp. :at:`dim` is automatically set to 2. Recall that a mesh asset
  2567. in MuJoCo can be used as a rigid geom attached to a single body. In contrast, the flex generated here corresponds to
  2568. a soft mesh with the same initial shape, where each vertex is a separate moving body (unless pinned).
  2569. .. _gmsh-file-docs:
  2570. **gmsh** is similar to mesh, but it loads a GMSH file in
  2571. `format 4.1 <https://gmsh.info//doc/texinfo/gmsh.html#MSH-file-format>`__
  2572. and `format 2.2 <https://gmsh.info//doc/texinfo/gmsh.html#MSH-file-format-version-2-_0028Legacy_0029>`__
  2573. (ascii or binary). The file extension can be anything; the parser recognizes the format by examining
  2574. the file header. This is a very rich file format, allowing all kinds of elements with different dimensionality and
  2575. topology. MuJoCo only supports GMSH element types 1, 2, 4 which happen to correspond to our 1D, 2D and 3D flexes and
  2576. assumes that the nodes are specified in a single block. Only the Nodes and Elements sections of the GMHS file are
  2577. processed, and used to populate the point and element data of the flexcomp. The parser will generate an error if the
  2578. GMSH file contains meshes that are not supported by MuJoCo. :at:`dim` is automatically set to the dimensionality
  2579. specified in the GMSH file. Presently this is the only mechanism to load a large tetrahedral mesh in MuJoCo and
  2580. generate a corresponding soft entity. If such a mesh is available in a different file format, use the freely
  2581. available `GMSH software <https://gmsh.info/>`__ to convert it to GMSH in one of the supported versions.
  2582. **direct** allows the user to specify the point and element data of the flexcomp directly in the XML. Note that
  2583. flexcomp will still generate moving bodies automatically, as well as automate other settings; so it still provides
  2584. convenience compared to specifing the corresponding flex directly.
  2585. .. _body-flexcomp-count:
  2586. :at:`count`: :at-val:`int(3), "10 10 10"`
  2587. The number of automatically generated points in each dimension. This and the next attribute only apply to types grid,
  2588. box, cylinder, ellipsoid.
  2589. .. _body-flexcomp-spacing:
  2590. :at:`spacing`: :at-val:`real(3), "0.02 0.02 0.02"`
  2591. The spacing between the automatically generated points in each dimension. The spacing should be sufficiently large
  2592. compared to the radius, to avoid permanent contacts.
  2593. .. _body-flexcomp-point:
  2594. :at:`point`: :at-val:`real(3*npoint), optional`
  2595. The 3D coordinates of the points. This attribute is only used with type **direct**. All other flexcomp types generate
  2596. their own points. The points are used to construct bodies and vertices as explained earlier.
  2597. .. _body-flexcomp-element:
  2598. :at:`element`: :at-val:`int((dim+1)*npoint), optional`
  2599. The zero-based point ids forming each flex elements. This attribute is only used with type **direct**. All other
  2600. flexcomp types generate their own elements. This data is passed through to the automatically-generated flex.
  2601. .. _body-flexcomp-texcoord:
  2602. :at:`texcoord`: :at-val:`real(2*npoint), optional`
  2603. Texture coordinates of each point, passed through to the automatically-generated flex. Note that flexcomp does not
  2604. generate texture coordinates automatically, except for 2D grids. For all other types, the user can specify explicit
  2605. texture coordinates here, even if the points themselves were generated automatically. This requires understanding of
  2606. the layout of the automatically-generated points and how they correspond to the texture referenced by the material.
  2607. .. _body-flexcomp-mass:
  2608. :at:`mass`: :at-val:`real(1), "1"`
  2609. The mass of each automatically-generated body equals this value divided by the number of points. Note that pinning
  2610. some points does not affect the mass of the other bodies.
  2611. .. _body-flexcomp-inertiabox:
  2612. :at:`inertiabox`: :at-val:`real(1), "0.005"`
  2613. Even though the automatically-generated bodies have the physics of point masses, with slider joints, MuJoCo still
  2614. requires each body to have rotational inertia. The inertias generated here are diagonal, and are computed such that
  2615. the corresponding equivalent-inertia boxes have sides equal to this value.
  2616. .. _body-flexcomp-file:
  2617. :at:`file`: :at-val:`string, optional`
  2618. The name of the file from which a **surface** (triangular) or **volumetric** (tetrahedral) mesh is loaded. For
  2619. surface meshes, the file extension is used to determine the file format. Supported formats are the same as in
  2620. :ref:`mesh assets<asset-mesh>` and also including GMSH. Volumetric meshes are supported only in GMSH format.
  2621. See :ref:`here<gmsh-file-docs>` for more information on GMSH files.
  2622. .. _body-flexcomp-rigid:
  2623. :at:`rigid`: :at-val:`[true, false], "false"`
  2624. If this is true, all points correspond to vertices within the parent body, and no new bodies are created. This is
  2625. equivalent to pinning all points. Note that if all points are indeed pinned, the model compiler will detect that the
  2626. flex is rigid (which behaves is a non-convex mesh in collision detection).
  2627. .. _body-flexcomp-pos:
  2628. :at:`pos`: :at-val:`real(3), "0 0 0"`
  2629. This 3D vector translates all points relative to the frame of the parent body.
  2630. .. _body-flexcomp-quat:
  2631. :at:`quat`: :at-val:`real(4), "1 0 0 0"`
  2632. This is a quaternion rotation of all points around the :at:`pos` vector specified above. Together these two vectors
  2633. define a pose transformation, used to position and orient the points as needed.
  2634. .. _body-flexcomp-axisangle:
  2635. .. _body-flexcomp-xyaxes:
  2636. .. _body-flexcomp-zaxis:
  2637. .. _body-flexcomp-euler:
  2638. :at:`axisangle`, :at:`xyaxes`, :at:`zaxis`, :at:`euler`
  2639. Alternative specification of rotation, that can be used instead of :at:`quat`.
  2640. .. _body-flexcomp-scale:
  2641. :at:`scale`: :at-val:`real(3), "1 1 1"`
  2642. Scaling of all point coordinates, for types that specify coordinates explicitly. Scaling is applied after the pose
  2643. transformation.
  2644. .. _body-flexcomp-radius:
  2645. .. _body-flexcomp-material:
  2646. .. _body-flexcomp-rgba:
  2647. .. _body-flexcomp-group:
  2648. .. _body-flexcomp-flatskin:
  2649. :at:`radius`, :at:`material`, :at:`rgba`, :at:`group`, :at:`flatskin`
  2650. These attributes are directly passed through to the automatically-generated :ref:`flex<deformable-flex>` object and
  2651. have the same meaning.
  2652. .. _flexcomp-contact:
  2653. :el-prefix:`flexcomp/` |-| **contact** (*)
  2654. ''''''''''''''''''''''''''''''''''''''''''
  2655. .. _flexcomp-contact-internal:
  2656. .. _flexcomp-contact-selfcollide:
  2657. .. _flexcomp-contact-activelayers:
  2658. .. _flexcomp-contact-contype:
  2659. .. _flexcomp-contact-conaffinity:
  2660. .. _flexcomp-contact-condim:
  2661. .. _flexcomp-contact-priority:
  2662. .. _flexcomp-contact-friction:
  2663. .. _flexcomp-contact-solmix:
  2664. .. _flexcomp-contact-solref:
  2665. .. _flexcomp-contact-solimp:
  2666. .. _flexcomp-contact-margin:
  2667. .. _flexcomp-contact-gap:
  2668. .. |body/flexcomp/contact attrib list| replace::
  2669. :at:`internal`, :at:`selfcollide`, :at:`activelayers`, :at:`contype`, :at:`conaffinity`, :at:`condim`,
  2670. :at:`priority`, :at:`friction`, :at:`solmix`, :at:`solimp`, :at:`margin`, :at:`gap`
  2671. |body/flexcomp/contact attrib list|
  2672. Same as in :ref:`flex/contact<flex-contact>`. All attributes are passed through to the automatically-generated flex.
  2673. .. _flexcomp-edge:
  2674. :el-prefix:`flexcomp/` |-| **edge** (*)
  2675. '''''''''''''''''''''''''''''''''''''''
  2676. Each flex element has one edge in 1D (coinciding with the capsule element), three edges in 2D, and six edges in 3D. The
  2677. edges are generated automatically when the flex element is compiled, and the user cannot specify them directly. This
  2678. element is used to adjust the properties of all edges in the flex.
  2679. .. _flexcomp-edge-equality:
  2680. :at:`equality`: :at-val:`[true, false], "false"`
  2681. When enabled, an equality constraint of :ref:`type flex<equality-flex>` is added to the model, referencing the
  2682. automatically-generated flex by name.
  2683. .. _flexcomp-edge-solref:
  2684. .. _flexcomp-edge-solimp:
  2685. :at:`solref`, :at:`solimp`
  2686. The standard constraint parameters, passed through to the automatically generated equality constraint.
  2687. .. _flexcomp-edge-stiffness:
  2688. .. _flexcomp-edge-damping:
  2689. :at:`stiffness`, :at:`damping`
  2690. Edge stiffness and damping, passed through to the automatically generated flex.
  2691. .. _flexcomp-elasticity:
  2692. :el-prefix:`flexcomp/` |-| **elasticity** (*)
  2693. '''''''''''''''''''''''''''''''''''''''''''''
  2694. .. _flexcomp-elasticity-young:
  2695. .. _flexcomp-elasticity-poisson:
  2696. .. _flexcomp-elasticity-damping:
  2697. .. _flexcomp-elasticity-thickness:
  2698. .. |body/flexcomp/elasticity attrib list| replace::
  2699. :at:`young`, :at:`poisson`, :at:`damping`, :at:`thickness`
  2700. |body/flexcomp/elasticity attrib list|
  2701. Same as in :ref:`flex/elasticity<flex-elasticity>`.
  2702. All attributes are passed through to the automatically-generated flex.
  2703. .. _flexcomp-pin:
  2704. :el-prefix:`flexcomp/` |-| **pin** (*)
  2705. ''''''''''''''''''''''''''''''''''''''
  2706. Each point is either pinned or not pinned. The effect of pinning was explained earlier. This element is used to specify
  2707. which points are pinned. Note that each attribute below can be used to specify multiple pins, and in addition to that,
  2708. the :el:`pin` element itself can be repeated for user convenience. The effects are cumulative; pinning the same point
  2709. multiple times is allowed.
  2710. .. _flexcomp-pin-id:
  2711. :at:`id`: :at-val:`int(n), required`
  2712. Zero-based ids of points to pin. When the points are automatically-generaged, the user needs to understand their
  2713. layout in order to decide which points to pin. This can be done by first creating a flexcomp without any pins,
  2714. loading it in the simulator, and showing the body labels.
  2715. .. _flexcomp-pin-range:
  2716. :at:`range`: :at-val:`int(2*n), required`
  2717. Ranges of points to pin. Each range is specified by two integers.
  2718. .. _flexcomp-pin-grid:
  2719. :at:`grid`: :at-val:`int(dim*n), required`
  2720. Grid coordinates of points to pin. This can only be used with type grid.
  2721. .. _flexcomp-pin-gridrange:
  2722. :at:`gridrange`: :at-val:`int(2*dim*n), required`
  2723. Ranges of grid coordinates of points to pin. Each range is specified by (dim) integers for the minimum of the range
  2724. followed by (dim) integers for the maximum of the range. This can only be used with type grid.
  2725. .. _flexcomp-plugin:
  2726. :el-prefix:`flexcomp/` |-| **plugin** (?)
  2727. '''''''''''''''''''''''''''''''''''''''''
  2728. Associate this flexcomp with an :ref:`engine plugin<exPlugin>`. Either :at:`plugin` or :at:`instance` are required.
  2729. .. _flexcomp-plugin-plugin:
  2730. :at:`plugin`: :at-val:`string, optional`
  2731. Plugin identifier, used for implicit plugin instantiation.
  2732. .. _flexcomp-plugin-instance:
  2733. :at:`instance`: :at-val:`string, optional`
  2734. Instance name, used for explicit plugin instantiation.
  2735. .. _body-plugin:
  2736. :el-prefix:`body/` |-| **plugin** (?)
  2737. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2738. Associate this body with an :ref:`engine plugin<exPlugin>`. Either :at:`plugin` or :at:`instance` are required.
  2739. .. _body-plugin-plugin:
  2740. :at:`plugin`: :at-val:`string, optional`
  2741. Plugin identifier, used for implicit plugin instantiation.
  2742. .. _body-plugin-instance:
  2743. :at:`instance`: :at-val:`string, optional`
  2744. Instance name, used for explicit plugin instantiation.
  2745. .. _body-attach:
  2746. :el-prefix:`body/` |-| **attach** (*)
  2747. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2748. The :el:`attach` element is used to insert a sub-tree of bodies from another model into this model's kinematic tree.
  2749. Unlike :ref:`include<include>`, which is implemented in the parser and is equivalent to copying and pasting XML from
  2750. one file into another, :el:`attach` is implemented in the model compiler. In order to use this element, the sub-model
  2751. must first be defined as an :ref:`asset<asset-model>`. When creating an attachment, the top body of the attached subtree
  2752. is specified, and all referencing elements outside the kinematic tree (e.g., sensors and actuators), are
  2753. also copied into the top-level model. Additionally, any elements referenced from within the attached subtree (e.g.
  2754. defaults and assets) will be copied in to the top-level model. :el:`attach` is a :ref:`meta-element`, so upon saving
  2755. all attachments will appear in the saved XML file.
  2756. .. admonition:: Known issues
  2757. :class: note
  2758. The following known limitations exist, to be addressed in a future release:
  2759. - An entire model cannot be attached (i.e. including all elements, referenced or not).
  2760. - All assets from the child model will be copied in, whether they are referenced or not.
  2761. - Circular references are not checked for and will lead to infinite loops.
  2762. - When attaching a model with :ref:`keyframes<keyframe>`, model compilation is required for the re-indexing to be
  2763. finalized. If a second attachment is performed without compilation, the keyframes from the first attachment will be
  2764. lost.
  2765. .. _body-attach-model:
  2766. :at:`model`: :at-val:`string, optional`
  2767. The sub-model from which to attach a subtree.
  2768. .. _body-attach-body:
  2769. :at:`body`: :at-val:`string, optional`
  2770. Name of the body in the sub-model to attach here. The body and its subtree will be attached.
  2771. .. _body-attach-prefix:
  2772. :at:`prefix`: :at-val:`string, optional`
  2773. Prefix to prepend to names of elements in the sub-model. If empty, the names are unchanged. This attribute is
  2774. required to prevent name collisions with the parent or when attaching the same sub-tree multiple times.
  2775. .. _body-frame:
  2776. :el-prefix:`body/` |-| **frame** (*)
  2777. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2778. Frames specify a coordinate transformation which is applied to all child elements. They disappear during compilation
  2779. and the transformation they encode is accumulated in their direct children. See :ref:`frame<frame>` for examples.
  2780. .. _frame-name:
  2781. :at:`name`: :at-val:`string, optional`
  2782. Name of the frame.
  2783. .. _frame-childclass:
  2784. :at:`childclass`: :at-val:`string, optional`
  2785. If this attribute is present, all descendant elements that admit a defaults class will use the class specified here,
  2786. unless they specify their own class or another frame or body with a childclass attribute is encountered along the
  2787. chain of nested bodies and frames. Recall :ref:`CDefault`.
  2788. .. _frame-pos:
  2789. :at:`pos`: :at-val:`real(3), "0 0 0"`
  2790. The 3D position of the frame, in the parent coordinate system.
  2791. .. _frame-quat:
  2792. .. _frame-axisangle:
  2793. .. _frame-xyaxes:
  2794. .. _frame-zaxis:
  2795. .. _frame-euler:
  2796. :at:`quat`, :at:`axisangle`, :at:`xyaxes`, :at:`zaxis`, :at:`euler`
  2797. See :ref:`COrientation`.
  2798. .. _contact:
  2799. **contact** (*)
  2800. ~~~~~~~~~~~~~~~
  2801. This is a grouping element and does not have any attributes. It groups elements that are used to adjust the generation
  2802. of candidate contact pairs for collision checking. :ref:`Collision` was described in detail in the Computation chapter,
  2803. thus the description here is brief.
  2804. .. _contact-pair:
  2805. :el-prefix:`contact/` |-| **pair** (*)
  2806. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2807. This element creates a predefined geom pair which will be checked for collision. Unlike dynamically generated pairs
  2808. whose properties are inferred from the corresponding geom properties, the pairs created here specify all their
  2809. properties explicitly or through defaults, and the properties of the individual geoms are not used. Anisotropic
  2810. friction can only be created with this element.
  2811. .. _contact-pair-name:
  2812. :at:`name`: :at-val:`string, optional`
  2813. Name of this contact pair.
  2814. .. _contact-pair-class:
  2815. :at:`class`: :at-val:`string, optional`
  2816. Defaults class for setting unspecified attributes.
  2817. .. _contact-pair-geom1:
  2818. :at:`geom1`: :at-val:`string, required`
  2819. The name of the first geom in the pair.
  2820. .. _contact-pair-geom2:
  2821. :at:`geom2`: :at-val:`string, required`
  2822. The name of the second geom in the pair. The contact force vector computed by the solver and stored in
  2823. mjData.efc_force points from the first towards the second geom by convention. The forces applied to the system are of
  2824. course equal and opposite, so the order of geoms does not affect the physics.
  2825. .. _contact-pair-condim:
  2826. :at:`condim`: :at-val:`int, "3"`
  2827. The dimensionality of the contacts generated by this geom pair.
  2828. .. _contact-pair-friction:
  2829. :at:`friction`: :at-val:`real(5), "1 1 0.005 0.0001 0.0001"`
  2830. The friction coefficients of the contacts generated by this geom pair. Making the first two coefficients different
  2831. results in anisotropic tangential friction. Making the last two coefficients different results in anisotropic rolling
  2832. friction. The length of this array is not enforced by the parser, and can be smaller than 5. This is because some of
  2833. the coefficients may not be used, depending on the contact dimensionality. Unspecified coefficients remain equal to
  2834. their defaults.
  2835. .. _contact-pair-solref:
  2836. .. _contact-pair-solimp:
  2837. :at:`solref`, :at:`solimp`
  2838. Constraint solver parameters for contact simulation. See :ref:`CSolver`.
  2839. .. _contact-pair-solreffriction:
  2840. :at:`solreffriction`: :at-val:`real, "0 0"`
  2841. Contact reference acceleration, in the friction dimensions. This attribute has the same semantics as other
  2842. :at:`solref` attributes (described in :ref:`CSolver`), with two important distictions:
  2843. - The default :at-val:`"0 0"` means "use the same values as :at:`solref`".
  2844. - This attribute only takes effect for :ref:`elliptic friction cones<option-cone>`, since pyramidal cones mix normal
  2845. and frictional forces.
  2846. Note that as with other :at:`solreffriction` attributes, the constraint violation is identically 0. Therefore, when
  2847. using positive semantics :at:`solreffriction[1]` is ignored, while for negative semantics :at:`solreffriction[0]` is
  2848. ignored. See :ref:`CSolver` for more details.
  2849. .. _contact-pair-margin:
  2850. :at:`margin`: :at-val:`real, "0"`
  2851. Distance threshold below which contacts are detected and included in the global array mjData.contact.
  2852. .. _contact-pair-gap:
  2853. :at:`gap`: :at-val:`real, "0"`
  2854. This attribute is used to enable the generation of inactive contacts, i.e., contacts that are ignored by the
  2855. constraint solver but are included in mjData.contact for the purpose of custom computations. When this value is
  2856. positive, geom distances between margin and margin-gap correspond to such inactive contacts.
  2857. .. _contact-exclude:
  2858. :el-prefix:`contact/` |-| **exclude** (*)
  2859. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2860. This element is used to exclude a pair of bodies from collision checking. Unlike all other contact-related elements
  2861. which refer to geoms, this element refers to bodies. Experience has shown that exclusion is more useful on the level of
  2862. bodies. Collisions between any geom defined in the first body and any geom defined in the second body are excluded.
  2863. .. _contact-exclude-name:
  2864. :at:`name`: :at-val:`string, optional`
  2865. Name of this exclude pair.
  2866. .. _contact-exclude-body1:
  2867. :at:`body1`: :at-val:`string, required`
  2868. The name of the first body in the pair.
  2869. .. _contact-exclude-body2:
  2870. :at:`body2`: :at-val:`string, required`
  2871. The name of the second body in the pair.
  2872. .. _deformable:
  2873. **deformable** (*)
  2874. ~~~~~~~~~~~~~~~~~~
  2875. This is a grouping element and does not have any attributes. It groups elements that specify deformable objects, namely flexes and skins.
  2876. .. _deformable-flex:
  2877. :el-prefix:`deformable/` |-| **flex** (*)
  2878. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2879. Flexible objects (or flexes) were added in MuJoCo 3.0. These are collections of massless stretchable geometric elements
  2880. (capsules, triangles or tetrahedra) connecting vertices that are defined within different moving body frames. These
  2881. stretchable elements support collisions and contact forces, which are then distributed to all the interconnected bodies.
  2882. Flexes also generate passive and constraint forces as needed to simulate deformable entities with the desired material
  2883. properties. The modeling of flexes is automated and simplified by the :ref:`flexcomp<body-flexcomp>` element. In most
  2884. cases, the user will specify a :el:`flexcomp` which will then automatically construct the corresponding low-level
  2885. :el:`flex`. See :ref:`deformable objects<CDeformable>` for additional information.
  2886. .. _deformable-flex-name:
  2887. :at:`name`: :at-val:`string, optional`
  2888. Name of the flex.
  2889. .. _deformable-flex-dim:
  2890. :at:`dim`: :at-val:`int, "2"`
  2891. Dimensionality of the flex. Allowed values are 1, 2 and 3. In 1D the elements are capsules, in 2D the elements are
  2892. triangles with radius, in 3D the elements are tetrahedra with (optional) radius.
  2893. .. _deformable-flex-radius:
  2894. :at:`radius`: :at-val:`real, "0.005"`
  2895. Radius of all flex elements. It can be zero in 3D, but must be positive in 1D and 2D. The radius affects both
  2896. collision detection and rendering. In 1D and 2D it is needed to make the elements volumetric.
  2897. .. _deformable-flex-body:
  2898. :at:`body`: :at-val:`string(nvert or 1), required`
  2899. An array of MuJoCo body names (separated by white space) to which each vertex belongs. The number of body names
  2900. should either equal the number of vertices (nvert), or be a single body. If a single body is specified, all vertices
  2901. are defined within that body - in which case the flex becomes a rigid body. The latter functionality effectively
  2902. creates a general non-convex mesh (unlike mesh geoms which are convexified for collision detection purposes).
  2903. .. _deformable-flex-vertex:
  2904. :at:`vertex`: :at-val:`real(3*nvert), optional`
  2905. The local coordinates of the vertices within the corresponding body frames. If this attribute is omitted, all
  2906. coordinates are (0,0,0) or in other words, the vertices coincide with the centers of the body frames.
  2907. .. _deformable-flex-texcoord:
  2908. :at:`texcoord`: :at-val:`real(2*nvert), optional`
  2909. Texture coordinates for each vertex. If omitted, texture mapping for this flex is disabled, even if a texture is
  2910. specified in the material.
  2911. .. _deformable-flex-element:
  2912. :at:`element`: :at-val:`int((dim+1)*nelem), required`
  2913. For each element of the flex, this lists the zero-based indices of the vertices forming that flex element. We need
  2914. two vertices to specify a capsule, three vertices to specify a triangle, and four vertices to specify a tetrahedron -
  2915. which is why the number of indices equals (dim+1) times the number of elements. In 2D, the vertices should be listed
  2916. in counter-clockwise order. In 1D and 3D the order is irrelevant; in 3D the model compiler will rearrange the
  2917. vertices as needed. Repeated vertex indices within a flex element are not allowed. The topology of the flex is not
  2918. enforced; it could corespond to a continuous soft body, or a collection of disconnected stretchable elements, or
  2919. anything in-between.
  2920. .. _deformable-flex-flatskin:
  2921. :at:`flatskin`: :at-val:`[true, false], "false"`
  2922. This attribute determines whether 2D and 3D flexes that are rendered in flexskin mode will use smooth or flat
  2923. shading. The default smooth shading is suitable in most cases, however if the object is intended to have visible
  2924. sharp edges (such as a cube) then flat shading is more natural.
  2925. .. _deformable-flex-material:
  2926. :at:`material`: :at-val:`string, optional`
  2927. If specified, this attribute applies a :ref:`material<asset-material>` to the flex. Note that textures specified in
  2928. the material will be applied only if the flex has explicit texture coordinates.
  2929. .. _deformable-flex-rgba:
  2930. :at:`rgba`: :at-val:`real(4), "0.5 0.5 0.5 1"`
  2931. Instead of creating material assets and referencing them, this attribute can be used to set color and transparency
  2932. only. This is not as flexible as the material mechanism, but is more convenient and is often sufficient. If the value
  2933. of this attribute is different from the internal default, it takes precedence over the material.
  2934. .. _deformable-flex-group:
  2935. :at:`group`: :at-val:`int, "0"`
  2936. Integer group to which the flex belongs. This attribute can be used for custom tags. It is also used by the
  2937. visualizer to enable and disable the rendering of entire groups of flexes.
  2938. .. _flex-edge:
  2939. :el-prefix:`flex/` |-| **edge** (?)
  2940. '''''''''''''''''''''''''''''''''''
  2941. This element adjusts the passive or constraint properties of all edges of the flex. A flex edge can have a damping
  2942. passive force and an :ref:`equality constraint<equality-flex>` associated with it, resulting in edge constraint forces.
  2943. In the latter case, passive forces are usually unnecessary. For a 1D flex, an edge can also have a passive stiffness,
  2944. while ``Solid`` or ``Membrane`` first-party plugins can be used for the 2D and 3D case, respectively. which would
  2945. generally make edge constraints unnecessary. However these are modeling choices left to the user. MuJoCo allows all
  2946. these mechanisms to be combined as desired.
  2947. .. _flex-edge-stiffness:
  2948. :at:`stiffness`: :at-val:`real(1), "0"`
  2949. Stiffness of all edges. Only for 1D flex. For 2D and 3D, plugins must be used.
  2950. .. _flex-edge-damping:
  2951. :at:`damping`: :at-val:`real(1), "0"`
  2952. Damping of all edges.
  2953. .. _flex-elasticity:
  2954. :el-prefix:`flex/` |-| **elasticity** (?)
  2955. '''''''''''''''''''''''''''''''''''''''''
  2956. The elasticity model is a `Saint Venant-Kirchhoff
  2957. <https://en.wikipedia.org/wiki/Hyperelastic_material#Saint_Venant%E2%80%93Kirchhoff_model>`__ model discretized with
  2958. piecewise linear finite elements, intended to simulate the compression or elongation of hyperelastic materials subjected
  2959. to large displacements (finite rotations) and small strains, since it uses a nonlinear strain-displacement but a linear
  2960. stress-strain relationship.. See also :ref:`deformable <CDeformable>` objects.
  2961. .. _flex-elasticity-young:
  2962. :at:`young`: :at-val:`real(1), "0"`
  2963. Young's elastic modulus, a measure of tensile and compressive stiffness for continuum elastic materials.
  2964. Units of :math:`\textrm{pressure}=\textrm{force}/\textrm{area}`.
  2965. .. _flex-elasticity-poisson:
  2966. :at:`poisson`: :at-val:`real(1), "0"`
  2967. Poisson's ratio, the ratio of transverse deformation to applied longitudinal strain.
  2968. This unitless quantity is in the range :math:`[0, 0.5)`.
  2969. Small or large values imply compressibility or incompressiblity, respectively.
  2970. .. _flex-elasticity-damping:
  2971. :at:`damping`: :at-val:`real(1), "0"`
  2972. Rayleigh's damping coefficient, units of time.
  2973. This quantity scales the stiffness defined by Young's modulus to produce the damping matrix.
  2974. .. _flex-elasticity-thickness:
  2975. :at:`thickness`: :at-val:`real(1), "-1"`
  2976. Shell thickness, units of length; only for used 2D flexes. Used to scale the stretching stiffness.
  2977. This thickness can be set equal to 2 times the :ref:`radius <deformable-flex-radius>` in order to match the geometry,
  2978. but is exposed seperately since the radius might be constrained by considerations related to collision detection.
  2979. .. _flex-contact:
  2980. :el-prefix:`flex/` |-| **contact** (?)
  2981. ''''''''''''''''''''''''''''''''''''''
  2982. This element adjusts the contact properties of the flex. It is mostly identical to geom contact properties, with some
  2983. extensions specific to flexes.
  2984. .. _flex-contact-internal:
  2985. :at:`internal`: :at-val:`[true, false], "true"`
  2986. Enables or disables internal collisions which prevent flex self-penetration and element inversion. Note that flex
  2987. elements that have shared vertices cannot collide (or else there will be permanent contacts). In 1D and 2D, internal
  2988. collision checks rely on predefined vertex-element pairs, where the vertex is treated as a sphere with the same
  2989. radius as the flex. These spheres correspond to non-shared vertices of neighboring elements on the periphery of the
  2990. flex. The pre-defined vertex-element pairs are generated by the model compiler automatically. In 3D, internal
  2991. collision checks are performed within each tetraheron: each vertex is collided with the plane corresponding to the
  2992. opposing triangle face (again using the flex radius). The resulting contacts are always created with condim 1, gap 0,
  2993. margin 0.
  2994. .. _flex-contact-selfcollide:
  2995. :at:`selfcollide`: :at-val:`[none, narrow, bvh, sap, auto], "auto"`
  2996. This determines the strategy for midphase collision pruning of element pairs belonging to the same flex. **none**
  2997. means flex elements cannot collide with each other. **narrow** means narrow phase only (i.e. all pairs are checked).
  2998. This is a diagnostic tool and is never a good idea in practice. **bvh** and **sap** refer to bounding volume
  2999. hierarchies and sweep-and-prune (which are two different strategies for midphase collision pruning). **auto** selects
  3000. **sap** in 1D and 2D, and **bvh** in 3D. Which strategy performs better depends on the specifics of the model. The
  3001. automatic setting is just a simple rule which we have found to perform well in general.
  3002. .. _flex-contact-activelayers:
  3003. :at:`activelayers`: :at-val:`int(1), "1"`
  3004. This only has an effect for 3D flexes. Each tetrahedron is labeled by the model compiler with an integer
  3005. corresponding to (graph) distance to the outside surface of the flex. Thus outside-facing elements are in layer 0,
  3006. their neighbors are in layer 1, etc. This attribute specifies how many layers will be allowed to participate in
  3007. collisions. The default setting 1 means that only one layer (i.e. layer 0) can collide, with itself and with the rest
  3008. of the world. This is usually sufficient, however if the outer layer is composed of small tetrahedra, another body
  3009. can "pierce" it and get stuck. In that case the value should be increased.
  3010. .. _flex-contact-contype:
  3011. .. _flex-contact-conaffinity:
  3012. .. _flex-contact-condim:
  3013. .. _flex-contact-priority:
  3014. .. _flex-contact-friction:
  3015. .. _flex-contact-solmix:
  3016. .. _flex-contact-solref:
  3017. .. _flex-contact-solimp:
  3018. .. _flex-contact-margin:
  3019. .. _flex-contact-gap:
  3020. .. |deformable/flex/contact attrib list| replace::
  3021. :at:`contype`, :at:`conaffinity`, :at:`condim`, :at:`priority`, :at:`friction`,
  3022. :at:`solmix`, :at:`solref`, :at:`solimp`, :at:`margin`, :at:`gap`
  3023. |deformable/flex/contact attrib list|
  3024. Same meaning as regular :ref:`geom <body-geom>` attributes.
  3025. .. _deformable-skin:
  3026. :el-prefix:`deformable/` |-| **skin** (*)
  3027. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  3028. These are deformable meshes whose vertex positions and normals are computed each time the model is rendered. MuJoCo
  3029. skins are only used for visualization and do not affect the physics in any way. In particular, collisions involve the
  3030. geoms of the bodies to which the skin is attached, and not the skin itself. Unlike regular meshes which are referenced
  3031. from geoms and participate in collisions, the skin is not referenced from anywhere else in the model. It is a
  3032. stand-alone element that is used by renderer and not by the simulator.
  3033. The skin has vertex positions and normals updated at runtime, and triangle faces and optional texture coordinates
  3034. which are predefined. It also has "bones" used for updating. Bones are regular MuJoCo bodies referenced with the
  3035. :el:`bone` subelement. Each bone has a list of vertex indices and corresponding real-valued weights which specify how
  3036. much the bone position and orientation influence the corresponding vertex. The vertex has local coordinates with
  3037. respect to every bone that influences it. The local coordinates are computed by the model compiler, given global
  3038. vertex coordinates and global bind poses for each body. The bind poses do not have to correspond to the model
  3039. reference configuration qpos0. Note that the vertex positions and bone bind poses provided in the skin definition are
  3040. always global, even if the model itself is defined in local coordinates.
  3041. At runtime the local coordinates of each vertex with respect to each bone that influences it are converted to global
  3042. coordinates, and averaged in proportion to the corresponding weights to obtain a single set of 3D coordinates for each
  3043. vertex. Normals then are computed automatically given the resulting global vertex positions and face information.
  3044. Finally, the skin can be inflated by applying an offset to each vertex position along its (computed) normal.
  3045. Skins are one-sided for rendering purposes; this is because back-face culling is needed to avoid shading and aliasing
  3046. artifacts. When the skin is a closed 3D shape this does not matter because the back sides cannot be seen. But if the
  3047. skin is a 2D object, we have to specify both sides and offset them slightly to avoid artifacts. Note that the
  3048. composite objects generate skins automatically. So one can save an XML model with a composite
  3049. object, and obtain an elaborate example of how a skin is specified in the XML.
  3050. Similar to meshes, skins can be specified directly in the XML via attributes documented later, or loaded from a binary
  3051. SKN file which is in a custom format. The specification of skins is more complex than meshes because of the bone
  3052. subelements. The file format starts with a header of 4 integers: nvertex, ntexcoord, nface, nbone. The first three are
  3053. the same as in meshes, and specify the total number of vertices, texture coordinate pairs, and triangle faces in the
  3054. skin. ntexcoord can be zero or equal to nvertex. nbone specifies the number of MuJoCo bodies that will be used as
  3055. bones in the skin. The header is followed by the vertex, texcoord and face data, followed by a specification for each
  3056. bone. The bone specification contains the name of the corresponding model body, 3D bind position, 4D bind quaternion,
  3057. number of vertices influenced by the bone, and the vertex index array and weight array. Body names are represented as
  3058. fixed-length character arrays and are expected to be 0-terminated. Characters after the first 0 are ignored. The
  3059. contents of the SKN file are:
  3060. .. code:: Text
  3061. (int32) nvertex
  3062. (int32) ntexcoord
  3063. (int32) nface
  3064. (int32) nbone
  3065. (float) vertex_positions[3*nvertex]
  3066. (float) vertex_texcoords[2*ntexcoord]
  3067. (int32) face_vertex_indices[3*nface]
  3068. for each bone:
  3069. (char) body_name[40]
  3070. (float) bind_position[3]
  3071. (float) bind_quaternion[4]
  3072. (int32) vertex_count
  3073. (int32) vertex_index[vertex_count]
  3074. (float) vertex_weight[vertex_count]
  3075. Similar to the other custom binary formats used in MuJoCo, the file size in bytes is strictly enforced by the model
  3076. compiler. The skin file format has subelements so the overall file size formula is difficult to write down, but should
  3077. be clear from the above specification.
  3078. .. _deformable-skin-name:
  3079. :at:`name`: :at-val:`string, optional`
  3080. Name of the skin.
  3081. .. _deformable-skin-file:
  3082. :at:`file`: :at-val:`string, optional`
  3083. The SKN file from which the skin will be loaded. The path is determined as described in the meshdir attribute of
  3084. :ref:`compiler <compiler>`. If the file is omitted, the skin specification must be provided in the XML using the
  3085. attributes below.
  3086. .. _deformable-skin-vertex:
  3087. :at:`vertex`: :at-val:`real(3*nvert), optional`
  3088. Vertex 3D positions, in the global bind pose where the skin is defined.
  3089. .. _deformable-skin-texcoord:
  3090. :at:`texcoord`: :at-val:`real(2*nvert), optional`
  3091. Vertex 2D texture coordinates, between 0 and 1. Note that skin and geom texturing are somewhat different. Geoms can
  3092. use automated texture coordinate generation while skins cannot. This is because skin data are computed directly in
  3093. global coordinates. So if the material references a texture, one should specify explicit texture coordinates for the
  3094. skin using this attribute. Otherwise the texture will appear to be stationary in the world while the skin moves
  3095. around (creating an interesting effect but probably not as intended).
  3096. .. _deformable-skin-face:
  3097. :at:`face`: :at-val:`int(3*nface), optional`
  3098. Trinagular skin faces. Each face is a triple of vertex indices, which are integers between zero and nvert-1.
  3099. .. _deformable-skin-inflate:
  3100. :at:`inflate`: :at-val:`real, "0"`
  3101. If this number is not zero, the position of vertex during updating will be offset along the vertex normal, but the
  3102. distance specified in this attribute. This is particularly useful for skins representing flexible 2D shapes.
  3103. .. _deformable-skin-material:
  3104. :at:`material`: :at-val:`string, optional`
  3105. If specified, this attribute applies a material to the skin.
  3106. .. _deformable-skin-rgba:
  3107. :at:`rgba`: :at-val:`real(4), "0.5 0.5 0.5 1"`
  3108. Instead of creating material assets and referencing them, this attribute can be used to set color and transparency
  3109. only. This is not as flexible as the material mechanism, but is more convenient and is often sufficient. If the value
  3110. of this attribute is different from the internal default, it takes precedence over the material.
  3111. .. _deformable-skin-group:
  3112. :at:`group`: :at-val:`int, "0"`
  3113. Integer group to which the skin belongs. This attribute can be used for custom tags. It is also used by the
  3114. visualizer to enable and disable the rendering of entire groups of skins.
  3115. .. _skin-bone:
  3116. :el-prefix:`skin/` |-| **bone** (*)
  3117. '''''''''''''''''''''''''''''''''''
  3118. This element defines a bone of the skin. The bone is a regular MuJoCo body which is referenced by name here.
  3119. .. _skin-bone-body:
  3120. :at:`body`: :at-val:`string, required`
  3121. Name of the body corresponding to this bone.
  3122. .. _skin-bone-bindpos:
  3123. :at:`bindpos`: :at-val:`real(3), required`
  3124. Global body position corresponding to the bind pose.
  3125. .. _skin-bone-bindquat:
  3126. :at:`bindquat`: :at-val:`real(4), required`
  3127. Global body orientation corresponding to the bind pose.
  3128. .. _skin-bone-vertid:
  3129. :at:`vertid`: :at-val:`int(nvert), required`
  3130. Integer indices of the vertices influenced by this bone. The vertex index corresponds to the order of the vertex in
  3131. the skin mesh. The number of vertex indices specified here (nvert) must equal the number of vertex weights specified
  3132. with the next attribute. The same vertex may be influenced by multiple bones, and each vertex must be influenced by
  3133. at least one bone.
  3134. .. _skin-bone-vertweight:
  3135. :at:`vertweight`: :at-val:`real(nvert), required`
  3136. Weights for the vertices influenced by this bone, in the same order as the vertex indices. Negative weights are
  3137. allowed (which is needed for cubic interpolation for example) however the sum of all bone weights for a given vertex
  3138. must be positive.
  3139. .. _equality:
  3140. **equality** (*)
  3141. ~~~~~~~~~~~~~~~~
  3142. This is a grouping element for equality constraints. It does not have attributes. See the :ref:`Equality <coEquality>`
  3143. section of the Computation chapter for a detailed description of equality constraints. Several attributes are common to
  3144. all equality constraint types, thus we document them only once, under the :ref:`connect <equality-connect>` element.
  3145. .. _equality-connect:
  3146. :el-prefix:`equality/` |-| **connect** (*)
  3147. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  3148. This element creates an equality constraint that connects two bodies at a point. The constraint effectively defines a
  3149. ball joint outside the kinematic tree. Connect constraints can be specified in one of two ways
  3150. - Using :ref:`body1<equality-connect-body1>` and :ref:`anchor<equality-connect-anchor>` (both required) and
  3151. optionally :ref:`body2<equality-connect-body2>`. When using this specification, the constraint is assumed to be
  3152. satisfied in the configuration in which the model is defined.
  3153. - :ref:`site1<equality-connect-site1>` and :ref:`site2<equality-connect-site2>` (both required). When using this
  3154. specification, the two sites will be pulled together by the constraint, regardless of their position in the default
  3155. configuration. An example of this specification is shown in
  3156. `this model <https://github.com/google-deepmind/mujoco/blob/main/test/engine/testdata/equality_site.xml>`__.
  3157. .. _equality-connect-name:
  3158. :at:`name`: :at-val:`string, optional`
  3159. Name of the equality constraint.
  3160. .. _equality-connect-class:
  3161. :at:`class`: :at-val:`string, optional`
  3162. Defaults class for setting unspecified attributes.
  3163. .. _equality-connect-active:
  3164. :at:`active`: :at-val:`[false, true], "true"`
  3165. If this attribute is set to "true", the constraint is active and the constraint solver will try to enforce it. The
  3166. field :ref:`mjModel.eq_active0<mjModel>` corresponds to this value, and is used to initialize
  3167. :ref:`mjData.eq_active<mjData>`, which is user-settable at runtime.
  3168. .. _equality-connect-solref:
  3169. .. _equality-connect-solimp:
  3170. :at:`solref`, :at:`solimp`
  3171. Constraint solver parameters for equality constraint simulation. See :ref:`CSolver`.
  3172. .. _equality-connect-body1:
  3173. :at:`body1`: :at-val:`string, optional`
  3174. Name of the first body participating in the constraint. Either this attribute and :at:`anchor` must be specified, or
  3175. :at:`site1` and :at:`site2` must be specified.
  3176. .. _equality-connect-body2:
  3177. :at:`body2`: :at-val:`string, optional`
  3178. Name of the second body participating in the constraint. If this attribute is omitted, the second body is the world
  3179. body.
  3180. .. _equality-connect-anchor:
  3181. :at:`anchor`: :at-val:`real(3), optional`
  3182. Coordinates of the 3D anchor point where the two bodies are connected, in the local coordinate frame of :at:`body1`.
  3183. The constraint is assumed to be satisfied in the configuration in which the model is defined, which lets the compiler
  3184. compute the associated anchor point for :at:`body2`.
  3185. .. _equality-connect-site1:
  3186. :at:`site1`: :at-val:`string, optional`
  3187. Name of a site belonging to the first body participating in the constraint. When specified, :at:`site2` must also be
  3188. specified. The (:at:`site1`, :at:`site2`) specification is a more flexible alternative to the body-based
  3189. specification, and is different in two ways. First, the sites are not required to overlap at the default
  3190. configuration; if they do not overlap then the sites will "snap together" at the beginning of the simulation. Second,
  3191. changing the site positions in ``mjModel.site_pos`` at runtime will correctly change the position of the constraint
  3192. (i.e. the content of ``mjModel.eq_data`` has no effect when this semantic is used).
  3193. .. _equality-connect-site2:
  3194. :at:`site2`: :at-val:`string, optional`
  3195. Name of a site belonging to the second body participating in the constraint. When specified, :at:`site1` must also be
  3196. specified. See the :ref:`site1<equality-connect-site1>` description for more details.
  3197. .. _equality-weld:
  3198. :el-prefix:`equality/` |-| **weld** (*)
  3199. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  3200. This element creates a weld equality constraint. It attaches two bodies to each other, removing all relative degrees of
  3201. freedom between them (softly of course, like all other constraints in MuJoCo). The two bodies are not required to be
  3202. close to each other. The relative body position and orientation being enforced by the constraint solver is the one in
  3203. which the model was defined. Note that two bodies can also be welded together rigidly, by defining one body as a child
  3204. of the other body, without any joint elements in the child body. Weld constraints can be specified in one of two ways:
  3205. - Using :ref:`body1<equality-weld-body1>` (and optionally :ref:`anchor<equality-weld-anchor>`,
  3206. :ref:`relpose<equality-weld-relpose>`, :ref:`body2<equality-weld-body2>`). When using this specification, the
  3207. constraint is assumed to be satisfied at the configuration in which the model is defined.
  3208. - :ref:`site1<equality-weld-site1>` and :ref:`site2<equality-weld-site2>` (both required). When using this
  3209. specification, the frames of the two sites will be aligned by the constraint, regardless of their position in the
  3210. default configuration. An example of this specification is shown in
  3211. `this model <https://github.com/google-deepmind/mujoco/blob/main/test/engine/testdata/equality_site.xml>`__.
  3212. .. _equality-weld-name:
  3213. .. _equality-weld-class:
  3214. .. _equality-weld-active:
  3215. .. _equality-weld-solref:
  3216. .. _equality-weld-solimp:
  3217. :at:`name`, :at:`class`, :at:`active`, :at:`solref`, :at:`solimp`
  3218. Same as in :ref:`connect <equality-connect>` element.
  3219. .. _equality-weld-body1:
  3220. :at:`body1`: :at-val:`string, optional`
  3221. Name of the first body participating in the constraint. Either this attribute and must be specified or :at:`site1`
  3222. and :at:`site2` must be specified.
  3223. .. _equality-weld-body2:
  3224. :at:`body2`: :at-val:`string, optional`
  3225. Name of the second body. If this attribute is omitted, the second body is the world body. Welding a body to the world
  3226. and changing the corresponding component of mjData.eq_active at runtime can be used to fix the body temporarily.
  3227. .. _equality-weld-relpose:
  3228. :at:`relpose`: :at-val:`real(7), "0 1 0 0 0 0 0"`
  3229. This attribute specifies the relative pose (3D position followed by 4D quaternion orientation) of body2 relative to
  3230. body1. If the quaternion part (i.e., last 4 components of the vector) are all zeros, as in the default setting, this
  3231. attribute is ignored and the relative pose is the one corresponding to the model reference pose in qpos0. The unusual
  3232. default is because all equality constraint types share the same default for their numeric parameters.
  3233. .. _equality-weld-anchor:
  3234. :at:`anchor`: :at-val:`real(3), "0 0 0"`
  3235. Coordinates of the weld point relative to body2. If :at:`relpose` is not specified, the meaning of
  3236. this parameter is the same as for connect constraints, except that is relative to body2. If :at:`relpose` is
  3237. specified, body1 will use the pose to compute its anchor point.
  3238. .. _equality-weld-site1:
  3239. :at:`site1`: :at-val:`string, optional`
  3240. Name of a site belonging to the first body participating in the constraint. When specified, :at:`site2` must also be
  3241. specified. The (:at:`site1`, :at:`site2`) specification is a more flexible alternative to the body-based
  3242. specification, and is different in two ways. First, the sites are not required to overlap at the default
  3243. configuration; if they do not overlap then the sites will "snap together" at the beginning of the simulation. Second,
  3244. changing the site position and orientation in ``mjModel.site_pos`` and ``mjModel.site_quat`` at runtime will
  3245. correctly change the position and orientation of the constraint (i.e. the content of ``mjModel.eq_data`` has no
  3246. effect when this semantic is used, with the exception of :ref:`torquescale<equality-weld-torquescale>`).
  3247. .. _equality-weld-site2:
  3248. :at:`site2`: :at-val:`string, optional`
  3249. Name of a site belonging to the second body participating in the constraint. When specified, :at:`site1` must also be
  3250. specified. See the :ref:`site1<equality-weld-site1>` description for more details.
  3251. .. _equality-weld-torquescale:
  3252. :at:`torquescale`: :at-val:`real, "1"`
  3253. A constant that scales the angular residual (angular constraint violation). Notionally in units of
  3254. :math:`\textrm{torque}/\textrm{force}=\textrm{length}`. Intuitively this coefficient defines how much the weld
  3255. "cares" about rotational displacements vs. translational displacements. Setting this value to 0 makes the :el:`weld`
  3256. behave like a :el:`connect` constraint. Note that this value has units of length and can therefore be understood as
  3257. follows. Imagining that the weld is implemented by a flat patch of glue sticking the two bodies together,
  3258. :at:`torquescale` can be interpreted as the diameter of this glue patch.
  3259. .. _equality-joint:
  3260. :el-prefix:`equality/` |-| **joint** (*)
  3261. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  3262. This element constrains the position or angle of one joint to be a quartic polynomial of another joint. Only scalar
  3263. joint types (slide and hinge) can be used.
  3264. .. _equality-joint-name:
  3265. .. _equality-joint-class:
  3266. .. _equality-joint-active:
  3267. .. _equality-joint-solref:
  3268. .. _equality-joint-solimp:
  3269. :at:`name`, :at:`class`, :at:`active`, :at:`solref`, :at:`solimp`
  3270. Same as in :ref:`connect <equality-connect>` element.
  3271. .. _equality-joint-joint1:
  3272. :at:`joint1`: :at-val:`string, required`
  3273. Name of the first joint.
  3274. .. _equality-joint-joint2:
  3275. :at:`joint2`: :at-val:`string, optional`
  3276. Name of the second joint. If this attribute is omitted, the first joint is fixed to a constant.
  3277. .. _equality-joint-polycoef:
  3278. :at:`polycoef`: :at-val:`real(5), "0 1 0 0 0"`
  3279. Coefficients :math:`a_0 \ldots a_4` of the quartic polynomial. If the joint values of :at:`joint1` and :at:`joint2`
  3280. are respectively :math:`y` and :math:`x`, and their reference positions (corresponding to the joint values in the
  3281. initial model configuration) are :math:`y_0` and :math:`x_0`, the constraint is:
  3282. .. math::
  3283. y-y_0 = a_0 + a_1(x-x_0) + a_2(x-x_0)^2 + a_3(x-x_0)^3 + a_4(x-x_0)^4
  3284. Omitting :at:`joint2` is equivalent to setting :math:`x = x_0`, in which case the constraint is
  3285. :math:`y = y_0 + a_0`.
  3286. .. _equality-tendon:
  3287. :el-prefix:`equality/` |-| **tendon** (*)
  3288. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  3289. This element constrains the length of one tendon to be a quartic polynomial of another tendon.
  3290. .. _equality-tendon-name:
  3291. .. _equality-tendon-class:
  3292. .. _equality-tendon-active:
  3293. .. _equality-tendon-solref:
  3294. .. _equality-tendon-solimp:
  3295. :at:`name`, :at:`class`, :at:`active`, :at:`solref`, :at:`solimp`
  3296. Same as in :ref:`connect <equality-connect>` element.
  3297. .. _equality-tendon-tendon1:
  3298. :at:`tendon1`: :at-val:`string, required`
  3299. Name of the first tendon.
  3300. .. _equality-tendon-tendon2:
  3301. :at:`tendon2`: :at-val:`string, optional`
  3302. Name of the second tendon. If this attribute is omitted, the first tendon is fixed to a constant.
  3303. .. _equality-tendon-polycoef:
  3304. :at:`polycoef`: :at-val:`real(5), "0 1 0 0 0"`
  3305. Same as in the :ref:`equality/joint <equality-joint>` element above, but applied to tendon lengths instead of joint
  3306. positions.
  3307. .. _equality-flex:
  3308. :el-prefix:`equality/` |-| **flex** (*)
  3309. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  3310. This element constrains the lengths of all edges of a specified flex to their respective lengths in the initial model
  3311. configuration. In this way the edges are used to maintain the shape of the deformable entity. Note that all other
  3312. equality constraint types add a fixed number of scalar constraints, while this element adds as many scalar constraints
  3313. as there are edges in the specified flex.
  3314. .. _equality-flex-name:
  3315. .. _equality-flex-class:
  3316. .. _equality-flex-active:
  3317. .. _equality-flex-solref:
  3318. .. _equality-flex-solimp:
  3319. :at:`name`, :at:`class`, :at:`active`, :at:`solref`, :at:`solimp`
  3320. Same as in :ref:`connect <equality-connect>` element.
  3321. .. _equality-flex-flex:
  3322. :at:`flex`: :at-val:`string, required`
  3323. Name of the flex whose edges are being constrained.
  3324. .. _equality-distance:
  3325. :el-prefix:`equality/` |-| **distance** (*)
  3326. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  3327. Distance equality constraints were removed in MuJoCo version 2.2.2. If you are using an earlier version, please switch
  3328. to the corresponding version of the documentation.
  3329. .. _tendon:
  3330. **tendon** (*)
  3331. ~~~~~~~~~~~~~~
  3332. Grouping element for tendon definitions. The attributes of fixed tendons are a subset of the attributes of spatial
  3333. tendons, thus we document them only once under spatial tendons. Tendons can be used to impose length limits, simulate
  3334. spring, damping and dry friction forces, as well as attach actuators to them. When used in equality constraints, tendons
  3335. can also represent different forms of mechanical coupling.
  3336. .. _tendon-spatial:
  3337. :el-prefix:`tendon/` |-| **spatial** (*)
  3338. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  3339. .. figure:: images/XMLreference/tendon.png
  3340. :width: 400px
  3341. :align: right
  3342. This element creates a spatial tendon, which is a minimum-length path passing through specified via-points and
  3343. wrapping around specified obstacle geoms. The objects along the path are defined with the sub-elements
  3344. :ref:`site <spatial-site>` and :ref:`geom <spatial-geom>` below. One can also define :ref:`pulleys <spatial-pulley>`
  3345. which split the path in multiple branches. Each branch of the tendon path must start and end with a site, and if it
  3346. has multiple obstacle geoms they must be separated by sites - so as to avoid the need for an iterative solver at the
  3347. tendon level. This example illustrates a multi-branch tendon acting as a finger extensor, with a counter-weight
  3348. instead of an actuator: `tendon.xml <_static/tendon.xml>`__.
  3349. A second form of wrapping is where the tendon is constrained to pass *through* a geom rather than
  3350. wrap around it. This is enabled automatically when a sidesite is specified and its position is inside the volume of
  3351. the obstacle geom.
  3352. .. _tendon-spatial-name:
  3353. :at:`name`: :at-val:`string, optional`
  3354. Name of the tendon.
  3355. .. _tendon-spatial-class:
  3356. :at:`class`: :at-val:`string, optional`
  3357. Defaults class for setting unspecified attributes.
  3358. .. _tendon-spatial-group:
  3359. :at:`group`: :at-val:`int, "0"`
  3360. Integer group to which the tendon belongs. This attribute can be used for custom tags. It is also used by the
  3361. visualizer to enable and disable the rendering of entire groups of tendons.
  3362. .. _tendon-spatial-limited:
  3363. :at:`limited`: :at-val:`[false, true, auto], "auto"`
  3364. If this attribute is "true", the length limits defined by the range attribute below are imposed by the constraint
  3365. solver. If this attribute is "auto", and :at:`autolimits` is set in :ref:`compiler <compiler>`, length limits
  3366. will be enabled if range is defined.
  3367. .. _tendon-spatial-range:
  3368. :at:`range`: :at-val:`real(2), "0 0"`
  3369. Range of allowed tendon lengths. Setting this attribute without specifying :at:`limited` is an error, unless
  3370. :at:`autolimits` is set in :ref:`compiler <compiler>`.
  3371. .. _tendon-spatial-solreflimit:
  3372. .. _tendon-spatial-solimplimit:
  3373. :at:`solreflimit`, :at:`solimplimit`
  3374. Constraint solver parameters for simulating tendon limits. See :ref:`CSolver`.
  3375. .. _tendon-spatial-solreffriction:
  3376. .. _tendon-spatial-solimpfriction:
  3377. :at:`solreffriction`, :at:`solimpfriction`
  3378. Constraint solver parameters for simulating dry friction in the tendon. See :ref:`CSolver`.
  3379. .. _tendon-spatial-margin:
  3380. :at:`margin`: :at-val:`real, "0"`
  3381. The limit constraint becomes active when the absolute value of the difference between the tendon length and either
  3382. limit of the specified range falls below this margin. Similar to contacts, the margin parameter is subtracted from
  3383. the difference between the range limit and the tendon length. The resulting constraint distance is always negative
  3384. when the constraint is active. This quantity is used to compute constraint impedance as a function of distance, as
  3385. explained in :ref:`CSolver`.
  3386. .. _tendon-spatial-frictionloss:
  3387. :at:`frictionloss`: :at-val:`real, "0"`
  3388. Friction loss caused by dry friction. To enable friction loss, set this attribute to a positive value.
  3389. .. _tendon-spatial-width:
  3390. :at:`width`: :at-val:`real, "0.003"`
  3391. Radius of the cross-section area of the spatial tendon, used for rendering. Parts of the tendon that wrap around geom
  3392. obstacles are rendered with reduced width.
  3393. .. _tendon-spatial-material:
  3394. :at:`material`: :at-val:`string, optional`
  3395. Material used to set the appearance of the tendon.
  3396. .. _tendon-spatial-rgba:
  3397. :at:`rgba`: :at-val:`real(4), "0.5 0.5 0.5 1"`
  3398. Color and transparency of the tendon. When this value is different from the internal default, it overrides the
  3399. corresponding material properties.
  3400. .. _tendon-spatial-springlength:
  3401. :at:`springlength`: :at-val:`real(2), "-1 -1"`
  3402. Spring resting position, can take either one or two values. If one value is given, it corresponds to the length of
  3403. the tendon at rest. If it is ``-1``, the tendon resting length is determined from the model reference configuration
  3404. in ``mjModel.qpos0``. |br| Note that the default value of ``-1``, which invokes the automatic length computation,
  3405. was designed with :ref:`spatial<tendon-spatial>` tendons in mind, which can only have nonegative length. In order to
  3406. set the :at:`springlength` of a :ref:`fixed<tendon-fixed>` tendon to ``-1``, use a nearby value like ``-0.99999``.
  3407. |br| If two non-decreasing values are given, they define a `dead-band <https://en.wikipedia.org/wiki/Deadband>`_
  3408. range. If the tendon length is between the two values, the force is 0. If it is outside this range, the force behaves
  3409. like a regular spring, with the rest-point corresponding to the nearest :at:`springlength` value. A deadband can be
  3410. used to define tendons whose limits are enforced by springs rather than constraints.
  3411. .. _tendon-spatial-stiffness:
  3412. :at:`stiffness`: :at-val:`real, "0"`
  3413. Stiffness coefficient. A positive value generates a spring force (linear in position) acting along the tendon.
  3414. .. _tendon-spatial-damping:
  3415. :at:`damping`: :at-val:`real, "0"`
  3416. Damping coefficient. A positive value generates a damping force (linear in velocity) acting along the tendon. Unlike
  3417. joint damping which is integrated implicitly by the Euler method, tendon damping is not integrated implicitly, thus
  3418. joint damping should be used if possible.
  3419. .. _tendon-spatial-user:
  3420. :at:`user`: :at-val:`real(nuser_tendon), "0 0 ..."`
  3421. See :ref:`CUser`.
  3422. .. _spatial-site:
  3423. :el-prefix:`spatial/` |-| **site** (*)
  3424. ''''''''''''''''''''''''''''''''''''''
  3425. This attribute specifies a site that the tendon path has to pass through. Recall that sites are rigidly attached to
  3426. bodies.
  3427. .. _spatial-site-site:
  3428. :at:`site`: :at-val:`string, required`
  3429. The name of the site that the tendon must pass through.
  3430. .. _spatial-geom:
  3431. :el-prefix:`spatial/` |-| **geom** (*)
  3432. ''''''''''''''''''''''''''''''''''''''
  3433. This element specifies a geom that acts as an obstacle for the tendon path. If the minimum-length path does not touch
  3434. the geom it has no effect; otherwise the path wraps around the surface of the geom. Wrapping is computed analytically,
  3435. which is why we restrict the geom types allowed here to spheres and cylinders. The latter are treated as having infinite
  3436. length for tendon wrapping purposes. If a sidesite is defined, and its position is inside the geom, then the tendon is
  3437. constrained to pass through the geom instead of passing around it.
  3438. .. _spatial-geom-geom:
  3439. :at:`geom`: :at-val:`string, required`
  3440. The name of a geom that acts as an obstacle for the tendon path. Only sphere and cylinder geoms can be referenced
  3441. here.
  3442. .. _spatial-geom-sidesite:
  3443. :at:`sidesite`: :at-val:`string, optional`
  3444. To prevent the tendon path from snapping from one side of the geom to the other as the model configuration varies,
  3445. the user can define a preferred "side" of the geom. At runtime, the wrap that is closer to the specified site is
  3446. automatically selected. Specifying a side site is often needed in practice. If the side site is inside the geom, the
  3447. tendon is constrained to pass through the interior of the geom.
  3448. .. _spatial-pulley:
  3449. :el-prefix:`spatial/` |-| **pulley** (*)
  3450. ''''''''''''''''''''''''''''''''''''''''
  3451. This element starts a new branch in the tendon path. The branches are not required to be connected spatially. Similar to
  3452. the transmissions described in the :ref:`Actuation model <geActuation>` section of the Computation
  3453. chapter, the quantity that affects the simulation is the tendon length and its gradient with respect to the joint
  3454. positions. If a spatial tendon has multiple branches, the length of each branch is divided by the divisor attribute of
  3455. the pulley element that started the branch, and added up to obtain the overall tendon length. This is why the spatial
  3456. relations among branches are not relevant to the simulation. The `tendon.xml <_static/tendon.xml>`__ example above
  3457. illustrated the use of pulleys.
  3458. .. _spatial-pulley-divisor:
  3459. :at:`divisor`: :at-val:`real, required`
  3460. The length of the tendon branch started by the pulley element is divided by the value specified here. For a physical
  3461. pulley that splits a single branch into two parallel branches, the common branch would have divisor value of 1 and
  3462. the two branches following the pulley would have divisor values of 2. If one of them is further split by another
  3463. pulley, each new branch would have divisor value of 4 and so on. Note that in MJCF each branch starts with a pulley,
  3464. thus a single physical pulley is modeled with two MJCF pulleys. If no pulley elements are included in the tendon
  3465. path, the first and only branch has divisor value of 1.
  3466. .. _tendon-fixed:
  3467. :el-prefix:`tendon/` |-| **fixed** (*)
  3468. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  3469. This element creates an abstract tendon whose length is defined as a linear combination of joint positions. Recall that
  3470. the tendon length and its gradient are the only quantities needed for simulation. Thus we could define any scalar
  3471. function of joint positions, call it "tendon", and plug it in MuJoCo. Presently the only such function is a fixed linear
  3472. combination. The attributes of fixed tendons are a subset of the attributes of spatial tendons and have the same meaning
  3473. as above.
  3474. .. _tendon-fixed-name:
  3475. .. _tendon-fixed-class:
  3476. .. _tendon-fixed-group:
  3477. .. _tendon-fixed-limited:
  3478. .. _tendon-fixed-range:
  3479. .. _tendon-fixed-solreflimit:
  3480. .. _tendon-fixed-solimplimit:
  3481. .. _tendon-fixed-solreffriction:
  3482. .. _tendon-fixed-solimpfriction:
  3483. .. _tendon-fixed-frictionloss:
  3484. .. _tendon-fixed-margin:
  3485. .. _tendon-fixed-springlength:
  3486. .. _tendon-fixed-stiffness:
  3487. .. _tendon-fixed-damping:
  3488. .. _tendon-fixed-user:
  3489. .. |tendon/fixed attrib list| replace::
  3490. :at:`name`, :at:`class`, :at:`group`, :at:`limited`, :at:`range`, :at:`solreflimit`, :at:`solimplimit`,
  3491. :at:`solreffriction`, :at:`solimpfriction`, :at:`frictionloss`, :at:`margin`, :at:`springlength`, :at:`stiffness`,
  3492. :at:`damping`, :at:`user`
  3493. |tendon/fixed attrib list|
  3494. Same as in the :ref:`spatial <tendon-spatial>` element.
  3495. .. _fixed-joint:
  3496. :el-prefix:`fixed/` |-| **joint** (*)
  3497. '''''''''''''''''''''''''''''''''''''
  3498. This element adds a joint to the computation of the fixed tendon length. The position or angle of each included joint is
  3499. multiplied by the corresponding coef value, and added up to obtain the tendon length.
  3500. .. _fixed-joint-joint:
  3501. :at:`joint`: :at-val:`string, required`
  3502. Name of the joint to be added to the fixed tendon. Only scalar joints (slide and hinge) can be referenced here.
  3503. .. _fixed-joint-coef:
  3504. :at:`coef`: :at-val:`real, required`
  3505. Scalar coefficient multiplying the position or angle of the specified joint.
  3506. .. _actuator:
  3507. **actuator** (*)
  3508. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3509. This is a grouping element for actuator definitions. Recall the discussion of MuJoCo's :ref:`Actuation model
  3510. <geActuation>` in the Computation chapter, and the :ref:`Actuator shortcuts <CActShortcuts>` discussed earlier in this
  3511. chapter. The first 13 attributes of all actuator-related elements below are the same, so we document them only once,
  3512. under the :el:`general` actuator.
  3513. .. _actuator-general:
  3514. :el-prefix:`actuator/` |-| **general** (*)
  3515. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  3516. This element creates a general actuator, providing full access to all actuator components and allowing the user to
  3517. specify them independently.
  3518. .. _actuator-general-name:
  3519. :at:`name`: :at-val:`string, optional`
  3520. Element name. See :ref:`CName`.
  3521. .. _actuator-general-class:
  3522. :at:`class`: :at-val:`string, optional`
  3523. Active defaults class. See :ref:`CDefault`.
  3524. .. _actuator-general-group:
  3525. :at:`group`: :at-val:`int, "0"`
  3526. Integer group to which the actuator belongs. This attribute can be used for custom tags. It is also used by the
  3527. visualizer to enable and disable the rendering of entire groups of actuators.
  3528. .. _actuator-general-ctrllimited:
  3529. :at:`ctrllimited`: :at-val:`[false, true, auto], "auto"`
  3530. If true, the control input to this actuator is automatically clamped to :at:`ctrlrange` at runtime. If false, control
  3531. input clamping is disabled. If "auto" and :at:`autolimits` is set in :ref:`compiler <compiler>`, control
  3532. clamping will automatically be set to true if :at:`ctrlrange` is defined without explicitly setting this attribute
  3533. to "true". Note that control input clamping can also be globally disabled with the :at:`clampctrl` attribute of
  3534. :ref:`option/flag <option-flag>`.
  3535. .. _actuator-general-forcelimited:
  3536. :at:`forcelimited`: :at-val:`[false, true, auto], "auto"`
  3537. If true, the force output of this actuator is automatically clamped to :at:`forcerange` at runtime. If false, force
  3538. clamping is disabled. If "auto" and :at:`autolimits` is set in :ref:`compiler <compiler>`, force clamping will
  3539. automatically be set to true if :at:`forcerange` is defined without explicitly setting this attribute to "true".
  3540. .. _actuator-general-actlimited:
  3541. :at:`actlimited`: :at-val:`[false, true, auto], "auto"`
  3542. If true, the internal state (activation) associated with this actuator is automatically clamped to :at:`actrange` at
  3543. runtime. If false, activation clamping is disabled. If "auto" and :at:`autolimits` is set in
  3544. :ref:`compiler <compiler>`, activation clamping will automatically be set to true if :at:`actrange` is defined
  3545. without explicitly setting this attribute to "true". See the :ref:`Activation clamping <CActRange>` section for more
  3546. details.
  3547. .. _actuator-general-ctrlrange:
  3548. :at:`ctrlrange`: :at-val:`real(2), "0 0"`
  3549. Range for clamping the control input. The first value must be smaller than the second value.
  3550. |br| Setting this attribute without specifying :at:`ctrllimited` is an error if :at:`autolimits` is "false" in
  3551. :ref:`compiler <compiler>`.
  3552. .. _actuator-general-forcerange:
  3553. :at:`forcerange`: :at-val:`real(2), "0 0"`
  3554. Range for clamping the force output. The first value must be no greater than the second value.
  3555. |br| Setting this attribute without specifying :at:`forcelimited` is an error if :at:`autolimits` is "false" in
  3556. :ref:`compiler <compiler>`.
  3557. .. _actuator-general-actrange:
  3558. :at:`actrange`: :at-val:`real(2), "0 0"`
  3559. Range for clamping the activation state. The first value must be no greater than the second value.
  3560. See the :ref:`Activation clamping <CActRange>` section for more details.
  3561. |br| Setting this attribute without specifying :at:`actlimited` is an error if :at:`autolimits` is "false" in
  3562. :ref:`compiler <compiler>`.
  3563. .. _actuator-general-lengthrange:
  3564. :at:`lengthrange`: :at-val:`real(2), "0 0"`
  3565. Range of feasible lengths of the actuator's transmission. See :ref:`Length Range <CLengthRange>`.
  3566. .. _actuator-general-gear:
  3567. :at:`gear`: :at-val:`real(6), "1 0 0 0 0 0"`
  3568. This attribute scales the length (and consequently moment arms, velocity and force) of the actuator, for all
  3569. transmission types. It is different from the gain in the force generation mechanism, because the gain only scales the
  3570. force output and does not affect the length, moment arms and velocity. For actuators with scalar transmission, only
  3571. the first element of this vector is used. The remaining elements are needed for joint, jointinparent and site
  3572. transmissions where this attribute is used to specify 3D force and torque axes.
  3573. .. _actuator-general-cranklength:
  3574. :at:`cranklength`: :at-val:`real, "0"`
  3575. Used only for the slider-crank transmission type. Specifies the length of the connecting rod. The compiler expects
  3576. this value to be positive when a slider-crank transmission is present.
  3577. .. _actuator-general-joint:
  3578. :at:`joint`: :at-val:`string, optional`
  3579. This and the next four attributes determine the type of actuator transmission. All of them are optional, and exactly
  3580. one of them must be specified. If this attribute is specified, the actuator acts on the given joint. For **hinge**
  3581. and **slide** joints, the actuator length equals the joint position/angle times the first element of :at:`gear`. For
  3582. **ball** joints, the first three elements of gear define a 3d rotation axis in the child frame around which the
  3583. actuator produces torque. The actuator length is defined as the dot-product between this gear axis and the angle-axis
  3584. representation of the joint quaternion, and is in units of radian if :at:`gear` is normalized (generally scaled by
  3585. by the norm of :at:`gear`). Note that after total rotation of more than :math:`\pi`, the length will wrap to :math:`-
  3586. \pi`, and vice-versa. Therefore :el:`position` servos for ball joints should generally use tighter limits which
  3587. prevent this wrapping. For **free** joints, gear defines a 3d translation axis in the world frame followed by a 3d
  3588. rotation axis in the child frame. The actuator generates force and torque relative to the specified axes. The
  3589. actuator length for free joints is defined as zero (so it should not be used with position servos).
  3590. .. _actuator-general-jointinparent:
  3591. :at:`jointinparent`: :at-val:`string, optional`
  3592. Identical to joint, except that for ball and free joints, the 3d rotation axis given by gear is defined in the parent
  3593. frame (which is the world frame for free joints) rather than the child frame.
  3594. .. _actuator-general-site:
  3595. :at:`site`: :at-val:`string, optional`
  3596. This transmission can apply force and torque at a site. The gear vector defines a 3d translation axis followed by a
  3597. 3d rotation axis. Both are defined in the site's frame. This can be used to model jets and propellers. The effect is
  3598. similar to actuating a free joint, and the actuator length is defined as zero unless a :at:`refsite` is defined (see
  3599. below). One difference from the :at:`joint` and :at:`jointinparent` transmissions above is that here the actuator
  3600. operates on a site rather than a joint, but this difference disappears when the site is defined at the frame origin
  3601. of the free-floating body. The other difference is that for site transmissions both the translation and rotation axes
  3602. are defined in local coordinates. In contrast, translation is global and rotation is local for :at:`joint`, and both
  3603. translation and rotation are global for :at:`jointinparent`.
  3604. .. youtube:: s-0JHanqV1A
  3605. :align: right
  3606. :height: 150px
  3607. .. _actuator-general-refsite:
  3608. :at:`refsite`: :at-val:`string, optional`
  3609. When using a :at:`site` transmission, measure the translation and rotation w.r.t the frame of the :at:`refsite`. In
  3610. this case the actuator *does* have length and :el:`position` actuators can be used to directly control an end
  3611. effector, see `refsite.xml
  3612. <https://github.com/google-deepmind/mujoco/tree/main/test/engine/testdata/actuation/refsite.xml>`__ example
  3613. model. As above, the length is the dot product of the :at:`gear` vector and the frame difference. So ``gear="0 1 0 0
  3614. 0 0"`` means "Y-offset of :at:`site` in the :at:`refsite` frame", while ``gear="0 0 0 0 0 1"`` means rotation "Z-
  3615. rotation of :at:`site` in the :at:`refsite` frame". It is recommended to use a normalized :at:`gear` vector with
  3616. nonzeros in only the first 3 *or* the last 3 elements of :at:`gear`, so the actuator length will be in either length
  3617. units or radians, respectively. As with ball joints (see :at:`joint` above), for rotations which exceed a total angle
  3618. of :math:`\pi` will wrap around, so tighter limits are recommended.
  3619. .. _actuator-general-body:
  3620. :at:`body`: :at-val:`string, optional`
  3621. This transmission can apply linear forces at contact points in the direction of the contact normal. The set of
  3622. contacts is all those belonging to the specified :at:`body`. This can be used to model natural active adhesion
  3623. mechanisms like the feet of geckos and insects. The actuator length is again defined as zero. For more information,
  3624. see the :ref:`adhesion<actuator-adhesion>` shortcut below.
  3625. .. _actuator-general-tendon:
  3626. :at:`tendon`: :at-val:`string, optional`
  3627. If specified, the actuator acts on the given tendon. The actuator length equals the tendon length times the gear
  3628. ratio. Both spatial and fixed tendons can be used.
  3629. .. _actuator-general-cranksite:
  3630. :at:`cranksite`: :at-val:`string, optional`
  3631. If specified, the actuator acts on a slider-crank mechanism which is implicitly determined by the actuator (i.e., it
  3632. is not a separate model element). The specified site corresponds to the pin joining the crank and the connecting rod.
  3633. The actuator length equals the position of the slider-crank mechanism times the gear ratio.
  3634. .. _actuator-general-slidersite:
  3635. :at:`slidersite`: :at-val:`string, required for slider-crank transmission`
  3636. Used only for the slider-crank transmission type. The specified site is the pin joining the slider and the connecting
  3637. rod. The slider moves along the z-axis of the slidersite frame. Therefore the site should be oriented as needed when
  3638. it is defined in the kinematic tree; its orientation cannot be changed in the actuator definition.
  3639. .. _actuator-general-user:
  3640. :at:`user`: :at-val:`real(nuser_actuator), "0 ... 0"`
  3641. See :ref:`CUser`.
  3642. .. _actuator-general-actdim:
  3643. :at:`actdim`: :at-val:`real, "-1"`
  3644. Dimension of the activation state. The default value of ``-1`` instructs the compiler to set the dimension according
  3645. to the :at:`dyntype`. Values larger than ``1`` are only allowed for user-defined activation dynamics, as native types
  3646. require dimensions of only 0 or 1. For activation dimensions bigger than 1, the *last element* is used to generate
  3647. force.
  3648. .. _actuator-general-dyntype:
  3649. :at:`dyntype`: :at-val:`[none, integrator, filter, filterexact, muscle, user], "none"`
  3650. Activation dynamics type for the actuator. The available dynamics types were already described in the :ref:`Actuation
  3651. model <geActuation>` section. Repeating that description in somewhat different notation (corresponding to the mjModel
  3652. and mjData fields involved) we have:
  3653. =========== ======================================
  3654. Keyword Description
  3655. =========== ======================================
  3656. none No internal state
  3657. integrator act_dot = ctrl
  3658. filter act_dot = (ctrl - act) / dynprm[0]
  3659. filterexact Like filter but with exact integration
  3660. muscle act_dot = mju_muscleDynamics(...)
  3661. user act_dot = mjcb_act_dyn(...)
  3662. =========== ======================================
  3663. .. _actuator-general-gaintype:
  3664. :at:`gaintype`: :at-val:`[fixed, affine, muscle, user], "fixed"`
  3665. The gain and bias together determine the output of the force generation mechanism, which is currently assumed to be
  3666. affine. As already explained in :ref:`Actuation model <geActuation>`, the general formula is:
  3667. scalar_force = gain_term \* (act or ctrl) + bias_term.
  3668. The formula uses the activation state when present, and the control otherwise. The keywords have the following
  3669. meaning:
  3670. ======= ===============================
  3671. Keyword Description
  3672. ======= ===============================
  3673. fixed gain_term = gainprm[0]
  3674. affine gain_term = gain_prm[0] + gain_prm[1]*length + gain_prm[2]*velocity
  3675. muscle gain_term = mju_muscleGain(...)
  3676. user gain_term = mjcb_act_gain(...)
  3677. ======= ===============================
  3678. .. _actuator-general-biastype:
  3679. :at:`biastype`: :at-val:`[none, affine, muscle, user], "none"`
  3680. The keywords have the following meaning:
  3681. ======= ================================================================
  3682. Keyword Description
  3683. ======= ================================================================
  3684. none bias_term = 0
  3685. affine bias_term = biasprm[0] + biasprm[1]*length + biasprm[2]*velocity
  3686. muscle bias_term = mju_muscleBias(...)
  3687. user bias_term = mjcb_act_bias(...)
  3688. ======= ================================================================
  3689. .. _actuator-general-dynprm:
  3690. :at:`dynprm`: :at-val:`real(10), "1 0 ... 0"`
  3691. Activation dynamics parameters. The built-in activation types (except for muscle) use only the first parameter, but
  3692. we provide additional parameters in case user callbacks implement a more elaborate model. The length of this array is
  3693. not enforced by the parser, so the user can enter as many parameters as needed. These defaults are not compatible
  3694. with muscle actuators; see :ref:`muscle <actuator-muscle>` below.
  3695. .. _actuator-general-gainprm:
  3696. :at:`gainprm`: :at-val:`real(10), "1 0 ... 0"`
  3697. Gain parameters. The built-in gain types (except for muscle) use only the first parameter, but we provide additional
  3698. parameters in case user callbacks implement a more elaborate model. The length of this array is not enforced by the
  3699. parser, so the user can enter as many parameters as needed. These defaults are not compatible with muscle actuators;
  3700. see :ref:`muscle <actuator-muscle>` below.
  3701. .. _actuator-general-biasprm:
  3702. :at:`biasprm`: :at-val:`real(10), "0 ... 0"`
  3703. Bias parameters. The affine bias type uses three parameters. The length of this array is not enforced by the parser,
  3704. so the user can enter as many parameters as needed. These defaults are not compatible with muscle actuators; see
  3705. :ref:`muscle <actuator-muscle>` below.
  3706. .. _actuator-general-actearly:
  3707. :at:`actearly`: :at-val:`[false, true], "false"`
  3708. If true, force computation will use the next value of the activation variable rather than the current one.
  3709. Setting this flag reduces the delay between the control and accelerations by one time-step.
  3710. .. _actuator-motor:
  3711. :el-prefix:`actuator/` |-| **motor** (*)
  3712. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  3713. This and the next three elements are the :ref:`Actuator shortcuts <CActShortcuts>` discussed earlier. When a
  3714. such shortcut is encountered, the parser creates a :el:`general` actuator and sets its dynprm, gainprm and biasprm
  3715. attributes to the internal defaults shown above, regardless of any default settings. It then adjusts dyntype, gaintype
  3716. and biastype depending on the shortcut, parses any custom attributes (beyond the common ones), and translates them
  3717. into regular attributes (i.e., attributes of the :el:`general` actuator type) as explained here.
  3718. This element creates a direct-drive actuator. The underlying :el:`general` attributes are set as follows:
  3719. ========= ======= ========= =======
  3720. Attribute Setting Attribute Setting
  3721. ========= ======= ========= =======
  3722. dyntype none dynprm 1 0 0
  3723. gaintype fixed gainprm 1 0 0
  3724. biastype none biasprm 0 0 0
  3725. ========= ======= ========= =======
  3726. This element does not have custom attributes. It only has common attributes, which are:
  3727. .. _actuator-motor-name:
  3728. .. _actuator-motor-class:
  3729. .. _actuator-motor-group:
  3730. .. _actuator-motor-ctrllimited:
  3731. .. _actuator-motor-forcelimited:
  3732. .. _actuator-motor-ctrlrange:
  3733. .. _actuator-motor-forcerange:
  3734. .. _actuator-motor-lengthrange:
  3735. .. _actuator-motor-gear:
  3736. .. _actuator-motor-cranklength:
  3737. .. _actuator-motor-joint:
  3738. .. _actuator-motor-jointinparent:
  3739. .. _actuator-motor-tendon:
  3740. .. _actuator-motor-cranksite:
  3741. .. _actuator-motor-slidersite:
  3742. .. _actuator-motor-site:
  3743. .. _actuator-motor-refsite:
  3744. .. _actuator-motor-user:
  3745. .. |actuator/motor attrib list| replace::
  3746. :at:`name`, :at:`class`, :at:`group`, :at:`ctrllimited`, :at:`forcelimited`, :at:`ctrlrange`, :at:`forcerange`,
  3747. :at:`lengthrange`, :at:`gear`, :at:`cranklength`, :at:`joint`, :at:`jointinparent`, :at:`tendon`, :at:`cranksite`,
  3748. :at:`slidersite`, :at:`site`, :at:`refsite`, :at:`user`
  3749. |actuator/motor attrib list|
  3750. Same as in actuator/ :ref:`general <actuator-general>`.
  3751. .. _actuator-position:
  3752. :el-prefix:`actuator/` |-| **position** (*)
  3753. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  3754. This element creates a position servo with an optional first-order filter. The underlying :el:`general` attributes are
  3755. set as follows:
  3756. ========= =================== ========= =============
  3757. Attribute Setting Attribute Setting
  3758. ========= =================== ========= =============
  3759. dyntype none or filterexact dynprm timeconst 0 0
  3760. gaintype fixed gainprm kp 0 0
  3761. biastype affine biasprm 0 -kp -kv
  3762. ========= =================== ========= =============
  3763. This element has one custom attribute in addition to the common attributes:
  3764. .. _actuator-position-name:
  3765. .. _actuator-position-class:
  3766. .. _actuator-position-group:
  3767. .. _actuator-position-ctrllimited:
  3768. .. _actuator-position-forcelimited:
  3769. .. _actuator-position-ctrlrange:
  3770. .. _actuator-position-forcerange:
  3771. .. _actuator-position-lengthrange:
  3772. .. _actuator-position-gear:
  3773. .. _actuator-position-cranklength:
  3774. .. _actuator-position-joint:
  3775. .. _actuator-position-jointinparent:
  3776. .. _actuator-position-tendon:
  3777. .. _actuator-position-cranksite:
  3778. .. _actuator-position-slidersite:
  3779. .. _actuator-position-site:
  3780. .. _actuator-position-refsite:
  3781. .. _actuator-position-user:
  3782. .. |actuator/position attrib list| replace::
  3783. :at:`name`, :at:`class`, :at:`group`, :at:`ctrllimited`, :at:`forcelimited`, :at:`ctrlrange`, :at:`forcerange`,
  3784. :at:`lengthrange`, :at:`gear`, :at:`cranklength`, :at:`joint`, :at:`jointinparent`, :at:`tendon`, :at:`cranksite`,
  3785. :at:`slidersite`, :at:`site`, :at:`refsite`, :at:`user`
  3786. |actuator/position attrib list|
  3787. Same as in actuator/ :ref:`general <actuator-general>`.
  3788. .. _actuator-position-kp:
  3789. :at:`kp`: :at-val:`real, "1"`
  3790. Position feedback gain.
  3791. .. _actuator-position-kv:
  3792. :at:`kv`: :at-val:`real, "0"`
  3793. Damping applied by the actuator.
  3794. When using this attribute, it is recommended to use the implicitfast or implicit :ref:`integrators<geIntegration>`.
  3795. .. _actuator-position-dampratio:
  3796. :at:`dampratio`: :at-val:`real, "0"`
  3797. Damping applied by the actuator, using damping ratio units.
  3798. This attribute is exclusive with :at:`kv` and has similar meaning, but instead of units of force/velocity, the units
  3799. are :math:`2 \sqrt{k_p \cdot m}`, corresponding to a harmonic oscillator's
  3800. `damping ratio <https://en.wikipedia.org/wiki/Damping#Damping_ratio_definition>`__.
  3801. A value of 1 corresponds to a *critically damped* oscillator, which often produces desirable behavior.
  3802. Values smaller or larger than 1 correspond to underdamped and overdamped oscillations, respectively.
  3803. The mass :math:`m` is computed at the reference configuration ``mjModel.qpos0``, taking into account joint
  3804. :ref:`armature <body-joint-armature>`.
  3805. However, passive :ref:`damping <body-joint-damping>` or :ref:`frictionloss <body-joint-frictionloss>` in the affected
  3806. joints are not taken into account; if they are non-negligible, :at:`dampratio` values smaller than 1 might be
  3807. required to achieve desirable motion.
  3808. When using this attribute, it is recommended to use the implicitfast or implicit :ref:`integrators<geIntegration>`.
  3809. .. _actuator-position-timeconst:
  3810. :at:`timeconst`: :at-val:`real, "0"`
  3811. Time-constant of optional first-order filter. If larger than zero, the actuator uses the :at:`filterexact`
  3812. :ref:`dynamics type<actuator-general-dyntype>`, if zero (the default) no filter is used.
  3813. .. _actuator-position-inheritrange:
  3814. :at:`inheritrange`: :at-val:`real, "0"`
  3815. Automatically set the actuator's :at:`ctrlrange` to match the transmission target's :at:`range`. The default value
  3816. means "disabled". A positive value :at-val:`X` sets the :at:`ctrlrange` around the midpoint of the target range,
  3817. scaled by :at-val:`X`. For example if the target joint has :at:`range` of :at-val:`[0, 1]`, then a value of
  3818. :at-val:`1.0` will set :at:`ctrlrange` to :at-val:`[0, 1]`; values of :at-val:`0.8` and :at-val:`1.2` will set the
  3819. :at:`ctrlrange` to :at-val:`[0.1, 0.9]` and :at-val:`[-0.1, 1.1]`, respectively. Values smaller than 1 are useful for
  3820. not hitting the limits; values larger than 1 are useful for maintaining control authority at the limits (being able
  3821. to push on them). This attribute is exclusive with :at:`ctrlrange` and available only for joint and tendon
  3822. transmissions which have :at:`range` defined. Note that while :at:`inheritrange` is available both as a
  3823. :ref:`position<actuator-position>` attribute and in the :ref:`default class<default-position-inheritrange>`,
  3824. saved XMLs always convert it to explicit :at:`ctrlrange` at the actuator.
  3825. .. _actuator-velocity:
  3826. :el-prefix:`actuator/` |-| **velocity** (*)
  3827. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  3828. This element creates a velocity servo. Note that in order create a PD controller, one has to define two actuators: a
  3829. position servo and a velocity servo. This is because MuJoCo actuators are SISO while a PD controller takes two control
  3830. inputs (reference position and reference velocity).
  3831. When using this actuator, it is recommended to use the implicitfast or implicit :ref:`integrators<geIntegration>`.
  3832. The underlying :el:`general` attributes are set as follows:
  3833. ========= ======= ========= =======
  3834. Attribute Setting Attribute Setting
  3835. ========= ======= ========= =======
  3836. dyntype none dynprm 1 0 0
  3837. gaintype fixed gainprm kv 0 0
  3838. biastype affine biasprm 0 0 -kv
  3839. ========= ======= ========= =======
  3840. This element has one custom attribute in addition to the common attributes:
  3841. .. _actuator-velocity-name:
  3842. .. _actuator-velocity-class:
  3843. .. _actuator-velocity-group:
  3844. .. _actuator-velocity-ctrllimited:
  3845. .. _actuator-velocity-forcelimited:
  3846. .. _actuator-velocity-ctrlrange:
  3847. .. _actuator-velocity-forcerange:
  3848. .. _actuator-velocity-lengthrange:
  3849. .. _actuator-velocity-gear:
  3850. .. _actuator-velocity-cranklength:
  3851. .. _actuator-velocity-joint:
  3852. .. _actuator-velocity-jointinparent:
  3853. .. _actuator-velocity-tendon:
  3854. .. _actuator-velocity-cranksite:
  3855. .. _actuator-velocity-slidersite:
  3856. .. _actuator-velocity-site:
  3857. .. _actuator-velocity-refsite:
  3858. .. _actuator-velocity-user:
  3859. .. |actuator/velocity attrib list| replace::
  3860. :at:`name`, :at:`class`, :at:`group`, :at:`ctrllimited`, :at:`forcelimited`, :at:`ctrlrange`, :at:`forcerange`,
  3861. :at:`lengthrange`, :at:`gear`, :at:`cranklength`, :at:`joint`, :at:`jointinparent`, :at:`tendon`, :at:`cranksite`,
  3862. :at:`slidersite`, :at:`site`, :at:`refsite`, :at:`user`
  3863. |actuator/velocity attrib list|
  3864. Same as in actuator/ :ref:`general <actuator-general>`.
  3865. .. _actuator-velocity-kv:
  3866. :at:`kv`: :at-val:`real, "1"`
  3867. Velocity feedback gain.
  3868. .. _actuator-intvelocity:
  3869. :el-prefix:`actuator/` |-| **intvelocity** (*)
  3870. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  3871. This element creates an integrated-velocity servo. For more information, see the
  3872. :ref:`Activation clamping <CActRange>` section of the Modeling chapter. The underlying
  3873. :el:`general` attributes are set as follows:
  3874. ========== =========== ========= =========
  3875. Attribute Setting Attribute Setting
  3876. ========== =========== ========= =========
  3877. dyntype integrator dynprm 1 0 0
  3878. gaintype fixed gainprm kp 0 0
  3879. biastype affine biasprm 0 -kp -kv
  3880. actlimited true
  3881. ========== =========== ========= =========
  3882. This element has one custom attribute in addition to the common attributes:
  3883. .. _actuator-intvelocity-name:
  3884. .. _actuator-intvelocity-class:
  3885. .. _actuator-intvelocity-group:
  3886. .. _actuator-intvelocity-ctrllimited:
  3887. .. _actuator-intvelocity-forcelimited:
  3888. .. _actuator-intvelocity-ctrlrange:
  3889. .. _actuator-intvelocity-forcerange:
  3890. .. _actuator-intvelocity-actrange:
  3891. .. _actuator-intvelocity-lengthrange:
  3892. .. _actuator-intvelocity-gear:
  3893. .. _actuator-intvelocity-cranklength:
  3894. .. _actuator-intvelocity-joint:
  3895. .. _actuator-intvelocity-jointinparent:
  3896. .. _actuator-intvelocity-tendon:
  3897. .. _actuator-intvelocity-cranksite:
  3898. .. _actuator-intvelocity-slidersite:
  3899. .. _actuator-intvelocity-site:
  3900. .. _actuator-intvelocity-refsite:
  3901. .. _actuator-intvelocity-user:
  3902. .. |actuator/intvelocity attrib list| replace::
  3903. :at:`name`, :at:`class`, :at:`group`, :at:`ctrllimited`, :at:`forcelimited`, :at:`ctrlrange`, :at:`forcerange`,
  3904. :at:`actrange`, :at:`lengthrange`, :at:`gear`, :at:`cranklength`, :at:`joint`, :at:`jointinparent`, :at:`tendon`,
  3905. :at:`cranksite`, :at:`slidersite`, :at:`site`, :at:`refsite`, :at:`user`
  3906. |actuator/intvelocity attrib list|
  3907. Same as in actuator/ :ref:`general <actuator-general>`.
  3908. .. _actuator-intvelocity-kp:
  3909. :at:`kp`: :at-val:`real, "1"`
  3910. Position feedback gain.
  3911. .. _actuator-intvelocity-kv:
  3912. :at:`kv`: :at-val:`real, "0"`
  3913. Damping applied by the actuator.
  3914. When using this attribute, it is recommended to use the implicitfast or implicit :ref:`integrators<geIntegration>`.
  3915. .. _actuator-intvelocity-dampratio:
  3916. :at:`dampratio`: :at-val:`real, "0"`
  3917. See :ref:`position/dampratio<actuator-position-dampratio>`.
  3918. .. _actuator-intvelocity-inheritrange:
  3919. :at:`inheritrange`: :at-val:`real, "0"`
  3920. Identical to :ref:`position/inheritrange<actuator-position-inheritrange>`, but sets :at:`actrange` (which has the same
  3921. length semantics as the transmission target) rather than :at:`ctrlrange` (which has velocity semantics).
  3922. .. _actuator-damper:
  3923. :el-prefix:`actuator/` |-| **damper** (*)
  3924. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  3925. This element is an active damper which produces a force proportional to both velocity and control: ``F = - kv * velocity
  3926. * control``, where ``kv`` must be nonnegative. :at:`ctrlrange` is required and must also be nonnegative.
  3927. When using this actuator, it is recommended to use the implicitfast or implicit :ref:`integrators<geIntegration>`.
  3928. The underlying :el:`general` attributes are set as follows:
  3929. =========== ======= ========= =======
  3930. Attribute Setting Attribute Setting
  3931. =========== ======= ========= =======
  3932. dyntype none dynprm 1 0 0
  3933. gaintype affine gainprm 0 0 -kv
  3934. biastype none biasprm 0 0 0
  3935. ctrllimited true
  3936. =========== ======= ========= =======
  3937. This element has one custom attribute in addition to the common attributes:
  3938. .. _actuator-damper-name:
  3939. .. _actuator-damper-class:
  3940. .. _actuator-damper-group:
  3941. .. _actuator-damper-ctrllimited:
  3942. .. _actuator-damper-forcelimited:
  3943. .. _actuator-damper-ctrlrange:
  3944. .. _actuator-damper-forcerange:
  3945. .. _actuator-damper-lengthrange:
  3946. .. _actuator-damper-gear:
  3947. .. _actuator-damper-cranklength:
  3948. .. _actuator-damper-joint:
  3949. .. _actuator-damper-jointinparent:
  3950. .. _actuator-damper-tendon:
  3951. .. _actuator-damper-cranksite:
  3952. .. _actuator-damper-slidersite:
  3953. .. _actuator-damper-site:
  3954. .. _actuator-damper-refsite:
  3955. .. _actuator-damper-user:
  3956. .. |actuator/damper attrib list| replace:: :at:`name`, :at:`class`, :at:`group`, :at:`ctrllimited`, :at:`forcelimited`,
  3957. :at:`ctrlrange`, :at:`forcerange`, :at:`lengthrange`, :at:`gear`, :at:`cranklength`, :at:`joint`,
  3958. :at:`jointinparent`, :at:`tendon`, :at:`cranksite`, :at:`slidersite`, :at:`site`, :at:`refsite`, :at:`user`
  3959. |actuator/damper attrib list|
  3960. Same as in actuator/ :ref:`general <actuator-general>`.
  3961. .. _actuator-damper-kv:
  3962. :at:`kv`: :at-val:`real, "1"`
  3963. Velocity feedback gain.
  3964. .. _actuator-cylinder:
  3965. :el-prefix:`actuator/` |-| **cylinder** (*)
  3966. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  3967. This element is suitable for modeling pneumatic or hydraulic cylinders. The underlying :el:`general` attributes are
  3968. set as follows:
  3969. ========= ======= ========= =============
  3970. Attribute Setting Attribute Setting
  3971. ========= ======= ========= =============
  3972. dyntype filter dynprm timeconst 0 0
  3973. gaintype fixed gainprm area 0 0
  3974. biastype affine biasprm bias(3)
  3975. ========= ======= ========= =============
  3976. This element has four custom attributes in addition to the common attributes:
  3977. .. _actuator-cylinder-name:
  3978. .. _actuator-cylinder-class:
  3979. .. _actuator-cylinder-group:
  3980. .. _actuator-cylinder-ctrllimited:
  3981. .. _actuator-cylinder-forcelimited:
  3982. .. _actuator-cylinder-ctrlrange:
  3983. .. _actuator-cylinder-forcerange:
  3984. .. _actuator-cylinder-lengthrange:
  3985. .. _actuator-cylinder-gear:
  3986. .. _actuator-cylinder-cranklength:
  3987. .. _actuator-cylinder-joint:
  3988. .. _actuator-cylinder-jointinparent:
  3989. .. _actuator-cylinder-tendon:
  3990. .. _actuator-cylinder-cranksite:
  3991. .. _actuator-cylinder-slidersite:
  3992. .. _actuator-cylinder-site:
  3993. .. _actuator-cylinder-refsite:
  3994. .. _actuator-cylinder-user:
  3995. .. |actuator/cylinder attrib list| replace::
  3996. :at:`name`, :at:`class`, :at:`group`, :at:`ctrllimited`, :at:`forcelimited`, :at:`ctrlrange`, :at:`forcerange`,
  3997. :at:`lengthrange`, :at:`gear`, :at:`cranklength`, :at:`joint`, :at:`jointinparent`, :at:`tendon`, :at:`cranksite`,
  3998. :at:`slidersite`, :at:`site`, :at:`refsite`, :at:`user`
  3999. |actuator/cylinder attrib list|
  4000. Same as in actuator/ :ref:`general <actuator-general>`.
  4001. .. _actuator-cylinder-timeconst:
  4002. :at:`timeconst`: :at-val:`real, "1"`
  4003. Time constant of the activation dynamics.
  4004. .. _actuator-cylinder-area:
  4005. :at:`area`: :at-val:`real, "1"`
  4006. Area of the cylinder. This is used internally as actuator gain.
  4007. .. _actuator-cylinder-diameter:
  4008. :at:`diameter`: :at-val:`real, optional`
  4009. Instead of area the user can specify diameter. If both are specified, diameter has precedence.
  4010. .. _actuator-cylinder-bias:
  4011. :at:`bias`: :at-val:`real(3), "0 0 0"`
  4012. Bias parameters, copied internally into biasprm.
  4013. .. _actuator-muscle:
  4014. :el-prefix:`actuator/` |-| **muscle** (*)
  4015. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4016. This element is used to model a muscle actuator, as described in the :ref:`Muscles actuators <CMuscle>`
  4017. section. The underlying :el:`general` attributes are set as follows:
  4018. ========= ======= ========= ======================================================
  4019. Attribute Setting Attribute Setting
  4020. ========= ======= ========= ======================================================
  4021. dyntype muscle dynprm timeconst(2) tausmooth
  4022. gaintype muscle gainprm range(2), force, scale, lmin, lmax, vmax, fpmax, fvmax
  4023. biastype muscle biasprm same as gainprm
  4024. ========= ======= ========= ======================================================
  4025. This element has nine custom attributes in addition to the common attributes:
  4026. .. _actuator-muscle-name:
  4027. .. _actuator-muscle-class:
  4028. .. _actuator-muscle-group:
  4029. .. _actuator-muscle-ctrllimited:
  4030. .. _actuator-muscle-forcelimited:
  4031. .. _actuator-muscle-ctrlrange:
  4032. .. _actuator-muscle-forcerange:
  4033. .. _actuator-muscle-lengthrange:
  4034. .. _actuator-muscle-gear:
  4035. .. _actuator-muscle-cranklength:
  4036. .. _actuator-muscle-joint:
  4037. .. _actuator-muscle-jointinparent:
  4038. .. _actuator-muscle-tendon:
  4039. .. _actuator-muscle-cranksite:
  4040. .. _actuator-muscle-slidersite:
  4041. .. _actuator-muscle-user:
  4042. .. |actuator/muscle attrib list| replace::
  4043. :at:`name`, :at:`class`, :at:`group`, :at:`ctrllimited`, :at:`forcelimited`, :at:`ctrlrange`, :at:`forcerange`,
  4044. :at:`lengthrange`, :at:`gear`, :at:`cranklength`, :at:`joint`, :at:`jointinparent`, :at:`tendon`, :at:`cranksite`,
  4045. :at:`slidersite`, :at:`user`
  4046. |actuator/muscle attrib list|
  4047. Same as in actuator/ :ref:`general <actuator-general>`.
  4048. .. _actuator-muscle-timeconst:
  4049. :at:`timeconst`: :at-val:`real(2), "0.01 0.04"`
  4050. Time constants for activation and de-activation dynamics.
  4051. .. _actuator-muscle-tausmooth:
  4052. :at:`tausmooth`: :at-val:`real, "0"`
  4053. Width of smooth transition between activation and deactivation time constants. Units of ctrl, must be
  4054. nonegative.
  4055. .. _actuator-muscle-range:
  4056. :at:`range`: :at-val:`real(2), "0.75 1.05"`
  4057. Operating length range of the muscle, in units of L0.
  4058. .. _actuator-muscle-force:
  4059. :at:`force`: :at-val:`real, "-1"`
  4060. Peak active force at rest. If this value is negative, the peak force is determined automatically using the scale
  4061. attribute below.
  4062. .. _actuator-muscle-scale:
  4063. :at:`scale`: :at-val:`real, "200"`
  4064. If the force attribute is negative, the peak active force for the muscle is set to this value divided by
  4065. mjModel.actuator_acc0. The latter is the norm of the joint-space acceleration vector caused by unit force on the
  4066. actuator's transmission in qpos0. In other words, scaling produces higher peak forces for muscles that pull more
  4067. weight.
  4068. .. _actuator-muscle-lmin:
  4069. :at:`lmin`: :at-val:`real, "0.5"`
  4070. Lower position range of the normalized FLV curve, in units of L0.
  4071. .. _actuator-muscle-lmax:
  4072. :at:`lmax`: :at-val:`real, "1.6"`
  4073. Upper position range of the normalized FLV curve, in units of L0.
  4074. .. _actuator-muscle-vmax:
  4075. :at:`vmax`: :at-val:`real, "1.5"`
  4076. Shortening velocity at which muscle force drops to zero, in units of L0 per second.
  4077. .. _actuator-muscle-fpmax:
  4078. :at:`fpmax`: :at-val:`real, "1.3"`
  4079. Passive force generated at lmax, relative to the peak rest force.
  4080. .. _actuator-muscle-fvmax:
  4081. :at:`fvmax`: :at-val:`real, "1.2"`
  4082. Active force generated at saturating lengthening velocity, relative to the peak rest force.
  4083. .. _actuator-adhesion:
  4084. :el-prefix:`actuator/` |-| **adhesion** (*)
  4085. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4086. .. youtube:: BcHZ5BFeTmU
  4087. :align: right
  4088. :height: 150px
  4089. This element defines an active adhesion actuator which injects forces at contacts in the normal direction, see
  4090. illustration video. The model shown in the video can be found `here
  4091. <https://github.com/google-deepmind/mujoco/tree/main/model/adhesion>`_ and includes inline annotations. The transmission target
  4092. is a :el:`body`, and adhesive forces are injected into all contacts involving geoms which belong to this body. The force
  4093. is divided equally between multiple contacts. When the :at:`gap` attribute is not used, this actuator requires active
  4094. contacts and cannot apply a force at a distance, more like the active adhesion on the feet of geckos and insects rather
  4095. than an industrial vacuum gripper. In order to enable "suction at a distance", "inflate" the body's geoms by
  4096. :at:`margin` and add a corresponding :at:`gap` which activates contacts only after :at:`gap` penetration distance. This
  4097. will create a layer around the geom where contacts are detected but are inactive, and can be used for
  4098. applying the adhesive force. In the video above, such inactive contacts are blue, while active contacts are orange.
  4099. An adhesion actuator's length is always 0. :at:`ctrlrange` is required and must also be nonnegative (no repulsive forces
  4100. are allowed). The underlying :el:`general` attributes are set as follows:
  4101. =========== ======= =========== ========
  4102. Attribute Setting Attribute Setting
  4103. =========== ======= =========== ========
  4104. dyntype none dynprm 1 0 0
  4105. gaintype fixed gainprm gain 0 0
  4106. biastype none biasprm 0 0 0
  4107. trntype body ctrllimited true
  4108. =========== ======= =========== ========
  4109. This element has a subset of the common attributes and two custom attributes.
  4110. .. _actuator-adhesion-name:
  4111. .. _actuator-adhesion-class:
  4112. .. _actuator-adhesion-group:
  4113. .. _actuator-adhesion-forcelimited:
  4114. .. _actuator-adhesion-ctrlrange:
  4115. .. _actuator-adhesion-forcerange:
  4116. .. _actuator-adhesion-user:
  4117. .. |actuator/adhesion attrib list| replace:: :at:`name`, :at:`class`, :at:`group`,
  4118. :at:`forcelimited`, :at:`ctrlrange`, :at:`forcerange`, :at:`user`
  4119. |actuator/adhesion attrib list|
  4120. Same as in actuator/ :ref:`general <actuator-general>`.
  4121. .. _actuator-adhesion-body:
  4122. :at:`body`: :at-val:`string, required`
  4123. The actuator acts on all contacts involving this body's geoms.
  4124. .. _actuator-adhesion-gain:
  4125. :at:`gain`: :at-val:`real, "1"`
  4126. Gain of the adhesion actuator, in units of force. The total adhesion force applied by the actuator is the control
  4127. value multiplied by the gain. This force is distributed equally between all the contacts involving geoms belonging
  4128. to the target body.
  4129. .. _actuator-plugin:
  4130. :el-prefix:`actuator/` |-| **plugin** (?)
  4131. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4132. Associate this actuator with an :ref:`engine plugin<exPlugin>`. Either :at:`plugin` or :at:`instance` are required.
  4133. .. _actuator-plugin-plugin:
  4134. :at:`plugin`: :at-val:`string, optional`
  4135. Plugin identifier, used for implicit plugin instantiation.
  4136. .. _actuator-plugin-instance:
  4137. :at:`instance`: :at-val:`string, optional`
  4138. Instance name, used for explicit plugin instantiation.
  4139. .. _actuator-plugin-dyntype:
  4140. :at:`dyntype`: :at-val:`[none, integrator, filter, filterexact, muscle, user], "none"`
  4141. Activation dynamics type for the actuator. The available dynamics types were already described in the :ref:`Actuation
  4142. model <geActuation>` section. If :ref:`dyntype<actuator-general-dyntype>` is not "none", an activation variable will
  4143. be added to the actuator. This variable will be added after any activation state computed by the plugin (see
  4144. :ref:`actuator plugin activations<exActuatorAct>`).
  4145. .. _actuator-plugin-actrange:
  4146. :at:`actrange`: :at-val:`real(2), "0 0"`
  4147. Range for clamping the activation state associated with this actuator's dyntype. The limit doesn't apply to
  4148. activations computed by the plugin. The first value must be no greater than the second value.
  4149. See the :ref:`Activation clamping <CActRange>` section for more details.
  4150. .. _actuator-plugin-name:
  4151. .. _actuator-plugin-class:
  4152. .. _actuator-plugin-group:
  4153. .. _actuator-plugin-actlimited:
  4154. .. _actuator-plugin-ctrllimited:
  4155. .. _actuator-plugin-forcelimited:
  4156. .. _actuator-plugin-ctrlrange:
  4157. .. _actuator-plugin-forcerange:
  4158. .. _actuator-plugin-lengthrange:
  4159. .. _actuator-plugin-gear:
  4160. .. _actuator-plugin-cranklength:
  4161. .. _actuator-plugin-joint:
  4162. .. _actuator-plugin-jointinparent:
  4163. .. _actuator-plugin-site:
  4164. .. _actuator-plugin-tendon:
  4165. .. _actuator-plugin-cranksite:
  4166. .. _actuator-plugin-slidersite:
  4167. .. _actuator-plugin-user:
  4168. .. _actuator-plugin-actdim:
  4169. .. _actuator-plugin-dynprm:
  4170. .. _actuator-plugin-actearly:
  4171. .. |actuator/plugin attrib list| replace:: :at:`name`, :at:`class`, :at:`group`, :at:`actlimited`, :at:`ctrllimited`,
  4172. :at:`forcelimited`, :at:`ctrlrange`, :at:`forcerange`, :at:`lengthrange`, :at:`gear`, :at:`cranklength`,
  4173. :at:`joint`, :at:`jointinparent`, :at:`site`, :at:`tendon`, :at:`cranksite`, :at:`slidersite`, :at:`user`,
  4174. :at:`actdim`, :at:`dynprm`, :at:`actearly`
  4175. |actuator/plugin attrib list|
  4176. Same as in actuator/ :ref:`general <actuator-general>`.
  4177. .. _sensor:
  4178. **sensor** (*)
  4179. ~~~~~~~~~~~~~~
  4180. This is a grouping element for sensor definitions. It does not have attributes. The outputs of all sensors are
  4181. concatenated in the field mjData.sensordata which has size mjModel.nsensordata. This data is not used in any internal
  4182. computations.
  4183. In addition to the sensors created with the elements below, the top-level function
  4184. :ref:`mj_step` computes the quantities mjData.cacc, mjData.cfrc_int and mjData.crfc_ext
  4185. corresponding to body accelerations and interaction forces. Some of these quantities are used to compute the output of
  4186. certain sensors (force, acceleration etc.) but even if no such sensors are defined in the model, these quantities
  4187. themselves are "features" that could be of interest to the user.
  4188. .. _sensor-touch:
  4189. :el-prefix:`sensor/` |-| **touch** (*)
  4190. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4191. This element creates a touch sensor. The active sensor zone is defined by a site. If a contact point falls within the
  4192. site's volume, and involves a geom attached to the same body as the site, the corresponding contact force is included in
  4193. the sensor reading. If a contact point falls outside the sensor zone, but the normal ray intersects the sensor zone, it
  4194. is also included. This re-projection feature is needed because, without it, the contact point may leave the sensor zone
  4195. from the back (due to soft contacts) and cause an erroneous force reading. The output of this sensor is non-negative
  4196. scalar. It is computed by adding up the (scalar) normal forces from all included contacts.
  4197. .. _sensor-touch-name:
  4198. .. _sensor-touch-noise:
  4199. .. _sensor-touch-cutoff:
  4200. .. _sensor-touch-user:
  4201. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4202. See :ref:`CSensor`.
  4203. .. _sensor-touch-site:
  4204. :at:`site`: :at-val:`string, required`
  4205. Site defining the active sensor zone.
  4206. .. _sensor-accelerometer:
  4207. :el-prefix:`sensor/` |-| **accelerometer** (*)
  4208. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4209. This element creates a 3-axis accelerometer. The sensor is mounted at a site, and has the same position and orientation
  4210. as the site frame. This sensor outputs three numbers, which are the linear acceleration of the site (including gravity)
  4211. in local coordinates.
  4212. The presence of this sensor in a model triggers a call to :ref:`mj_rnePostConstraint` during sensor computation.
  4213. .. _sensor-accelerometer-name:
  4214. .. _sensor-accelerometer-noise:
  4215. .. _sensor-accelerometer-cutoff:
  4216. .. _sensor-accelerometer-user:
  4217. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4218. See :ref:`CSensor`.
  4219. .. _sensor-accelerometer-site:
  4220. :at:`site`: :at-val:`string, required`
  4221. Site where the sensor is mounted. The accelerometer is centered and aligned with the site local frame.
  4222. .. _sensor-velocimeter:
  4223. :el-prefix:`sensor/` |-| **velocimeter** (*)
  4224. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4225. This element creates a 3-axis velocimeter. The sensor is mounted at a site, and has the same position and orientation as
  4226. the site frame. This sensor outputs three numbers, which are the linear velocity of the site in local coordinates.
  4227. .. _sensor-velocimeter-name:
  4228. .. _sensor-velocimeter-noise:
  4229. .. _sensor-velocimeter-cutoff:
  4230. .. _sensor-velocimeter-user:
  4231. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4232. See :ref:`CSensor`.
  4233. .. _sensor-velocimeter-site:
  4234. :at:`site`: :at-val:`string, required`
  4235. Site where the sensor is mounted. The velocimeter is centered and aligned with the site local frame.
  4236. .. _sensor-gyro:
  4237. :el-prefix:`sensor/` |-| **gyro** (*)
  4238. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4239. This element creates a 3-axis gyroscope. The sensor is mounted at a site, and has the same position and orientation as
  4240. the site frame. This sensor outputs three numbers, which are the angular velocity of the site in local coordinates. This
  4241. sensor is often used in conjunction with an :ref:`accelerometer <sensor-accelerometer>` mounted at the same site, to
  4242. simulate an inertial measurement unit (IMU).
  4243. .. _sensor-gyro-name:
  4244. .. _sensor-gyro-noise:
  4245. .. _sensor-gyro-cutoff:
  4246. .. _sensor-gyro-user:
  4247. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4248. See :ref:`CSensor`.
  4249. .. _sensor-gyro-site:
  4250. :at:`site`: :at-val:`string, required`
  4251. Site where the sensor is mounted. The gyroscope is centered and aligned with the site local frame.
  4252. .. _sensor-force:
  4253. :el-prefix:`sensor/` |-| **force** (*)
  4254. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4255. This element creates a 3-axis force sensor. The sensor outputs three numbers, which are the interaction force between a
  4256. child and a parent body, expressed in the site frame defining the sensor. The convention is that the site is attached to
  4257. the child body, and the force points from the child towards the parent. The computation here takes into account all
  4258. forces acting on the system, including contacts as well as external perturbations. Using this sensor often requires
  4259. creating a dummy body welded to its parent (i.e., having no joint elements).
  4260. The presence of this sensor in a model triggers a call to :ref:`mj_rnePostConstraint` during sensor computation.
  4261. .. _sensor-force-name:
  4262. .. _sensor-force-noise:
  4263. .. _sensor-force-cutoff:
  4264. .. _sensor-force-user:
  4265. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4266. See :ref:`CSensor`.
  4267. .. _sensor-force-site:
  4268. :at:`site`: :at-val:`string, required`
  4269. Site where the sensor is mounted. The measured interaction force is between the body where the site is defined and
  4270. its parent body, and points from the child towards the parent. The physical sensor being modeled could of course be
  4271. attached to the parent body, in which case the sensor data would have the opposite sign. Note that each body has a
  4272. unique parent but can have multiple children, which is why we define this sensor through the child rather than the
  4273. parent body in the pair.
  4274. .. _sensor-torque:
  4275. :el-prefix:`sensor/` |-| **torque** (*)
  4276. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4277. This element creates a 3-axis torque sensor. This is similar to the :ref:`force <sensor-force>` sensor above, but
  4278. measures torque rather than force.
  4279. The presence of this sensor in a model triggers a call to :ref:`mj_rnePostConstraint` during sensor computation.
  4280. .. _sensor-torque-name:
  4281. .. _sensor-torque-noise:
  4282. .. _sensor-torque-cutoff:
  4283. .. _sensor-torque-user:
  4284. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4285. See :ref:`CSensor`.
  4286. .. _sensor-torque-site:
  4287. :at:`site`: :at-val:`string, required`
  4288. Site where the sensor is mounted. The measured interaction torque is between the body where the site is defined and
  4289. its parent body.
  4290. .. _sensor-magnetometer:
  4291. :el-prefix:`sensor/` |-| **magnetometer** (*)
  4292. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4293. This element creates a magnetometer. It measures the magnetic flux at the sensor site position, expressed in the sensor
  4294. site frame. The output is a 3D vector.
  4295. .. _sensor-magnetometer-name:
  4296. .. _sensor-magnetometer-noise:
  4297. .. _sensor-magnetometer-cutoff:
  4298. .. _sensor-magnetometer-user:
  4299. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4300. See :ref:`CSensor`.
  4301. .. _sensor-magnetometer-site:
  4302. :at:`site`: :at-val:`string, required`
  4303. The site where the sensor is attached.
  4304. .. _sensor-rangefinder:
  4305. :el-prefix:`sensor/` |-| **rangefinder** (*)
  4306. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4307. This element creates a rangefinder. It measures the distance to the nearest geom surface, along the ray defined by the
  4308. positive Z-axis of the sensor site. If the ray does not intersect any geom surface, the sensor output is -1. If the
  4309. origin of the ray is inside a geom, the surface is still sensed (but not the inner volume). Geoms attached to the same
  4310. body as the sensor site are excluded. Invisible geoms, defined as geoms whose rgba (or whose material rgba) has alpha=0,
  4311. are also excluded. Note however that geoms made invisible in the visualizer by disabling their geom group are not
  4312. excluded; this is because sensor calculations are independent of the visualizer.
  4313. .. _sensor-rangefinder-name:
  4314. .. _sensor-rangefinder-noise:
  4315. .. _sensor-rangefinder-cutoff:
  4316. .. _sensor-rangefinder-user:
  4317. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4318. See :ref:`CSensor`.
  4319. .. _sensor-rangefinder-site:
  4320. :at:`site`: :at-val:`string, required`
  4321. The site where the sensor is attached.
  4322. .. _sensor-camprojection:
  4323. :el-prefix:`sensor/` |-| **camprojection** (*)
  4324. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4325. This element creates a camprojection sensor, which returns the location of a target site, projected onto a camera image
  4326. in pixel coordinates. The origin of this system is located at the top-left corner of the first pixel, so a target
  4327. which projects exactly onto the corner of the image, will have value (0, 0). Values are not clipped, so targets which
  4328. fall outside the camera image will take values above or below the pixel limits. Moreover, points behind the camera
  4329. are also projected onto the image, so it is up to the user to filter out such points, if desired. This can be done using
  4330. a `framepos<sensor-framepos>` sensor with the camera as reference frame, then a negative/positive value in the
  4331. z-coordinate indicates (respectively) a location in the front/back of the camera.
  4332. .. _sensor-camprojection-site:
  4333. :at:`site`: :at-val:`string, required`
  4334. The site which is projected on to the camera image.
  4335. .. _sensor-camprojection-camera:
  4336. :at:`camera`: :at-val:`string, required`
  4337. The camera used for the projection, its :ref:`resolution<body-camera-resolution>` attribute must be positive.
  4338. .. _sensor-camprojection-name:
  4339. .. _sensor-camprojection-noise:
  4340. .. _sensor-camprojection-cutoff:
  4341. .. _sensor-camprojection-user:
  4342. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4343. See :ref:`CSensor`.
  4344. .. _sensor-jointpos:
  4345. :el-prefix:`sensor/` |-| **jointpos** (*)
  4346. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4347. This and the remaining sensor elements do not involve sensor-specific computations. Instead they copy into the array
  4348. mjData.sensordata quantities that are already computed. This element creates a joint position or angle sensor. It can be
  4349. attached to scalar joints (slide or hinge). Its output is scalar.
  4350. .. _sensor-jointpos-name:
  4351. .. _sensor-jointpos-noise:
  4352. .. _sensor-jointpos-cutoff:
  4353. .. _sensor-jointpos-user:
  4354. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4355. See :ref:`CSensor`.
  4356. .. _sensor-jointpos-joint:
  4357. :at:`joint`: :at-val:`string, required`
  4358. The joint whose position or angle will be sensed. Only scalar joints can be referenced here. The sensor output is
  4359. copied from mjData.qpos.
  4360. .. _sensor-jointvel:
  4361. :el-prefix:`sensor/` |-| **jointvel** (*)
  4362. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4363. This element creates a joint velocity sensor. It can be attached to scalar joints (slide or hinge). Its output is
  4364. scalar.
  4365. .. _sensor-jointvel-name:
  4366. .. _sensor-jointvel-noise:
  4367. .. _sensor-jointvel-cutoff:
  4368. .. _sensor-jointvel-user:
  4369. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4370. See :ref:`CSensor`.
  4371. .. _sensor-jointvel-joint:
  4372. :at:`joint`: :at-val:`string, required`
  4373. The joint whose velocity will be sensed. Only scalar joints can be referenced here. The sensor output is copied from
  4374. mjData.qvel.
  4375. .. _sensor-tendonpos:
  4376. :el-prefix:`sensor/` |-| **tendonpos** (*)
  4377. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4378. This element creates a tendon length sensor. It can be attached to both spatial and fixed tendons. Its output is scalar.
  4379. .. _sensor-tendonpos-name:
  4380. .. _sensor-tendonpos-noise:
  4381. .. _sensor-tendonpos-cutoff:
  4382. .. _sensor-tendonpos-user:
  4383. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4384. See :ref:`CSensor`.
  4385. .. _sensor-tendonpos-tendon:
  4386. :at:`tendon`: :at-val:`string, required`
  4387. The tendon whose length will be sensed. The sensor output is copied from mjData.ten_length.
  4388. .. _sensor-tendonvel:
  4389. :el-prefix:`sensor/` |-| **tendonvel** (*)
  4390. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4391. This element creates a tendon velocity sensor. It can be attached to both spatial and fixed tendons. Its output is
  4392. scalar.
  4393. .. _sensor-tendonvel-name:
  4394. .. _sensor-tendonvel-noise:
  4395. .. _sensor-tendonvel-cutoff:
  4396. .. _sensor-tendonvel-user:
  4397. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4398. See :ref:`CSensor`.
  4399. .. _sensor-tendonvel-tendon:
  4400. :at:`tendon`: :at-val:`string, required`
  4401. The tendon whose velocity will be sensed. The sensor output is copied from mjData.ten_velocity.
  4402. .. _sensor-actuatorpos:
  4403. :el-prefix:`sensor/` |-| **actuatorpos** (*)
  4404. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4405. This element creates an actuator length sensor. Recall that each actuator has a transmission which has length. This
  4406. sensor can be attached to any actuator. Its output is scalar.
  4407. .. _sensor-actuatorpos-name:
  4408. .. _sensor-actuatorpos-noise:
  4409. .. _sensor-actuatorpos-cutoff:
  4410. .. _sensor-actuatorpos-user:
  4411. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4412. See :ref:`CSensor`.
  4413. .. _sensor-actuatorpos-actuator:
  4414. :at:`actuator`: :at-val:`string, required`
  4415. The actuator whose transmission's length will be sensed. The sensor output is copied from mjData.actuator_length.
  4416. .. _sensor-actuatorvel:
  4417. :el-prefix:`sensor/` |-| **actuatorvel** (*)
  4418. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4419. This element creates an actuator velocity sensor. This sensor can be attached to any actuator. Its output is scalar.
  4420. .. _sensor-actuatorvel-name:
  4421. .. _sensor-actuatorvel-noise:
  4422. .. _sensor-actuatorvel-cutoff:
  4423. .. _sensor-actuatorvel-user:
  4424. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4425. See :ref:`CSensor`.
  4426. .. _sensor-actuatorvel-actuator:
  4427. :at:`actuator`: :at-val:`string, required`
  4428. The actuator whose transmission's velocity will be sensed. The sensor output is copied from mjData.actuator_velocity.
  4429. .. _sensor-actuatorfrc:
  4430. :el-prefix:`sensor/` |-| **actuatorfrc** (*)
  4431. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4432. This element creates an actuator force sensor. The quantity being sensed is the scalar actuator force, not the
  4433. generalized force contributed by the actuator (the latter is the product of the scalar force and the vector of moment
  4434. arms determined by the transmission). This sensor can be attached to any actuator. Its output is scalar.
  4435. .. _sensor-actuatorfrc-name:
  4436. .. _sensor-actuatorfrc-noise:
  4437. .. _sensor-actuatorfrc-cutoff:
  4438. .. _sensor-actuatorfrc-user:
  4439. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4440. See :ref:`CSensor`.
  4441. .. _sensor-actuatorfrc-actuator:
  4442. :at:`actuator`: :at-val:`string, required`
  4443. The actuator whose scalar force output will be sensed. The sensor output is copied from mjData.actuator_force.
  4444. .. _sensor-jointactuatorfrc:
  4445. :el-prefix:`sensor/` |-| **jointactuatorfrc** (*)
  4446. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4447. This element creates an actuator force sensor, measured at a joint. The quantity being sensed is the generalized force
  4448. contributed by all actuators to a single scalar joint (hinge or slider). If the joint's
  4449. :ref:`actuatorgravcomp<body-joint-actuatorgravcomp>` attribute is "true", this sensor will also measure contributions by
  4450. gravity compensation forces (which are added directly to the joint and would *not* register in the
  4451. :ref:`actuatorfrc<sensor-actuatorfrc>`) sensor. This type of sensor is important when multiple actuators act on a single
  4452. joint or when a single actuator act on multiple joints. See :ref:`CForceRange` for details.
  4453. .. _sensor-jointactuatorfrc-name:
  4454. .. _sensor-jointactuatorfrc-noise:
  4455. .. _sensor-jointactuatorfrc-cutoff:
  4456. .. _sensor-jointactuatorfrc-user:
  4457. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4458. See :ref:`CSensor`.
  4459. .. _sensor-jointactuatorfrc-joint:
  4460. :at:`joint`: :at-val:`string, required`
  4461. The joint where actuator forces will be sensed. The sensor output is copied from ``mjData.qfrc_actuator``.
  4462. .. _sensor-ballquat:
  4463. :el-prefix:`sensor/` |-| **ballquat** (*)
  4464. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4465. This element creates a quaternion sensor for a ball joints. It outputs 4 numbers corresponding to a unit quaternion.
  4466. .. _sensor-ballquat-name:
  4467. .. _sensor-ballquat-noise:
  4468. .. _sensor-ballquat-cutoff:
  4469. .. _sensor-ballquat-user:
  4470. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4471. See :ref:`CSensor`.
  4472. .. _sensor-ballquat-joint:
  4473. :at:`joint`: :at-val:`string, required`
  4474. The ball joint whose quaternion is sensed. The sensor output is copied from mjData.qpos.
  4475. .. _sensor-ballangvel:
  4476. :el-prefix:`sensor/` |-| **ballangvel** (*)
  4477. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4478. This element creates a ball joint angular velocity sensor. It outputs 3 numbers corresponding to the angular velocity of
  4479. the joint. The norm of that vector is the rotation speed in rad/s and the direction is the axis around which the
  4480. rotation takes place.
  4481. .. _sensor-ballangvel-name:
  4482. .. _sensor-ballangvel-noise:
  4483. .. _sensor-ballangvel-cutoff:
  4484. .. _sensor-ballangvel-user:
  4485. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4486. See :ref:`CSensor`.
  4487. .. _sensor-ballangvel-joint:
  4488. :at:`joint`: :at-val:`string, required`
  4489. The ball joint whose angular velocity is sensed. The sensor output is copied from mjData.qvel.
  4490. .. _sensor-jointlimitpos:
  4491. :el-prefix:`sensor/` |-| **jointlimitpos** (*)
  4492. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4493. This element creates a joint limit sensor for position.
  4494. .. _sensor-jointlimitpos-name:
  4495. .. _sensor-jointlimitpos-noise:
  4496. .. _sensor-jointlimitpos-cutoff:
  4497. .. _sensor-jointlimitpos-user:
  4498. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4499. See :ref:`CSensor`.
  4500. .. _sensor-jointlimitpos-joint:
  4501. :at:`joint`: :at-val:`string, required`
  4502. The joint whose limit is sensed. The sensor output equals mjData.efc_pos - mjData.efc_margin for the corresponding
  4503. limit constraint. Note that the result is negative if the limit is violated, regardless of which side of the limit is
  4504. violated. If both sides of the limit are violated simultaneously, only the first component is returned. If there is
  4505. no violation, the result is 0.
  4506. .. _sensor-jointlimitvel:
  4507. :el-prefix:`sensor/` |-| **jointlimitvel** (*)
  4508. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4509. This element creates a joint limit sensor for velocity.
  4510. .. _sensor-jointlimitvel-name:
  4511. .. _sensor-jointlimitvel-noise:
  4512. .. _sensor-jointlimitvel-cutoff:
  4513. .. _sensor-jointlimitvel-user:
  4514. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4515. See :ref:`CSensor`.
  4516. .. _sensor-jointlimitvel-joint:
  4517. :at:`joint`: :at-val:`string, required`
  4518. The joint whose limit is sensed. The sensor output is copied from mjData.efc_vel. If the joint limit is not violated,
  4519. the result is 0.
  4520. .. _sensor-jointlimitfrc:
  4521. :el-prefix:`sensor/` |-| **jointlimitfrc** (*)
  4522. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4523. This element creates a joint limit sensor for constraint force.
  4524. .. _sensor-jointlimitfrc-name:
  4525. .. _sensor-jointlimitfrc-noise:
  4526. .. _sensor-jointlimitfrc-cutoff:
  4527. .. _sensor-jointlimitfrc-user:
  4528. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4529. See :ref:`CSensor`.
  4530. .. _sensor-jointlimitfrc-joint:
  4531. :at:`joint`: :at-val:`string, required`
  4532. The joint whose limit is sensed. The sensor output is copied from mjData.efc_force. If the joint limit is not
  4533. violated, the result is 0.
  4534. .. _sensor-tendonlimitpos:
  4535. :el-prefix:`sensor/` |-| **tendonlimitpos** (*)
  4536. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4537. This element creates a tendon limit sensor for position.
  4538. .. _sensor-tendonlimitpos-name:
  4539. .. _sensor-tendonlimitpos-noise:
  4540. .. _sensor-tendonlimitpos-cutoff:
  4541. .. _sensor-tendonlimitpos-user:
  4542. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4543. See :ref:`CSensor`.
  4544. .. _sensor-tendonlimitpos-tendon:
  4545. :at:`tendon`: :at-val:`string, required`
  4546. The tendon whose limit is sensed. The sensor output equals mjData.efc_pos - mjData.efc_margin for the corresponding
  4547. limit constraint. If the tendon limit is not violated, the result is 0.
  4548. .. _sensor-tendonlimitvel:
  4549. :el-prefix:`sensor/` |-| **tendonlimitvel** (*)
  4550. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4551. This element creates a tendon limit sensor for velocity.
  4552. .. _sensor-tendonlimitvel-name:
  4553. .. _sensor-tendonlimitvel-noise:
  4554. .. _sensor-tendonlimitvel-cutoff:
  4555. .. _sensor-tendonlimitvel-user:
  4556. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4557. See :ref:`CSensor`.
  4558. .. _sensor-tendonlimitvel-tendon:
  4559. :at:`tendon`: :at-val:`string, required`
  4560. The tendon whose limit is sensed. The sensor output is copied from mjData.efc_vel. If the tendon limit is not
  4561. violated, the result is 0.
  4562. .. _sensor-tendonlimitfrc:
  4563. :el-prefix:`sensor/` |-| **tendonlimitfrc** (*)
  4564. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4565. This element creates a tendon limit sensor for constraint force.
  4566. .. _sensor-tendonlimitfrc-name:
  4567. .. _sensor-tendonlimitfrc-noise:
  4568. .. _sensor-tendonlimitfrc-cutoff:
  4569. .. _sensor-tendonlimitfrc-user:
  4570. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4571. See :ref:`CSensor`.
  4572. .. _sensor-tendonlimitfrc-tendon:
  4573. :at:`tendon`: :at-val:`string, required`
  4574. The tendon whose limit is sensed. The sensor output is copied from mjData.efc_force. If the tendon limit is not
  4575. violated, the result is 0.
  4576. .. _sensor-framepos:
  4577. :el-prefix:`sensor/` |-| **framepos** (*)
  4578. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4579. This element creates a sensor that returns the 3D position of the spatial frame of the object, in global coordinates or
  4580. optionally with respect to a given frame-of-reference.
  4581. .. _sensor-framepos-name:
  4582. .. _sensor-framepos-noise:
  4583. .. _sensor-framepos-cutoff:
  4584. .. _sensor-framepos-user:
  4585. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4586. See :ref:`CSensor`.
  4587. .. _sensor-framepos-objtype:
  4588. :at:`objtype`: :at-val:`[body, xbody, geom, site, camera], required`
  4589. The type of object to which the sensor is attached. This must be an object type that has a spatial frame. "body"
  4590. refers to the inertial frame of the body, while "xbody" refers to the regular frame of the body (usually centered at
  4591. the joint with the parent body).
  4592. .. _sensor-framepos-objname:
  4593. :at:`objname`: :at-val:`string, required`
  4594. The name of the object to which the sensor is attached.
  4595. .. _sensor-framepos-reftype:
  4596. :at:`reftype`: :at-val:`[body, xbody, geom, site, camera]`
  4597. The type of object to which the frame-of-reference is attached. The semantics are identical to the :at:`objtype`
  4598. attribute. If :at:`reftype` and :at:`refname` are given, the sensor values will be measured with respect to this
  4599. frame. If they are not given, sensor values will be measured with respect to the global frame.
  4600. .. _sensor-framepos-refname:
  4601. :at:`refname`: :at-val:`string`
  4602. The name of the object to which the frame-of-reference is attached.
  4603. .. _sensor-framequat:
  4604. :el-prefix:`sensor/` |-| **framequat** (*)
  4605. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4606. This element creates a sensor that returns the unit quaternion specifying the orientation of the spatial frame of the
  4607. object, in global coordinates.
  4608. .. _sensor-framequat-name:
  4609. .. _sensor-framequat-noise:
  4610. .. _sensor-framequat-cutoff:
  4611. .. _sensor-framequat-user:
  4612. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4613. See :ref:`CSensor`.
  4614. .. _sensor-framequat-objtype:
  4615. :at:`objtype`: :at-val:`[body, xbody, geom, site, camera], required`
  4616. See :ref:`framepos<sensor-framepos>` sensor.
  4617. .. _sensor-framequat-objname:
  4618. :at:`objname`: :at-val:`string, required`
  4619. See :ref:`framepos<sensor-framepos>` sensor.
  4620. .. _sensor-framequat-reftype:
  4621. :at:`reftype`: :at-val:`[body, xbody, geom, site, camera]`
  4622. See :ref:`framepos<sensor-framepos>` sensor.
  4623. .. _sensor-framequat-refname:
  4624. :at:`refname`: :at-val:`string`
  4625. See :ref:`framepos<sensor-framepos>` sensor.
  4626. .. _sensor-framexaxis:
  4627. :el-prefix:`sensor/` |-| **framexaxis** (*)
  4628. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4629. This element creates a sensor that returns the 3D unit vector corresponding to the X-axis of the spatial frame of the
  4630. object, in global coordinates.
  4631. .. _sensor-framexaxis-name:
  4632. .. _sensor-framexaxis-noise:
  4633. .. _sensor-framexaxis-cutoff:
  4634. .. _sensor-framexaxis-user:
  4635. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4636. See :ref:`CSensor`.
  4637. .. _sensor-framexaxis-objtype:
  4638. :at:`objtype`: :at-val:`[body, xbody, geom, site, camera], required`
  4639. See :ref:`framepos<sensor-framepos>` sensor.
  4640. .. _sensor-framexaxis-objname:
  4641. :at:`objname`: :at-val:`string, required`
  4642. See :ref:`framepos<sensor-framepos>` sensor.
  4643. .. _sensor-framexaxis-reftype:
  4644. :at:`reftype`: :at-val:`[body, xbody, geom, site, camera]`
  4645. See :ref:`framepos<sensor-framepos>` sensor.
  4646. .. _sensor-framexaxis-refname:
  4647. :at:`refname`: :at-val:`string`
  4648. See :ref:`framepos<sensor-framepos>` sensor.
  4649. .. _sensor-frameyaxis:
  4650. :el-prefix:`sensor/` |-| **frameyaxis** (*)
  4651. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4652. This element creates a sensor that returns the 3D unit vector corresponding to the Y-axis of the spatial frame of the
  4653. object, in global coordinates.
  4654. .. _sensor-frameyaxis-name:
  4655. .. _sensor-frameyaxis-noise:
  4656. .. _sensor-frameyaxis-cutoff:
  4657. .. _sensor-frameyaxis-user:
  4658. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4659. See :ref:`CSensor`.
  4660. .. _sensor-frameyaxis-objtype:
  4661. :at:`objtype`: :at-val:`[body, xbody, geom, site, camera], required`
  4662. See :ref:`framepos<sensor-framepos>` sensor.
  4663. .. _sensor-frameyaxis-objname:
  4664. :at:`objname`: :at-val:`string, required`
  4665. See :ref:`framepos<sensor-framepos>` sensor.
  4666. .. _sensor-frameyaxis-reftype:
  4667. :at:`reftype`: :at-val:`[body, xbody, geom, site, camera]`
  4668. See :ref:`framepos<sensor-framepos>` sensor.
  4669. .. _sensor-frameyaxis-refname:
  4670. :at:`refname`: :at-val:`string`
  4671. See :ref:`framepos<sensor-framepos>` sensor.
  4672. .. _sensor-framezaxis:
  4673. :el-prefix:`sensor/` |-| **framezaxis** (*)
  4674. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4675. This element creates a sensor that returns the 3D unit vector corresponding to the Z-axis of the spatial frame of the
  4676. object, in global coordinates.
  4677. .. _sensor-framezaxis-name:
  4678. .. _sensor-framezaxis-noise:
  4679. .. _sensor-framezaxis-cutoff:
  4680. .. _sensor-framezaxis-user:
  4681. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4682. See :ref:`CSensor`.
  4683. .. _sensor-framezaxis-objtype:
  4684. :at:`objtype`: :at-val:`[body, xbody, geom, site, camera], required`
  4685. See :ref:`framepos<sensor-framepos>` sensor.
  4686. .. _sensor-framezaxis-objname:
  4687. :at:`objname`: :at-val:`string, required`
  4688. See :ref:`framepos<sensor-framepos>` sensor.
  4689. .. _sensor-framezaxis-reftype:
  4690. :at:`reftype`: :at-val:`[body, xbody, geom, site, camera]`
  4691. See :ref:`framepos<sensor-framepos>` sensor.
  4692. .. _sensor-framezaxis-refname:
  4693. :at:`refname`: :at-val:`string`
  4694. See :ref:`framepos<sensor-framepos>` sensor.
  4695. .. _sensor-framelinvel:
  4696. :el-prefix:`sensor/` |-| **framelinvel** (*)
  4697. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4698. This element creates a sensor that returns the 3D linear velocity of the spatial frame of the object, in global
  4699. coordinates.
  4700. .. _sensor-framelinvel-name:
  4701. .. _sensor-framelinvel-noise:
  4702. .. _sensor-framelinvel-cutoff:
  4703. .. _sensor-framelinvel-user:
  4704. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4705. See :ref:`CSensor`.
  4706. .. _sensor-framelinvel-objtype:
  4707. :at:`objtype`: :at-val:`[body, xbody, geom, site, camera], required`
  4708. See :ref:`framepos<sensor-framepos>` sensor.
  4709. .. _sensor-framelinvel-objname:
  4710. :at:`objname`: :at-val:`string, required`
  4711. See :ref:`framepos<sensor-framepos>` sensor.
  4712. .. _sensor-framelinvel-reftype:
  4713. :at:`reftype`: :at-val:`[body, xbody, geom, site, camera]`
  4714. See :ref:`framepos<sensor-framepos>` sensor.
  4715. .. _sensor-framelinvel-refname:
  4716. :at:`refname`: :at-val:`string`
  4717. See :ref:`framepos<sensor-framepos>` sensor.
  4718. .. _sensor-frameangvel:
  4719. :el-prefix:`sensor/` |-| **frameangvel** (*)
  4720. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4721. This element creates a sensor that returns the 3D angular velocity of the spatial frame of the object, in global
  4722. coordinates.
  4723. .. _sensor-frameangvel-name:
  4724. .. _sensor-frameangvel-noise:
  4725. .. _sensor-frameangvel-cutoff:
  4726. .. _sensor-frameangvel-user:
  4727. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4728. See :ref:`CSensor`.
  4729. .. _sensor-frameangvel-objtype:
  4730. :at:`objtype`: :at-val:`[body, xbody, geom, site, camera], required`
  4731. See :ref:`framepos<sensor-framepos>` sensor.
  4732. .. _sensor-frameangvel-objname:
  4733. :at:`objname`: :at-val:`string, required`
  4734. See :ref:`framepos<sensor-framepos>` sensor.
  4735. .. _sensor-frameangvel-reftype:
  4736. :at:`reftype`: :at-val:`[body, xbody, geom, site, camera]`
  4737. See :ref:`framepos<sensor-framepos>` sensor.
  4738. .. _sensor-frameangvel-refname:
  4739. :at:`refname`: :at-val:`string`
  4740. See :ref:`framepos<sensor-framepos>` sensor.
  4741. .. _sensor-framelinacc:
  4742. :el-prefix:`sensor/` |-| **framelinacc** (*)
  4743. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4744. This element creates a sensor that returns the 3D linear acceleration of the spatial frame of the object, in global
  4745. coordinates.
  4746. The presence of this sensor in a model triggers a call to :ref:`mj_rnePostConstraint` during sensor computation.
  4747. .. _sensor-framelinacc-name:
  4748. .. _sensor-framelinacc-noise:
  4749. .. _sensor-framelinacc-cutoff:
  4750. .. _sensor-framelinacc-user:
  4751. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4752. See :ref:`CSensor`.
  4753. .. _sensor-framelinacc-objtype:
  4754. :at:`objtype`: :at-val:`[body, xbody, geom, site, camera], required`
  4755. See :ref:`framepos<sensor-framepos>` sensor.
  4756. .. _sensor-framelinacc-objname:
  4757. :at:`objname`: :at-val:`string, required`
  4758. See :ref:`framepos<sensor-framepos>` sensor.
  4759. .. _sensor-frameangacc:
  4760. :el-prefix:`sensor/` |-| **frameangacc** (*)
  4761. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4762. This element creates a sensor that returns the 3D angular acceleration of the spatial frame of the object, in global
  4763. coordinates.
  4764. The presence of this sensor in a model triggers a call to :ref:`mj_rnePostConstraint` during sensor computation.
  4765. .. _sensor-frameangacc-name:
  4766. .. _sensor-frameangacc-noise:
  4767. .. _sensor-frameangacc-cutoff:
  4768. .. _sensor-frameangacc-user:
  4769. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4770. See :ref:`CSensor`.
  4771. .. _sensor-frameangacc-objtype:
  4772. :at:`objtype`: :at-val:`[body, xbody, geom, site, camera], required`
  4773. See :ref:`framepos<sensor-framepos>` sensor.
  4774. .. _sensor-frameangacc-objname:
  4775. :at:`objname`: :at-val:`string, required`
  4776. See :ref:`framepos<sensor-framepos>` sensor.
  4777. .. _sensor-subtreecom:
  4778. :el-prefix:`sensor/` |-| **subtreecom** (*)
  4779. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4780. This element creates sensor that returns the center of mass of the kinematic subtree rooted at a specified body, in
  4781. global coordinates.
  4782. .. _sensor-subtreecom-name:
  4783. .. _sensor-subtreecom-noise:
  4784. .. _sensor-subtreecom-cutoff:
  4785. .. _sensor-subtreecom-user:
  4786. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4787. See :ref:`CSensor`.
  4788. .. _sensor-subtreecom-body:
  4789. :at:`body`: :at-val:`string, required`
  4790. Name of the body where the kinematic subtree is rooted.
  4791. .. _sensor-subtreelinvel:
  4792. :el-prefix:`sensor/` |-| **subtreelinvel** (*)
  4793. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4794. This element creates sensor that returns the linear velocity of the center of mass of the kinematic subtree rooted at a
  4795. specified body, in global coordinates.
  4796. The presence of this sensor in a model triggers a call to :ref:`mj_subtreeVel` during sensor computation.
  4797. .. _sensor-subtreelinvel-name:
  4798. .. _sensor-subtreelinvel-noise:
  4799. .. _sensor-subtreelinvel-cutoff:
  4800. .. _sensor-subtreelinvel-user:
  4801. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4802. See :ref:`CSensor`.
  4803. .. _sensor-subtreelinvel-body:
  4804. :at:`body`: :at-val:`string, required`
  4805. Name of the body where the kinematic subtree is rooted.
  4806. .. _sensor-subtreeangmom:
  4807. :el-prefix:`sensor/` |-| **subtreeangmom** (*)
  4808. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4809. This element creates sensor that returns the angular momentum around the center of mass of the kinematic subtree rooted
  4810. at a specified body, in global coordinates.
  4811. The presence of this sensor in a model triggers a call to :ref:`mj_subtreeVel` during sensor computation.
  4812. .. _sensor-subtreeangmom-name:
  4813. .. _sensor-subtreeangmom-noise:
  4814. .. _sensor-subtreeangmom-cutoff:
  4815. .. _sensor-subtreeangmom-user:
  4816. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4817. See :ref:`CSensor`.
  4818. .. _sensor-subtreeangmom-body:
  4819. :at:`body`: :at-val:`string, required`
  4820. Name of the body where the kinematic subtree is rooted.
  4821. .. _collision-sensors:
  4822. collision sensors
  4823. ^^^^^^^^^^^^^^^^^
  4824. The following 3 sensor types, :ref:`sensor/distance<sensor-distance>`, :ref:`sensor/normal<sensor-normal>` and
  4825. :ref:`sensor/fromto<sensor-fromto>`, respectively measure the distance, normal direction and line segment of the
  4826. smallest signed distance between the surfaces of two geoms using the narrow-phase geom-geom colliders. The collision
  4827. computation is always performed, independently of the standard collision :ref:`selection and filtering<coSelection>`
  4828. pipeline. These 3 sensors share some common properties:
  4829. .. _collision-sensors-cutoff:
  4830. :at:`cutoff`
  4831. For most sensors, the :at:`cutoff` attribute simply defines a clipping operation on sensor values. For collision
  4832. sensors, it defines the maximum distance at which collisions will be detected, corresponding to the ``dismax``
  4833. argument of :ref:`mj_geomDistance`. For example, at the default value of 0, only negative distances (corresponding
  4834. to geom-geom penetration) will be reported by :ref:`sensor/distance<sensor-distance>`.
  4835. In order to determine collision properties of non-penetrating geom pairs, a positive :at:`cutoff` is required.
  4836. .. admonition:: Positive cutoff values
  4837. :class: note
  4838. .. TODO: b/339596989 - Improve mjc_Convex.
  4839. For some colliders, a positive :at:`cutoff` will result in an accurate measurement. However, for collision
  4840. pairs which use the general ``mjc_Convex`` collider, the result will be approximate and likely innacurate.
  4841. This is considered a bug to be fixed in a future release.
  4842. In order to determine whether a geom pair uses ``mjc_Convex``, inspect the table at the top of
  4843. `engine_collision_driver.c <https://github.com/google-deepmind/mujoco/blob/main/src/engine/engine_collision_driver.c>`__.
  4844. :at:`geom1`, :at:`geom2`, :at:`body1`, :at:`body2`
  4845. For all 3 collision sensor types, the two colliding geoms can be specified explicitly using the :at:`geom1` and
  4846. :at:`geom2` attributes or implicitly, using :at:`body1`, :at:`body2`. In the latter case the sensor will iterate over
  4847. all geoms of the specified body or bodies (mixed specification like :at:`geom1`, :at:`body2` are allowed), and
  4848. select the collision with the smallest signed distance.
  4849. sequential sensors
  4850. When multiple collision sensors are defined sequentially and have identical attributes (:at:`geom1`, :at:`body1`,
  4851. :at:`geom2`, :at:`body2`, :at:`cutoff`), for example when both distance and normal are queried for the same geom
  4852. pair, the collision functions will be called once for the whole sensor block, avoiding repeated computation.
  4853. .. _sensor-distance:
  4854. :el-prefix:`sensor/` |-| **distance** (*)
  4855. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4856. This element creates a sensor that returns the smallest signed distance between the surfaces of two geoms.
  4857. See :ref:`collision-sensors` for more details about sensors of this type.
  4858. .. _sensor-distance-cutoff:
  4859. :at:`cutoff`
  4860. See :ref:`collision-sensors` for the sematics of this attribute, which is different than for other sensor categories.
  4861. If no collision is detected, the distance sensor returns the :at:`cutoff` value, so in this case
  4862. :at:`cutoff` acts as a maximum clipping value, in addition to the special semantics.
  4863. .. _sensor-distance-geom1:
  4864. :at:`geom1`: :at-val:`string, optional`
  4865. Name of the first geom. Exactly one of (:at:`geom1`, :at:`body1`) must be specified.
  4866. .. _sensor-distance-geom2:
  4867. :at:`geom2`: :at-val:`string, optional`
  4868. Name of the second geom. Exactly one of (:at:`geom2`, :at:`body2`) must be specified.
  4869. .. _sensor-distance-body1:
  4870. :at:`body1`: :at-val:`string, optional`
  4871. Name of the first body. Exactly one of (:at:`geom1`, :at:`body1`) must be specified.
  4872. .. _sensor-distance-body2:
  4873. :at:`body2`: :at-val:`string, optional`
  4874. Name of the second body. Exactly one of (:at:`geom2`, :at:`body2`) must be specified.
  4875. .. _sensor-distance-name:
  4876. .. _sensor-distance-noise:
  4877. .. _sensor-distance-user:
  4878. :at:`name`, :at:`noise`, :at:`user`
  4879. See :ref:`CSensor`.
  4880. .. _sensor-normal:
  4881. :el-prefix:`sensor/` |-| **normal** (*)
  4882. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4883. This element creates a sensor that returns the normal direction of the smallest signed distance between the surfaces of
  4884. two geoms. It is guaranteed to point from the surface of geom1 to the surface of geom2, though note that in the case of
  4885. penetration, this direction is generally in the opposite direction to that of the centroids.
  4886. See :ref:`collision-sensors` for more details about sensors of this type.
  4887. .. _sensor-normal-cutoff:
  4888. :at:`cutoff`
  4889. See :ref:`collision-sensors` for the sematics of this attribute, which is different than for other sensor categories.
  4890. If no collision is detected, the :ref:`normal<sensor-normal>` sensor returns (0, 0, 0), otherwise it returns a
  4891. normalized direction vector. For this sensor, :at:`cutoff` does not lead to any clamping.
  4892. .. _sensor-normal-geom1:
  4893. :at:`geom1`: :at-val:`string, optional`
  4894. Name of the first geom. Exactly one of (:at:`geom1`, :at:`body1`) must be specified.
  4895. .. _sensor-normal-geom2:
  4896. :at:`geom2`: :at-val:`string, optional`
  4897. Name of the second geom. Exactly one of (:at:`geom2`, :at:`body2`) must be specified.
  4898. .. _sensor-normal-body1:
  4899. :at:`body1`: :at-val:`string, optional`
  4900. Name of the first body. Exactly one of (:at:`geom1`, :at:`body1`) must be specified.
  4901. .. _sensor-normal-body2:
  4902. :at:`body2`: :at-val:`string, optional`
  4903. Name of the second body. Exactly one of (:at:`geom2`, :at:`body2`) must be specified.
  4904. .. _sensor-normal-name:
  4905. .. _sensor-normal-noise:
  4906. .. _sensor-normal-user:
  4907. :at:`name`, :at:`noise`, :at:`user`
  4908. See :ref:`CSensor`.
  4909. .. _sensor-fromto:
  4910. :el-prefix:`sensor/` |-| **fromto** (*)
  4911. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4912. This element creates a sensor that returns the segment defining the smallest signed distance between the surfaces of two
  4913. geoms. The segment is defined by 6 numbers (x1, y1, z1, x2, y2, z2) corresponding to two points in the world frame.
  4914. (x1, y1, z1) is on the surface of geom1, (x2, y2, z2) is on the surface of geom2. When this sensor is present and the
  4915. :ref:`mjVIS_RANGEFINDER<mjtVisFlag>` visualization flag is set, segments will be visualized as rangefinder rays.
  4916. See :ref:`collision-sensors` for more details about sensors of this type.
  4917. .. _sensor-fromto-cutoff:
  4918. :at:`cutoff`
  4919. See :ref:`collision-sensors` for the sematics of this attribute, which is different than for other sensor categories.
  4920. If no collision is detected, the :ref:`fromto<sensor-fromto>` sensor returns 6 zeros.
  4921. For this sensor, :at:`cutoff` does not lead to any clamping.
  4922. .. _sensor-fromto-geom1:
  4923. :at:`geom1`: :at-val:`string, optional`
  4924. Name of the first geom. Exactly one of (:at:`geom1`, :at:`body1`) must be specified.
  4925. .. _sensor-fromto-geom2:
  4926. :at:`geom2`: :at-val:`string, optional`
  4927. Name of the second geom. Exactly one of (:at:`geom2`, :at:`body2`) must be specified.
  4928. .. _sensor-fromto-body1:
  4929. :at:`body1`: :at-val:`string, optional`
  4930. Name of the first body. Exactly one of (:at:`geom1`, :at:`body1`) must be specified.
  4931. .. _sensor-fromto-body2:
  4932. :at:`body2`: :at-val:`string, optional`
  4933. Name of the second body. Exactly one of (:at:`geom2`, :at:`body2`) must be specified.
  4934. .. _sensor-fromto-name:
  4935. .. _sensor-fromto-noise:
  4936. .. _sensor-fromto-user:
  4937. :at:`name`, :at:`noise`, :at:`user`
  4938. See :ref:`CSensor`.
  4939. .. _sensor-clock:
  4940. :el-prefix:`sensor/` |-| **clock** (*)
  4941. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4942. This element creates sensor that returns the simulation time.
  4943. .. _sensor-clock-name:
  4944. .. _sensor-clock-noise:
  4945. .. _sensor-clock-cutoff:
  4946. .. _sensor-clock-user:
  4947. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4948. See :ref:`CSensor`.
  4949. .. _sensor-user:
  4950. :el-prefix:`sensor/` |-| **user** (*)
  4951. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4952. This element creates a user sensor. MuJoCo does not know how to compute the output of this sensor. Instead the user
  4953. should install the callback :ref:`mjcb_sensor` which is expected to fill in the sensor data in ``mjData.sensordata``.
  4954. The specification in the XML is used to allocate space for this sensor, and also determine which MuJoCo object it is
  4955. attached to and what stage of computation it needs before the data can be computed. Note that the MuJoCo object
  4956. referenced here can be a tuple, which in turn can reference a custom collection of MuJoCo objects -- for example several
  4957. bodies whose center of mass is of interest.
  4958. If a user sensor is of :ref:`stage<sensor-user-needstage>` "vel" or "acc", then :ref:`mj_subtreeVel` or
  4959. :ref:`mj_rnePostConstraint` will be triggered, respectively.
  4960. .. _sensor-user-name:
  4961. .. _sensor-user-noise:
  4962. .. _sensor-user-cutoff:
  4963. .. _sensor-user-user:
  4964. :at:`name`, :at:`noise`, :at:`cutoff`, :at:`user`
  4965. See :ref:`CSensor`.
  4966. .. _sensor-user-objtype:
  4967. :at:`objtype`: :at-val:`(any element type that can be named), optional`
  4968. Type of the MuJoCo object to which the sensor is attached. This together with the objname attribute determines the
  4969. actual object. If unspecified, will be :ref:`mjOBJ_UNKNOWN<mjtObj>`.
  4970. .. _sensor-user-objname:
  4971. :at:`objname`: :at-val:`string, optional`
  4972. Name of the MuJoCo object to which the sensor is attached.
  4973. .. _sensor-user-datatype:
  4974. :at:`datatype`: :at-val:`[real, positive, axis, quaternion], "real"`
  4975. The type of output generated by this sensor. "axis" means a unit-length 3D vector. "quat" means a unit quaternion.
  4976. These need to be declared because when MuJoCo adds noise, it must respect the vector normalization. "real" means a
  4977. generic array (or scalar) of real values to which noise can be added independently.
  4978. .. _sensor-user-needstage:
  4979. :at:`needstage`: :at-val:`[pos, vel, acc], "acc"`
  4980. The MuJoCo computation stage that must be completed before the user callback mjcb_sensor() is able to evaluate the
  4981. output of this sensor.
  4982. .. _sensor-user-dim:
  4983. :at:`dim`: :at-val:`int, required`
  4984. Number of scalar outputs of this sensor.
  4985. .. _sensor-plugin:
  4986. :el-prefix:`sensor/` |-| **plugin** (?)
  4987. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  4988. Ascociate this sensor with an :ref:`engine plugin<exPlugin>`. Either :at:`plugin` or :at:`instance` are required.
  4989. .. _sensor-plugin-plugin:
  4990. :at:`plugin`: :at-val:`string, optional`
  4991. Plugin identifier, used for implicit plugin instantiation.
  4992. .. _sensor-plugin-instance:
  4993. :at:`instance`: :at-val:`string, optional`
  4994. Instance name, used for explicit plugin instantiation.
  4995. .. _sensor-plugin-name:
  4996. .. _sensor-plugin-cutoff:
  4997. .. _sensor-plugin-objtype:
  4998. .. _sensor-plugin-objname:
  4999. .. _sensor-plugin-reftype:
  5000. .. _sensor-plugin-refname:
  5001. .. _sensor-plugin-user:
  5002. .. |sensor/plugin attrib list| replace:: :at:`name`, :at:`cutoff`, :at:`objtype`, :at:`objname`, :at:`reftype`,
  5003. :at:`refname`, :at:`user`
  5004. |sensor/plugin attrib list|
  5005. See :ref:`CSensor`.
  5006. .. _keyframe:
  5007. **keyframe** (*)
  5008. ~~~~~~~~~~~~~~~~
  5009. This is a grouping element for keyframe definitions. It does not have attributes. Keyframes can be used to create a
  5010. library of states that are of interest to the user, and to initialize the simulation state to one of the states in the
  5011. library. They are not needed by any MuJoCo computations. The number of keyframes allocated in mjModel is the larger of
  5012. the nkey attribute of :ref:`size <size>`, and the number of elements defined here. If fewer than nkey elements are
  5013. defined here, the undefined keyframes have all their data set to 0, except for the qpos attribute which is set to
  5014. mjModel.qpos0.
  5015. The user can also set keyframe data in mjModel at runtime; this data will then appear in the saved MJCF model. Note that
  5016. in :ref:`simulate.cc <saSimulate>` the simulation state can be copied into a selected keyframe and vice versa.
  5017. .. _keyframe-key:
  5018. :el-prefix:`keyframe/` |-| **key** (*)
  5019. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5020. This element sets the data for one of the keyframes. They are set in the order in which they appear here.
  5021. .. _keyframe-key-name:
  5022. :at:`name`: :at-val:`string, optional`
  5023. Name of this keyframe.
  5024. .. _keyframe-key-time:
  5025. :at:`time`: :at-val:`real, "0"`
  5026. Simulation time, copied into mjData.time when the simulation state is set to this keyframe.
  5027. .. _keyframe-key-qpos:
  5028. :at:`qpos`: :at-val:`real(mjModel.nq), default = mjModel.qpos0`
  5029. Vector of joint positions, copied into mjData.qpos when the simulation state is set to this keyframe.
  5030. .. _keyframe-key-qvel:
  5031. :at:`qvel`: :at-val:`real(mjModel.nq), "0 0 ..."`
  5032. Vector of joint velocities, copied into mjData.qvel when the simulation state is set to this keyframe.
  5033. .. _keyframe-key-act:
  5034. :at:`act`: :at-val:`real(mjModel.na), "0 0 ..."`
  5035. Vector of actuator activations, copied into mjData.act when the simulation state is set to this keyframe.
  5036. .. _keyframe-key-ctrl:
  5037. :at:`ctrl`: :at-val:`real(mjModel.nu), "0 0 ..."`
  5038. Vector of controls, copied into mjData.ctrl when the simulation state is set to this keyframe.
  5039. .. _keyframe-key-mpos:
  5040. :at:`mpos`: :at-val:`real(3*mjModel.nmocap), default = mjModel.body_pos`
  5041. Vector of mocap body positions, copied into mjData.mocap_pos when the simulation state is set to this keyframe.
  5042. .. _keyframe-key-mquat:
  5043. :at:`mquat`: :at-val:`real(4*mjModel.nmocap), default = mjModel.body_quat`
  5044. Vector of mocap body quaternions, copied into mjData.mocap_quat when the simulation state is set to this keyframe.
  5045. .. _visual:
  5046. **visual** (*)
  5047. ~~~~~~~~~~~~~~
  5048. This element is in one-to-one correspondence with the low level structure mjVisual contained in the field mjModel.vis
  5049. of mjModel. The settings here affect the visualizer, or more precisely the abstract phase of visualization which
  5050. yields a list of geometric entities for subsequent rendering. The settings here are global, in contrast with the
  5051. element-specific visual settings. The global and element-specific settings refer to non-overlapping properties. Some
  5052. of the global settings affect properties such as triangulation of geometric primitives that cannot be set per element.
  5053. Other global settings affect the properties of decorative objects, i.e., objects such as contact points and force
  5054. arrows which do not correspond to model elements. The visual settings are grouped semantically into several
  5055. subsections.
  5056. |br| This element is a good candidate for the :ref:`file include <CInclude>` mechanism. One can create an XML file with
  5057. coordinated visual settings corresponding to a "theme", and then include this file in multiple models.
  5058. .. _visual-global:
  5059. :el-prefix:`visual/` |-| **global** (?)
  5060. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5061. While all settings in mjVisual are global, the settings here could not be fit into any of the other subsections. So this
  5062. is effectively a miscellaneous subsection.
  5063. .. _visual-global-orthographic:
  5064. :at:`orthographic`: :at-val:`[false, true], "false"`
  5065. Whether the free camera uses a perspective projection (the default) or an orthographic projection. Setting this
  5066. attribute changes the semantic of the :ref:`global/fovy<visual-global-fovy>` attribute, see below.
  5067. .. _visual-global-fovy:
  5068. :at:`fovy`: :at-val:`real, "45"`
  5069. This attribute specifies the vertical field of view of the free camera, i.e., the camera that is always available in
  5070. the visualizer even if no cameras are explicitly defined in the model. If the camera uses a perspective projection,
  5071. the field-of-view is expressed in degrees, regardless of the global :ref:`compiler/angle <compiler-angle>` setting.
  5072. If the camera uses an orthographic projection, the field-of-view is expressed in units of length; note that in this
  5073. case the default of 45 is too large for most scenes and should likely be reduced. In either case, the horizontal
  5074. field of view is computed automatically given the window size and the vertical field of view. The same convention
  5075. applies to the :ref:`camera/fovy <body-camera-fovy>` attribute.
  5076. .. _visual-global-ipd:
  5077. :at:`ipd`: :at-val:`real, "0.068"`
  5078. This attribute specifies the inter-pupilary distance of the free camera. It only affects the rendering in
  5079. stereoscopic mode. The left and right viewpoints are offset by half of this value in the corresponding direction.
  5080. .. _visual-global-azimuth:
  5081. :at:`azimuth`: :at-val:`real, "90"`
  5082. This attribute specifies the initial azimuth of the free camera around the vertical z-axis, in degrees. A value of 0
  5083. corresponds to looking in the positive x direction, while the default value of 90 corresponds to looking in the
  5084. positive y direction. The look-at point itself is specified by the :ref:`statistic/center<statistic-center>`
  5085. attribute, while the distance from the look-at point is controlled by the :ref:`statistic/extent<statistic-extent>`
  5086. attribute.
  5087. .. _visual-global-elevation:
  5088. :at:`elevation`: :at-val:`real, "-45"`
  5089. This attribute specifies the initial elevation of the free camera with respect to the lookat point. Note that since
  5090. this is a rotation around a vector parallel to the camera's X-axis (right in pixel space), *negative* numbers
  5091. correspond to moving the camera *up* from the horizontal plane, and vice-versa. The look-at point itself is specified
  5092. by the :ref:`statistic/center<statistic-center>` attribute, while the distance from the look-at point is controlled
  5093. by the :ref:`statistic/extent<statistic-extent>` attribute.
  5094. .. _visual-global-linewidth:
  5095. :at:`linewidth`: :at-val:`real, "1"`
  5096. This attribute specifies the line-width in the sense of OpenGL. It affects the rendering in wire-frame mode.
  5097. .. _visual-global-glow:
  5098. :at:`glow`: :at-val:`real, "0.3"`
  5099. The value of this attribute is added to the emission coefficient of all geoms attached to the selected body. As a
  5100. result, the selected body appears to glow.
  5101. .. _visual-global-realtime:
  5102. :at:`realtime`: :at-val:`real, "1"`
  5103. This value sets the initial real-time factor of the model, when loaded in `simulate`. 1: real time. Less than 1:
  5104. slower than real time. Must be greater than 0.
  5105. .. _visual-global-offwidth:
  5106. :at:`offwidth`: :at-val:`int, "640"`
  5107. This and the next attribute specify the size in pixels of the off-screen OpenGL rendering buffer. This attribute
  5108. specifies the width of the buffer. The size of this buffer can also be adjusted at runtime, but it is usually more
  5109. convenient to set it in the XML.
  5110. .. _visual-global-offheight:
  5111. :at:`offheight`: :at-val:`int, "480"`
  5112. This attribute specifies the height in pixels of the OpenGL off-screen rendering buffer.
  5113. .. _visual-global-ellipsoidinertia:
  5114. :at:`ellipsoidinertia`: :at-val:`[false, true], "false"`
  5115. This attribute specifies how the equivalent inertia is visualized. "false":
  5116. use box, "true": use ellipsoid.
  5117. .. _visual-global-bvactive:
  5118. :at:`bvactive`: :at-val:`[false, true], "true"`
  5119. This attribute specifies whether collision and raycasting code should mark elements of Bounding Volume Hierarchies
  5120. as intersecting, for the purpose of visualization. Setting this attribute to "false" can speed up simulation for
  5121. models with high-resolution meshes.
  5122. .. _visual-quality:
  5123. :el-prefix:`visual/` |-| **quality** (?)
  5124. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5125. This element specifies settings that affect the quality of the rendering. Larger values result in higher quality but
  5126. possibly slower speed. Note that :ref:`simulate.cc <saSimulate>` displays the frames per second (FPS). The target FPS is
  5127. 60 Hz; if the number shown in the visualizer is substantially lower, this means that the GPU is over-loaded and the
  5128. visualization should somehow be simplified.
  5129. .. _visual-quality-shadowsize:
  5130. :at:`shadowsize`: :at-val:`int, "4096"`
  5131. This attribute specifies the size of the square texture used for shadow mapping. Higher values result is smoother
  5132. shadows. The size of the area over which a :ref:`light <body-light>` can cast shadows also affects smoothness, so
  5133. these settings should be adjusted jointly. The default here is somewhat conservative. Most modern GPUs are able to
  5134. handle significantly larger textures without slowing down.
  5135. .. _visual-quality-offsamples:
  5136. :at:`offsamples`: :at-val:`int, "4"`
  5137. This attribute specifies the number of multi-samples for offscreen rendering. Larger values produce better
  5138. anti-aliasing but can slow down the GPU. Set this to 0 to disable multi-sampling. Note that this attribute only
  5139. affects offscreen rendering. For regular window rendering, multi-sampling is specified in an OS-dependent way when
  5140. the OpenGL context for the window is first created, and cannot be changed from within MuJoCo.
  5141. |br| When rendering segmentation images, multi-sampling is automatically disabled so as not to average segmentation
  5142. indices. However, some rendering backends ignore the automatic disabling. If your segmentation images contain bad
  5143. indices, try manually setting this attribute to 0.
  5144. .. _visual-quality-numslices:
  5145. :at:`numslices`: :at-val:`int, "28"`
  5146. This and the next three attributes specify the density of internally-generated meshes for geometric primitives. Such
  5147. meshes are only used for rendering, while the collision detector works with the underlying analytic surfaces. This
  5148. value is passed to the various visualizer functions as the "slices" parameter as used in GLU. It specifies the number
  5149. of subdivisions around the Z-axis, similar to lines of longitude.
  5150. .. _visual-quality-numstacks:
  5151. :at:`numstacks`: :at-val:`int, "16"`
  5152. This value of this attribute is passed to the various visualization functions as the "stacks" parameter as used in
  5153. GLU. It specifies the number of subdivisions along the Z-axis, similar to lines of latitude.
  5154. .. _visual-quality-numquads:
  5155. :at:`numquads`: :at-val:`int, "4"`
  5156. This attribute specifies the number of rectangles for rendering box faces, automatically-generated planes (as opposed
  5157. to geom planes which have an element-specific attribute with the same function), and sides of height fields. Even
  5158. though a geometrically correct rendering can be obtained by setting this value to 1, illumination works better for
  5159. larger values because we use per-vertex illumination (as opposed to per-fragment).
  5160. .. _visual-headlight:
  5161. :el-prefix:`visual/` |-| **headlight** (?)
  5162. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5163. This element is used to adjust the properties of the headlight. There is always a built-in headlight, in addition to any
  5164. lights explicitly defined in the model. The headlight is a directional light centered at the current camera and pointed
  5165. in the direction in which the camera is looking. It does not cast shadows (which would be invisible anyway). Note that
  5166. lights are additive, so if explicit lights are defined in the model, the intensity of the headlight would normally need
  5167. to be reduced.
  5168. .. _visual-headlight-ambient:
  5169. :at:`ambient`: :at-val:`real(3), "0.1 0.1 0.1"`
  5170. The ambient component of the headlight, in the sense of OpenGL. The alpha component here and in the next two
  5171. attributes is set to 1 and cannot be adjusted.
  5172. .. _visual-headlight-diffuse:
  5173. :at:`diffuse`: :at-val:`real(3), "0.4 0.4 0.4"`
  5174. The diffuse component of the headlight, in the sense of OpenGL.
  5175. .. _visual-headlight-specular:
  5176. :at:`specular`: :at-val:`real(3), "0.5 0.5 0.5"`
  5177. The specular component of the headlight, in the sense of OpenGL.
  5178. .. _visual-headlight-active:
  5179. :at:`active`: :at-val:`int, "1"`
  5180. This attribute enables and disables the headlight. A value of 0 means disabled, any other value means enabled.
  5181. .. _visual-map:
  5182. :el-prefix:`visual/` |-| **map** (?)
  5183. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5184. This element is used to specify scaling quantities that affect both the visualization and built-in mouse perturbations.
  5185. Unlike the scaling quantities in the next element which are specific to spatial extent, the quantities here are
  5186. miscellaneous.
  5187. .. _visual-map-stiffness:
  5188. :at:`stiffness`: :at-val:`real, "100"`
  5189. This attribute controls the strength of mouse perturbations. The internal perturbation mechanism simulates a
  5190. mass-spring-damper with critical damping, unit mass, and stiffness given here. Larger values mean that a larger force
  5191. will be applied for the same displacement between the selected body and the mouse-controlled target.
  5192. .. _visual-map-stiffnessrot:
  5193. :at:`stiffnessrot`: :at-val:`real, "500"`
  5194. Same as above but applies to rotational perturbations rather than translational perturbations. Empirically, the
  5195. rotational stiffness needs to be larger in order for rotational mouse perturbations to have an effect.
  5196. .. _visual-map-force:
  5197. :at:`force`: :at-val:`real, "0.005"`
  5198. This attributes controls the visualization of both contact forces and perturbation forces. The length of the rendered
  5199. force vector equals the force magnitude multiplied by the value of this attribute and divided by the mean body mass
  5200. for the model (see :ref:`statistic <statistic>` element).
  5201. .. _visual-map-torque:
  5202. :at:`torque`: :at-val:`real, "0.1"`
  5203. Same as above, but controls the rendering of contact torque and perturbation torque rather than force (currently
  5204. disabled).
  5205. .. _visual-map-alpha:
  5206. :at:`alpha`: :at-val:`real, "0.3"`
  5207. When transparency is turned on in the visualizer, the geoms attached to all moving bodies are made more transparent.
  5208. This is done by multiplying the geom-specific alpha values by this value.
  5209. .. _visual-map-fogstart:
  5210. :at:`fogstart`: :at-val:`real, "3"`
  5211. The visualizer can simulate linear fog, in the sense of OpenGL. The start position of the fog is the model extent
  5212. (see :ref:`statistic <statistic>` element) multiplied by the value of this attribute.
  5213. .. _visual-map-fogend:
  5214. :at:`fogend`: :at-val:`real, "10"`
  5215. The end position of the fog is the model extent multiplied by the value of this attribute.
  5216. .. _visual-map-znear:
  5217. :at:`znear`: :at-val:`real, "0.01"`
  5218. This and the next attribute determine the clipping planes of the OpenGL projection. The near clipping plane is
  5219. particularly important: setting it too close causes (often severe) loss of resolution in the depth buffer, while
  5220. setting it too far causes objects of interest to be clipped, making it impossible to zoom in. The distance to the
  5221. near clipping plane is the model ``extent`` multiplied by the value of this attribute. Must be strictly positive.
  5222. .. _visual-map-zfar:
  5223. :at:`zfar`: :at-val:`real, "50"`
  5224. The distance to the far clipping plane is the model ``extent`` multiplied by the value of this attribute.
  5225. .. _visual-map-haze:
  5226. :at:`haze`: :at-val:`real, "0.3"`
  5227. Proportion of the distance-to-horizon that is covered by haze (when haze rendering is enabled and a skybox is
  5228. present).
  5229. .. _visual-map-shadowclip:
  5230. :at:`shadowclip`: :at-val:`real, "1"`
  5231. As mentioned above, shadow quality depends on the size of the shadow texture as well as the area where a given light
  5232. can cast shadows. For directional lights, the area would be infinite unless we limited it somehow. This attribute
  5233. specifies the limits, as +/- the model extent multiplied by the present value. These limits define a square in the
  5234. plane orthogonal to the light direction. If a shadow crosses the boundary of this virtual square, it will disappear
  5235. abruptly, revealing the edges of the square.
  5236. .. _visual-map-shadowscale:
  5237. :at:`shadowscale`: :at-val:`real, "0.6"`
  5238. This attribute plays a similar role as the previous one, but applies to spotlights rather than directional lights.
  5239. Spotlights have a cutoff angle, limited internally to 80 deg. However this angle is often too large to obtain good
  5240. quality shadows, and it is necessary to limit the shadow to a smaller cone. The angle of the cone in which shadows
  5241. can be cast is the light cutoff multiplied by the present value.
  5242. .. _visual-map-actuatortendon:
  5243. :at:`actuatortendon`: :at-val:`real, "2"`
  5244. Ratio of actuator width to tendon width for rendering of actuators attached to tendons.
  5245. .. _visual-scale:
  5246. :el-prefix:`visual/` |-| **scale** (?)
  5247. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5248. The settings in this element control the spatial extent of various decorative objects. In all cases, the rendered size
  5249. equals the mean body size (see :ref:`statistic <statistic>` element) multiplied by the value of an attribute
  5250. documented below.
  5251. .. _visual-scale-forcewidth:
  5252. :at:`forcewidth`: :at-val:`real, "0.1"`
  5253. The radius of the arrows used to render contact forces and perturbation forces.
  5254. .. _visual-scale-contactwidth:
  5255. :at:`contactwidth`: :at-val:`real, "0.3"`
  5256. The radius of the cylinders used to render contact points. The normal direction of the cylinder is aligned with the
  5257. contact normal. Making the cylinder short and wide results in a "pancake" representation of the tangent plane.
  5258. .. _visual-scale-contactheight:
  5259. :at:`contactheight`: :at-val:`real, "0.1"`
  5260. The height of the cylinders used to render contact points.
  5261. .. _visual-scale-connect:
  5262. :at:`connect`: :at-val:`real, "0.2"`
  5263. The radius of the capsules used to connect bodies and joints, resulting in an automatically generated skeleton.
  5264. .. _visual-scale-com:
  5265. :at:`com`: :at-val:`real, "0.4"`
  5266. The radius of the spheres used to render the centers of mass of kinematic sub-trees.
  5267. .. _visual-scale-camera:
  5268. :at:`camera`: :at-val:`real, "0.3"`
  5269. The size of the decorative object used to represent model cameras in the rendering.
  5270. .. _visual-scale-light:
  5271. :at:`light`: :at-val:`real, "0.3"`
  5272. The size of the decorative object used to represent model lights in the rendering.
  5273. .. _visual-scale-selectpoint:
  5274. :at:`selectpoint`: :at-val:`real, "0.2"`
  5275. The radius of the sphere used to render the selection point (i.e., the point where the user left-double-clicked to
  5276. select a body). Note that the local and global coordinates of this point can be printed in the 3D view by activating
  5277. the corresponding rendering flags. In this way, the coordinates of points of interest can be found.
  5278. .. _visual-scale-jointlength:
  5279. :at:`jointlength`: :at-val:`real, "1.0"`
  5280. The length of the arrows used to render joint axes.
  5281. .. _visual-scale-jointwidth:
  5282. :at:`jointwidth`: :at-val:`real, "0.1"`
  5283. The radius of the arrows used to render joint axes.
  5284. .. _visual-scale-actuatorlength:
  5285. :at:`actuatorlength`: :at-val:`real, "0.7"`
  5286. The length of the arrows used to render actuators acting on scalar joints only.
  5287. .. _visual-scale-actuatorwidth:
  5288. :at:`actuatorwidth`: :at-val:`real, "0.2"`
  5289. The radius of the arrows used to render actuators acting on scalar joints only.
  5290. .. _visual-scale-framelength:
  5291. :at:`framelength`: :at-val:`real, "1.0"`
  5292. The length of the cylinders used to render coordinate frames. The world frame is automatically scaled relative to
  5293. this setting.
  5294. .. _visual-scale-framewidth:
  5295. :at:`framewidth`: :at-val:`real, "0.1"`
  5296. The radius of the cylinders used to render coordinate frames.
  5297. .. _visual-scale-constraint:
  5298. :at:`constraint`: :at-val:`real, "0.1"`
  5299. The radius of the capsules used to render violations in spatial constraints.
  5300. .. _visual-scale-slidercrank:
  5301. :at:`slidercrank`: :at-val:`real, "0.2"`
  5302. The radius of the capsules used to render slider-crank mechanisms. The second part of the mechanism is automatically
  5303. scaled relative to this setting.
  5304. .. _visual-scale-frustum:
  5305. :at:`frustum`: :at-val:`real, "10"`
  5306. The distance of the zfar plane from the camera pinhole for rendering the frustum.
  5307. .. _visual-rgba:
  5308. :el-prefix:`visual/` |-| **rgba** (?)
  5309. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5310. The settings in this element control the color and transparency (rgba) of various decorative objects. We will call this
  5311. combined attribute "color" to simplify terminology below. All values should be in the range [0 1]. An alpha value of 0
  5312. disables the rendering of the corresponding object.
  5313. .. _visual-rgba-fog:
  5314. :at:`fog`: :at-val:`real(4), "0 0 0 1"`
  5315. When fog is enabled, the color of all pixels fades towards the color specified here. The spatial extent of the fading
  5316. is controlled by the fogstart and fogend attributes of the :ref:`map <visual-map>` element above.
  5317. .. _visual-rgba-haze:
  5318. :at:`haze`: :at-val:`real(4), "1 1 1 1"`
  5319. Haze color at the horizon, used to transition between an infinite plane and a skybox smoothly. The default creates
  5320. white haze. To create a seamless transition, make sure the skybox colors near the horizon are similar to the plane
  5321. color/texture, and set the haze color somewhere in that color gamut.
  5322. .. _visual-rgba-force:
  5323. :at:`force`: :at-val:`real(4), "1 0.5 0.5 1"`
  5324. Color of the arrows used to render perturbation forces.
  5325. .. _visual-rgba-inertia:
  5326. :at:`inertia`: :at-val:`real(4), "0.8 0.2 0.2 0.6"`
  5327. Color of the boxes used to render equivalent body inertias. This is the only rgba setting that has transparency by
  5328. default, because it is usually desirable to see the geoms inside the inertia box.
  5329. .. _visual-rgba-joint:
  5330. :at:`joint`: :at-val:`real(4), "0.2 0.6 0.8 1"`
  5331. Color of the arrows used to render joint axes.
  5332. .. _visual-rgba-actuator:
  5333. :at:`actuator`: :at-val:`real(4), "0.2 0.25 0.2 1"`
  5334. Actuator color for neutral value of the control.
  5335. .. _visual-rgba-actuatornegative:
  5336. :at:`actuatornegative`: :at-val:`real(4), "0.2 0.6 0.9 1"`
  5337. Actuator color for most negative value of the control.
  5338. .. _visual-rgba-actuatorpositive:
  5339. :at:`actuatorpositive`: :at-val:`real(4), "0.9 0.4 0.2 1"`
  5340. Actuator color for most positive value of the control.
  5341. .. _visual-rgba-com:
  5342. :at:`com`: :at-val:`real(4), "0.9 0.9 0.9 1"`
  5343. Color of the spheres used to render sub-tree centers of mass.
  5344. .. _visual-rgba-camera:
  5345. :at:`camera`: :at-val:`real(4), "0.6 0.9 0.6 1"`
  5346. Color of the decorative object used to represent model cameras in the rendering.
  5347. .. _visual-rgba-light:
  5348. :at:`light`: :at-val:`real(4), "0.6 0.6 0.9 1"`
  5349. Color of the decorative object used to represent model lights in the rendering.
  5350. .. _visual-rgba-selectpoint:
  5351. :at:`selectpoint`: :at-val:`real(4), "0.9 0.9 0.1 1"`
  5352. Color of the sphere used to render the selection point.
  5353. .. _visual-rgba-connect:
  5354. :at:`connect`: :at-val:`real(4), "0.2 0.2 0.8 1"`
  5355. Color of the capsules used to connect bodies and joints, resulting in an automatically generated skeleton.
  5356. .. _visual-rgba-contactpoint:
  5357. :at:`contactpoint`: :at-val:`real(4), "0.9 0.6 0.2 1"`
  5358. Color of the cylinders used to render contact points.
  5359. .. _visual-rgba-contactforce:
  5360. :at:`contactforce`: :at-val:`real(4), "0.7 0.9 0.9 1"`
  5361. Color of the arrows used to render contact forces. When splitting of contact forces into normal and tangential
  5362. components is enabled, this color is used to render the normal components.
  5363. .. _visual-rgba-contactfriction:
  5364. :at:`contactfriction`: :at-val:`real(4), "0.9 0.8 0.4 1"`
  5365. Color of the arrows used to render contact tangential forces, only when splitting is enabled.
  5366. .. _visual-rgba-contacttorque:
  5367. :at:`contacttorque`: :at-val:`real(4), "0.9 0.7 0.9 1"`
  5368. Color of the arrows used to render contact torques (currently disabled).
  5369. .. _visual-rgba-contactgap:
  5370. :at:`contactgap`: :at-val:`real(4), "0.5, 0.8, 0.9, 1"`
  5371. Color of contacts that fall in the contact gap (and are thereby excluded from contact force computations).
  5372. .. _visual-rgba-rangefinder:
  5373. :at:`rangefinder`: :at-val:`real(4), "1 1 0.1 1"`
  5374. Color of line geoms used to render rangefinder sensors.
  5375. .. _visual-rgba-constraint:
  5376. :at:`constraint`: :at-val:`real(4), "0.9 0 0 1"`
  5377. Color of the capsules corresponding to spatial constraint violations.
  5378. .. _visual-rgba-slidercrank:
  5379. :at:`slidercrank`: :at-val:`real(4), "0.5 0.3 0.8 1"`
  5380. Color of slider-crank mechanisms.
  5381. .. _visual-rgba-crankbroken:
  5382. :at:`crankbroken`: :at-val:`real(4), "0.9 0 0 1"`
  5383. Color used to render the crank of slide-crank mechanisms, in model configurations where the specified rod length
  5384. cannot be maintained, i.e., it is "broken".
  5385. .. _visual-rgba-frustum:
  5386. :at:`frustum`: :at-val:`real(4), "1 1 0 0.2"`
  5387. Color used to render the camera frustum.
  5388. .. _visual-rgba-bv:
  5389. :at:`bv`: :at-val:`real(4), "0 1 0 0.5"`
  5390. Color used to render bounding volumes.
  5391. .. _visual-rgba-bvactive:
  5392. :at:`bvactive`: :at-val:`real(4), "1 0 0 0.5"`
  5393. Color used to render active bounding volumes, if the :ref:`bvactive<visual-global-bvactive>` flag is "true".
  5394. .. _default:
  5395. **default** (R)
  5396. ~~~~~~~~~~~~~~~
  5397. This element is used to create a new defaults class; see :ref:`CDefault` above. Defaults classes can be nested,
  5398. inheriting all attribute values from their parent. The top-level defaults class is always defined; it is called "main"
  5399. if omitted.
  5400. .. _default-class:
  5401. :at:`class`: :at-val:`string, required (except at the top level)`
  5402. The name of the defaults class. It must be unique among all defaults classes. This name is used to make the class
  5403. active when creating an actual model element.
  5404. .. _default-mesh:
  5405. .. _default-mesh-scale:
  5406. .. _default-mesh-maxhullvert:
  5407. :el-prefix:`default/` |-| **mesh** (?)
  5408. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5409. | This element sets the attributes of the dummy :ref:`mesh <asset-mesh>` element of the defaults class.
  5410. | The available attributes are: :ref:`scale <asset-mesh-scale>` and :ref:`scale <asset-mesh-maxhullvert>`.
  5411. .. _default-material:
  5412. .. _default-material-texture:
  5413. .. _default-material-emission:
  5414. .. _default-material-specular:
  5415. .. _default-material-shininess:
  5416. .. _default-material-reflectance:
  5417. .. _default-material-metallic:
  5418. .. _default-material-roughness:
  5419. .. _default-material-rgba:
  5420. .. _default-material-texrepeat:
  5421. .. _default-material-texuniform:
  5422. :el-prefix:`default/` |-| **material** (?)
  5423. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5424. | This element sets the attributes of the dummy :ref:`material <asset-material>` element of the defaults class.
  5425. | All material attributes are available here except: name, class.
  5426. .. _default-joint:
  5427. .. _default-joint-type:
  5428. .. _default-joint-group:
  5429. .. _default-joint-pos:
  5430. .. _default-joint-axis:
  5431. .. _default-joint-springdamper:
  5432. .. _default-joint-limited:
  5433. .. _default-joint-actuatorfrclimited:
  5434. .. _default-joint-actuatorgravcomp:
  5435. .. _default-joint-solreflimit:
  5436. .. _default-joint-solimplimit:
  5437. .. _default-joint-solreffriction:
  5438. .. _default-joint-solimpfriction:
  5439. .. _default-joint-stiffness:
  5440. .. _default-joint-range:
  5441. .. _default-joint-actuatorfrcrange:
  5442. .. _default-joint-margin:
  5443. .. _default-joint-ref:
  5444. .. _default-joint-springref:
  5445. .. _default-joint-armature:
  5446. .. _default-joint-damping:
  5447. .. _default-joint-frictionloss:
  5448. .. _default-joint-user:
  5449. :el-prefix:`default/` |-| **joint** (?)
  5450. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5451. | This element sets the attributes of the dummy :ref:`joint <body-joint>` element of the defaults class.
  5452. | All joint attributes are available here except: name, class.
  5453. .. _default-geom:
  5454. .. _default-geom-type:
  5455. .. _default-geom-pos:
  5456. .. _default-geom-quat:
  5457. .. _default-geom-contype:
  5458. .. _default-geom-conaffinity:
  5459. .. _default-geom-condim:
  5460. .. _default-geom-group:
  5461. .. _default-geom-priority:
  5462. .. _default-geom-size:
  5463. .. _default-geom-material:
  5464. .. _default-geom-friction:
  5465. .. _default-geom-mass:
  5466. .. _default-geom-density:
  5467. .. _default-geom-shellinertia:
  5468. .. _default-geom-solmix:
  5469. .. _default-geom-solref:
  5470. .. _default-geom-solimp:
  5471. .. _default-geom-margin:
  5472. .. _default-geom-gap:
  5473. .. _default-geom-fromto:
  5474. .. _default-geom-axisangle:
  5475. .. _default-geom-xyaxes:
  5476. .. _default-geom-zaxis:
  5477. .. _default-geom-euler:
  5478. .. _default-geom-hfield:
  5479. .. _default-geom-mesh:
  5480. .. _default-geom-fitscale:
  5481. .. _default-geom-rgba:
  5482. .. _default-geom-fluidshape:
  5483. .. _default-geom-fluidcoef:
  5484. .. _default-geom-user:
  5485. :el-prefix:`default/` |-| **geom** (?)
  5486. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5487. | This element sets the attributes of the dummy :ref:`geom <body-geom>` element of the defaults class.
  5488. | All geom attributes are available here except: name, class.
  5489. .. _default-site:
  5490. .. _default-site-type:
  5491. .. _default-site-group:
  5492. .. _default-site-pos:
  5493. .. _default-site-quat:
  5494. .. _default-site-material:
  5495. .. _default-site-size:
  5496. .. _default-site-fromto:
  5497. .. _default-site-axisangle:
  5498. .. _default-site-xyaxes:
  5499. .. _default-site-zaxis:
  5500. .. _default-site-euler:
  5501. .. _default-site-rgba:
  5502. .. _default-site-user:
  5503. :el-prefix:`default/` |-| **site** (?)
  5504. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5505. | This element sets the attributes of the dummy :ref:`site <body-site>` element of the defaults class.
  5506. | All site attributes are available here except: name, class.
  5507. .. _default-camera-orthographic:
  5508. .. _default-camera-fovy:
  5509. .. _default-camera-resolution:
  5510. .. _default-camera-ipd:
  5511. .. _default-camera-pos:
  5512. .. _default-camera-quat:
  5513. .. _default-camera-axisangle:
  5514. .. _default-camera-xyaxes:
  5515. .. _default-camera-zaxis:
  5516. .. _default-camera-euler:
  5517. .. _default-camera-mode:
  5518. .. _default-camera-user:
  5519. .. _default-camera-focal:
  5520. .. _default-camera-focalpixel:
  5521. .. _default-camera-principal:
  5522. .. _default-camera-principalpixel:
  5523. .. _default-camera-sensorsize:
  5524. .. _default-camera:
  5525. :el-prefix:`default/` |-| **camera** (?)
  5526. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5527. | This element sets the attributes of the dummy :ref:`camera <body-camera>` element of the defaults class.
  5528. | All camera attributes are available here except: name, class, mode, target.
  5529. .. _default-light:
  5530. .. _default-light-pos:
  5531. .. _default-light-dir:
  5532. .. _default-light-bulbradius:
  5533. .. _default-light-directional:
  5534. .. _default-light-castshadow:
  5535. .. _default-light-active:
  5536. .. _default-light-attenuation:
  5537. .. _default-light-cutoff:
  5538. .. _default-light-exponent:
  5539. .. _default-light-ambient:
  5540. .. _default-light-diffuse:
  5541. .. _default-light-specular:
  5542. .. _default-light-mode:
  5543. :el-prefix:`default/` |-| **light** (?)
  5544. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5545. | This element sets the attributes of the dummy :ref:`light <body-light>` element of the defaults class.
  5546. | All light attributes are available here except: name, class.
  5547. .. _default-pair:
  5548. .. _default-pair-condim:
  5549. .. _default-pair-friction:
  5550. .. _default-pair-solref:
  5551. .. _default-pair-solreffriction:
  5552. .. _default-pair-solimp:
  5553. .. _default-pair-gap:
  5554. .. _default-pair-margin:
  5555. :el-prefix:`default/` |-| **pair** (?)
  5556. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5557. | This element sets the attributes of the dummy :ref:`pair <contact-pair>` element of the defaults class.
  5558. | All pair attributes are available here except: name, class, geom1, geom2.
  5559. .. _default-equality:
  5560. .. _default-equality-active:
  5561. .. _default-equality-solref:
  5562. .. _default-equality-solimp:
  5563. :el-prefix:`default/` |-| **equality** (?)
  5564. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5565. | This element sets the attributes of the dummy :ref:`equality <equality>` element of the defaults class. The actual
  5566. equality constraints have types depending on the sub-element used to define them. However here we are setting
  5567. attributes common to all equality constraint types, which is why we do not make a distinction between types.
  5568. | The equality sub-element attributes available here are: :at:`active`, :at:`solref`, :at:`solimp`.
  5569. .. _default-tendon:
  5570. .. _default-tendon-group:
  5571. .. _default-tendon-limited:
  5572. .. _default-tendon-range:
  5573. .. _default-tendon-solreflimit:
  5574. .. _default-tendon-solimplimit:
  5575. .. _default-tendon-solreffriction:
  5576. .. _default-tendon-solimpfriction:
  5577. .. _default-tendon-frictionloss:
  5578. .. _default-tendon-springlength:
  5579. .. _default-tendon-width:
  5580. .. _default-tendon-material:
  5581. .. _default-tendon-margin:
  5582. .. _default-tendon-stiffness:
  5583. .. _default-tendon-damping:
  5584. .. _default-tendon-rgba:
  5585. .. _default-tendon-user:
  5586. :el-prefix:`default/` |-| **tendon** (?)
  5587. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5588. | This element sets the attributes of the dummy :ref:`tendon <tendon>` element of the defaults class. Similar to
  5589. equality constraints, the actual tendons have types, but here we are setting attributes common to all types.
  5590. | All tendon sub-element attributes are available here except: name, class.
  5591. .. _default-general:
  5592. .. _default-general-ctrllimited:
  5593. .. _default-general-forcelimited:
  5594. .. _default-general-actlimited:
  5595. .. _default-general-ctrlrange:
  5596. .. _default-general-forcerange:
  5597. .. _default-general-actrange:
  5598. .. _default-general-gear:
  5599. .. _default-general-cranklength:
  5600. .. _default-general-user:
  5601. .. _default-general-group:
  5602. .. _default-general-actdim:
  5603. .. _default-general-dyntype:
  5604. .. _default-general-gaintype:
  5605. .. _default-general-biastype:
  5606. .. _default-general-dynprm:
  5607. .. _default-general-gainprm:
  5608. .. _default-general-biasprm:
  5609. .. _default-general-actearly:
  5610. :el-prefix:`default/` |-| **general** (?)
  5611. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5612. | This element sets the attributes of the dummy :ref:`general <actuator-general>` element of the defaults class.
  5613. | All general attributes are available here except: name, class, joint, jointinparent, site, refsite, tendon,
  5614. slidersite, cranksite.
  5615. .. _default-motor:
  5616. .. _default-motor-ctrllimited:
  5617. .. _default-motor-forcelimited:
  5618. .. _default-motor-ctrlrange:
  5619. .. _default-motor-forcerange:
  5620. .. _default-motor-gear:
  5621. .. _default-motor-cranklength:
  5622. .. _default-motor-user:
  5623. .. _default-motor-group:
  5624. :el-prefix:`default/` |-| **motor** (?)
  5625. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5626. This and the next three elements set the attributes of the :ref:`general <actuator-general>` element using
  5627. :ref:`Actuator shortcuts <CActShortcuts>`. It does not make sense to use more than one such shortcut in the same defaults
  5628. class, because they set the same underlying attributes, replacing any previous settings. All
  5629. :ref:`motor <actuator-motor>` attributes are available here except: name, class, joint, jointinparent, site, refsite,
  5630. tendon, slidersite, cranksite.
  5631. .. _default-position:
  5632. .. _default-position-ctrllimited:
  5633. .. _default-position-forcelimited:
  5634. .. _default-position-ctrlrange:
  5635. .. _default-position-inheritrange:
  5636. .. _default-position-forcerange:
  5637. .. _default-position-gear:
  5638. .. _default-position-cranklength:
  5639. .. _default-position-user:
  5640. .. _default-position-group:
  5641. .. _default-position-kp:
  5642. .. _default-position-kv:
  5643. .. _default-position-dampratio:
  5644. .. _default-position-timeconst:
  5645. :el-prefix:`default/` |-| **position** (?)
  5646. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5647. All :ref:`position <actuator-position>` attributes are available here except: name, class, joint, jointinparent, site,
  5648. refsite, tendon, slidersite, cranksite.
  5649. .. _default-velocity:
  5650. .. _default-velocity-ctrllimited:
  5651. .. _default-velocity-forcelimited:
  5652. .. _default-velocity-ctrlrange:
  5653. .. _default-velocity-forcerange:
  5654. .. _default-velocity-gear:
  5655. .. _default-velocity-cranklength:
  5656. .. _default-velocity-user:
  5657. .. _default-velocity-group:
  5658. .. _default-velocity-kv:
  5659. :el-prefix:`default/` |-| **velocity** (?)
  5660. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5661. All :ref:`velocity <actuator-velocity>` attributes are available here except: name, class, joint, jointinparent, site,
  5662. refsite, tendon, slidersite, cranksite.
  5663. .. _default-intvelocity:
  5664. .. _default-intvelocity-ctrllimited:
  5665. .. _default-intvelocity-forcelimited:
  5666. .. _default-intvelocity-ctrlrange:
  5667. .. _default-intvelocity-forcerange:
  5668. .. _default-intvelocity-actrange:
  5669. .. _default-intvelocity-inheritrange:
  5670. .. _default-intvelocity-gear:
  5671. .. _default-intvelocity-cranklength:
  5672. .. _default-intvelocity-user:
  5673. .. _default-intvelocity-group:
  5674. .. _default-intvelocity-kp:
  5675. .. _default-intvelocity-kv:
  5676. .. _default-intvelocity-dampratio:
  5677. :el-prefix:`default/` |-| **intvelocity** (?)
  5678. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5679. All :ref:`intvelocity <actuator-intvelocity>` attributes are available here except: name, class, joint, jointinparent,
  5680. site, refsite, tendon, slidersite, cranksite.
  5681. .. _default-damper:
  5682. .. _default-damper-forcelimited:
  5683. .. _default-damper-ctrlrange:
  5684. .. _default-damper-forcerange:
  5685. .. _default-damper-gear:
  5686. .. _default-damper-cranklength:
  5687. .. _default-damper-user:
  5688. .. _default-damper-group:
  5689. .. _default-damper-kv:
  5690. :el-prefix:`default/` |-| **damper** (?)
  5691. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5692. All :ref:`damper <actuator-damper>` attributes are available here except: name, class, joint, jointinparent, site,
  5693. refsite, tendon, slidersite, cranksite.
  5694. .. _default-cylinder:
  5695. .. _default-cylinder-ctrllimited:
  5696. .. _default-cylinder-forcelimited:
  5697. .. _default-cylinder-ctrlrange:
  5698. .. _default-cylinder-forcerange:
  5699. .. _default-cylinder-gear:
  5700. .. _default-cylinder-cranklength:
  5701. .. _default-cylinder-user:
  5702. .. _default-cylinder-group:
  5703. .. _default-cylinder-timeconst:
  5704. .. _default-cylinder-area:
  5705. .. _default-cylinder-diameter:
  5706. .. _default-cylinder-bias:
  5707. :el-prefix:`default/` |-| **cylinder** (?)
  5708. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5709. All :ref:`cylinder <actuator-cylinder>` attributes are available here except: name, class, joint, jointinparent, site,
  5710. refsite, tendon, slidersite, cranksite.
  5711. .. _default-muscle:
  5712. .. _default-muscle-ctrllimited:
  5713. .. _default-muscle-forcelimited:
  5714. .. _default-muscle-ctrlrange:
  5715. .. _default-muscle-forcerange:
  5716. .. _default-muscle-gear:
  5717. .. _default-muscle-cranklength:
  5718. .. _default-muscle-user:
  5719. .. _default-muscle-group:
  5720. .. _default-muscle-timeconst:
  5721. .. _default-muscle-range:
  5722. .. _default-muscle-force:
  5723. .. _default-muscle-scale:
  5724. .. _default-muscle-lmin:
  5725. .. _default-muscle-lmax:
  5726. .. _default-muscle-vmax:
  5727. .. _default-muscle-fpmax:
  5728. .. _default-muscle-fvmax:
  5729. :el-prefix:`default/` |-| **muscle** (?)
  5730. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5731. All :ref:`muscle <actuator-muscle>` attributes are available here except: name, class, joint, jointinparent, site,
  5732. refsite, tendon, slidersite, cranksite.
  5733. .. _default-adhesion:
  5734. .. _default-adhesion-forcelimited:
  5735. .. _default-adhesion-ctrlrange:
  5736. .. _default-adhesion-forcerange:
  5737. .. _default-adhesion-gain:
  5738. .. _default-adhesion-user:
  5739. .. _default-adhesion-group:
  5740. :el-prefix:`default/` |-| **adhesion** (?)
  5741. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5742. All :ref:`adhesion <actuator-adhesion>` attributes are available here except: name, class, body.
  5743. .. _custom:
  5744. **custom** (*)
  5745. ~~~~~~~~~~~~~~
  5746. This is a grouping element for custom numeric and text elements. It does not have attributes.
  5747. .. _custom-numeric:
  5748. :el-prefix:`custom/` |-| **numeric** (*)
  5749. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5750. This element creates a custom numeric array in mjModel.
  5751. .. _custom-numeric-name:
  5752. :at:`name`: :at-val:`string, required`
  5753. The name of the array. This attribute is required because the only way to find a custom element of interest at
  5754. runtime is through its name.
  5755. .. _custom-numeric-size:
  5756. :at:`size`: :at-val:`int, optional`
  5757. If specified this attribute sets the size of the data array, in doubles. If this attribute is not specified, the size
  5758. will be inferred from the actual data array below.
  5759. .. _custom-numeric-data:
  5760. :at:`data`: :at-val:`real(size), "0 0 ..."`
  5761. Numeric data to be copied into mjModel. If size is specified, the length of the array given here cannot exceed the
  5762. specified size. If the length of the array is smaller, the missing components are set to 0. Note that custom arrays
  5763. can be created for storing information at runtime - which is why data initialization is optional. It becomes required
  5764. only when the array size is omitted.
  5765. .. _custom-text:
  5766. :el-prefix:`custom/` |-| **text** (*)
  5767. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5768. This element creates a custom text field in mjModel. It could be used to store keyword commands for user callbacks and
  5769. other custom computations.
  5770. .. _custom-text-name:
  5771. :at:`name`: :at-val:`string, required`
  5772. Name of the custom text field.
  5773. .. _custom-text-data:
  5774. :at:`data`: :at-val:`string, required`
  5775. Custom text to be copied into mjModel.
  5776. .. _custom-tuple:
  5777. :el-prefix:`custom/` |-| **tuple** (*)
  5778. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5779. This element creates a custom tuple, which is a list of MuJoCo objects. The list is created by referencing the desired
  5780. objects by name.
  5781. .. _custom-tuple-name:
  5782. :at:`name`: :at-val:`string, required`
  5783. Name of the custom tuple.
  5784. .. _tuple-element:
  5785. :el-prefix:`tuple/` |-| **element** (*)
  5786. '''''''''''''''''''''''''''''''''''''''
  5787. This adds an element to the tuple.
  5788. .. _tuple-element-objtype:
  5789. :at:`objtype`: :at-val:`(any element type that can be named), required`
  5790. Type of the object being added.
  5791. .. _tuple-element-objname:
  5792. :at:`objname`: :at-val:`string, required`
  5793. Name of the object being added. The type and name must reference a named MuJoCo element defined somewhere in the
  5794. model. Tuples can also be referenced (including self-references).
  5795. .. _tuple-element-prm:
  5796. :at:`prm`: :at-val:`real, "0"`
  5797. Real-valued parameter associated with this element of the tuple. Its use is up to the user.
  5798. .. _extension:
  5799. **extension** (*)
  5800. ~~~~~~~~~~~~~~~~~
  5801. This is a grouping element for MuJoCo extensions. Extensions allow the user to extend MuJoCo's capabilities with custom
  5802. code and are described in detail in the Programming chapter's :ref:`exExtension` page. Currently, the only available
  5803. extension type are :ref:`exPlugin`.
  5804. .. _extension-plugin:
  5805. :el-prefix:`extension/` |-| **plugin** (*)
  5806. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  5807. This element specifies that an engine plugin is required in order to simulate this model.
  5808. See :ref:`exPlugin` for more details.
  5809. .. _extension-plugin-plugin:
  5810. :at:`plugin`: :at-val:`string, required`
  5811. Identifier of the plugin.
  5812. .. _plugin-instance:
  5813. :el-prefix:`plugin/` |-| **instance** (*)
  5814. '''''''''''''''''''''''''''''''''''''''''
  5815. Declares a plugin instance. Explicit instances declaration is required when multiple elements are backed by the same
  5816. plugin, or when global plugin configuration is desired. See plugin :ref:`declaration<exDeclaration>` and
  5817. :ref:`configuration<exConfiguration>` for more details.
  5818. .. _plugin-instance-name:
  5819. :at:`name`: :at-val:`string, required`
  5820. Name of the plugin instance.
  5821. .. _plugin-config:
  5822. .. _instance-config:
  5823. :el-prefix:`instance/` |-| **config** (*)
  5824. """""""""""""""""""""""""""""""""""""""""
  5825. Configuration of a plugin instance. When implicitly declaring a plugin under a model element, configuration is
  5826. performed with identical semantics using :el:`element/plugin/config`. The elements which currently support plugins are
  5827. :el:`body`, :el:`composite`, :el:`actuator` and :el:`sensor`.
  5828. .. _plugin-config-key:
  5829. .. _instance-config-key:
  5830. :at:`key`: :at-val:`string, optional`
  5831. Key used for plugin configuration.
  5832. .. _plugin-config-value:
  5833. .. _instance-config-value:
  5834. :at:`value`: :at-val:`string, optional`
  5835. Value associated with key.