fix: ik slover
@ -32,47 +32,44 @@
|
||||
<!-- <LeftArm id="left_arm" devtype="ti5Robot" />-->
|
||||
<!-- <RightArm />-->
|
||||
<!-- <Neck/>-->
|
||||
<!-- <Humanoid id="hc01" dof="14"-->
|
||||
<!-- urdf="/home/tankaitao/cmvr-lgv/cmvr-es/config/robot_description/hc_description/dual_arm.urdf"-->
|
||||
<!-- baseLink="PELVIS_S"-->
|
||||
<!-- jointNames="L_SHOULDER_P,L_SHOULDER_R,L_SHOULDER_Y,L_ELBOW_R,L_WRIST_P,L_WRIST_Y,L_WRIST_R,R_SHOULDER_P,R_SHOULDER_R,R_SHOULDER_Y,R_ELBOW_R,R_WRIST_P,R_WRIST_Y,R_WRIST_R"-->
|
||||
<!-- linkNames="PELVIS_S,L_SHOULDER_P_S,L_SHOULDER_R_S,L_SHOULDER_Y_S,L_ELBOW_R_S,L_WRIST_P_S,L_WRIST_Y_S,L_WRIST_R_S,R_SHOULDER_P_S,R_SHOULDER_R_S,R_SHOULDER_Y_S,R_ELBOW_R_S,R_WRIST_P_S,R_WRIST_Y_S,R_WRIST_R_S,R_FINGER_TIP,R_CAM"-->
|
||||
<!-- bufferSize="50"-->
|
||||
<!-- verbose="false">-->
|
||||
<!-- <CanManger id="" devId="">-->
|
||||
<!-- <LeftArmCan id = " " devId = " " channelId ="0" enable="false" toolFrame="L_FINGER_TIP">-->
|
||||
<!-- <Motor id="23" jointName="L_SHOULDER_P" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
|
||||
<!-- <Motor id="24" jointName="L_SHOULDER_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
|
||||
<!-- <Motor id="25" jointName="L_SHOULDER_Y" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
|
||||
<!-- <Motor id="26" jointName="L_ELBOW_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
|
||||
<!-- <Motor id="27" jointName="L_WRIST_P" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
|
||||
<!-- <Motor id="28" jointName="L_WRIST_Y" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
|
||||
<!-- <Motor id="1" jointName="L_WRIST_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
|
||||
<!-- </LeftArmCan>-->
|
||||
<!-- <RightArmCan id = " " devId = " " channelId ="1" enable="false" toolFrame="R_FINGER_TIP">-->
|
||||
<!-- <Motor id="16" jointName="R_SHOULDER_P" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
|
||||
<!-- <Motor id="17" jointName="R_SHOULDER_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
|
||||
<!-- <Motor id="18" jointName="R_SHOULDER_Y" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
|
||||
<!-- <Motor id="19" jointName="R_ELBOW_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
|
||||
<!-- <Motor id="20" jointName="R_WRIST_P" limitQLb="-3.14" limitQUb="3.14" limitQd="3.0"/>-->
|
||||
<!-- <Motor id="21" jointName="R_WRIST_Y" limitQLb="-1.102" limitQUb="1.02" limitQd="3.0"/>-->
|
||||
<!-- <Motor id="22" jointName="R_WRIST_R" limitQLb="-0.293" limitQUb="1.57079" limitQd="3.0"/>-->
|
||||
<!-- </RightArmCan>-->
|
||||
<!-- <HeadCan id = " " devId = " " channelId ="2" enable="false">-->
|
||||
<!-- <Motor id="32" jointName="HEAD_Y" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
|
||||
<!-- <Motor id="30" jointName="HEAD_P" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
|
||||
<!-- <Motor id="31" jointName="HEAD_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
|
||||
<!-- </HeadCan>-->
|
||||
<!-- <WaistCan id = " " devId = " " channelId ="3" enable="false">-->
|
||||
<!-- <Motor id="14" jointName="WAIST_Y" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
|
||||
<!-- <Motor id="15" jointName="WAIST_P" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>-->
|
||||
<!-- </WaistCan>-->
|
||||
<!-- </CanManger>-->
|
||||
<Humanoid id="hc01" dof="14"
|
||||
urdf="/home/lgv/cmvr/cmvr-es/config/robot_description/hc_description/dual_arm.urdf"
|
||||
baseLink="PELVIS_S"
|
||||
jointNames="L_SHOULDER_P,L_SHOULDER_R,L_SHOULDER_Y,L_ELBOW_R,L_WRIST_P,L_WRIST_Y,L_WRIST_R,R_SHOULDER_P,R_SHOULDER_R,R_SHOULDER_Y,R_ELBOW_R,R_WRIST_P,R_WRIST_Y,R_WRIST_R"
|
||||
linkNames="PELVIS_S,L_SHOULDER_P_S,L_SHOULDER_R_S,L_SHOULDER_Y_S,L_ELBOW_R_S,L_WRIST_P_S,L_WRIST_Y_S,L_WRIST_R_S,R_SHOULDER_P_S,R_SHOULDER_R_S,R_SHOULDER_Y_S,R_ELBOW_R_S,R_WRIST_P_S,R_WRIST_Y_S,R_WRIST_R_S,R_FINGER_TIP,R_CAM"
|
||||
bufferSize="50"
|
||||
verbose="false">
|
||||
<CanManger id="" devId="">
|
||||
<LeftArmCan id = " " devId = " " channelId ="0" enable="false" toolFrame="L_FINGER_TIP">
|
||||
<Motor id="23" jointName="L_SHOULDER_P" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
|
||||
<Motor id="24" jointName="L_SHOULDER_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
|
||||
<Motor id="25" jointName="L_SHOULDER_Y" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
|
||||
<Motor id="26" jointName="L_ELBOW_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
|
||||
<Motor id="27" jointName="L_WRIST_P" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
|
||||
<Motor id="28" jointName="L_WRIST_Y" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
|
||||
<Motor id="22" jointName="L_WRIST_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
|
||||
</LeftArmCan>
|
||||
<RightArmCan id = " " devId = " " channelId ="1" enable="true" toolFrame="R_FINGER_TIP">
|
||||
<Motor id="16" jointName="R_SHOULDER_P" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
|
||||
<Motor id="17" jointName="R_SHOULDER_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
|
||||
<Motor id="18" jointName="R_SHOULDER_Y" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
|
||||
<Motor id="19" jointName="R_ELBOW_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
|
||||
<Motor id="20" jointName="R_WRIST_P" limitQLb="-3.14" limitQUb="3.14" limitQd="3.0"/>
|
||||
<Motor id="21" jointName="R_WRIST_Y" limitQLb="-1.102" limitQUb="1.02" limitQd="3.0"/>
|
||||
<Motor id="1" jointName="R_WRIST_R" limitQLb="-0.293" limitQUb="1.57079" limitQd="3.0"/>
|
||||
</RightArmCan>
|
||||
<HeadCan id = " " devId = " " channelId ="2" enable="false">
|
||||
<Motor id="32" jointName="HEAD_Y" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
|
||||
<Motor id="30" jointName="HEAD_P" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
|
||||
<Motor id="31" jointName="HEAD_R" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
|
||||
</HeadCan>
|
||||
<WaistCan id = " " devId = " " channelId ="3" enable="false">
|
||||
<Motor id="14" jointName="WAIST_Y" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
|
||||
<Motor id="15" jointName="WAIST_P" limitQLb="3.14" limitQUb="3.14" limitQd="3.0"/>
|
||||
</WaistCan>
|
||||
</CanManger>
|
||||
|
||||
<!-- </Humanoid>-->
|
||||
<!-- <AuboRobot id="hc02" ip="127.0.0.1" port="30004" username="aubo" password="123456">-->
|
||||
|
||||
<!-- </AuboRobot>-->
|
||||
</Humanoid>
|
||||
</Robot>
|
||||
|
||||
<BioHead>
|
||||
|
||||
@ -1,134 +1,110 @@
|
||||
t,q1,qd1,qdd1
|
||||
0.0000000000,0.0000000000,0.0000000000,0.0000000000
|
||||
0.0100000000,0.0000406839,0.0150597278,2.9544225473
|
||||
0.0200000000,0.0003318988,0.0434389689,2.8328411544
|
||||
0.0300000000,0.0009089804,0.0721925912,2.9085974602
|
||||
0.0400000000,0.0017753841,0.1011555878,2.9788370387
|
||||
0.0500000000,0.0029332621,0.1304223336,2.8974621431
|
||||
0.0600000000,0.0043835776,0.1596780532,2.9849342393
|
||||
0.0700000000,0.0061276028,0.1891399125,2.9436385788
|
||||
0.0800000000,0.0081659118,0.2185494408,2.9100229391
|
||||
0.0900000000,0.0104989150,0.2480391312,2.9903919563
|
||||
0.1000000000,0.0131273068,0.2776386486,2.9710319107
|
||||
0.1100000000,0.0160514180,0.3072295680,2.9553609553
|
||||
0.1200000000,0.0192715028,0.3368228958,2.9429784390
|
||||
0.1300000000,0.0227878085,0.3664259693,2.9333976058
|
||||
0.1400000000,0.0266005752,0.3960787191,2.9965532367
|
||||
0.1500000000,0.0307100762,0.4257870931,2.9893875915
|
||||
0.1600000000,0.0351164853,0.4555002329,2.9835420444
|
||||
0.1700000000,0.0398199454,0.4852198851,2.9788128547
|
||||
0.1800000000,0.0448205874,0.5149470456,2.9750155809
|
||||
0.1900000000,0.0501185300,0.5446821560,2.9719877241
|
||||
0.2000000000,0.0557138798,0.5744252584,2.9695884669
|
||||
0.2100000000,0.0616067323,0.6041761124,2.9676970254
|
||||
0.2200000000,0.0677971720,0.6339342832,2.9662104321
|
||||
0.2300000000,0.0742852736,0.6636992056,2.9650411835
|
||||
0.2400000000,0.0810711022,0.6934702307,2.9641149689
|
||||
0.2500000000,0.0881547141,0.7232466591,2.9633685823
|
||||
0.2600000000,0.0955361574,0.7530277630,2.9627480494
|
||||
0.2700000000,0.1032154722,0.7828128015,2.9622069731
|
||||
0.2800000000,0.1111926914,0.8126010294,2.9617050786
|
||||
0.2900000000,0.1194678407,0.8423917022,2.9612069361
|
||||
0.3000000000,0.1280409386,0.8721840779,2.9606808319
|
||||
0.3100000000,0.1369119973,0.9019774156,2.9600977635
|
||||
0.3200000000,0.1460810222,0.9317709736,2.9594305320
|
||||
0.3300000000,0.1555480123,0.9615640043,2.9586529089
|
||||
0.3400000000,0.1653129605,0.9913614506,2.9994436646
|
||||
0.3500000000,0.1753758533,1.0211579226,2.9987759136
|
||||
0.3600000000,0.1857366703,1.0509520895,2.9980466764
|
||||
0.3700000000,0.1963953845,1.0807433647,2.9972296032
|
||||
0.3800000000,0.2073519622,1.1105311329,2.9962959464
|
||||
0.3900000000,0.2186063626,1.1403147437,2.9952138015
|
||||
0.4000000000,0.2301585380,1.1700935028,2.9939472846
|
||||
0.4100000000,0.2420084329,1.1998666617,2.9924556275
|
||||
0.4200000000,0.2541559844,1.2296334033,2.9906921714
|
||||
0.4300000000,0.2666011211,1.2593928252,2.9886032370
|
||||
0.4400000000,0.2793437633,1.2891439183,2.9861268471
|
||||
0.4500000000,0.2923838217,1.3188855399,2.9831912740
|
||||
0.4600000000,0.3057211976,1.3486163807,2.9797133785
|
||||
0.4700000000,0.3193557814,1.3783349239,2.9755967043
|
||||
0.4800000000,0.3332874520,1.4080393945,2.9707292859
|
||||
0.4900000000,0.3475160759,1.4377276969,2.9649811176
|
||||
0.5000000000,0.3620415055,1.4673973379,2.9582012286
|
||||
0.5100000000,0.3768520933,1.4935024462,2.3994624602
|
||||
0.5200000000,0.3918443109,1.5001292329,-0.0473926375
|
||||
0.5300000000,0.4068455345,1.5000904478,-0.0558181019
|
||||
0.5400000000,0.4218466876,1.5000544796,-0.0617672439
|
||||
0.5500000000,0.4368477831,1.5000228970,-0.0657945138
|
||||
0.5600000000,0.4518488328,1.5000034924,0.0646808468
|
||||
0.5700000000,0.4668498542,1.5000225620,0.0580673577
|
||||
0.5800000000,0.4818508530,1.5000357501,0.0528981018
|
||||
0.5900000000,0.4968518295,1.5000446841,0.0489129125
|
||||
0.6000000000,0.5118527850,1.5000505493,0.0458984781
|
||||
0.6100000000,0.5268537219,1.5000542156,0.0436792658
|
||||
0.6200000000,0.5418546430,1.5000563308,0.0421099146
|
||||
0.6300000000,0.5568555514,1.5000573907,0.0410687802
|
||||
0.6400000000,0.5718564501,1.5000577910,0.0404523670
|
||||
0.6500000000,0.5868573425,1.5000578650,0.0401704239
|
||||
0.6600000000,0.6018582318,1.5000579132,0.0401415090
|
||||
0.6700000000,0.6168591213,1.5000582237,0.0402888495
|
||||
0.6800000000,0.6318600142,1.5000590879,0.0405363350
|
||||
0.6900000000,0.6468609138,1.5000608096,0.0408044882
|
||||
0.7000000000,0.6618618236,1.5000637088,0.0410062532
|
||||
0.7100000000,0.6768627471,1.5000681192,0.0410424371
|
||||
0.7200000000,0.6918636881,1.5000743763,0.0407966178
|
||||
0.7300000000,0.7068646509,1.5000827939,0.0401293113
|
||||
0.7400000000,0.7218656402,1.5000936245,0.0388711525
|
||||
0.7500000000,0.7368666615,1.5001069976,0.0368147988
|
||||
0.7600000000,0.7518677212,1.5001228260,0.0337052009
|
||||
0.7700000000,0.7668688267,1.5001406711,0.0292278068
|
||||
0.7800000000,0.7818699858,1.5001595500,0.0229941581
|
||||
0.7900000000,0.7968712072,1.5001776641,0.0145242063
|
||||
0.8000000000,0.8118724982,1.5001920227,0.0032245014
|
||||
0.8100000000,0.8268408076,1.4875275785,-2.4236229211
|
||||
0.8200000000,0.8415850092,1.4600455429,-2.9763843157
|
||||
0.8300000000,0.8560369100,1.4303603856,-2.9821334464
|
||||
0.8400000000,0.8701919621,1.4006590026,-2.9869477296
|
||||
0.8500000000,0.8840500235,1.3709435235,-2.9909698326
|
||||
0.8600000000,0.8976109653,1.3412157309,-2.9943223520
|
||||
0.8700000000,0.9108746707,1.3114771308,-2.9971106438
|
||||
0.8800000000,0.9238410335,1.2817290081,-2.9994252697
|
||||
0.8900000000,0.9365099596,1.2519856123,-2.9516661304
|
||||
0.9000000000,0.9488813661,1.2222373806,-2.9548394352
|
||||
0.9100000000,0.9609551735,1.1924800852,-2.9575790728
|
||||
0.9200000000,0.9727313111,1.1627149317,-2.9599417699
|
||||
0.9300000000,0.9842097169,1.1329430086,-2.9619771266
|
||||
0.9400000000,0.9953903367,1.1031653091,-2.9637287294
|
||||
0.9500000000,1.0062731238,1.0733827485,-2.9652351488
|
||||
0.9600000000,1.0168580392,1.0435961801,-2.9665308469
|
||||
0.9700000000,1.0271450505,1.0138064072,-2.9676470105
|
||||
0.9800000000,1.0371341323,0.9840141940,-2.9686123313
|
||||
0.9900000000,1.0468252659,0.9542202743,-2.9694537486
|
||||
1.0000000000,1.0562184391,0.9244253592,-2.9701971713
|
||||
1.0100000000,1.0653136460,0.8946301430,-2.9708681970
|
||||
1.0200000000,1.0741108876,0.8648353085,-2.9714928442
|
||||
1.0300000000,1.0826101708,0.8350415301,-2.9720983147
|
||||
1.0400000000,1.0908115096,0.8052494763,-2.9727138063
|
||||
1.0500000000,1.0987149244,0.7754598102,-2.9733713929
|
||||
1.0600000000,1.1063204427,0.7456731880,-2.9741069935
|
||||
1.0700000000,1.1136280987,0.7158902540,-2.9749614500
|
||||
1.0800000000,1.1206379346,0.6861116337,-2.9759817342
|
||||
1.0900000000,1.1273500000,0.6563379202,-2.9772223010
|
||||
1.1000000000,1.1337643527,0.6265696561,-2.9787465964
|
||||
1.1100000000,1.1398810593,0.5968073062,-2.9806287192
|
||||
1.1200000000,1.1457001954,0.5670512198,-2.9829552013
|
||||
1.1300000000,1.1512218466,0.5373015791,-2.9858268288
|
||||
1.1400000000,1.1564461083,0.5075583300,-2.9893603321
|
||||
1.1500000000,1.1613730868,0.4778210896,-2.9936896219
|
||||
1.1600000000,1.1660028991,0.4480890268,-2.9989659697
|
||||
1.1700000000,1.1703356966,0.4184158210,-2.9408728463
|
||||
1.1800000000,1.1743716794,0.3887671793,-2.9472841555
|
||||
1.1900000000,1.1781110347,0.3591305176,-2.9556079643
|
||||
1.2000000000,1.1815539662,0.3295023791,-2.9662283169
|
||||
1.2100000000,1.1847006925,0.2998771665,-2.9795424021
|
||||
1.2200000000,1.1875514414,0.2702465011,-2.9958998774
|
||||
1.2300000000,1.1901065598,0.2407521222,-2.9205021381
|
||||
1.2400000000,1.1923666133,0.2112921989,-2.9478052207
|
||||
1.2500000000,1.1943319553,0.1817988988,-2.9816509494
|
||||
1.2600000000,1.1960030174,0.1524407057,-2.8915887933
|
||||
1.2700000000,1.1973809412,0.1231678311,-2.9572485748
|
||||
1.2800000000,1.1984662906,0.0939921512,-2.8580629729
|
||||
1.2900000000,1.1992609116,0.0648770893,-2.9932552277
|
||||
1.3000000000,1.1997676425,0.0364479401,-2.9790115923
|
||||
1.3100000000,1.1999870932,0.0078713741,-2.8408663580
|
||||
1.3175726744,1.2000000000,-0.0000000000,-0.0000000000
|
||||
0.0100000000,-0.0000159557,-0.0063777738,-1.9106392001
|
||||
0.0200000000,-0.0002496495,-0.0461350389,-4.8925174498
|
||||
0.0300000000,-0.0009799863,-0.1009783500,-5.7006022582
|
||||
0.0400000000,-0.0022807296,-0.1593365091,-5.9446327575
|
||||
0.0500000000,-0.0041699534,-0.2185817120,-5.9159701967
|
||||
0.0600000000,-0.0066533315,-0.2781414650,-5.9705725375
|
||||
0.0700000000,-0.0097336379,-0.3379378160,-5.9974845155
|
||||
0.0800000000,-0.0134121852,-0.3977883838,-5.9866809788
|
||||
0.0900000000,-0.0176896602,-0.4577119179,-5.9970097232
|
||||
0.1000000000,-0.0225665586,-0.5176710831,-5.9958021374
|
||||
0.1100000000,-0.0280431623,-0.5776536328,-5.9994155793
|
||||
0.1200000000,-0.0341196983,-0.6376542617,-5.9998355059
|
||||
0.1300000000,-0.0407961934,-0.6976428031,-5.9975948022
|
||||
0.1400000000,-0.0480724867,-0.7576129914,-5.9994877401
|
||||
0.1500000000,-0.0559484540,-0.8175781906,-5.9948813054
|
||||
0.1600000000,-0.0644239673,-0.8775223553,-5.9991411360
|
||||
0.1700000000,-0.0734989367,-0.9374685960,-5.9921968215
|
||||
0.1800000000,-0.0831732416,-0.9973926934,-5.9980487477
|
||||
0.1900000000,-0.0934468113,-1.0573180377,-5.9884990499
|
||||
0.2000000000,-0.1043195108,-1.1172260364,-5.9955305424
|
||||
0.2100000000,-0.1157912824,-1.1771239542,-5.9828859374
|
||||
0.2200000000,-0.1278619739,-1.2370190713,-5.9907608055
|
||||
0.2300000000,-0.1405315123,-1.2968780749,-5.9743209965
|
||||
0.2400000000,-0.1537997689,-1.3567629311,-5.9826547281
|
||||
0.2500000000,-0.1676665996,-1.4166118373,-5.9923074269
|
||||
0.2600000000,-0.1821319218,-1.4764412133,-5.9697616364
|
||||
0.2700000000,-0.1970596457,-1.5002473361,0.0171102264
|
||||
0.2800000000,-0.2120611169,-1.5001229872,-0.0936585266
|
||||
0.2900000000,-0.2270627160,-1.5001591883,0.0626046461
|
||||
0.3000000000,-0.2420638680,-1.5001494874,-0.0493634487
|
||||
0.3100000000,-0.2570652126,-1.5001168351,0.0601054870
|
||||
0.3200000000,-0.2720661740,-1.5001226497,-0.0429343553
|
||||
0.3300000000,-0.2870673191,-1.5001201883,0.0376000906
|
||||
0.3400000000,-0.3020681493,-1.5000681224,-0.0536751182
|
||||
0.3500000000,-0.3170691028,-1.5001264472,0.0082265532
|
||||
0.3600000000,-0.3320699393,-1.5000247482,0.0601852966
|
||||
0.3700000000,-0.3470706417,-1.5000970260,-0.0220756027
|
||||
0.3800000000,-0.3620714540,-1.5000937922,0.0202436733
|
||||
0.3900000000,-0.3770720959,-1.5000067263,-0.0509307278
|
||||
0.4000000000,-0.3920727217,-1.5000860034,-0.0153620262
|
||||
0.4100000000,-0.4070734099,-1.5000814991,0.0158196206
|
||||
0.4200000000,-0.4220739813,-1.5000096953,0.0433168602
|
||||
0.4300000000,-0.4370744971,-1.5000652115,-0.0197234398
|
||||
0.4400000000,-0.4520750926,-1.5000792039,0.0048924020
|
||||
0.4500000000,-0.4670756435,-1.5000418289,0.0272059475
|
||||
0.4600000000,-0.4820760839,-1.5000304960,-0.0291077061
|
||||
0.4700000000,-0.4970765865,-1.5000689907,-0.0084527266
|
||||
0.4800000000,-0.5120771137,-1.5000650107,0.0108023623
|
||||
0.4900000000,-0.5270775833,-1.5000230438,0.0289463322
|
||||
0.5000000000,-0.5420779858,-1.5000379628,-0.0229003696
|
||||
0.5100000000,-0.5570784597,-1.5000659848,-0.0053852033
|
||||
0.5200000000,-0.5720789504,-1.5000591832,0.0116064517
|
||||
0.5300000000,-0.5870793908,-1.5000189548,0.0282953124
|
||||
0.5400000000,-0.6020797808,-1.5000382186,-0.0217869758
|
||||
0.5500000000,-0.6170802457,-1.5000652898,-0.0051190608
|
||||
0.5600000000,-0.6320807334,-1.5000590120,0.0117371194
|
||||
0.5700000000,-0.6470811772,-1.5000183275,0.0289971921
|
||||
0.5800000000,-0.6620815779,-1.5000411362,-0.0221300068
|
||||
0.5900000000,-0.6770820652,-1.5000691816,-0.0043107723
|
||||
0.6000000000,-0.6920825806,-1.5000599565,0.0144703189
|
||||
0.6100000000,-0.7070830438,-1.5000094950,0.0344841461
|
||||
0.6200000000,-0.7220834921,-1.5000550755,-0.0204007575
|
||||
0.6300000000,-0.7370840458,-1.5000780803,0.0010977386
|
||||
0.6400000000,-0.7520846130,-1.5000518625,0.0246543532
|
||||
0.6500000000,-0.7670850940,-1.5000277946,-0.0362960678
|
||||
0.6600000000,-0.7820856746,-1.5000839673,-0.0101938888
|
||||
0.6700000000,-0.7970863370,-1.5000768918,0.0192059116
|
||||
0.6800000000,-0.8120869163,-1.5000079810,-0.0500617756
|
||||
0.6900000000,-0.8270875558,-1.5000937560,-0.0161395518
|
||||
0.7000000000,-0.8420883334,-1.5000899803,0.0230861013
|
||||
0.7100000000,-0.8570890000,-1.5000264122,-0.0561275847
|
||||
0.7200000000,-0.8720897997,-1.5001202617,-0.0085789842
|
||||
0.7300000000,-0.8870907129,-1.5000718602,0.0477346007
|
||||
0.7400000000,-0.9020914935,-1.5001047330,-0.0409993467
|
||||
0.7500000000,-0.9170925757,-1.5001292996,0.0312149063
|
||||
0.7600000000,-0.9320934962,-1.5000800883,-0.0699810062
|
||||
0.7700000000,-0.9470947367,-1.5001636089,0.0266269093
|
||||
0.7800000000,-0.9620958396,-1.5000957794,-0.0858124395
|
||||
0.7900000000,-0.9770973277,-1.5001775357,0.0497342643
|
||||
0.8000000000,-0.9920986393,-1.5001878235,-0.0674476188
|
||||
0.8100000000,-1.0071004195,-1.5000874072,0.1329867627
|
||||
0.8200000000,-1.0219392817,-1.4598649714,5.9855481837
|
||||
0.8300000000,-1.0362386361,-1.4000134628,5.9761092719
|
||||
0.8400000000,-1.0499395206,-1.3401551196,5.9954386163
|
||||
0.8500000000,-1.0630417494,-1.2802946681,5.9861781069
|
||||
0.8600000000,-1.0755452385,-1.2203987456,5.9782697343
|
||||
0.8700000000,-1.0874498709,-1.1605200735,5.9923908792
|
||||
0.8800000000,-1.0987555135,-1.1006126206,5.9851787314
|
||||
0.8900000000,-1.1094621009,-1.0407014354,5.9959626652
|
||||
0.9000000000,-1.1195694896,-0.9807796092,5.9898010161
|
||||
0.9100000000,-1.1290776208,-0.9208443071,5.9978168972
|
||||
0.9200000000,-1.1379863614,-0.8609046692,5.9930906392
|
||||
0.9300000000,-1.1462956389,-0.8009489668,5.9986985104
|
||||
0.9400000000,-1.1540053226,-0.7409868136,5.9960412019
|
||||
0.9500000000,-1.1611153106,-0.6810089169,5.9993530710
|
||||
0.9600000000,-1.1676254504,-0.6210160321,6.0002469001
|
||||
0.9700000000,-1.1735356080,-0.5610186206,5.9983480103
|
||||
0.9800000000,-1.1788458912,-0.5010412674,5.9984313020
|
||||
0.9900000000,-1.1835565264,-0.4410898752,5.9914009231
|
||||
1.0000000000,-1.1876678759,-0.3811931772,5.9988240228
|
||||
1.0100000000,-1.1911804273,-0.3213300729,5.9806076203
|
||||
1.0200000000,-1.1940950327,-0.2616201787,5.9451605548
|
||||
1.0300000000,-1.1964133597,-0.2020822778,5.9652439958
|
||||
1.0400000000,-1.1981383931,-0.1430012424,5.8369634669
|
||||
1.0500000000,-1.1992783791,-0.0854621410,5.4905248998
|
||||
1.0600000000,-1.1998598641,-0.0324705716,5.6308791939
|
||||
1.0700000000,-1.1999956445,-0.0024097970,0.9995966965
|
||||
1.0772269967,-1.2000000000,0.0000000000,0.0000000000
|
||||
|
||||
|
@ -32,9 +32,10 @@ robot = Robot("/home/lgv/cmvr/cmvr-es/config/cabin_robot.xml", "hc01")
|
||||
# js = robot.getJointQ('right')
|
||||
# print(js)
|
||||
# 控制左臂关节
|
||||
robot.calibrateZeroQ("R_WRIST_R")
|
||||
robot.calibrateZeroQ("R_WRIST_Y")
|
||||
# robot.calibrateZeroQ("R_WRIST_R")
|
||||
time.sleep(3)
|
||||
time.sleep(1)
|
||||
print("--------------------------")
|
||||
# robot.moveJ("right", [0.0, 0.0, 0.0, 0.0, 0.0,0.0, 0.0])
|
||||
# # robot.moveJ("right", [-0.344938, 0.935147, 2.27031,1.68959, -2.32841,0.460145, 0.300996])
|
||||
# robot.moveJ("right", [0.0, 0.0, 0.0, 0.0, 0.0,0.0, 0.0])
|
||||
|
||||
@ -138,4 +138,66 @@ public:
|
||||
Ti.block<3,1>(0,3) = -Rt * t;
|
||||
return Ti;
|
||||
}
|
||||
|
||||
|
||||
static int calcLookahead(double qd_ref,
|
||||
double qdd_ref,
|
||||
double v_max,
|
||||
double dt,
|
||||
int n_min = 1,
|
||||
int n_max = 5)
|
||||
{
|
||||
double v0 = std::abs(qd_ref);
|
||||
double a = std::abs(qdd_ref);
|
||||
double vmax = std::abs(v_max);
|
||||
|
||||
// 1) 已经在接近最大速度的匀速阶段:直接用 1 步
|
||||
const double vel_sat_ratio = 0.95; // 95% vmax 就认为是全速段
|
||||
if (v0 >= vel_sat_ratio * vmax) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 2) 其他情况再用“加速 + 饱和”的那套公式
|
||||
double s_target = vmax * dt;
|
||||
|
||||
if (v0 < 1e-6 && a < 1e-6) {
|
||||
return n_min;
|
||||
}
|
||||
|
||||
double tau = 0.0;
|
||||
|
||||
if (a < 1e-6) {
|
||||
// 近似匀速:v0 * tau = s_target
|
||||
tau = s_target / (v0 + 1e-6);
|
||||
} else {
|
||||
double A = 0.5 * a;
|
||||
double B = v0;
|
||||
double C = -s_target;
|
||||
|
||||
double disc = B * B - 4.0 * A * C;
|
||||
if (disc < 0.0) disc = 0.0;
|
||||
double sqrt_disc = std::sqrt(disc);
|
||||
|
||||
double tau_quad = (-B + sqrt_disc) / (2.0 * A);
|
||||
double v_at_tau = v0 + a * tau_quad;
|
||||
|
||||
if (v_at_tau <= vmax + 1e-9) {
|
||||
tau = tau_quad;
|
||||
} else {
|
||||
double t_sat = (vmax - v0) / a;
|
||||
double s_sat = v0 * t_sat + 0.5 * a * t_sat * t_sat;
|
||||
|
||||
if (s_target <= s_sat) {
|
||||
tau = std::min(tau_quad, t_sat);
|
||||
} else {
|
||||
tau = t_sat + (s_target - s_sat) / vmax;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int n = (int)std::ceil(tau / dt);
|
||||
if (n < n_min) n = n_min;
|
||||
if (n > n_max) n = n_max;
|
||||
return n;
|
||||
}
|
||||
};
|
||||
|
||||
@ -21,11 +21,11 @@ namespace cmvr {
|
||||
~DataCenter() {}
|
||||
|
||||
public:
|
||||
std::shared_ptr<MotorsInfo> getMotorsInfo() const {
|
||||
const MotorsInfo* getMotorsInfo() const {
|
||||
return motors_info_;
|
||||
}
|
||||
|
||||
private:
|
||||
std::shared_ptr<MotorsInfo> motors_info_{nullptr};
|
||||
MotorsInfo* motors_info_{nullptr};
|
||||
};
|
||||
}
|
||||
|
||||
@ -31,9 +31,9 @@ namespace cmvr {
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void getJointsAngle(const std::vector<std::string> &joints_name,std::unordered_map<std::string, double> &joint_qs) const;
|
||||
|
||||
void getJointsAngle(const std::vector<std::string> &joints_name,std::vector<double> &joint_qs) const;
|
||||
bool getJointsQ(const std::vector<std::string> &joints_name,std::unordered_map<std::string, double> &joint_qs) const;
|
||||
bool getJointsQ(const std::vector<std::string> &joints_name,std::vector<double> &joint_qs) const;
|
||||
bool getJointsQ(std::unordered_map<std::string, double> &joint_qs) const;
|
||||
|
||||
std::shared_ptr<device::MotorManager> getMotorManager() const {
|
||||
return motor_manager_;
|
||||
|
||||
@ -8,6 +8,6 @@ using namespace cmvr;
|
||||
|
||||
DataCenter::DataCenter()
|
||||
{
|
||||
motors_info_ = std::shared_ptr<MotorsInfo>(MotorsInfo::getInstance());
|
||||
motors_info_ = MotorsInfo::getInstance();
|
||||
|
||||
}
|
||||
@ -151,8 +151,9 @@ void MotorsInfo::init(const XmlNode &cfg) {
|
||||
LOG(INFO) << "All enabled motors initialized successfully.";
|
||||
}
|
||||
|
||||
void MotorsInfo::getJointsAngle(const std::vector<std::string> &joints_name,
|
||||
bool MotorsInfo::getJointsQ(const std::vector<std::string> &joints_name,
|
||||
std::unordered_map<std::string, double> &joint_qs) const {
|
||||
auto res{true};
|
||||
joint_qs.clear();
|
||||
for (auto &name: joints_name) {
|
||||
auto motor = motor_manager_->getMotor(name);
|
||||
@ -160,11 +161,14 @@ void MotorsInfo::getJointsAngle(const std::vector<std::string> &joints_name,
|
||||
joint_qs.emplace(name, motor->getQ());
|
||||
} else {
|
||||
joint_qs.emplace(name, std::numeric_limits<double>::quiet_NaN());
|
||||
res = false;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void MotorsInfo::getJointsAngle(const std::vector<std::string> &joints_name, std::vector<double> &joint_qs) const {
|
||||
bool MotorsInfo::getJointsQ(const std::vector<std::string> &joints_name, std::vector<double> &joint_qs) const {
|
||||
auto res{true};
|
||||
joint_qs.clear();
|
||||
for (auto &name: joints_name) {
|
||||
auto motor = motor_manager_->getMotor(name);
|
||||
@ -172,6 +176,20 @@ void MotorsInfo::getJointsAngle(const std::vector<std::string> &joints_name, std
|
||||
joint_qs.emplace_back(motor->getQ());
|
||||
} else {
|
||||
joint_qs.emplace_back(std::numeric_limits<double>::quiet_NaN());
|
||||
res = false;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
bool MotorsInfo::getJointsQ(std::unordered_map<std::string, double> &joint_qs) const {
|
||||
joint_qs.clear();
|
||||
auto motors = motor_manager_->motorsMap();
|
||||
for (auto &motor_pair: motors) {
|
||||
auto motor = motor_pair.second;
|
||||
joint_qs.emplace(motor->jointName(), motor->getQ());
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -16,11 +16,11 @@ void Ti5MotorRPDO1::UpdateData(uint8_t *data) {
|
||||
data[2] = target_pos_ >> 16 & 0xFF;
|
||||
data[3] = target_pos_ >> 24 & 0xFF;
|
||||
//
|
||||
// data[4] = ctrl_word_ & 0xFF;
|
||||
// data[5] = ctrl_word_ >> 8 & 0xFF;
|
||||
data[4] = ctrl_word_ & 0xFF;
|
||||
data[5] = ctrl_word_ >> 8 & 0xFF;
|
||||
|
||||
data[4] = target_vel_ & 0xFF;
|
||||
data[5] = target_vel_ >> 8 & 0xFF;
|
||||
data[6] = target_vel_ >> 16 & 0xFF;
|
||||
data[7] = target_vel_ >> 24 & 0xFF;
|
||||
// data[4] = target_vel_ & 0xFF;
|
||||
// data[5] = target_vel_ >> 8 & 0xFF;
|
||||
// data[6] = target_vel_ >> 16 & 0xFF;
|
||||
// data[7] = target_vel_ >> 24 & 0xFF;
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ namespace cmvr {
|
||||
void UpdateData(uint8_t *data) override;
|
||||
|
||||
int32_t GetLength() const override {
|
||||
return 0x08;
|
||||
return 0x06;
|
||||
}
|
||||
|
||||
uint32_t GetPeriod() const override {
|
||||
|
||||
@ -331,7 +331,7 @@ void Ti5MotorCanopenProtocol::configRPDO1(uint8_t node_id, bool start) {
|
||||
|
||||
//6 : 映射控制字
|
||||
seedSdoRequest(node_id, CS_WRITE_FOUR_BYTES, RPDO1_MAP_1600, SUB_INDEX_2,
|
||||
PROFILE_SPEED_6081 << 16 | SUB_INDEX_0 << 8 | 32);
|
||||
CONTROL_WORD_6040 << 16 | SUB_INDEX_0 << 8 | 16);
|
||||
|
||||
|
||||
if (start) {
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
#include "motor/ti5_motor/ti5_motor.h"
|
||||
#include "../../../../utils/base/include/abstract_interpolation.h"
|
||||
#include "data_center/include/motors_info.h"
|
||||
#include "common/utils/math/support_functions.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace cmvr::device;
|
||||
@ -62,7 +63,7 @@ template<int DOF>
|
||||
void HumanoidRobot<DOF>::torqueOff() {
|
||||
try {
|
||||
for (const auto &pair: motor_manager_->motorsMap()) {
|
||||
if (pair.second->jointName() != "R_WRIST_R" && pair.second->jointName() != "WAIST_P")
|
||||
if (pair.second->jointName() != "WAIST_Y" && pair.second->jointName() != "WAIST_P")
|
||||
pair.second->torqueOff();
|
||||
}
|
||||
} catch (std::exception &e) {
|
||||
@ -219,23 +220,12 @@ template<int DOF>
|
||||
void HumanoidRobot<DOF>::moveJ(std::vector<JointPoint> &cmd, double vel, double acc) {
|
||||
if (cmd.empty()) return;
|
||||
|
||||
LOG(INFO) << "vel " << vel << " acc" << acc << " " << cmd.size() << endl;
|
||||
|
||||
// 1. 读当前关节角
|
||||
std::unordered_map<std::string, double> cur_joints_angle;
|
||||
cur_joints_angle.reserve(cmd.size());
|
||||
|
||||
std::vector<std::shared_ptr<AbstractMotor> > motors;
|
||||
motors.reserve(cmd.size());
|
||||
|
||||
for (auto &jp: cmd) {
|
||||
auto motor = motor_manager_->getMotor(jp.joint_name);
|
||||
motors.push_back(motor);
|
||||
// 切 CSP
|
||||
if (motor->getMode() != msgs::RUN_MODE_CYCLIC_SYNC_POSITION) {
|
||||
motor->setMode(msgs::RUN_MODE_CYCLIC_SYNC_POSITION);
|
||||
}
|
||||
// 为 map 预填 key
|
||||
cur_joints_angle.emplace(jp.joint_name, 0.0);
|
||||
cur_joints_angle.emplace(jp.joint_name, 0.0); // 预填 key
|
||||
}
|
||||
|
||||
getJointQ(cur_joints_angle);
|
||||
@ -243,24 +233,27 @@ void HumanoidRobot<DOF>::moveJ(std::vector<JointPoint> &cmd, double vel, double
|
||||
std::vector<double> q_start, q_goal;
|
||||
q_start.reserve(cmd.size());
|
||||
q_goal.reserve(cmd.size());
|
||||
|
||||
for (auto &jp: cmd) {
|
||||
auto it = cur_joints_angle.find(jp.joint_name);
|
||||
if (it == cur_joints_angle.end()) {
|
||||
LOG(ERROR) << "missing current angle for " << jp.joint_name;
|
||||
return;
|
||||
}
|
||||
q_start.push_back(it->second); // 当前读到的弧度
|
||||
q_goal.push_back(jp.rad); // 目标弧度
|
||||
q_start.push_back(it->second);
|
||||
q_goal.push_back(jp.rad);
|
||||
}
|
||||
if (q_start.size() != q_goal.size()) {
|
||||
LOG(ERROR) << "q_start size != q_goal size";
|
||||
return;
|
||||
}
|
||||
if (q_start.size() != q_goal.size()) return;
|
||||
|
||||
|
||||
// 2. 轨迹规划
|
||||
TrajPtr traj;
|
||||
joint_space_planner_->setPathType(PathType::Quintic);
|
||||
joint_space_planner_->setSymmetricLimits(std::vector<double>(cmd.size(), vel),
|
||||
std::vector<double>(cmd.size(), acc));
|
||||
|
||||
|
||||
bool ok = joint_space_planner_->plan(q_start, q_goal, traj);
|
||||
if (!ok) {
|
||||
LOG(ERROR) << "planner plan() failed";
|
||||
@ -268,7 +261,7 @@ void HumanoidRobot<DOF>::moveJ(std::vector<JointPoint> &cmd, double vel, double
|
||||
}
|
||||
|
||||
|
||||
// 10ms
|
||||
// 3. 采样
|
||||
const double dt = 0.001;
|
||||
auto samples = joint_space_planner_->sampleTrajectory(traj, dt);
|
||||
if (samples.size() < 2) {
|
||||
@ -276,37 +269,56 @@ void HumanoidRobot<DOF>::moveJ(std::vector<JointPoint> &cmd, double vel, double
|
||||
return;
|
||||
}
|
||||
|
||||
const auto t0 = std::chrono::steady_clock::now();
|
||||
|
||||
// k=0 开始
|
||||
size_t k = 0;
|
||||
// 4. 切模式、设速度
|
||||
std::vector<std::shared_ptr<AbstractMotor> > motors;
|
||||
motors.reserve(cmd.size());
|
||||
for (auto &jp: cmd) {
|
||||
auto motor = motor_manager_->getMotor(jp.joint_name);
|
||||
if (!motor) {
|
||||
LOG(ERROR) << "getMotor failed for " << jp.joint_name;
|
||||
return;
|
||||
}
|
||||
if (motor->getMode() != msgs::RUN_MODE_CYCLIC_SYNC_POSITION) {
|
||||
motor->setMode(msgs::RUN_MODE_CYCLIC_SYNC_POSITION);
|
||||
}
|
||||
motor->setQd(vel);
|
||||
motors.push_back(motor);
|
||||
}
|
||||
|
||||
|
||||
// 5. 下发命令
|
||||
const auto t0 = std::chrono::steady_clock::now();
|
||||
size_t k = 1;
|
||||
const size_t K = samples.size();
|
||||
|
||||
|
||||
while (k < K) {
|
||||
// // ——根据墙钟计算“应当在的拍次”,用于追赶——
|
||||
// auto now = std::chrono::steady_clock::now();
|
||||
// double elapsed = std::chrono::duration<double>(now - t0).count();
|
||||
// size_t k_should = static_cast<size_t>(std::floor(elapsed / dt)); // 向下取整更保守
|
||||
// if (k_should >= K) k_should = K - 1;
|
||||
// if (k < k_should) k = k_should; // 追赶,避免越拖越晚
|
||||
|
||||
// ——下发第 k 个采样点——
|
||||
const auto &s = samples[k];
|
||||
|
||||
for (size_t i = 0; i < motors.size(); ++i) {
|
||||
// motors[i]->setQd(s.qd[i]);
|
||||
// motors[i]->setQ(s.q[i]);
|
||||
motors[i]->set(s.q[i],s.qd[i]);
|
||||
motors[i]->setQ(s.q[i]);
|
||||
}
|
||||
|
||||
++k;
|
||||
if (k <= K) {
|
||||
if (k < K) {
|
||||
auto next_t = t0 + std::chrono::duration<double>(k * dt);
|
||||
std::this_thread::sleep_until(next_t);
|
||||
}
|
||||
}
|
||||
|
||||
// 6 输出误差
|
||||
getJointQ(cur_joints_angle);
|
||||
for (auto &jp: cmd) {
|
||||
auto it = cur_joints_angle.find(jp.joint_name);
|
||||
if (it == cur_joints_angle.end()) {
|
||||
LOG(ERROR) << "missing current angle for " << jp.joint_name;
|
||||
return;
|
||||
}
|
||||
LOG(INFO) << jp.joint_name << " pos err = " << std::abs(it->second - jp.rad);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<int DOF>
|
||||
void HumanoidRobot<DOF>::calibrateZeroQ(const std::string &joint_name) {
|
||||
auto motor = motor_manager_->getMotor(joint_name);
|
||||
|
||||
@ -28,6 +28,31 @@ namespace cmvr {
|
||||
return false;
|
||||
};
|
||||
|
||||
// 1:单次求解,即moveJ ,调用 ik 之前 一定要使用机械臂的真实关节角度 去更新
|
||||
// moveJ()
|
||||
// update_joints_state(械臂的真实关节角度)
|
||||
// ik()
|
||||
// 2 : 多次求解,即moveL ,
|
||||
// moveL(){
|
||||
// update_joints_state(械臂的真实关节角度)
|
||||
// for(i = 0 , i ++)
|
||||
// ik()
|
||||
// update_joints_state(使用ik的值)
|
||||
void update_joints_state(std::vector<double> cur_joints_angle) {
|
||||
cur_joints_angle_ = std::move(cur_joints_angle);
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
//机械臂末端工具坐标系相对于末端法兰的变换矩阵
|
||||
Eigen::Matrix4d T_tool_flange_{};
|
||||
|
||||
// 机械臂基座相对于机器人基座的变换矩阵
|
||||
Eigen::Matrix4d T_arm_robot_{};
|
||||
|
||||
// 上次调用ik 时计算的结果
|
||||
std::vector<double> cur_joints_angle_{};
|
||||
|
||||
// 设置 机械臂末端工具坐标系相对于末端法兰的变换矩阵
|
||||
void setTcpTransform(const Eigen::Matrix4d& T_tool_flange) {
|
||||
T_tool_flange_ = T_tool_flange;
|
||||
@ -39,11 +64,5 @@ namespace cmvr {
|
||||
T_arm_robot_ = T_arm_robot;
|
||||
}
|
||||
|
||||
protected:
|
||||
//机械臂末端工具坐标系相对于末端法兰的变换矩阵
|
||||
Eigen::Matrix4d T_tool_flange_{};
|
||||
|
||||
// 机械臂基座相对于机器人基座的变换矩阵
|
||||
Eigen::Matrix4d T_arm_robot_{};
|
||||
};
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include "ik_solver.h"
|
||||
#include "ik_solver/ik_solver/include/ik_solver.h"
|
||||
|
||||
namespace cmvr
|
||||
{
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
|
||||
#include "ik_solver/include/ik_solver_creator.h"
|
||||
#include "ik_solver/opt_psi_limit_bias_solver/include/opt_psi_limit_bias_solver.h"
|
||||
namespace cmvr
|
||||
{
|
||||
std::unordered_map<IkSolverType, std::shared_ptr<IKSolver>>
|
||||
@ -31,7 +32,7 @@ namespace cmvr
|
||||
case IK_SOLVER_UNKNOWN:
|
||||
return nullptr;
|
||||
case OPT_PSI_LIMIT_BIAS_SRS:
|
||||
// return std::make_shared<HybridAstarParkIn>();
|
||||
return std::make_shared<OptPsiLimitBiasSolver>();
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -19,13 +19,8 @@ namespace cmvr{
|
||||
|
||||
bool init() override;
|
||||
bool ik(const Eigen::Matrix4d &target_pose, std::vector<double> &joints_angle) override;
|
||||
|
||||
bool fk(const std::vector<double> &joints_angle, Eigen::Matrix4d &cur_pose, bool robot_base = false) override;
|
||||
|
||||
// 机械臂运动完成后一定要调用一下此接口
|
||||
void update_joints_state(std::vector<double> cur_joints_angle) {
|
||||
cur_joints_angle_ = std::move(cur_joints_angle);
|
||||
}
|
||||
private:
|
||||
std::shared_ptr<BiasSRSIkSolver> bias_srs_ik_solver_{nullptr};
|
||||
std::shared_ptr<JointsLimitAnalyzer> joints_limit_analyzer_{nullptr};
|
||||
@ -36,9 +31,6 @@ namespace cmvr{
|
||||
bool valid{false};
|
||||
}prev_opt_psi_;
|
||||
|
||||
|
||||
// todo :: 后续添加到 data_center
|
||||
std::vector<double> cur_joints_angle_{};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -91,6 +91,14 @@ bool OptPsiLimitBiasSolver::ik(const Eigen::Matrix4d &target_pose, std::vector<d
|
||||
|
||||
// 4 : 求取关节角
|
||||
joints_angle = bias_srs_ik_solver_->inverse_kinematics(target_cal_pose, best_psi);
|
||||
|
||||
// 5: 验证有没有超出限制
|
||||
for (int i = 0; i < joints_angle.size(); ++i) {
|
||||
if ((joints_angle[i] > joints_limits[i].second) || (joints_angle[i] < joints_limits[i].first)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -360,6 +360,7 @@ TEST(SRS_IK_TEST, TR_TEST) {
|
||||
0.0, 0.0, 0.0, 1.0;
|
||||
|
||||
std::vector<double> joint_angles = {0.00203898, 1.34062, 0.0, 0.522261, 0.0, -0.000210733, -0.0942364};
|
||||
std::vector<double> last_joint_angles = {0.00203898, 1.34062, 0.111, 0.622261, 0.256, -0.0210733, 1.00};
|
||||
|
||||
|
||||
|
||||
@ -368,6 +369,17 @@ TEST(SRS_IK_TEST, TR_TEST) {
|
||||
solver.fk(joint_angles,pose,true);
|
||||
cout << "Target Pose (FK from seed joints):\n" << pose << endl;
|
||||
|
||||
// solver.ik(T,joint_angles);
|
||||
|
||||
|
||||
solver.update_joints_state(last_joint_angles);
|
||||
solver.ik(pose,joint_angles);
|
||||
|
||||
for (double joint_angle: joint_angles) {
|
||||
cout << joint_angle << endl;
|
||||
}
|
||||
|
||||
solver.fk(joint_angles,pose,true);
|
||||
cout << "Target Pose (FK from seed joints):\n" << pose << endl;
|
||||
|
||||
|
||||
}
|
||||
@ -5,21 +5,58 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include "planner/joint_space_planner/include/toppra_bspline.h"
|
||||
#include "planner/joint_space_planner/include/joint_space_planner_creator.h"
|
||||
#include "common/utils/math/support_functions.h"
|
||||
#include <thread>
|
||||
using namespace cmvr;
|
||||
TEST(JOINT_SPACE_PLANNER_TEST,TOPPRA_TEST) {
|
||||
|
||||
auto planner = JointSpacePlannerCreator::create(JointSpacePlannerType::TOPPRA_BSPLINE);
|
||||
planner->setPathType(PathType::Quintic);
|
||||
planner->setPathType(PathType::CubicHermite);
|
||||
|
||||
planner->setSymmetricLimits(std::vector<double>(1, 1.5),
|
||||
std::vector<double>(1, 3.0));
|
||||
std::vector<double>(1, 6.0));
|
||||
TrajPtr traj;
|
||||
std::vector<double> q0{0.0};
|
||||
std::vector<double> q1{1.2};
|
||||
std::vector<double> q1{-1.2};
|
||||
if (!planner->plan(q0, q1, traj)) { std::cerr << "plan failed\n"; }
|
||||
|
||||
// 2) 采样 0.01 s
|
||||
auto samples = planner->sampleTrajectory(traj, 0.01);
|
||||
double dt = 0.01;
|
||||
auto samples = planner->sampleTrajectory(traj, dt);
|
||||
|
||||
|
||||
const auto t0 = std::chrono::steady_clock::now();
|
||||
size_t k = 1;
|
||||
const size_t K = samples.size();
|
||||
|
||||
const int lookahead_steps = 1; // 看前 1 个点,或者直接设 0 就是你的原版
|
||||
|
||||
while (k < K) {
|
||||
const auto &s_now = samples[k];
|
||||
|
||||
int global_lookahead = 1;
|
||||
for (size_t i = 0; i < q0.size(); ++i) {
|
||||
int la_i = SupportFunctions::calcLookahead(
|
||||
s_now.qd[i],
|
||||
s_now.qdd[i],
|
||||
1.5,
|
||||
dt,1,10);
|
||||
global_lookahead = std::max(global_lookahead, la_i);
|
||||
}
|
||||
|
||||
size_t k_la = std::min(k + (size_t) global_lookahead, K - 1);
|
||||
const auto &s_cmd = samples[k];
|
||||
|
||||
std::cout << s_cmd.q << std::endl;
|
||||
|
||||
|
||||
|
||||
++k;
|
||||
if (k < K) {
|
||||
auto next_t = t0 + std::chrono::duration<double>(k * dt);
|
||||
std::this_thread::sleep_until(next_t);
|
||||
}
|
||||
}
|
||||
|
||||
// 3) 写 CSV
|
||||
if (!planner->writeTrajectoryCsv("/home/lgv/cmvr/cmvr-es/data/planner/traj.csv", samples)) {
|
||||
|
||||
3
third_party/mujoco/3.3.7/MUJOCO_LOG.TXT
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
Wed Nov 19 10:46:50 2025
|
||||
ERROR: could not initialize GLFW
|
||||
|
||||
630
third_party/mujoco/3.3.7/THIRD_PARTY_NOTICES
vendored
Normal file
@ -0,0 +1,630 @@
|
||||
MuJoCo version 3.3.7 incorporates the following open-source libraries:
|
||||
|
||||
- libccd
|
||||
- Collisions
|
||||
- TinyXML2
|
||||
- LodePNG
|
||||
- Qhull
|
||||
- GLAD
|
||||
- GLFW
|
||||
- TinyObjLoader
|
||||
- MarchingCubeCpp
|
||||
- {fmt}
|
||||
- OpenGL Mathematics
|
||||
- TriangleMeshDistance
|
||||
|
||||
MuJoCo was built for GNU/Linux using LLVM/Clang.
|
||||
LLVM/Clang incorporates portions of its standard headers and runtime libraries
|
||||
in the resulting MuJoCo binary.
|
||||
|
||||
Third-party copyright and license information is included below.
|
||||
|
||||
|
||||
|
||||
========================= LIBCCD =============================================
|
||||
|
||||
Copyright (c)2010-2012 Daniel Fiser <danfis@danfis.cz>,
|
||||
Intelligent and Mobile Robotics Group, Department of Cybernetics,
|
||||
Faculty of Electrical Engineering, Czech Technical University in Prague.
|
||||
All rights reserved.
|
||||
|
||||
|
||||
This work was supported by SYMBRION and REPLICATOR projects.
|
||||
The SYMBRION project is funded by European Commission within the work
|
||||
"Future and Emergent Technologies Proactive" under grant agreement no.
|
||||
216342.
|
||||
The REPLICATOR project is funded within the work programme "Cognitive
|
||||
Systems, Interaction, Robotics" under grant agreement no. 216240.
|
||||
http://www.symbrion.eu/
|
||||
http://www.replicators.eu/
|
||||
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
|
||||
========================= COLLISIONS =========================================
|
||||
|
||||
Copyright (c) 2015 Svetoslav Kolev
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
|
||||
========================= TINYXML2 ===========================================
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
|
||||
|
||||
========================= LODEPNG ============================================
|
||||
|
||||
Copyright (c) 2005-2018 Lode Vandevenne
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
|
||||
|
||||
========================= QHULL ==============================================
|
||||
|
||||
Qhull, Copyright (c) 1993-2020
|
||||
|
||||
C.B. Barber
|
||||
Arlington, MA
|
||||
|
||||
and
|
||||
|
||||
The National Science and Technology Research Center for
|
||||
Computation and Visualization of Geometric Structures
|
||||
(The Geometry Center)
|
||||
University of Minnesota
|
||||
|
||||
email: qhull@qhull.org
|
||||
|
||||
This software includes Qhull from C.B. Barber and The Geometry Center.
|
||||
Files derived from Qhull 1.0 are copyrighted by the Geometry Center. The
|
||||
remaining files are copyrighted by C.B. Barber. Qhull is free software
|
||||
and may be obtained via http from www.qhull.org. It may be freely copied,
|
||||
modified, and redistributed under the following conditions:
|
||||
|
||||
1. All copyright notices must remain intact in all files.
|
||||
|
||||
2. A copy of this text file must be distributed along with any copies
|
||||
of Qhull that you redistribute; this includes copies that you have
|
||||
modified, or copies of programs or other software products that
|
||||
include Qhull.
|
||||
|
||||
3. If you modify Qhull, you must include a notice giving the
|
||||
name of the person performing the modification, the date of
|
||||
modification, and the reason for such modification.
|
||||
|
||||
4. When distributing modified versions of Qhull, or other software
|
||||
products that include Qhull, you must provide notice that the original
|
||||
source code may be obtained as noted above.
|
||||
|
||||
5. There is no warranty or other guarantee of fitness for Qhull, it is
|
||||
provided solely "as is". Bug reports or fixes may be sent to
|
||||
qhull_bug@qhull.org; the authors may or may not act on them as
|
||||
they desire.
|
||||
|
||||
|
||||
|
||||
========================= GLAD ===============================================
|
||||
|
||||
The glad generated code itself is CC0. The source files for the generated code
|
||||
are under various licenses from Khronos.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Copyright 2013-2020 The Khronos Group Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and/or associated documentation files (the
|
||||
"Materials"), to deal in the Materials without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
permit persons to whom the Materials are furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Materials.
|
||||
|
||||
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
|
||||
|
||||
|
||||
========================= GLFW ===============================================
|
||||
|
||||
Copyright (c) 2002-2006 Marcus Geelnard
|
||||
|
||||
Copyright (c) 2006-2019 Camilla Löwy
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would
|
||||
be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
|
||||
|
||||
========================= TINYOBJLOADER ========================================
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2012-2019 Syoyo Fujita and many contributors.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
|
||||
========================= MARCHINGCUBECPP ======================================
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2020 Axel Paris
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
|
||||
========================= FMT ==================================================
|
||||
|
||||
Copyright (c) 2012 - present, Victor Zverovich and {fmt} contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
--- Optional exception to the license ---
|
||||
|
||||
As an exception, if, as a result of your compiling your source code, portions
|
||||
of this Software are embedded into a machine-executable object form of such
|
||||
source code, you may redistribute such embedded portions in such object form
|
||||
without including the above copyright and permission notices.
|
||||
|
||||
|
||||
|
||||
========================= TRIANGLEMESHDISTANCE =================================
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Jose Antonio Fernandez Fernandez
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
|
||||
================================================================================
|
||||
The LLVM Project is under the Apache License v2.0 with LLVM Exceptions:
|
||||
================================================================================
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
---- LLVM Exceptions to the Apache 2.0 License ----
|
||||
|
||||
As an exception, if, as a result of your compiling your source code, portions
|
||||
of this Software are embedded into an Object form of such source code, you
|
||||
may redistribute such embedded portions in such Object form without complying
|
||||
with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
|
||||
|
||||
In addition, if you combine or link compiled forms of this Software with
|
||||
software that is licensed under the GPLv2 ("Combined Software") and if a
|
||||
court of competent jurisdiction determines that the patent provision (Section
|
||||
3), the indemnity provision (Section 9) or other Section of the License
|
||||
conflicts with the conditions of the GPLv2, you may retroactively and
|
||||
prospectively choose to deem waived or otherwise exclude such Section(s) of
|
||||
the License, but only in their entirety and only with respect to the Combined
|
||||
Software.
|
||||
|
||||
================================================================================
|
||||
Software from third parties included in the LLVM Project:
|
||||
================================================================================
|
||||
The LLVM Project contains third party software which is under different license
|
||||
terms. All such code will be identified clearly using at least one of two
|
||||
mechanisms:
|
||||
1) It will be in a separate directory tree with its own `LICENSE.txt` or
|
||||
`LICENSE` file at the top containing the specific license and restrictions
|
||||
which apply to that software, or
|
||||
2) It will contain specific license and restriction terms at the top of every
|
||||
file.
|
||||
|
||||
================================================================================
|
||||
Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy):
|
||||
================================================================================
|
||||
University of Illinois/NCSA
|
||||
Open Source License
|
||||
|
||||
Copyright (c) 2003-2019 University of Illinois at Urbana-Champaign.
|
||||
All rights reserved.
|
||||
|
||||
Developed by:
|
||||
|
||||
LLVM Team
|
||||
|
||||
University of Illinois at Urbana-Champaign
|
||||
|
||||
http://llvm.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal with
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimers.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimers in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the names of the LLVM Team, University of Illinois at
|
||||
Urbana-Champaign, nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this Software without specific
|
||||
prior written permission.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
|
||||
SOFTWARE.
|
||||
BIN
third_party/mujoco/3.3.7/bin/basic
vendored
Executable file
BIN
third_party/mujoco/3.3.7/bin/compile
vendored
Executable file
BIN
third_party/mujoco/3.3.7/bin/dependencies
vendored
Executable file
BIN
third_party/mujoco/3.3.7/bin/mujoco_plugin/libactuator.so
vendored
Executable file
BIN
third_party/mujoco/3.3.7/bin/mujoco_plugin/libelasticity.so
vendored
Executable file
BIN
third_party/mujoco/3.3.7/bin/mujoco_plugin/libsdf_plugin.so
vendored
Executable file
BIN
third_party/mujoco/3.3.7/bin/mujoco_plugin/libsensor.so
vendored
Executable file
BIN
third_party/mujoco/3.3.7/bin/record
vendored
Executable file
BIN
third_party/mujoco/3.3.7/bin/simulate
vendored
Executable file
BIN
third_party/mujoco/3.3.7/bin/testspeed
vendored
Executable file
41
third_party/mujoco/3.3.7/include/mujoco/experimental/usd/layer_sink.h
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
// Copyright 2025 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MUJOCO_SRC_EXPERIMENTAL_USD_LAYER_SINK_H_
|
||||
#define MUJOCO_SRC_EXPERIMENTAL_USD_LAYER_SINK_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <mujoco/mujoco.h>
|
||||
#include <pxr/usd/sdf/path.h>
|
||||
#include <pxr/usd/usd/common.h>
|
||||
|
||||
namespace mujoco {
|
||||
namespace usd {
|
||||
|
||||
// A sink for writing pose data to an SDF layer.
|
||||
// Opinions will be authored on the edit target layer for the
|
||||
// passed stage argument.
|
||||
class LayerSink {
|
||||
public:
|
||||
explicit LayerSink(pxr::UsdStageRefPtr stage);
|
||||
void Update(const mjData* const data, std::vector<pxr::SdfPath> body_paths_);
|
||||
|
||||
private:
|
||||
pxr::UsdStageRefPtr stage_;
|
||||
};
|
||||
} // namespace usd
|
||||
} // namespace mujoco
|
||||
|
||||
#endif // MUJOCO_SRC_EXPERIMENTAL_USD_LAYER_SINK_H_
|
||||
872
third_party/mujoco/3.3.7/include/mujoco/experimental/usd/mjcPhysics/actuator.h
vendored
Normal file
@ -0,0 +1,872 @@
|
||||
// Copyright 2025 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MJCPHYSICS_GENERATED_ACTUATOR_H
|
||||
#define MJCPHYSICS_GENERATED_ACTUATOR_H
|
||||
|
||||
/// \file mjcPhysics/actuator.h
|
||||
|
||||
#include <mujoco/experimental/usd/mjcPhysics/api.h>
|
||||
#include <mujoco/experimental/usd/mjcPhysics/tokens.h>
|
||||
#include <pxr/base/gf/matrix4d.h>
|
||||
#include <pxr/base/gf/vec3d.h>
|
||||
#include <pxr/base/gf/vec3f.h>
|
||||
#include <pxr/base/tf/token.h>
|
||||
#include <pxr/base/tf/type.h>
|
||||
#include <pxr/base/vt/value.h>
|
||||
#include <pxr/pxr.h>
|
||||
#include <pxr/usd/usd/prim.h>
|
||||
#include <pxr/usd/usd/stage.h>
|
||||
#include <pxr/usd/usd/typed.h>
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
class SdfAssetPath;
|
||||
|
||||
// -------------------------------------------------------------------------- //
|
||||
// MJCACTUATOR //
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
/// \class MjcPhysicsActuator
|
||||
///
|
||||
/// Known as actuator in MuJoCo, this prim represents force transmission to
|
||||
/// joints, bodies, or sites.
|
||||
///
|
||||
/// For any described attribute \em Fallback \em Value or \em Allowed \em Values
|
||||
/// below that are text/tokens, the actual token is published and defined in
|
||||
/// \ref MjcPhysicsTokens. So to set an attribute to the value "rightHanded",
|
||||
/// use MjcPhysicsTokens->rightHanded as the value.
|
||||
///
|
||||
class MjcPhysicsActuator : public UsdTyped {
|
||||
public:
|
||||
/// Compile time constant representing what kind of schema this class is.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped;
|
||||
|
||||
/// Construct a MjcPhysicsActuator on UsdPrim \p prim .
|
||||
/// Equivalent to MjcPhysicsActuator::Get(prim.GetStage(), prim.GetPath())
|
||||
/// for a \em valid \p prim, but will not immediately throw an error for
|
||||
/// an invalid \p prim
|
||||
explicit MjcPhysicsActuator(const UsdPrim& prim = UsdPrim())
|
||||
: UsdTyped(prim) {}
|
||||
|
||||
/// Construct a MjcPhysicsActuator on the prim held by \p schemaObj .
|
||||
/// Should be preferred over MjcPhysicsActuator(schemaObj.GetPrim()),
|
||||
/// as it preserves SchemaBase state.
|
||||
explicit MjcPhysicsActuator(const UsdSchemaBase& schemaObj)
|
||||
: UsdTyped(schemaObj) {}
|
||||
|
||||
/// Destructor.
|
||||
MJCPHYSICS_API
|
||||
virtual ~MjcPhysicsActuator();
|
||||
|
||||
/// Return a vector of names of all pre-declared attributes for this schema
|
||||
/// class and all its ancestor classes. Does not include attributes that
|
||||
/// may be authored by custom/extended methods of the schemas involved.
|
||||
MJCPHYSICS_API
|
||||
static const TfTokenVector& GetSchemaAttributeNames(
|
||||
bool includeInherited = true);
|
||||
|
||||
/// Return a MjcPhysicsActuator holding the prim adhering to this
|
||||
/// schema at \p path on \p stage. If no prim exists at \p path on
|
||||
/// \p stage, or if the prim at that path does not adhere to this schema,
|
||||
/// return an invalid schema object. This is shorthand for the following:
|
||||
///
|
||||
/// \code
|
||||
/// MjcPhysicsActuator(stage->GetPrimAtPath(path));
|
||||
/// \endcode
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static MjcPhysicsActuator Get(const UsdStagePtr& stage, const SdfPath& path);
|
||||
|
||||
/// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
|
||||
/// is defined (according to UsdPrim::IsDefined()) on this stage.
|
||||
///
|
||||
/// If a prim adhering to this schema at \p path is already defined on this
|
||||
/// stage, return that prim. Otherwise author an \a SdfPrimSpec with
|
||||
/// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
|
||||
/// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
|
||||
/// with \p specifier == \a SdfSpecifierDef and empty typeName at the
|
||||
/// current EditTarget for any nonexistent, or existing but not \a Defined
|
||||
/// ancestors.
|
||||
///
|
||||
/// The given \a path must be an absolute prim path that does not contain
|
||||
/// any variant selections.
|
||||
///
|
||||
/// If it is impossible to author any of the necessary PrimSpecs, (for
|
||||
/// example, in case \a path cannot map to the current UsdEditTarget's
|
||||
/// namespace) issue an error and return an invalid \a UsdPrim.
|
||||
///
|
||||
/// Note that this method may return a defined prim whose typeName does not
|
||||
/// specify this schema class, in case a stronger typeName opinion overrides
|
||||
/// the opinion at the current EditTarget.
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static MjcPhysicsActuator Define(const UsdStagePtr& stage,
|
||||
const SdfPath& path);
|
||||
|
||||
protected:
|
||||
/// Returns the kind of schema this class belongs to.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
MJCPHYSICS_API
|
||||
UsdSchemaKind _GetSchemaKind() const override;
|
||||
|
||||
private:
|
||||
// needs to invoke _GetStaticTfType.
|
||||
friend class UsdSchemaRegistry;
|
||||
MJCPHYSICS_API
|
||||
static const TfType& _GetStaticTfType();
|
||||
|
||||
static bool _IsTypedSchema();
|
||||
|
||||
// override SchemaBase virtuals.
|
||||
MJCPHYSICS_API
|
||||
const TfType& _GetTfType() const override;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// GROUP
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Integer MuJoCo group to which the transmission belongs.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform int mjc:group = 0` |
|
||||
/// | C++ Type | int |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetGroupAttr() const;
|
||||
|
||||
/// See GetGroupAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateGroupAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCCTRLLIMITED
|
||||
// --------------------------------------------------------------------- //
|
||||
/// If true, the control input to this actuator is automatically clamped to
|
||||
/// ctrlrange at runtime. If false, control input clamping is disabled. If
|
||||
/// 'auto' and autolimits is set in compiler, control clamping will
|
||||
/// automatically be set to true if ctrlrange is defined without explicitly
|
||||
/// setting this attribute to 'true'. Note that control input clamping can
|
||||
/// also be globally disabled with the clampctrl attribute of option/flag.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform token mjc:ctrlLimited = "auto"` |
|
||||
/// | C++ Type | TfToken |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
/// | \ref MjcPhysicsTokens "Allowed Values" | false, true, auto |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcCtrlLimitedAttr() const;
|
||||
|
||||
/// See GetMjcCtrlLimitedAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcCtrlLimitedAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCFORCELIMITED
|
||||
// --------------------------------------------------------------------- //
|
||||
/// If true, the force output of this actuator is automatically clamped to
|
||||
/// forcerange at runtime. If false, force clamping is disabled. If 'auto' and
|
||||
/// autolimits is set in compiler, force clamping will automatically be set to
|
||||
/// true if forcerange is defined without explicitly setting this attribute to
|
||||
/// 'true'.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform token mjc:forceLimited = "auto"` |
|
||||
/// | C++ Type | TfToken |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
/// | \ref MjcPhysicsTokens "Allowed Values" | false, true, auto |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcForceLimitedAttr() const;
|
||||
|
||||
/// See GetMjcForceLimitedAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcForceLimitedAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCACTLIMITED
|
||||
// --------------------------------------------------------------------- //
|
||||
/// If true, the internal state (activation) associated with this actuator is
|
||||
/// automatically clamped to actrange at runtime. If false, activation
|
||||
/// clamping is disabled. If 'auto' and autolimits is set in compiler,
|
||||
/// activation clamping will automatically be set to true if actrange is
|
||||
/// defined without explicitly setting this attribute to 'true'. See the
|
||||
/// Activation clamping section for more details.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform token mjc:actLimited = "auto"` |
|
||||
/// | C++ Type | TfToken |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
/// | \ref MjcPhysicsTokens "Allowed Values" | false, true, auto |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcActLimitedAttr() const;
|
||||
|
||||
/// See GetMjcActLimitedAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcActLimitedAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCCTRLRANGEMIN
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Minimum range for clamping the control input. The first value must be
|
||||
/// smaller than the second value. Setting this attribute without specifying
|
||||
/// ctrllimited is an error if autolimits is 'false' in compiler.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:ctrlRange:min = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcCtrlRangeMinAttr() const;
|
||||
|
||||
/// See GetMjcCtrlRangeMinAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcCtrlRangeMinAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCCTRLRANGEMAX
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Maximum range for clamping the control input. The first value must be
|
||||
/// smaller than the second value. Setting this attribute without specifying
|
||||
/// ctrllimited is an error if autolimits is 'false' in compiler.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:ctrlRange:max = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcCtrlRangeMaxAttr() const;
|
||||
|
||||
/// See GetMjcCtrlRangeMaxAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcCtrlRangeMaxAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCFORCERANGEMIN
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Minimum range for clamping the force output. The first value must be no
|
||||
/// greater than the second value. Setting this attribute without specifying
|
||||
/// forcelimited is an error if autolimits is 'false' in compiler.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:forceRange:min = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcForceRangeMinAttr() const;
|
||||
|
||||
/// See GetMjcForceRangeMinAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcForceRangeMinAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCFORCERANGEMAX
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Maximum range for clamping the force output. The first value must be no
|
||||
/// greater than the second value. Setting this attribute without specifying
|
||||
/// forcelimited is an error if autolimits is 'false' in compiler.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:forceRange:max = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcForceRangeMaxAttr() const;
|
||||
|
||||
/// See GetMjcForceRangeMaxAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcForceRangeMaxAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCACTRANGEMIN
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Minimum range for clamping the activation state. The first value must be
|
||||
/// no greater than the second value. See the Activation clamping section for
|
||||
/// more details. Setting this attribute without specifying actlimited is an
|
||||
/// error if autolimits is 'false' in compiler.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:actRange:min = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcActRangeMinAttr() const;
|
||||
|
||||
/// See GetMjcActRangeMinAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcActRangeMinAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCACTRANGEMAX
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Maximum range for clamping the activation state. The first value must be
|
||||
/// no greater than the second value. See the Activation clamping section for
|
||||
/// more details. Setting this attribute without specifying actlimited is an
|
||||
/// error if autolimits is 'false' in compiler.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:actRange:max = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcActRangeMaxAttr() const;
|
||||
|
||||
/// See GetMjcActRangeMaxAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcActRangeMaxAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCLENGTHRANGEMIN
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Minimum range of feasible lengths of the actuator's transmission.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:lengthRange:min = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcLengthRangeMinAttr() const;
|
||||
|
||||
/// See GetMjcLengthRangeMinAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcLengthRangeMinAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCLENGTHRANGEMAX
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Maximum range of feasible lengths of the actuator's transmission.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:lengthRange:max = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcLengthRangeMaxAttr() const;
|
||||
|
||||
/// See GetMjcLengthRangeMaxAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcLengthRangeMaxAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCGEAR
|
||||
// --------------------------------------------------------------------- //
|
||||
/// This attribute scales the length (and consequently moment arms, velocity
|
||||
/// and force) of the actuator, for all transmission types. It is different
|
||||
/// from the gain in the force generation mechanism, because the gain only
|
||||
/// scales the force output and does not affect the length, moment arms and
|
||||
/// velocity. For actuators with scalar transmission, only the first element
|
||||
/// of this vector is used. The remaining elements are needed for joint,
|
||||
/// jointinparent and site transmissions where this attribute is used to
|
||||
/// specify 3D force and torque axes.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double[] mjc:gear = [1, 0, 0, 0, 0, 0]` |
|
||||
/// | C++ Type | VtArray<double> |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->DoubleArray |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcGearAttr() const;
|
||||
|
||||
/// See GetMjcGearAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcGearAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCCRANKLENGTH
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Used only for the slider-crank transmission type. Specifies the length of
|
||||
/// the connecting rod. The compiler expects this value to be positive when a
|
||||
/// slider-crank transmission is present.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:crankLength = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcCrankLengthAttr() const;
|
||||
|
||||
/// See GetMjcCrankLengthAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcCrankLengthAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCJOINTINPARENT
|
||||
// --------------------------------------------------------------------- //
|
||||
/// If true and applied to ball and free joints, the 3d rotation axis given by
|
||||
/// gear is defined in the parent frame (which is the world frame for free
|
||||
/// joints) rather than the child frame.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform bool mjc:jointInParent = 0` |
|
||||
/// | C++ Type | bool |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcJointInParentAttr() const;
|
||||
|
||||
/// See GetMjcJointInParentAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcJointInParentAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCACTDIM
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Dimension of the activation state. The default value of -1 instructs the
|
||||
/// compiler to set the dimension according to the dyntype. Values larger than
|
||||
/// 1 are only allowed for user-defined activation dynamics, as native types
|
||||
/// require dimensions of only 0 or 1. For activation dimensions bigger than
|
||||
/// 1, the last element is used to generate force.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform int mjc:actDim = -1` |
|
||||
/// | C++ Type | int |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcActDimAttr() const;
|
||||
|
||||
/// See GetMjcActDimAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcActDimAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCDYNTYPE
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Activation dynamics type for the actuator. The available dynamics types
|
||||
/// were already described in the Actuation model section.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform token mjc:dynType = "none"` |
|
||||
/// | C++ Type | TfToken |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
/// | \ref MjcPhysicsTokens "Allowed Values" | none, integrator, filter,
|
||||
/// filterexact, muscle, user |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcDynTypeAttr() const;
|
||||
|
||||
/// See GetMjcDynTypeAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcDynTypeAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCGAINTYPE
|
||||
// --------------------------------------------------------------------- //
|
||||
/// The gain and bias together determine the output of the force generation
|
||||
/// mechanism, which is currently assumed to be affine.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform token mjc:gainType = "fixed"` |
|
||||
/// | C++ Type | TfToken |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
/// | \ref MjcPhysicsTokens "Allowed Values" | fixed, affine, muscle, user |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcGainTypeAttr() const;
|
||||
|
||||
/// See GetMjcGainTypeAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcGainTypeAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCBIASTYPE
|
||||
// --------------------------------------------------------------------- //
|
||||
/// The gain and bias together determine the output of the force generation
|
||||
/// mechanism, which is currently assumed to be affine.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform token mjc:biasType = "none"` |
|
||||
/// | C++ Type | TfToken |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
/// | \ref MjcPhysicsTokens "Allowed Values" | none, affine, muscle, user |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcBiasTypeAttr() const;
|
||||
|
||||
/// See GetMjcBiasTypeAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcBiasTypeAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCDYNPRM
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Activation dynamics parameters. The built-in activation types (except for
|
||||
/// muscle) use only the first parameter, but we provide additional parameters
|
||||
/// in case user callbacks implement a more elaborate model. The length of
|
||||
/// this array is not enforced by the parser, so the user can enter as many
|
||||
/// parameters as needed. These defaults are not compatible with muscle
|
||||
/// actuators.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double[] mjc:dynPrm = [1, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/// 0]` | | C++ Type | VtArray<double> | | \ref Usd_Datatypes "Usd Type" |
|
||||
/// SdfValueTypeNames->DoubleArray | | \ref SdfVariability "Variability" |
|
||||
/// SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcDynPrmAttr() const;
|
||||
|
||||
/// See GetMjcDynPrmAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcDynPrmAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCGAINPRM
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Gain parameters. The built-in gain types (except for muscle) use only the
|
||||
/// first parameter, but we provide additional parameters in case user
|
||||
/// callbacks implement a more elaborate model. The length of this array is
|
||||
/// not enforced by the parser, so the user can enter as many parameters as
|
||||
/// needed. These defaults are not compatible with muscle actuators.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double[] mjc:gainPrm = [1, 0, 0, 0, 0, 0, 0, 0,
|
||||
/// 0, 0]` | | C++ Type | VtArray<double> | | \ref Usd_Datatypes "Usd Type" |
|
||||
/// SdfValueTypeNames->DoubleArray | | \ref SdfVariability "Variability" |
|
||||
/// SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcGainPrmAttr() const;
|
||||
|
||||
/// See GetMjcGainPrmAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcGainPrmAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCBIASPRM
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Bias parameters. The affine bias type uses three parameters. The length of
|
||||
/// this array is not enforced by the parser, so the user can enter as many
|
||||
/// parameters as needed. These defaults are not compatible with muscle
|
||||
/// actuators.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double[] mjc:biasPrm = [0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/// 0, 0]` | | C++ Type | VtArray<double> | | \ref Usd_Datatypes "Usd Type" |
|
||||
/// SdfValueTypeNames->DoubleArray | | \ref SdfVariability "Variability" |
|
||||
/// SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcBiasPrmAttr() const;
|
||||
|
||||
/// See GetMjcBiasPrmAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcBiasPrmAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCACTEARLY
|
||||
// --------------------------------------------------------------------- //
|
||||
/// If true, force computation will use the next value of the activation
|
||||
/// variable rather than the current one. Setting this flag reduces the delay
|
||||
/// between the control and accelerations by one time-step.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform bool mjc:actEarly = 0` |
|
||||
/// | C++ Type | bool |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcActEarlyAttr() const;
|
||||
|
||||
/// See GetMjcActEarlyAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcActEarlyAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCINHERITRANGE
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Automatically set the actuator’s ctrlrange to match the transmission
|
||||
/// target’s range. The default value means disabled. A positive value X sets
|
||||
/// the ctrlrange around the midpoint of the target range, scaled by X. For
|
||||
/// example if the target joint has range of [0, 1], then a value of 1.0 will
|
||||
/// set ctrlrange to [0, 1]; values of 0.8 and 1.2 will set the ctrlrange to
|
||||
/// [0.1, 0.9] and [-0.1, 1.1], respectively. Values smaller than 1 are useful
|
||||
/// for not hitting the limits; values larger than 1 are useful for
|
||||
/// maintaining control authority at the limits (being able to push on them).
|
||||
/// This attribute is exclusive with ctrlrange and available only for joint
|
||||
/// and tendon transmissions which have range defined.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:inheritRange = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcInheritRangeAttr() const;
|
||||
|
||||
/// See GetMjcInheritRangeAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcInheritRangeAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCTARGET
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Actuator transmission target.
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
UsdRelationship GetMjcTargetRel() const;
|
||||
|
||||
/// See GetMjcTargetRel(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
|
||||
MJCPHYSICS_API
|
||||
UsdRelationship CreateMjcTargetRel() const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCREFSITE
|
||||
// --------------------------------------------------------------------- //
|
||||
/// When applied to a site, measure the translation and rotation w.r.t the
|
||||
/// frame of the refsite. In this case the actuator does have length and
|
||||
/// position actuators can be used to directly control an end effector, see
|
||||
/// refsite.xml example model. As above, the length is the dot product of the
|
||||
/// gear vector and the frame difference. So gear='0 1 0 0 0 0' means
|
||||
/// 'Y-offset of site in the refsite frame', while gear='0 0 0 0 0 1' means
|
||||
/// rotation 'Z- rotation of site in the refsite frame'. It is recommended to
|
||||
/// use a normalized gear vector with nonzeros in only the first 3 or the last
|
||||
/// 3 elements of gear, so the actuator length will be in either length units
|
||||
/// or radians, respectively. As with ball joints (see joint above), for
|
||||
/// rotations which exceed a total angle of pi will wrap around, so tighter
|
||||
/// limits are recommended.
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
UsdRelationship GetMjcRefSiteRel() const;
|
||||
|
||||
/// See GetMjcRefSiteRel(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
|
||||
MJCPHYSICS_API
|
||||
UsdRelationship CreateMjcRefSiteRel() const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCSLIDERSITE
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Used only for the slider-crank transmission type. The target site is the
|
||||
/// pin joining the slider and the connecting rod. The slider moves along the
|
||||
/// z-axis of the slidersite frame. Therefore the site should be oriented as
|
||||
/// needed when it is defined in the kinematic tree; its orientation cannot be
|
||||
/// changed in the actuator definition.
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
UsdRelationship GetMjcSliderSiteRel() const;
|
||||
|
||||
/// See GetMjcSliderSiteRel(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
|
||||
MJCPHYSICS_API
|
||||
UsdRelationship CreateMjcSliderSiteRel() const;
|
||||
|
||||
public:
|
||||
// ===================================================================== //
|
||||
// Feel free to add custom code below this line, it will be preserved by
|
||||
// the code generator.
|
||||
//
|
||||
// Just remember to:
|
||||
// - Close the class declaration with };
|
||||
// - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
|
||||
// - Close the include guard with #endif
|
||||
// ===================================================================== //
|
||||
// --(BEGIN CUSTOM CODE)--
|
||||
};
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif
|
||||
42
third_party/mujoco/3.3.7/include/mujoco/experimental/usd/mjcPhysics/api.h
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
// Copyright 2025 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MJCPHYSICS_API_H
|
||||
#define MJCPHYSICS_API_H
|
||||
|
||||
#include <pxr/base/arch/export.h>
|
||||
|
||||
#if defined(PXR_STATIC)
|
||||
#define MJCPHYSICS_API
|
||||
#define MJCPHYSICS_API_TEMPLATE_CLASS(...)
|
||||
#define MJCPHYSICS_API_TEMPLATE_STRUCT(...)
|
||||
#define MJCPHYSICS_LOCAL
|
||||
#else
|
||||
#if defined(MJCPHYSICS_EXPORTS)
|
||||
#define MJCPHYSICS_API ARCH_EXPORT
|
||||
#define MJCPHYSICS_API_TEMPLATE_CLASS(...) \
|
||||
ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__)
|
||||
#define MJCPHYSICS_API_TEMPLATE_STRUCT(...) \
|
||||
ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__)
|
||||
#else
|
||||
#define MJCPHYSICS_API ARCH_IMPORT
|
||||
#define MJCPHYSICS_API_TEMPLATE_CLASS(...) \
|
||||
ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__)
|
||||
#define MJCPHYSICS_API_TEMPLATE_STRUCT(...) \
|
||||
ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__)
|
||||
#endif
|
||||
#define MJCPHYSICS_LOCAL ARCH_HIDDEN
|
||||
#endif
|
||||
|
||||
#endif
|
||||
388
third_party/mujoco/3.3.7/include/mujoco/experimental/usd/mjcPhysics/collisionAPI.h
vendored
Normal file
@ -0,0 +1,388 @@
|
||||
// Copyright 2025 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MJCPHYSICS_GENERATED_COLLISIONAPI_H
|
||||
#define MJCPHYSICS_GENERATED_COLLISIONAPI_H
|
||||
|
||||
/// \file mjcPhysics/collisionAPI.h
|
||||
|
||||
#include <mujoco/experimental/usd/mjcPhysics/api.h>
|
||||
#include <mujoco/experimental/usd/mjcPhysics/tokens.h>
|
||||
#include <pxr/base/gf/matrix4d.h>
|
||||
#include <pxr/base/gf/vec3d.h>
|
||||
#include <pxr/base/gf/vec3f.h>
|
||||
#include <pxr/base/tf/token.h>
|
||||
#include <pxr/base/tf/type.h>
|
||||
#include <pxr/base/vt/value.h>
|
||||
#include <pxr/pxr.h>
|
||||
#include <pxr/usd/usd/apiSchemaBase.h>
|
||||
#include <pxr/usd/usd/prim.h>
|
||||
#include <pxr/usd/usd/stage.h>
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
class SdfAssetPath;
|
||||
|
||||
// -------------------------------------------------------------------------- //
|
||||
// MJCCOLLISIONAPI //
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
/// \class MjcPhysicsCollisionAPI
|
||||
///
|
||||
/// API describing a MuJoCo collider.
|
||||
///
|
||||
class MjcPhysicsCollisionAPI : public UsdAPISchemaBase {
|
||||
public:
|
||||
/// Compile time constant representing what kind of schema this class is.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
|
||||
|
||||
/// Construct a MjcPhysicsCollisionAPI on UsdPrim \p prim .
|
||||
/// Equivalent to MjcPhysicsCollisionAPI::Get(prim.GetStage(), prim.GetPath())
|
||||
/// for a \em valid \p prim, but will not immediately throw an error for
|
||||
/// an invalid \p prim
|
||||
explicit MjcPhysicsCollisionAPI(const UsdPrim& prim = UsdPrim())
|
||||
: UsdAPISchemaBase(prim) {}
|
||||
|
||||
/// Construct a MjcPhysicsCollisionAPI on the prim held by \p schemaObj .
|
||||
/// Should be preferred over MjcPhysicsCollisionAPI(schemaObj.GetPrim()),
|
||||
/// as it preserves SchemaBase state.
|
||||
explicit MjcPhysicsCollisionAPI(const UsdSchemaBase& schemaObj)
|
||||
: UsdAPISchemaBase(schemaObj) {}
|
||||
|
||||
/// Destructor.
|
||||
MJCPHYSICS_API
|
||||
virtual ~MjcPhysicsCollisionAPI();
|
||||
|
||||
/// Return a vector of names of all pre-declared attributes for this schema
|
||||
/// class and all its ancestor classes. Does not include attributes that
|
||||
/// may be authored by custom/extended methods of the schemas involved.
|
||||
MJCPHYSICS_API
|
||||
static const TfTokenVector& GetSchemaAttributeNames(
|
||||
bool includeInherited = true);
|
||||
|
||||
/// Return a MjcPhysicsCollisionAPI holding the prim adhering to this
|
||||
/// schema at \p path on \p stage. If no prim exists at \p path on
|
||||
/// \p stage, or if the prim at that path does not adhere to this schema,
|
||||
/// return an invalid schema object. This is shorthand for the following:
|
||||
///
|
||||
/// \code
|
||||
/// MjcPhysicsCollisionAPI(stage->GetPrimAtPath(path));
|
||||
/// \endcode
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static MjcPhysicsCollisionAPI Get(const UsdStagePtr& stage,
|
||||
const SdfPath& path);
|
||||
|
||||
/// Returns true if this <b>single-apply</b> API schema can be applied to
|
||||
/// the given \p prim. If this schema can not be a applied to the prim,
|
||||
/// this returns false and, if provided, populates \p whyNot with the
|
||||
/// reason it can not be applied.
|
||||
///
|
||||
/// Note that if CanApply returns false, that does not necessarily imply
|
||||
/// that calling Apply will fail. Callers are expected to call CanApply
|
||||
/// before calling Apply if they want to ensure that it is valid to
|
||||
/// apply a schema.
|
||||
///
|
||||
/// \sa UsdPrim::GetAppliedSchemas()
|
||||
/// \sa UsdPrim::HasAPI()
|
||||
/// \sa UsdPrim::CanApplyAPI()
|
||||
/// \sa UsdPrim::ApplyAPI()
|
||||
/// \sa UsdPrim::RemoveAPI()
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static bool CanApply(const UsdPrim& prim, std::string* whyNot = nullptr);
|
||||
|
||||
/// Applies this <b>single-apply</b> API schema to the given \p prim.
|
||||
/// This information is stored by adding "MjcCollisionAPI" to the
|
||||
/// token-valued, listOp metadata \em apiSchemas on the prim.
|
||||
///
|
||||
/// \return A valid MjcPhysicsCollisionAPI object is returned upon success.
|
||||
/// An invalid (or empty) MjcPhysicsCollisionAPI object is returned upon
|
||||
/// failure. See \ref UsdPrim::ApplyAPI() for conditions
|
||||
/// resulting in failure.
|
||||
///
|
||||
/// \sa UsdPrim::GetAppliedSchemas()
|
||||
/// \sa UsdPrim::HasAPI()
|
||||
/// \sa UsdPrim::CanApplyAPI()
|
||||
/// \sa UsdPrim::ApplyAPI()
|
||||
/// \sa UsdPrim::RemoveAPI()
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static MjcPhysicsCollisionAPI Apply(const UsdPrim& prim);
|
||||
|
||||
protected:
|
||||
/// Returns the kind of schema this class belongs to.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
MJCPHYSICS_API
|
||||
UsdSchemaKind _GetSchemaKind() const override;
|
||||
|
||||
private:
|
||||
// needs to invoke _GetStaticTfType.
|
||||
friend class UsdSchemaRegistry;
|
||||
MJCPHYSICS_API
|
||||
static const TfType& _GetStaticTfType();
|
||||
|
||||
static bool _IsTypedSchema();
|
||||
|
||||
// override SchemaBase virtuals.
|
||||
MJCPHYSICS_API
|
||||
const TfType& _GetTfType() const override;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// GROUP
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Integer MuJoCo group to which the collider belongs.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform int mjc:group = 0` |
|
||||
/// | C++ Type | int |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetGroupAttr() const;
|
||||
|
||||
/// See GetGroupAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateGroupAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// SHELLINERTIA
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Enables handling of the inertia assuming mass is concentrated on the
|
||||
/// surface.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform bool mjc:shellinertia = 0` |
|
||||
/// | C++ Type | bool |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetShellInertiaAttr() const;
|
||||
|
||||
/// See GetShellInertiaAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateShellInertiaAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// PRIORITY
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Priority determining how the properties of two colliders are combined to
|
||||
/// form the properties of the contact.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform int mjc:priority = 0` |
|
||||
/// | C++ Type | int |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetPriorityAttr() const;
|
||||
|
||||
/// See GetPriorityAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreatePriorityAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// CONDIM
|
||||
// --------------------------------------------------------------------- //
|
||||
/// The dimensionality of the contact space for a dynamically generated
|
||||
/// contact pair is set to the maximum of the condim values of the two
|
||||
/// participating geoms.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform int mjc:condim = 3` |
|
||||
/// | C++ Type | int |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetConDimAttr() const;
|
||||
|
||||
/// See GetConDimAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateConDimAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// SOLMIX
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Specifies the weight used for averaging of contact parameters, and
|
||||
/// interacts with the priority attribute.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:solmix = 1` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetSolMixAttr() const;
|
||||
|
||||
/// See GetSolMixAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateSolMixAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// SOLREF
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Specifies the weight used for averaging of contact parameters, and
|
||||
/// interacts with the priority attribute.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double[] mjc:solref = [0.02, 1]` |
|
||||
/// | C++ Type | VtArray<double> |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->DoubleArray |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetSolRefAttr() const;
|
||||
|
||||
/// See GetSolRefAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateSolRefAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// SOLIMP
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Specifies the weight used for averaging of contact parameters, and
|
||||
/// interacts with the priority attribute.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double[] mjc:solimp = [0.9, 0.95, 0.001, 0.5, 2]`
|
||||
/// | | C++ Type | VtArray<double> | | \ref Usd_Datatypes "Usd Type" |
|
||||
/// SdfValueTypeNames->DoubleArray | | \ref SdfVariability "Variability" |
|
||||
/// SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetSolImpAttr() const;
|
||||
|
||||
/// See GetSolImpAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateSolImpAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MARGIN
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Distance threshold below which contacts are detected and included in the
|
||||
/// global array mjData.contact.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:margin = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMarginAttr() const;
|
||||
|
||||
/// See GetMarginAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMarginAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// GAP
|
||||
// --------------------------------------------------------------------- //
|
||||
/// This attribute is used to enable the generation of inactive contacts,
|
||||
/// i.e., contacts that are ignored by the constraint solver but are included
|
||||
/// in mjData.contact for the purpose of custom computations. When this value
|
||||
/// is positive, geom distances between margin and margin-gap correspond to
|
||||
/// such inactive contacts.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:gap = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetGapAttr() const;
|
||||
|
||||
/// See GetGapAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateGapAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// ===================================================================== //
|
||||
// Feel free to add custom code below this line, it will be preserved by
|
||||
// the code generator.
|
||||
//
|
||||
// Just remember to:
|
||||
// - Close the class declaration with };
|
||||
// - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
|
||||
// - Close the include guard with #endif
|
||||
// ===================================================================== //
|
||||
// --(BEGIN CUSTOM CODE)--
|
||||
};
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif
|
||||
184
third_party/mujoco/3.3.7/include/mujoco/experimental/usd/mjcPhysics/imageableAPI.h
vendored
Normal file
@ -0,0 +1,184 @@
|
||||
// Copyright 2025 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MJCPHYSICS_GENERATED_IMAGEABLEAPI_H
|
||||
#define MJCPHYSICS_GENERATED_IMAGEABLEAPI_H
|
||||
|
||||
/// \file mjcPhysics/imageableAPI.h
|
||||
|
||||
#include <mujoco/experimental/usd/mjcPhysics/api.h>
|
||||
#include <mujoco/experimental/usd/mjcPhysics/tokens.h>
|
||||
#include <pxr/base/gf/matrix4d.h>
|
||||
#include <pxr/base/gf/vec3d.h>
|
||||
#include <pxr/base/gf/vec3f.h>
|
||||
#include <pxr/base/tf/token.h>
|
||||
#include <pxr/base/tf/type.h>
|
||||
#include <pxr/base/vt/value.h>
|
||||
#include <pxr/pxr.h>
|
||||
#include <pxr/usd/usd/apiSchemaBase.h>
|
||||
#include <pxr/usd/usd/prim.h>
|
||||
#include <pxr/usd/usd/stage.h>
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
class SdfAssetPath;
|
||||
|
||||
// -------------------------------------------------------------------------- //
|
||||
// MJCIMAGEABLEAPI //
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
/// \class MjcPhysicsImageableAPI
|
||||
///
|
||||
/// API describing attributes for visual entities in MuJoCo.
|
||||
///
|
||||
class MjcPhysicsImageableAPI : public UsdAPISchemaBase {
|
||||
public:
|
||||
/// Compile time constant representing what kind of schema this class is.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
|
||||
|
||||
/// Construct a MjcPhysicsImageableAPI on UsdPrim \p prim .
|
||||
/// Equivalent to MjcPhysicsImageableAPI::Get(prim.GetStage(), prim.GetPath())
|
||||
/// for a \em valid \p prim, but will not immediately throw an error for
|
||||
/// an invalid \p prim
|
||||
explicit MjcPhysicsImageableAPI(const UsdPrim& prim = UsdPrim())
|
||||
: UsdAPISchemaBase(prim) {}
|
||||
|
||||
/// Construct a MjcPhysicsImageableAPI on the prim held by \p schemaObj .
|
||||
/// Should be preferred over MjcPhysicsImageableAPI(schemaObj.GetPrim()),
|
||||
/// as it preserves SchemaBase state.
|
||||
explicit MjcPhysicsImageableAPI(const UsdSchemaBase& schemaObj)
|
||||
: UsdAPISchemaBase(schemaObj) {}
|
||||
|
||||
/// Destructor.
|
||||
MJCPHYSICS_API
|
||||
virtual ~MjcPhysicsImageableAPI();
|
||||
|
||||
/// Return a vector of names of all pre-declared attributes for this schema
|
||||
/// class and all its ancestor classes. Does not include attributes that
|
||||
/// may be authored by custom/extended methods of the schemas involved.
|
||||
MJCPHYSICS_API
|
||||
static const TfTokenVector& GetSchemaAttributeNames(
|
||||
bool includeInherited = true);
|
||||
|
||||
/// Return a MjcPhysicsImageableAPI holding the prim adhering to this
|
||||
/// schema at \p path on \p stage. If no prim exists at \p path on
|
||||
/// \p stage, or if the prim at that path does not adhere to this schema,
|
||||
/// return an invalid schema object. This is shorthand for the following:
|
||||
///
|
||||
/// \code
|
||||
/// MjcPhysicsImageableAPI(stage->GetPrimAtPath(path));
|
||||
/// \endcode
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static MjcPhysicsImageableAPI Get(const UsdStagePtr& stage,
|
||||
const SdfPath& path);
|
||||
|
||||
/// Returns true if this <b>single-apply</b> API schema can be applied to
|
||||
/// the given \p prim. If this schema can not be a applied to the prim,
|
||||
/// this returns false and, if provided, populates \p whyNot with the
|
||||
/// reason it can not be applied.
|
||||
///
|
||||
/// Note that if CanApply returns false, that does not necessarily imply
|
||||
/// that calling Apply will fail. Callers are expected to call CanApply
|
||||
/// before calling Apply if they want to ensure that it is valid to
|
||||
/// apply a schema.
|
||||
///
|
||||
/// \sa UsdPrim::GetAppliedSchemas()
|
||||
/// \sa UsdPrim::HasAPI()
|
||||
/// \sa UsdPrim::CanApplyAPI()
|
||||
/// \sa UsdPrim::ApplyAPI()
|
||||
/// \sa UsdPrim::RemoveAPI()
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static bool CanApply(const UsdPrim& prim, std::string* whyNot = nullptr);
|
||||
|
||||
/// Applies this <b>single-apply</b> API schema to the given \p prim.
|
||||
/// This information is stored by adding "MjcImageableAPI" to the
|
||||
/// token-valued, listOp metadata \em apiSchemas on the prim.
|
||||
///
|
||||
/// \return A valid MjcPhysicsImageableAPI object is returned upon success.
|
||||
/// An invalid (or empty) MjcPhysicsImageableAPI object is returned upon
|
||||
/// failure. See \ref UsdPrim::ApplyAPI() for conditions
|
||||
/// resulting in failure.
|
||||
///
|
||||
/// \sa UsdPrim::GetAppliedSchemas()
|
||||
/// \sa UsdPrim::HasAPI()
|
||||
/// \sa UsdPrim::CanApplyAPI()
|
||||
/// \sa UsdPrim::ApplyAPI()
|
||||
/// \sa UsdPrim::RemoveAPI()
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static MjcPhysicsImageableAPI Apply(const UsdPrim& prim);
|
||||
|
||||
protected:
|
||||
/// Returns the kind of schema this class belongs to.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
MJCPHYSICS_API
|
||||
UsdSchemaKind _GetSchemaKind() const override;
|
||||
|
||||
private:
|
||||
// needs to invoke _GetStaticTfType.
|
||||
friend class UsdSchemaRegistry;
|
||||
MJCPHYSICS_API
|
||||
static const TfType& _GetStaticTfType();
|
||||
|
||||
static bool _IsTypedSchema();
|
||||
|
||||
// override SchemaBase virtuals.
|
||||
MJCPHYSICS_API
|
||||
const TfType& _GetTfType() const override;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// GROUP
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Integer MuJoCo group to which the imageable belongs.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform int mjc:group = 0` |
|
||||
/// | C++ Type | int |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetGroupAttr() const;
|
||||
|
||||
/// See GetGroupAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateGroupAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// ===================================================================== //
|
||||
// Feel free to add custom code below this line, it will be preserved by
|
||||
// the code generator.
|
||||
//
|
||||
// Just remember to:
|
||||
// - Close the class declaration with };
|
||||
// - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
|
||||
// - Close the include guard with #endif
|
||||
// ===================================================================== //
|
||||
// --(BEGIN CUSTOM CODE)--
|
||||
};
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif
|
||||
646
third_party/mujoco/3.3.7/include/mujoco/experimental/usd/mjcPhysics/jointAPI.h
vendored
Normal file
@ -0,0 +1,646 @@
|
||||
// Copyright 2025 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MJCPHYSICS_GENERATED_JOINTAPI_H
|
||||
#define MJCPHYSICS_GENERATED_JOINTAPI_H
|
||||
|
||||
/// \file mjcPhysics/jointAPI.h
|
||||
|
||||
#include <mujoco/experimental/usd/mjcPhysics/api.h>
|
||||
#include <mujoco/experimental/usd/mjcPhysics/tokens.h>
|
||||
#include <pxr/base/gf/matrix4d.h>
|
||||
#include <pxr/base/gf/vec3d.h>
|
||||
#include <pxr/base/gf/vec3f.h>
|
||||
#include <pxr/base/tf/token.h>
|
||||
#include <pxr/base/tf/type.h>
|
||||
#include <pxr/base/vt/value.h>
|
||||
#include <pxr/pxr.h>
|
||||
#include <pxr/usd/usd/apiSchemaBase.h>
|
||||
#include <pxr/usd/usd/prim.h>
|
||||
#include <pxr/usd/usd/stage.h>
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
class SdfAssetPath;
|
||||
|
||||
// -------------------------------------------------------------------------- //
|
||||
// MJCJOINTAPI //
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
/// \class MjcPhysicsJointAPI
|
||||
///
|
||||
/// API describing a MuJoCo joint.
|
||||
///
|
||||
/// For any described attribute \em Fallback \em Value or \em Allowed \em Values
|
||||
/// below that are text/tokens, the actual token is published and defined in
|
||||
/// \ref MjcPhysicsTokens. So to set an attribute to the value "rightHanded",
|
||||
/// use MjcPhysicsTokens->rightHanded as the value.
|
||||
///
|
||||
class MjcPhysicsJointAPI : public UsdAPISchemaBase {
|
||||
public:
|
||||
/// Compile time constant representing what kind of schema this class is.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
|
||||
|
||||
/// Construct a MjcPhysicsJointAPI on UsdPrim \p prim .
|
||||
/// Equivalent to MjcPhysicsJointAPI::Get(prim.GetStage(), prim.GetPath())
|
||||
/// for a \em valid \p prim, but will not immediately throw an error for
|
||||
/// an invalid \p prim
|
||||
explicit MjcPhysicsJointAPI(const UsdPrim& prim = UsdPrim())
|
||||
: UsdAPISchemaBase(prim) {}
|
||||
|
||||
/// Construct a MjcPhysicsJointAPI on the prim held by \p schemaObj .
|
||||
/// Should be preferred over MjcPhysicsJointAPI(schemaObj.GetPrim()),
|
||||
/// as it preserves SchemaBase state.
|
||||
explicit MjcPhysicsJointAPI(const UsdSchemaBase& schemaObj)
|
||||
: UsdAPISchemaBase(schemaObj) {}
|
||||
|
||||
/// Destructor.
|
||||
MJCPHYSICS_API
|
||||
virtual ~MjcPhysicsJointAPI();
|
||||
|
||||
/// Return a vector of names of all pre-declared attributes for this schema
|
||||
/// class and all its ancestor classes. Does not include attributes that
|
||||
/// may be authored by custom/extended methods of the schemas involved.
|
||||
MJCPHYSICS_API
|
||||
static const TfTokenVector& GetSchemaAttributeNames(
|
||||
bool includeInherited = true);
|
||||
|
||||
/// Return a MjcPhysicsJointAPI holding the prim adhering to this
|
||||
/// schema at \p path on \p stage. If no prim exists at \p path on
|
||||
/// \p stage, or if the prim at that path does not adhere to this schema,
|
||||
/// return an invalid schema object. This is shorthand for the following:
|
||||
///
|
||||
/// \code
|
||||
/// MjcPhysicsJointAPI(stage->GetPrimAtPath(path));
|
||||
/// \endcode
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static MjcPhysicsJointAPI Get(const UsdStagePtr& stage, const SdfPath& path);
|
||||
|
||||
/// Returns true if this <b>single-apply</b> API schema can be applied to
|
||||
/// the given \p prim. If this schema can not be a applied to the prim,
|
||||
/// this returns false and, if provided, populates \p whyNot with the
|
||||
/// reason it can not be applied.
|
||||
///
|
||||
/// Note that if CanApply returns false, that does not necessarily imply
|
||||
/// that calling Apply will fail. Callers are expected to call CanApply
|
||||
/// before calling Apply if they want to ensure that it is valid to
|
||||
/// apply a schema.
|
||||
///
|
||||
/// \sa UsdPrim::GetAppliedSchemas()
|
||||
/// \sa UsdPrim::HasAPI()
|
||||
/// \sa UsdPrim::CanApplyAPI()
|
||||
/// \sa UsdPrim::ApplyAPI()
|
||||
/// \sa UsdPrim::RemoveAPI()
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static bool CanApply(const UsdPrim& prim, std::string* whyNot = nullptr);
|
||||
|
||||
/// Applies this <b>single-apply</b> API schema to the given \p prim.
|
||||
/// This information is stored by adding "MjcJointAPI" to the
|
||||
/// token-valued, listOp metadata \em apiSchemas on the prim.
|
||||
///
|
||||
/// \return A valid MjcPhysicsJointAPI object is returned upon success.
|
||||
/// An invalid (or empty) MjcPhysicsJointAPI object is returned upon
|
||||
/// failure. See \ref UsdPrim::ApplyAPI() for conditions
|
||||
/// resulting in failure.
|
||||
///
|
||||
/// \sa UsdPrim::GetAppliedSchemas()
|
||||
/// \sa UsdPrim::HasAPI()
|
||||
/// \sa UsdPrim::CanApplyAPI()
|
||||
/// \sa UsdPrim::ApplyAPI()
|
||||
/// \sa UsdPrim::RemoveAPI()
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static MjcPhysicsJointAPI Apply(const UsdPrim& prim);
|
||||
|
||||
protected:
|
||||
/// Returns the kind of schema this class belongs to.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
MJCPHYSICS_API
|
||||
UsdSchemaKind _GetSchemaKind() const override;
|
||||
|
||||
private:
|
||||
// needs to invoke _GetStaticTfType.
|
||||
friend class UsdSchemaRegistry;
|
||||
MJCPHYSICS_API
|
||||
static const TfType& _GetStaticTfType();
|
||||
|
||||
static bool _IsTypedSchema();
|
||||
|
||||
// override SchemaBase virtuals.
|
||||
MJCPHYSICS_API
|
||||
const TfType& _GetTfType() const override;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// GROUP
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Integer MuJoCo group to which the joint belongs.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform int mjc:group = 0` |
|
||||
/// | C++ Type | int |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetGroupAttr() const;
|
||||
|
||||
/// See GetGroupAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateGroupAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCSPRINGDAMPER
|
||||
// --------------------------------------------------------------------- //
|
||||
/// When both numbers are positive, the compiler will override any stiffness
|
||||
/// and damping values specified with the attributes below, and will instead
|
||||
/// set them automatically so that the resulting mass-spring-damper for this
|
||||
/// joint has the desired time constant (first value) and damping ratio
|
||||
/// (second value). This is done by taking into account the joint inertia in
|
||||
/// the model reference configuration. Note that the format is the same as the
|
||||
/// solref parameter of the constraint solver.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double[] mjc:springdamper = [0, 0]` |
|
||||
/// | C++ Type | VtArray<double> |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->DoubleArray |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcSpringdamperAttr() const;
|
||||
|
||||
/// See GetMjcSpringdamperAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcSpringdamperAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCSOLREFLIMIT
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Constraint solver parameters for simulating joint limits.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double[] mjc:solreflimit = [0.02, 1]` |
|
||||
/// | C++ Type | VtArray<double> |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->DoubleArray |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcSolreflimitAttr() const;
|
||||
|
||||
/// See GetMjcSolreflimitAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcSolreflimitAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCSOLIMPLIMIT
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Constraint solver parameters for simulating joint limits.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double[] mjc:solimplimit = [0.9, 0.95, 0.001,
|
||||
/// 0.5, 2]` | | C++ Type | VtArray<double> | | \ref Usd_Datatypes "Usd Type"
|
||||
/// | SdfValueTypeNames->DoubleArray | | \ref SdfVariability "Variability" |
|
||||
/// SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcSolimplimitAttr() const;
|
||||
|
||||
/// See GetMjcSolimplimitAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcSolimplimitAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCSOLREFFRICTION
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Constraint solver parameters for simulating dry friction.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double[] mjc:solreffriction = [0.02, 1]` |
|
||||
/// | C++ Type | VtArray<double> |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->DoubleArray |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcSolreffrictionAttr() const;
|
||||
|
||||
/// See GetMjcSolreffrictionAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcSolreffrictionAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCSOLIMPFRICTION
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Constraint solver parameters for simulating dry friction.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double[] mjc:solimpfriction = [0.9, 0.95, 0.001,
|
||||
/// 0.5, 2]` | | C++ Type | VtArray<double> | | \ref Usd_Datatypes "Usd Type"
|
||||
/// | SdfValueTypeNames->DoubleArray | | \ref SdfVariability "Variability" |
|
||||
/// SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcSolimpfrictionAttr() const;
|
||||
|
||||
/// See GetMjcSolimpfrictionAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcSolimpfrictionAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCSTIFFNESS
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Joint stiffness. If this value is positive, a spring will be created with
|
||||
/// equilibrium position given by springref below. The spring force is
|
||||
/// computed along with the other passive forces.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:stiffness = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcStiffnessAttr() const;
|
||||
|
||||
/// See GetMjcStiffnessAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcStiffnessAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCACTUATORFRCRANGEMIN
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Minimum range for clamping total actuator forces acting on this joint. See
|
||||
/// Force limits for details. It is available only for scalar joints (hinge
|
||||
/// and slider) and ignored for ball and free joints. The compiler expects the
|
||||
/// first value to be smaller than the second value. Setting this attribute
|
||||
/// without specifying actuatorfrclimited is an error if compiler-autolimits
|
||||
/// is 'false'.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:actuatorfrcrange:min = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcActuatorfrcrangeMinAttr() const;
|
||||
|
||||
/// See GetMjcActuatorfrcrangeMinAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcActuatorfrcrangeMinAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCACTUATORFRCRANGEMAX
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Maximum range for clamping total actuator forces acting on this joint. See
|
||||
/// Force limits for details. It is available only for scalar joints (hinge
|
||||
/// and slider) and ignored for ball and free joints. The compiler expects the
|
||||
/// first value to be smaller than the second value. Setting this attribute
|
||||
/// without specifying actuatorfrclimited is an error if compiler-autolimits
|
||||
/// is 'false'.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:actuatorfrcrange:max = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcActuatorfrcrangeMaxAttr() const;
|
||||
|
||||
/// See GetMjcActuatorfrcrangeMaxAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcActuatorfrcrangeMaxAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCACTUATORFRCLIMITED
|
||||
// --------------------------------------------------------------------- //
|
||||
/// This attribute specifies whether actuator forces acting on the joint
|
||||
/// should be clamped. See Force limits for details. It is available only for
|
||||
/// scalar joints (hinge and slider) and ignored for ball and free joints.
|
||||
/// This attribute interacts with the actuatorfrcrange attribute. If this
|
||||
/// attribute is 'false', actuator force clamping is disabled. If it is
|
||||
/// 'true', actuator force clamping is enabled. If this attribute is 'auto',
|
||||
/// and autolimits is set in compiler, actuator force clamping will be enabled
|
||||
/// if actuatorfrcrange is defined.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform token mjc:actuatorfrclimited = "auto"` |
|
||||
/// | C++ Type | TfToken |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
/// | \ref MjcPhysicsTokens "Allowed Values" | false, true, auto |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcActuatorfrclimitedAttr() const;
|
||||
|
||||
/// See GetMjcActuatorfrclimitedAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcActuatorfrclimitedAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCACTUATORGRAVCOMP
|
||||
// --------------------------------------------------------------------- //
|
||||
/// If this flag is enabled, gravity compensation applied to this joint is
|
||||
/// added to actuator forces (mjData.qfrc_actuator) rather than passive forces
|
||||
/// (mjData.qfrc_passive). Notionally, this means that gravity compensation is
|
||||
/// the result of a control system rather than natural buoyancy. In practice,
|
||||
/// enabling this flag is useful when joint-level actuator force clamping is
|
||||
/// used. In this case, the total actuation force applied on a joint,
|
||||
/// including gravity compensation, is guaranteed to not exceed the specified
|
||||
/// limits. See Force limits and actuatorfrcrange for more details on this
|
||||
/// type of force limit.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform bool mjc:actuatorgravcomp = 0` |
|
||||
/// | C++ Type | bool |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcActuatorgravcompAttr() const;
|
||||
|
||||
/// See GetMjcActuatorgravcompAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcActuatorgravcompAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCMARGIN
|
||||
// --------------------------------------------------------------------- //
|
||||
/// The distance threshold below which limits become active. Recall that the
|
||||
/// Constraint solver normally generates forces as soon as a constraint
|
||||
/// becomes active, even if the margin parameter makes that happen at a
|
||||
/// distance. This attribute together with solreflimit and solimplimit can be
|
||||
/// used to model a soft joint limit.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:margin = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcMarginAttr() const;
|
||||
|
||||
/// See GetMjcMarginAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcMarginAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCREF
|
||||
// --------------------------------------------------------------------- //
|
||||
/// The reference position or angle of the joint. This attribute is only used
|
||||
/// for slide and hinge joints. It defines the joint value corresponding to
|
||||
/// the initial model configuration. The amount of spatial transformation that
|
||||
/// the joint applies at runtime equals the current joint value stored in
|
||||
/// mjData.qpos minus this reference value stored in mjModel.qpos0. The
|
||||
/// meaning of these vectors was discussed in the Stand-alone section in the
|
||||
/// Overview chapter.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:ref = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcRefAttr() const;
|
||||
|
||||
/// See GetMjcRefAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcRefAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCSPRINGREF
|
||||
// --------------------------------------------------------------------- //
|
||||
/// The joint position or angle in which the joint spring (if any) achieves
|
||||
/// equilibrium. Similar to the vector mjModel.qpos0 which stores all joint
|
||||
/// reference values specified with the ref attribute above, all spring
|
||||
/// reference values specified with this attribute are stored in the vector
|
||||
/// mjModel.qpos_spring. The model configuration corresponding to
|
||||
/// mjModel.qpos_spring is also used to compute the spring reference lengths
|
||||
/// of all tendons, stored in mjModel.tendon_lengthspring. This is because
|
||||
/// tendons can also have springs.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:springref = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcSpringrefAttr() const;
|
||||
|
||||
/// See GetMjcSpringrefAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcSpringrefAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCARMATURE
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Additional inertia associated with movement of the joint that is not due
|
||||
/// to body mass. This added inertia is usually due to a rotor (a.k.a
|
||||
/// armature) spinning faster than the joint itself due to a geared
|
||||
/// transmission. The value applies to all degrees of freedom created by this
|
||||
/// joint. Besides increasing the realism of joints with geared transmission,
|
||||
/// positive armature significantly improves simulation stability, even for
|
||||
/// small values, and is a recommended possible fix when encountering
|
||||
/// stability issues.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:armature = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcArmatureAttr() const;
|
||||
|
||||
/// See GetMjcArmatureAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcArmatureAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCDAMPING
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Damping applied to all degrees of freedom created by this joint. Unlike
|
||||
/// friction loss which is computed by the constraint solver, damping is
|
||||
/// simply a force linear in velocity. It is included in the passive forces.
|
||||
/// Despite this simplicity, larger damping values can make numerical
|
||||
/// integrators unstable, which is why our Euler integrator handles damping
|
||||
/// implicitly. See Integration in the Computation chapter.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:damping = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcDampingAttr() const;
|
||||
|
||||
/// See GetMjcDampingAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcDampingAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCFRICTIONLOSS
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Friction loss due to dry friction. This value is the same for all degrees
|
||||
/// of freedom created by this joint. Semantically friction loss does not make
|
||||
/// sense for free joints, but the compiler allows it. To enable friction
|
||||
/// loss, set this attribute to a positive value.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:frictionloss = 0` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcFrictionlossAttr() const;
|
||||
|
||||
/// See GetMjcFrictionlossAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcFrictionlossAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// ===================================================================== //
|
||||
// Feel free to add custom code below this line, it will be preserved by
|
||||
// the code generator.
|
||||
//
|
||||
// Just remember to:
|
||||
// - Close the class declaration with };
|
||||
// - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
|
||||
// - Close the include guard with #endif
|
||||
// ===================================================================== //
|
||||
// --(BEGIN CUSTOM CODE)--
|
||||
};
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif
|
||||
292
third_party/mujoco/3.3.7/include/mujoco/experimental/usd/mjcPhysics/keyframe.h
vendored
Normal file
@ -0,0 +1,292 @@
|
||||
// Copyright 2025 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MJCPHYSICS_GENERATED_KEYFRAME_H
|
||||
#define MJCPHYSICS_GENERATED_KEYFRAME_H
|
||||
|
||||
/// \file mjcPhysics/keyframe.h
|
||||
|
||||
#include <mujoco/experimental/usd/mjcPhysics/api.h>
|
||||
#include <mujoco/experimental/usd/mjcPhysics/tokens.h>
|
||||
#include <pxr/base/gf/matrix4d.h>
|
||||
#include <pxr/base/gf/vec3d.h>
|
||||
#include <pxr/base/gf/vec3f.h>
|
||||
#include <pxr/base/tf/token.h>
|
||||
#include <pxr/base/tf/type.h>
|
||||
#include <pxr/base/vt/value.h>
|
||||
#include <pxr/pxr.h>
|
||||
#include <pxr/usd/usd/prim.h>
|
||||
#include <pxr/usd/usd/stage.h>
|
||||
#include <pxr/usd/usd/typed.h>
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
class SdfAssetPath;
|
||||
|
||||
// -------------------------------------------------------------------------- //
|
||||
// MJCKEYFRAME //
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
/// \class MjcPhysicsKeyframe
|
||||
///
|
||||
/// Represents time independent keyframe values.
|
||||
///
|
||||
class MjcPhysicsKeyframe : public UsdTyped {
|
||||
public:
|
||||
/// Compile time constant representing what kind of schema this class is.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped;
|
||||
|
||||
/// Construct a MjcPhysicsKeyframe on UsdPrim \p prim .
|
||||
/// Equivalent to MjcPhysicsKeyframe::Get(prim.GetStage(), prim.GetPath())
|
||||
/// for a \em valid \p prim, but will not immediately throw an error for
|
||||
/// an invalid \p prim
|
||||
explicit MjcPhysicsKeyframe(const UsdPrim& prim = UsdPrim())
|
||||
: UsdTyped(prim) {}
|
||||
|
||||
/// Construct a MjcPhysicsKeyframe on the prim held by \p schemaObj .
|
||||
/// Should be preferred over MjcPhysicsKeyframe(schemaObj.GetPrim()),
|
||||
/// as it preserves SchemaBase state.
|
||||
explicit MjcPhysicsKeyframe(const UsdSchemaBase& schemaObj)
|
||||
: UsdTyped(schemaObj) {}
|
||||
|
||||
/// Destructor.
|
||||
MJCPHYSICS_API
|
||||
virtual ~MjcPhysicsKeyframe();
|
||||
|
||||
/// Return a vector of names of all pre-declared attributes for this schema
|
||||
/// class and all its ancestor classes. Does not include attributes that
|
||||
/// may be authored by custom/extended methods of the schemas involved.
|
||||
MJCPHYSICS_API
|
||||
static const TfTokenVector& GetSchemaAttributeNames(
|
||||
bool includeInherited = true);
|
||||
|
||||
/// Return a MjcPhysicsKeyframe holding the prim adhering to this
|
||||
/// schema at \p path on \p stage. If no prim exists at \p path on
|
||||
/// \p stage, or if the prim at that path does not adhere to this schema,
|
||||
/// return an invalid schema object. This is shorthand for the following:
|
||||
///
|
||||
/// \code
|
||||
/// MjcPhysicsKeyframe(stage->GetPrimAtPath(path));
|
||||
/// \endcode
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static MjcPhysicsKeyframe Get(const UsdStagePtr& stage, const SdfPath& path);
|
||||
|
||||
/// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
|
||||
/// is defined (according to UsdPrim::IsDefined()) on this stage.
|
||||
///
|
||||
/// If a prim adhering to this schema at \p path is already defined on this
|
||||
/// stage, return that prim. Otherwise author an \a SdfPrimSpec with
|
||||
/// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
|
||||
/// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
|
||||
/// with \p specifier == \a SdfSpecifierDef and empty typeName at the
|
||||
/// current EditTarget for any nonexistent, or existing but not \a Defined
|
||||
/// ancestors.
|
||||
///
|
||||
/// The given \a path must be an absolute prim path that does not contain
|
||||
/// any variant selections.
|
||||
///
|
||||
/// If it is impossible to author any of the necessary PrimSpecs, (for
|
||||
/// example, in case \a path cannot map to the current UsdEditTarget's
|
||||
/// namespace) issue an error and return an invalid \a UsdPrim.
|
||||
///
|
||||
/// Note that this method may return a defined prim whose typeName does not
|
||||
/// specify this schema class, in case a stronger typeName opinion overrides
|
||||
/// the opinion at the current EditTarget.
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static MjcPhysicsKeyframe Define(const UsdStagePtr& stage,
|
||||
const SdfPath& path);
|
||||
|
||||
protected:
|
||||
/// Returns the kind of schema this class belongs to.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
MJCPHYSICS_API
|
||||
UsdSchemaKind _GetSchemaKind() const override;
|
||||
|
||||
private:
|
||||
// needs to invoke _GetStaticTfType.
|
||||
friend class UsdSchemaRegistry;
|
||||
MJCPHYSICS_API
|
||||
static const TfType& _GetStaticTfType();
|
||||
|
||||
static bool _IsTypedSchema();
|
||||
|
||||
// override SchemaBase virtuals.
|
||||
MJCPHYSICS_API
|
||||
const TfType& _GetTfType() const override;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCQPOS
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Vector of joint positions, copied into mjData.qpos when the simulation
|
||||
/// state is set to this keyframe.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `double[] mjc:qpos` |
|
||||
/// | C++ Type | VtArray<double> |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->DoubleArray |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcQposAttr() const;
|
||||
|
||||
/// See GetMjcQposAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcQposAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCQVEL
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Vector of joint velocities, copied into mjData.qvel when the simulation
|
||||
/// state is set to this keyframe.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `double[] mjc:qvel` |
|
||||
/// | C++ Type | VtArray<double> |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->DoubleArray |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcQvelAttr() const;
|
||||
|
||||
/// See GetMjcQvelAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcQvelAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCACT
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Vector of actuator activations, copied into mjData.act when the simulation
|
||||
/// state is set to this keyframe.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `double[] mjc:act` |
|
||||
/// | C++ Type | VtArray<double> |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->DoubleArray |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcActAttr() const;
|
||||
|
||||
/// See GetMjcActAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcActAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCCTRL
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Vector of controls, copied into mjData.ctrl when the simulation state is
|
||||
/// set to this keyframe.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `double[] mjc:ctrl` |
|
||||
/// | C++ Type | VtArray<double> |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->DoubleArray |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcCtrlAttr() const;
|
||||
|
||||
/// See GetMjcCtrlAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcCtrlAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCMPOS
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Vector of mocap body positions, copied into mjData.mocap_pos when the
|
||||
/// simulation state is set to this keyframe.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `double[] mjc:mpos` |
|
||||
/// | C++ Type | VtArray<double> |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->DoubleArray |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcMposAttr() const;
|
||||
|
||||
/// See GetMjcMposAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcMposAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MJCMQUAT
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Vector of mocap body quaternions, copied into mjData.mocap_quat when the
|
||||
/// simulation state is set to this keyframe.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `double[] mjc:mquat` |
|
||||
/// | C++ Type | VtArray<double> |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->DoubleArray |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMjcMquatAttr() const;
|
||||
|
||||
/// See GetMjcMquatAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMjcMquatAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// ===================================================================== //
|
||||
// Feel free to add custom code below this line, it will be preserved by
|
||||
// the code generator.
|
||||
//
|
||||
// Just remember to:
|
||||
// - Close the class declaration with };
|
||||
// - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
|
||||
// - Close the include guard with #endif
|
||||
// ===================================================================== //
|
||||
// --(BEGIN CUSTOM CODE)--
|
||||
};
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif
|
||||
210
third_party/mujoco/3.3.7/include/mujoco/experimental/usd/mjcPhysics/materialAPI.h
vendored
Normal file
@ -0,0 +1,210 @@
|
||||
// Copyright 2025 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MJCPHYSICS_GENERATED_MATERIALAPI_H
|
||||
#define MJCPHYSICS_GENERATED_MATERIALAPI_H
|
||||
|
||||
/// \file mjcPhysics/materialAPI.h
|
||||
|
||||
#include <mujoco/experimental/usd/mjcPhysics/api.h>
|
||||
#include <mujoco/experimental/usd/mjcPhysics/tokens.h>
|
||||
#include <pxr/base/gf/matrix4d.h>
|
||||
#include <pxr/base/gf/vec3d.h>
|
||||
#include <pxr/base/gf/vec3f.h>
|
||||
#include <pxr/base/tf/token.h>
|
||||
#include <pxr/base/tf/type.h>
|
||||
#include <pxr/base/vt/value.h>
|
||||
#include <pxr/pxr.h>
|
||||
#include <pxr/usd/usd/apiSchemaBase.h>
|
||||
#include <pxr/usd/usd/prim.h>
|
||||
#include <pxr/usd/usd/stage.h>
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
class SdfAssetPath;
|
||||
|
||||
// -------------------------------------------------------------------------- //
|
||||
// MJCMATERIALAPI //
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
/// \class MjcPhysicsMaterialAPI
|
||||
///
|
||||
/// API providing extension attributes to represent physical MuJoCo materials.
|
||||
///
|
||||
class MjcPhysicsMaterialAPI : public UsdAPISchemaBase {
|
||||
public:
|
||||
/// Compile time constant representing what kind of schema this class is.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
|
||||
|
||||
/// Construct a MjcPhysicsMaterialAPI on UsdPrim \p prim .
|
||||
/// Equivalent to MjcPhysicsMaterialAPI::Get(prim.GetStage(), prim.GetPath())
|
||||
/// for a \em valid \p prim, but will not immediately throw an error for
|
||||
/// an invalid \p prim
|
||||
explicit MjcPhysicsMaterialAPI(const UsdPrim& prim = UsdPrim())
|
||||
: UsdAPISchemaBase(prim) {}
|
||||
|
||||
/// Construct a MjcPhysicsMaterialAPI on the prim held by \p schemaObj .
|
||||
/// Should be preferred over MjcPhysicsMaterialAPI(schemaObj.GetPrim()),
|
||||
/// as it preserves SchemaBase state.
|
||||
explicit MjcPhysicsMaterialAPI(const UsdSchemaBase& schemaObj)
|
||||
: UsdAPISchemaBase(schemaObj) {}
|
||||
|
||||
/// Destructor.
|
||||
MJCPHYSICS_API
|
||||
virtual ~MjcPhysicsMaterialAPI();
|
||||
|
||||
/// Return a vector of names of all pre-declared attributes for this schema
|
||||
/// class and all its ancestor classes. Does not include attributes that
|
||||
/// may be authored by custom/extended methods of the schemas involved.
|
||||
MJCPHYSICS_API
|
||||
static const TfTokenVector& GetSchemaAttributeNames(
|
||||
bool includeInherited = true);
|
||||
|
||||
/// Return a MjcPhysicsMaterialAPI holding the prim adhering to this
|
||||
/// schema at \p path on \p stage. If no prim exists at \p path on
|
||||
/// \p stage, or if the prim at that path does not adhere to this schema,
|
||||
/// return an invalid schema object. This is shorthand for the following:
|
||||
///
|
||||
/// \code
|
||||
/// MjcPhysicsMaterialAPI(stage->GetPrimAtPath(path));
|
||||
/// \endcode
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static MjcPhysicsMaterialAPI Get(const UsdStagePtr& stage,
|
||||
const SdfPath& path);
|
||||
|
||||
/// Returns true if this <b>single-apply</b> API schema can be applied to
|
||||
/// the given \p prim. If this schema can not be a applied to the prim,
|
||||
/// this returns false and, if provided, populates \p whyNot with the
|
||||
/// reason it can not be applied.
|
||||
///
|
||||
/// Note that if CanApply returns false, that does not necessarily imply
|
||||
/// that calling Apply will fail. Callers are expected to call CanApply
|
||||
/// before calling Apply if they want to ensure that it is valid to
|
||||
/// apply a schema.
|
||||
///
|
||||
/// \sa UsdPrim::GetAppliedSchemas()
|
||||
/// \sa UsdPrim::HasAPI()
|
||||
/// \sa UsdPrim::CanApplyAPI()
|
||||
/// \sa UsdPrim::ApplyAPI()
|
||||
/// \sa UsdPrim::RemoveAPI()
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static bool CanApply(const UsdPrim& prim, std::string* whyNot = nullptr);
|
||||
|
||||
/// Applies this <b>single-apply</b> API schema to the given \p prim.
|
||||
/// This information is stored by adding "MjcMaterialAPI" to the
|
||||
/// token-valued, listOp metadata \em apiSchemas on the prim.
|
||||
///
|
||||
/// \return A valid MjcPhysicsMaterialAPI object is returned upon success.
|
||||
/// An invalid (or empty) MjcPhysicsMaterialAPI object is returned upon
|
||||
/// failure. See \ref UsdPrim::ApplyAPI() for conditions
|
||||
/// resulting in failure.
|
||||
///
|
||||
/// \sa UsdPrim::GetAppliedSchemas()
|
||||
/// \sa UsdPrim::HasAPI()
|
||||
/// \sa UsdPrim::CanApplyAPI()
|
||||
/// \sa UsdPrim::ApplyAPI()
|
||||
/// \sa UsdPrim::RemoveAPI()
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static MjcPhysicsMaterialAPI Apply(const UsdPrim& prim);
|
||||
|
||||
protected:
|
||||
/// Returns the kind of schema this class belongs to.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
MJCPHYSICS_API
|
||||
UsdSchemaKind _GetSchemaKind() const override;
|
||||
|
||||
private:
|
||||
// needs to invoke _GetStaticTfType.
|
||||
friend class UsdSchemaRegistry;
|
||||
MJCPHYSICS_API
|
||||
static const TfType& _GetStaticTfType();
|
||||
|
||||
static bool _IsTypedSchema();
|
||||
|
||||
// override SchemaBase virtuals.
|
||||
MJCPHYSICS_API
|
||||
const TfType& _GetTfType() const override;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// TORSIONALFRICTION
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Friction value acting around contact normal.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:torsionalfriction = 0.005` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetTorsionalFrictionAttr() const;
|
||||
|
||||
/// See GetTorsionalFrictionAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateTorsionalFrictionAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// ROLLINGFRICTION
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Friction value acting around both axes on the contact tangent plane.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform double mjc:rollingfriction = 0.0001` |
|
||||
/// | C++ Type | double |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Double |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetRollingFrictionAttr() const;
|
||||
|
||||
/// See GetRollingFrictionAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateRollingFrictionAttr(
|
||||
VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// ===================================================================== //
|
||||
// Feel free to add custom code below this line, it will be preserved by
|
||||
// the code generator.
|
||||
//
|
||||
// Just remember to:
|
||||
// - Close the class declaration with };
|
||||
// - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
|
||||
// - Close the include guard with #endif
|
||||
// ===================================================================== //
|
||||
// --(BEGIN CUSTOM CODE)--
|
||||
};
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif
|
||||
216
third_party/mujoco/3.3.7/include/mujoco/experimental/usd/mjcPhysics/meshCollisionAPI.h
vendored
Normal file
@ -0,0 +1,216 @@
|
||||
// Copyright 2025 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MJCPHYSICS_GENERATED_MESHCOLLISIONAPI_H
|
||||
#define MJCPHYSICS_GENERATED_MESHCOLLISIONAPI_H
|
||||
|
||||
/// \file mjcPhysics/meshCollisionAPI.h
|
||||
|
||||
#include <mujoco/experimental/usd/mjcPhysics/api.h>
|
||||
#include <mujoco/experimental/usd/mjcPhysics/tokens.h>
|
||||
#include <pxr/base/gf/matrix4d.h>
|
||||
#include <pxr/base/gf/vec3d.h>
|
||||
#include <pxr/base/gf/vec3f.h>
|
||||
#include <pxr/base/tf/token.h>
|
||||
#include <pxr/base/tf/type.h>
|
||||
#include <pxr/base/vt/value.h>
|
||||
#include <pxr/pxr.h>
|
||||
#include <pxr/usd/usd/apiSchemaBase.h>
|
||||
#include <pxr/usd/usd/prim.h>
|
||||
#include <pxr/usd/usd/stage.h>
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
class SdfAssetPath;
|
||||
|
||||
// -------------------------------------------------------------------------- //
|
||||
// MJCMESHCOLLISIONAPI //
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
/// \class MjcPhysicsMeshCollisionAPI
|
||||
///
|
||||
/// API describing a MuJoCo mesh collider.
|
||||
///
|
||||
/// For any described attribute \em Fallback \em Value or \em Allowed \em Values
|
||||
/// below that are text/tokens, the actual token is published and defined in
|
||||
/// \ref MjcPhysicsTokens. So to set an attribute to the value "rightHanded",
|
||||
/// use MjcPhysicsTokens->rightHanded as the value.
|
||||
///
|
||||
class MjcPhysicsMeshCollisionAPI : public UsdAPISchemaBase {
|
||||
public:
|
||||
/// Compile time constant representing what kind of schema this class is.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
|
||||
|
||||
/// Construct a MjcPhysicsMeshCollisionAPI on UsdPrim \p prim .
|
||||
/// Equivalent to MjcPhysicsMeshCollisionAPI::Get(prim.GetStage(),
|
||||
/// prim.GetPath()) for a \em valid \p prim, but will not immediately throw an
|
||||
/// error for an invalid \p prim
|
||||
explicit MjcPhysicsMeshCollisionAPI(const UsdPrim& prim = UsdPrim())
|
||||
: UsdAPISchemaBase(prim) {}
|
||||
|
||||
/// Construct a MjcPhysicsMeshCollisionAPI on the prim held by \p schemaObj .
|
||||
/// Should be preferred over MjcPhysicsMeshCollisionAPI(schemaObj.GetPrim()),
|
||||
/// as it preserves SchemaBase state.
|
||||
explicit MjcPhysicsMeshCollisionAPI(const UsdSchemaBase& schemaObj)
|
||||
: UsdAPISchemaBase(schemaObj) {}
|
||||
|
||||
/// Destructor.
|
||||
MJCPHYSICS_API
|
||||
virtual ~MjcPhysicsMeshCollisionAPI();
|
||||
|
||||
/// Return a vector of names of all pre-declared attributes for this schema
|
||||
/// class and all its ancestor classes. Does not include attributes that
|
||||
/// may be authored by custom/extended methods of the schemas involved.
|
||||
MJCPHYSICS_API
|
||||
static const TfTokenVector& GetSchemaAttributeNames(
|
||||
bool includeInherited = true);
|
||||
|
||||
/// Return a MjcPhysicsMeshCollisionAPI holding the prim adhering to this
|
||||
/// schema at \p path on \p stage. If no prim exists at \p path on
|
||||
/// \p stage, or if the prim at that path does not adhere to this schema,
|
||||
/// return an invalid schema object. This is shorthand for the following:
|
||||
///
|
||||
/// \code
|
||||
/// MjcPhysicsMeshCollisionAPI(stage->GetPrimAtPath(path));
|
||||
/// \endcode
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static MjcPhysicsMeshCollisionAPI Get(const UsdStagePtr& stage,
|
||||
const SdfPath& path);
|
||||
|
||||
/// Returns true if this <b>single-apply</b> API schema can be applied to
|
||||
/// the given \p prim. If this schema can not be a applied to the prim,
|
||||
/// this returns false and, if provided, populates \p whyNot with the
|
||||
/// reason it can not be applied.
|
||||
///
|
||||
/// Note that if CanApply returns false, that does not necessarily imply
|
||||
/// that calling Apply will fail. Callers are expected to call CanApply
|
||||
/// before calling Apply if they want to ensure that it is valid to
|
||||
/// apply a schema.
|
||||
///
|
||||
/// \sa UsdPrim::GetAppliedSchemas()
|
||||
/// \sa UsdPrim::HasAPI()
|
||||
/// \sa UsdPrim::CanApplyAPI()
|
||||
/// \sa UsdPrim::ApplyAPI()
|
||||
/// \sa UsdPrim::RemoveAPI()
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static bool CanApply(const UsdPrim& prim, std::string* whyNot = nullptr);
|
||||
|
||||
/// Applies this <b>single-apply</b> API schema to the given \p prim.
|
||||
/// This information is stored by adding "MjcMeshCollisionAPI" to the
|
||||
/// token-valued, listOp metadata \em apiSchemas on the prim.
|
||||
///
|
||||
/// \return A valid MjcPhysicsMeshCollisionAPI object is returned upon
|
||||
/// success. An invalid (or empty) MjcPhysicsMeshCollisionAPI object is
|
||||
/// returned upon failure. See \ref UsdPrim::ApplyAPI() for conditions
|
||||
/// resulting in failure.
|
||||
///
|
||||
/// \sa UsdPrim::GetAppliedSchemas()
|
||||
/// \sa UsdPrim::HasAPI()
|
||||
/// \sa UsdPrim::CanApplyAPI()
|
||||
/// \sa UsdPrim::ApplyAPI()
|
||||
/// \sa UsdPrim::RemoveAPI()
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static MjcPhysicsMeshCollisionAPI Apply(const UsdPrim& prim);
|
||||
|
||||
protected:
|
||||
/// Returns the kind of schema this class belongs to.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
MJCPHYSICS_API
|
||||
UsdSchemaKind _GetSchemaKind() const override;
|
||||
|
||||
private:
|
||||
// needs to invoke _GetStaticTfType.
|
||||
friend class UsdSchemaRegistry;
|
||||
MJCPHYSICS_API
|
||||
static const TfType& _GetStaticTfType();
|
||||
|
||||
static bool _IsTypedSchema();
|
||||
|
||||
// override SchemaBase virtuals.
|
||||
MJCPHYSICS_API
|
||||
const TfType& _GetTfType() const override;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// INERTIA
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Controls how a mesh is used when mass and inertia are inferred from
|
||||
/// geometry.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform token mjc:inertia = "legacy"` |
|
||||
/// | C++ Type | TfToken |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
/// | \ref MjcPhysicsTokens "Allowed Values" | legacy, convex, exact, shell |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetInertiaAttr() const;
|
||||
|
||||
/// See GetInertiaAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateInertiaAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// MAXHULLVERT
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Sets an upper limit on the number of vertices in the meshes convex hull.
|
||||
/// The default value of -1 means unlimited.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform int mjc:maxhullvert = -1` |
|
||||
/// | C++ Type | int |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetMaxHullVertAttr() const;
|
||||
|
||||
/// See GetMaxHullVertAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateMaxHullVertAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// ===================================================================== //
|
||||
// Feel free to add custom code below this line, it will be preserved by
|
||||
// the code generator.
|
||||
//
|
||||
// Just remember to:
|
||||
// - Close the class declaration with };
|
||||
// - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
|
||||
// - Close the include guard with #endif
|
||||
// ===================================================================== //
|
||||
// --(BEGIN CUSTOM CODE)--
|
||||
};
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif
|
||||
1781
third_party/mujoco/3.3.7/include/mujoco/experimental/usd/mjcPhysics/sceneAPI.h
vendored
Normal file
183
third_party/mujoco/3.3.7/include/mujoco/experimental/usd/mjcPhysics/siteAPI.h
vendored
Normal file
@ -0,0 +1,183 @@
|
||||
// Copyright 2025 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MJCPHYSICS_GENERATED_SITEAPI_H
|
||||
#define MJCPHYSICS_GENERATED_SITEAPI_H
|
||||
|
||||
/// \file mjcPhysics/siteAPI.h
|
||||
|
||||
#include <mujoco/experimental/usd/mjcPhysics/api.h>
|
||||
#include <mujoco/experimental/usd/mjcPhysics/tokens.h>
|
||||
#include <pxr/base/gf/matrix4d.h>
|
||||
#include <pxr/base/gf/vec3d.h>
|
||||
#include <pxr/base/gf/vec3f.h>
|
||||
#include <pxr/base/tf/token.h>
|
||||
#include <pxr/base/tf/type.h>
|
||||
#include <pxr/base/vt/value.h>
|
||||
#include <pxr/pxr.h>
|
||||
#include <pxr/usd/usd/apiSchemaBase.h>
|
||||
#include <pxr/usd/usd/prim.h>
|
||||
#include <pxr/usd/usd/stage.h>
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
class SdfAssetPath;
|
||||
|
||||
// -------------------------------------------------------------------------- //
|
||||
// MJCSITEAPI //
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
/// \class MjcPhysicsSiteAPI
|
||||
///
|
||||
/// API describing a MuJoCo site.
|
||||
///
|
||||
class MjcPhysicsSiteAPI : public UsdAPISchemaBase {
|
||||
public:
|
||||
/// Compile time constant representing what kind of schema this class is.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
|
||||
|
||||
/// Construct a MjcPhysicsSiteAPI on UsdPrim \p prim .
|
||||
/// Equivalent to MjcPhysicsSiteAPI::Get(prim.GetStage(), prim.GetPath())
|
||||
/// for a \em valid \p prim, but will not immediately throw an error for
|
||||
/// an invalid \p prim
|
||||
explicit MjcPhysicsSiteAPI(const UsdPrim& prim = UsdPrim())
|
||||
: UsdAPISchemaBase(prim) {}
|
||||
|
||||
/// Construct a MjcPhysicsSiteAPI on the prim held by \p schemaObj .
|
||||
/// Should be preferred over MjcPhysicsSiteAPI(schemaObj.GetPrim()),
|
||||
/// as it preserves SchemaBase state.
|
||||
explicit MjcPhysicsSiteAPI(const UsdSchemaBase& schemaObj)
|
||||
: UsdAPISchemaBase(schemaObj) {}
|
||||
|
||||
/// Destructor.
|
||||
MJCPHYSICS_API
|
||||
virtual ~MjcPhysicsSiteAPI();
|
||||
|
||||
/// Return a vector of names of all pre-declared attributes for this schema
|
||||
/// class and all its ancestor classes. Does not include attributes that
|
||||
/// may be authored by custom/extended methods of the schemas involved.
|
||||
MJCPHYSICS_API
|
||||
static const TfTokenVector& GetSchemaAttributeNames(
|
||||
bool includeInherited = true);
|
||||
|
||||
/// Return a MjcPhysicsSiteAPI holding the prim adhering to this
|
||||
/// schema at \p path on \p stage. If no prim exists at \p path on
|
||||
/// \p stage, or if the prim at that path does not adhere to this schema,
|
||||
/// return an invalid schema object. This is shorthand for the following:
|
||||
///
|
||||
/// \code
|
||||
/// MjcPhysicsSiteAPI(stage->GetPrimAtPath(path));
|
||||
/// \endcode
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static MjcPhysicsSiteAPI Get(const UsdStagePtr& stage, const SdfPath& path);
|
||||
|
||||
/// Returns true if this <b>single-apply</b> API schema can be applied to
|
||||
/// the given \p prim. If this schema can not be a applied to the prim,
|
||||
/// this returns false and, if provided, populates \p whyNot with the
|
||||
/// reason it can not be applied.
|
||||
///
|
||||
/// Note that if CanApply returns false, that does not necessarily imply
|
||||
/// that calling Apply will fail. Callers are expected to call CanApply
|
||||
/// before calling Apply if they want to ensure that it is valid to
|
||||
/// apply a schema.
|
||||
///
|
||||
/// \sa UsdPrim::GetAppliedSchemas()
|
||||
/// \sa UsdPrim::HasAPI()
|
||||
/// \sa UsdPrim::CanApplyAPI()
|
||||
/// \sa UsdPrim::ApplyAPI()
|
||||
/// \sa UsdPrim::RemoveAPI()
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static bool CanApply(const UsdPrim& prim, std::string* whyNot = nullptr);
|
||||
|
||||
/// Applies this <b>single-apply</b> API schema to the given \p prim.
|
||||
/// This information is stored by adding "MjcSiteAPI" to the
|
||||
/// token-valued, listOp metadata \em apiSchemas on the prim.
|
||||
///
|
||||
/// \return A valid MjcPhysicsSiteAPI object is returned upon success.
|
||||
/// An invalid (or empty) MjcPhysicsSiteAPI object is returned upon
|
||||
/// failure. See \ref UsdPrim::ApplyAPI() for conditions
|
||||
/// resulting in failure.
|
||||
///
|
||||
/// \sa UsdPrim::GetAppliedSchemas()
|
||||
/// \sa UsdPrim::HasAPI()
|
||||
/// \sa UsdPrim::CanApplyAPI()
|
||||
/// \sa UsdPrim::ApplyAPI()
|
||||
/// \sa UsdPrim::RemoveAPI()
|
||||
///
|
||||
MJCPHYSICS_API
|
||||
static MjcPhysicsSiteAPI Apply(const UsdPrim& prim);
|
||||
|
||||
protected:
|
||||
/// Returns the kind of schema this class belongs to.
|
||||
///
|
||||
/// \sa UsdSchemaKind
|
||||
MJCPHYSICS_API
|
||||
UsdSchemaKind _GetSchemaKind() const override;
|
||||
|
||||
private:
|
||||
// needs to invoke _GetStaticTfType.
|
||||
friend class UsdSchemaRegistry;
|
||||
MJCPHYSICS_API
|
||||
static const TfType& _GetStaticTfType();
|
||||
|
||||
static bool _IsTypedSchema();
|
||||
|
||||
// override SchemaBase virtuals.
|
||||
MJCPHYSICS_API
|
||||
const TfType& _GetTfType() const override;
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------- //
|
||||
// GROUP
|
||||
// --------------------------------------------------------------------- //
|
||||
/// Integer MuJoCo group to which the collider belongs.
|
||||
///
|
||||
/// | ||
|
||||
/// | -- | -- |
|
||||
/// | Declaration | `uniform int mjc:group = 0` |
|
||||
/// | C++ Type | int |
|
||||
/// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
|
||||
/// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute GetGroupAttr() const;
|
||||
|
||||
/// See GetGroupAttr(), and also
|
||||
/// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
|
||||
/// If specified, author \p defaultValue as the attribute's default,
|
||||
/// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
|
||||
/// the default for \p writeSparsely is \c false.
|
||||
MJCPHYSICS_API
|
||||
UsdAttribute CreateGroupAttr(VtValue const& defaultValue = VtValue(),
|
||||
bool writeSparsely = false) const;
|
||||
|
||||
public:
|
||||
// ===================================================================== //
|
||||
// Feel free to add custom code below this line, it will be preserved by
|
||||
// the code generator.
|
||||
//
|
||||
// Just remember to:
|
||||
// - Close the class declaration with };
|
||||
// - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
|
||||
// - Close the include guard with #endif
|
||||
// ===================================================================== //
|
||||
// --(BEGIN CUSTOM CODE)--
|
||||
};
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif
|
||||
740
third_party/mujoco/3.3.7/include/mujoco/experimental/usd/mjcPhysics/tokens.h
vendored
Normal file
@ -0,0 +1,740 @@
|
||||
// Copyright 2025 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MJCPHYSICS_TOKENS_H
|
||||
#define MJCPHYSICS_TOKENS_H
|
||||
|
||||
/// \file mjcPhysics/tokens.h
|
||||
|
||||
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
//
|
||||
// This is an automatically generated file (by usdGenSchema.py).
|
||||
// Do not hand-edit!
|
||||
//
|
||||
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <mujoco/experimental/usd/mjcPhysics/api.h>
|
||||
#include <pxr/base/tf/staticData.h>
|
||||
#include <pxr/base/tf/token.h>
|
||||
#include <pxr/pxr.h>
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
/// \class MjcPhysicsTokensType
|
||||
///
|
||||
/// \link MjcPhysicsTokens \endlink provides static, efficient
|
||||
/// \link TfToken TfTokens\endlink for use in all public USD API.
|
||||
///
|
||||
/// These tokens are auto-generated from the module's schema, representing
|
||||
/// property names, for when you need to fetch an attribute or relationship
|
||||
/// directly by name, e.g. UsdPrim::GetAttribute(), in the most efficient
|
||||
/// manner, and allow the compiler to verify that you spelled the name
|
||||
/// correctly.
|
||||
///
|
||||
/// MjcPhysicsTokens also contains all of the \em allowedTokens values
|
||||
/// declared for schema builtin attributes of 'token' scene description type.
|
||||
/// Use MjcPhysicsTokens like so:
|
||||
///
|
||||
/// \code
|
||||
/// gprim.GetMyTokenValuedAttr().Set(MjcPhysicsTokens->affine);
|
||||
/// \endcode
|
||||
struct MjcPhysicsTokensType {
|
||||
MJCPHYSICS_API MjcPhysicsTokensType();
|
||||
/// \brief "affine"
|
||||
///
|
||||
/// Possible value for MjcPhysicsActuator::GetMjcBiasTypeAttr(), Possible
|
||||
/// value for MjcPhysicsActuator::GetMjcGainTypeAttr()
|
||||
const TfToken affine;
|
||||
/// \brief "auto"
|
||||
///
|
||||
/// Fallback value for MjcPhysicsSceneAPI::GetInertiaFromGeomAttr(), Fallback
|
||||
/// value for MjcPhysicsSceneAPI::GetJacobianAttr(), Fallback value for
|
||||
/// MjcPhysicsActuator::GetMjcActLimitedAttr(), Fallback value for
|
||||
/// MjcPhysicsActuator::GetMjcCtrlLimitedAttr(), Fallback value for
|
||||
/// MjcPhysicsActuator::GetMjcForceLimitedAttr(), Fallback value for
|
||||
/// MjcPhysicsJointAPI::GetMjcActuatorfrclimitedAttr(), This token represents
|
||||
/// the auto constraint Jacobian and matrices computed from it.
|
||||
const TfToken auto_;
|
||||
/// \brief "cg"
|
||||
///
|
||||
/// Possible value for MjcPhysicsSceneAPI::GetSolverAttr(), This token
|
||||
/// represents the CG constraint solver algorithm.
|
||||
const TfToken cg;
|
||||
/// \brief "convex"
|
||||
///
|
||||
/// Possible value for MjcPhysicsMeshCollisionAPI::GetInertiaAttr()
|
||||
const TfToken convex;
|
||||
/// \brief "degree"
|
||||
///
|
||||
/// Fallback value for MjcPhysicsSceneAPI::GetAngleAttr()
|
||||
const TfToken degree;
|
||||
/// \brief "dense"
|
||||
///
|
||||
/// Possible value for MjcPhysicsSceneAPI::GetJacobianAttr(), This token
|
||||
/// represents the dense constraint Jacobian and matrices computed from it.
|
||||
const TfToken dense;
|
||||
/// \brief "elliptic"
|
||||
///
|
||||
/// Possible value for MjcPhysicsSceneAPI::GetConeAttr(), This token
|
||||
/// represents the elliptic contact friction cone type.
|
||||
const TfToken elliptic;
|
||||
/// \brief "euler"
|
||||
///
|
||||
/// Fallback value for MjcPhysicsSceneAPI::GetIntegratorAttr(), This token
|
||||
/// represents the Euler numerical integrator.
|
||||
const TfToken euler;
|
||||
/// \brief "exact"
|
||||
///
|
||||
/// Possible value for MjcPhysicsMeshCollisionAPI::GetInertiaAttr()
|
||||
const TfToken exact;
|
||||
/// \brief "false"
|
||||
///
|
||||
/// Possible value for MjcPhysicsSceneAPI::GetInertiaFromGeomAttr(), Possible
|
||||
/// value for MjcPhysicsActuator::GetMjcActLimitedAttr(), Possible value for
|
||||
/// MjcPhysicsActuator::GetMjcCtrlLimitedAttr(), Possible value for
|
||||
/// MjcPhysicsActuator::GetMjcForceLimitedAttr(), Possible value for
|
||||
/// MjcPhysicsJointAPI::GetMjcActuatorfrclimitedAttr()
|
||||
const TfToken false_;
|
||||
/// \brief "filter"
|
||||
///
|
||||
/// Possible value for MjcPhysicsActuator::GetMjcDynTypeAttr()
|
||||
const TfToken filter;
|
||||
/// \brief "filterexact"
|
||||
///
|
||||
/// Possible value for MjcPhysicsActuator::GetMjcDynTypeAttr()
|
||||
const TfToken filterexact;
|
||||
/// \brief "fixed"
|
||||
///
|
||||
/// Fallback value for MjcPhysicsActuator::GetMjcGainTypeAttr()
|
||||
const TfToken fixed;
|
||||
/// \brief "implicit"
|
||||
///
|
||||
/// Possible value for MjcPhysicsSceneAPI::GetIntegratorAttr(), This token
|
||||
/// represents the implicit numerical integrator.
|
||||
const TfToken implicit;
|
||||
/// \brief "implicitfast"
|
||||
///
|
||||
/// Possible value for MjcPhysicsSceneAPI::GetIntegratorAttr(), This token
|
||||
/// represents the implicitfast numerical integrator.
|
||||
const TfToken implicitfast;
|
||||
/// \brief "integrator"
|
||||
///
|
||||
/// Possible value for MjcPhysicsActuator::GetMjcDynTypeAttr()
|
||||
const TfToken integrator;
|
||||
/// \brief "legacy"
|
||||
///
|
||||
/// Fallback value for MjcPhysicsMeshCollisionAPI::GetInertiaAttr()
|
||||
const TfToken legacy;
|
||||
/// \brief "mjc:act"
|
||||
///
|
||||
/// MjcPhysicsKeyframe
|
||||
const TfToken mjcAct;
|
||||
/// \brief "mjc:actDim"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcActDim;
|
||||
/// \brief "mjc:actEarly"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcActEarly;
|
||||
/// \brief "mjc:actLimited"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcActLimited;
|
||||
/// \brief "mjc:actRange:max"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcActRangeMax;
|
||||
/// \brief "mjc:actRange:min"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcActRangeMin;
|
||||
/// \brief "mjc:actuatorfrclimited"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
const TfToken mjcActuatorfrclimited;
|
||||
/// \brief "mjc:actuatorfrcrange:max"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
const TfToken mjcActuatorfrcrangeMax;
|
||||
/// \brief "mjc:actuatorfrcrange:min"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
const TfToken mjcActuatorfrcrangeMin;
|
||||
/// \brief "mjc:actuatorgravcomp"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
const TfToken mjcActuatorgravcomp;
|
||||
/// \brief "mjc:armature"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
const TfToken mjcArmature;
|
||||
/// \brief "mjc:biasPrm"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcBiasPrm;
|
||||
/// \brief "mjc:biasType"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcBiasType;
|
||||
/// \brief "mjc:compiler:alignFree"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcCompilerAlignFree;
|
||||
/// \brief "mjc:compiler:angle"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcCompilerAngle;
|
||||
/// \brief "mjc:compiler:autoLimits"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcCompilerAutoLimits;
|
||||
/// \brief "mjc:compiler:balanceInertia"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcCompilerBalanceInertia;
|
||||
/// \brief "mjc:compiler:boundInertia"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcCompilerBoundInertia;
|
||||
/// \brief "mjc:compiler:boundMass"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcCompilerBoundMass;
|
||||
/// \brief "mjc:compiler:fitAABB"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcCompilerFitAABB;
|
||||
/// \brief "mjc:compiler:fuseStatic"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcCompilerFuseStatic;
|
||||
/// \brief "mjc:compiler:inertiaFromGeom"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcCompilerInertiaFromGeom;
|
||||
/// \brief "mjc:compiler:inertiaGroupRange:max"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcCompilerInertiaGroupRangeMax;
|
||||
/// \brief "mjc:compiler:inertiaGroupRange:min"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcCompilerInertiaGroupRangeMin;
|
||||
/// \brief "mjc:compiler:saveInertial"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcCompilerSaveInertial;
|
||||
/// \brief "mjc:compiler:setTotalMass"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcCompilerSetTotalMass;
|
||||
/// \brief "mjc:compiler:useThread"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcCompilerUseThread;
|
||||
/// \brief "mjc:condim"
|
||||
///
|
||||
/// MjcPhysicsCollisionAPI
|
||||
const TfToken mjcCondim;
|
||||
/// \brief "mjc:crankLength"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcCrankLength;
|
||||
/// \brief "mjc:ctrl"
|
||||
///
|
||||
/// MjcPhysicsKeyframe
|
||||
const TfToken mjcCtrl;
|
||||
/// \brief "mjc:ctrlLimited"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcCtrlLimited;
|
||||
/// \brief "mjc:ctrlRange:max"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcCtrlRangeMax;
|
||||
/// \brief "mjc:ctrlRange:min"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcCtrlRangeMin;
|
||||
/// \brief "mjc:damping"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
const TfToken mjcDamping;
|
||||
/// \brief "mjc:dynPrm"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcDynPrm;
|
||||
/// \brief "mjc:dynType"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcDynType;
|
||||
/// \brief "mjc:flag:actuation"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagActuation;
|
||||
/// \brief "mjc:flag:autoreset"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagAutoreset;
|
||||
/// \brief "mjc:flag:clampctrl"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagClampctrl;
|
||||
/// \brief "mjc:flag:constraint"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagConstraint;
|
||||
/// \brief "mjc:flag:contact"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagContact;
|
||||
/// \brief "mjc:flag:damper"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagDamper;
|
||||
/// \brief "mjc:flag:energy"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagEnergy;
|
||||
/// \brief "mjc:flag:equality"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagEquality;
|
||||
/// \brief "mjc:flag:eulerdamp"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagEulerdamp;
|
||||
/// \brief "mjc:flag:filterparent"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagFilterparent;
|
||||
/// \brief "mjc:flag:frictionloss"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagFrictionloss;
|
||||
/// \brief "mjc:flag:fwdinv"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagFwdinv;
|
||||
/// \brief "mjc:flag:gravity"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagGravity;
|
||||
/// \brief "mjc:flag:invdiscrete"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagInvdiscrete;
|
||||
/// \brief "mjc:flag:island"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagIsland;
|
||||
/// \brief "mjc:flag:limit"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagLimit;
|
||||
/// \brief "mjc:flag:midphase"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagMidphase;
|
||||
/// \brief "mjc:flag:multiccd"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagMulticcd;
|
||||
/// \brief "mjc:flag:nativeccd"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagNativeccd;
|
||||
/// \brief "mjc:flag:override"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagOverride;
|
||||
/// \brief "mjc:flag:refsafe"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagRefsafe;
|
||||
/// \brief "mjc:flag:sensor"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagSensor;
|
||||
/// \brief "mjc:flag:spring"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagSpring;
|
||||
/// \brief "mjc:flag:warmstart"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcFlagWarmstart;
|
||||
/// \brief "mjc:forceLimited"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcForceLimited;
|
||||
/// \brief "mjc:forceRange:max"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcForceRangeMax;
|
||||
/// \brief "mjc:forceRange:min"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcForceRangeMin;
|
||||
/// \brief "mjc:frictionloss"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
const TfToken mjcFrictionloss;
|
||||
/// \brief "mjc:gainPrm"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcGainPrm;
|
||||
/// \brief "mjc:gainType"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcGainType;
|
||||
/// \brief "mjc:gap"
|
||||
///
|
||||
/// MjcPhysicsCollisionAPI
|
||||
const TfToken mjcGap;
|
||||
/// \brief "mjc:gear"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcGear;
|
||||
/// \brief "mjc:group"
|
||||
///
|
||||
/// MjcPhysicsSiteAPI, MjcPhysicsImageableAPI, MjcPhysicsCollisionAPI,
|
||||
/// MjcPhysicsActuator, MjcPhysicsJointAPI
|
||||
const TfToken mjcGroup;
|
||||
/// \brief "mjc:inertia"
|
||||
///
|
||||
/// MjcPhysicsMeshCollisionAPI
|
||||
const TfToken mjcInertia;
|
||||
/// \brief "mjc:inheritRange"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcInheritRange;
|
||||
/// \brief "mjc:jointInParent"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcJointInParent;
|
||||
/// \brief "mjc:lengthRange:max"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcLengthRangeMax;
|
||||
/// \brief "mjc:lengthRange:min"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcLengthRangeMin;
|
||||
/// \brief "mjc:margin"
|
||||
///
|
||||
/// MjcPhysicsCollisionAPI, MjcPhysicsJointAPI
|
||||
const TfToken mjcMargin;
|
||||
/// \brief "mjc:maxhullvert"
|
||||
///
|
||||
/// MjcPhysicsMeshCollisionAPI
|
||||
const TfToken mjcMaxhullvert;
|
||||
/// \brief "mjc:mpos"
|
||||
///
|
||||
/// MjcPhysicsKeyframe
|
||||
const TfToken mjcMpos;
|
||||
/// \brief "mjc:mquat"
|
||||
///
|
||||
/// MjcPhysicsKeyframe
|
||||
const TfToken mjcMquat;
|
||||
/// \brief "mjc:option:actuatorgroupdisable"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionActuatorgroupdisable;
|
||||
/// \brief "mjc:option:ccd_iterations"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionCcd_iterations;
|
||||
/// \brief "mjc:option:ccd_tolerance"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionCcd_tolerance;
|
||||
/// \brief "mjc:option:cone"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionCone;
|
||||
/// \brief "mjc:option:density"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionDensity;
|
||||
/// \brief "mjc:option:impratio"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionImpratio;
|
||||
/// \brief "mjc:option:integrator"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionIntegrator;
|
||||
/// \brief "mjc:option:iterations"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionIterations;
|
||||
/// \brief "mjc:option:jacobian"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionJacobian;
|
||||
/// \brief "mjc:option:ls_iterations"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionLs_iterations;
|
||||
/// \brief "mjc:option:ls_tolerance"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionLs_tolerance;
|
||||
/// \brief "mjc:option:magnetic"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionMagnetic;
|
||||
/// \brief "mjc:option:noslip_iterations"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionNoslip_iterations;
|
||||
/// \brief "mjc:option:noslip_tolerance"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionNoslip_tolerance;
|
||||
/// \brief "mjc:option:o_friction"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionO_friction;
|
||||
/// \brief "mjc:option:o_margin"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionO_margin;
|
||||
/// \brief "mjc:option:o_solimp"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionO_solimp;
|
||||
/// \brief "mjc:option:o_solref"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionO_solref;
|
||||
/// \brief "mjc:option:sdf_initpoints"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionSdf_initpoints;
|
||||
/// \brief "mjc:option:sdf_iterations"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionSdf_iterations;
|
||||
/// \brief "mjc:option:solver"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionSolver;
|
||||
/// \brief "mjc:option:timestep"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionTimestep;
|
||||
/// \brief "mjc:option:tolerance"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionTolerance;
|
||||
/// \brief "mjc:option:viscosity"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionViscosity;
|
||||
/// \brief "mjc:option:wind"
|
||||
///
|
||||
/// MjcPhysicsSceneAPI
|
||||
const TfToken mjcOptionWind;
|
||||
/// \brief "mjc:priority"
|
||||
///
|
||||
/// MjcPhysicsCollisionAPI
|
||||
const TfToken mjcPriority;
|
||||
/// \brief "mjc:qpos"
|
||||
///
|
||||
/// MjcPhysicsKeyframe
|
||||
const TfToken mjcQpos;
|
||||
/// \brief "mjc:qvel"
|
||||
///
|
||||
/// MjcPhysicsKeyframe
|
||||
const TfToken mjcQvel;
|
||||
/// \brief "mjc:ref"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
const TfToken mjcRef;
|
||||
/// \brief "mjc:refSite"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcRefSite;
|
||||
/// \brief "mjc:rollingfriction"
|
||||
///
|
||||
/// MjcPhysicsMaterialAPI
|
||||
const TfToken mjcRollingfriction;
|
||||
/// \brief "mjc:shellinertia"
|
||||
///
|
||||
/// MjcPhysicsCollisionAPI
|
||||
const TfToken mjcShellinertia;
|
||||
/// \brief "mjc:sliderSite"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcSliderSite;
|
||||
/// \brief "mjc:solimp"
|
||||
///
|
||||
/// MjcPhysicsCollisionAPI
|
||||
const TfToken mjcSolimp;
|
||||
/// \brief "mjc:solimpfriction"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
const TfToken mjcSolimpfriction;
|
||||
/// \brief "mjc:solimplimit"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
const TfToken mjcSolimplimit;
|
||||
/// \brief "mjc:solmix"
|
||||
///
|
||||
/// MjcPhysicsCollisionAPI
|
||||
const TfToken mjcSolmix;
|
||||
/// \brief "mjc:solref"
|
||||
///
|
||||
/// MjcPhysicsCollisionAPI
|
||||
const TfToken mjcSolref;
|
||||
/// \brief "mjc:solreffriction"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
const TfToken mjcSolreffriction;
|
||||
/// \brief "mjc:solreflimit"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
const TfToken mjcSolreflimit;
|
||||
/// \brief "mjc:springdamper"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
const TfToken mjcSpringdamper;
|
||||
/// \brief "mjc:springref"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
const TfToken mjcSpringref;
|
||||
/// \brief "mjc:stiffness"
|
||||
///
|
||||
/// MjcPhysicsJointAPI
|
||||
const TfToken mjcStiffness;
|
||||
/// \brief "mjc:target"
|
||||
///
|
||||
/// MjcPhysicsActuator
|
||||
const TfToken mjcTarget;
|
||||
/// \brief "mjc:torsionalfriction"
|
||||
///
|
||||
/// MjcPhysicsMaterialAPI
|
||||
const TfToken mjcTorsionalfriction;
|
||||
/// \brief "muscle"
|
||||
///
|
||||
/// Possible value for MjcPhysicsActuator::GetMjcBiasTypeAttr(), Possible
|
||||
/// value for MjcPhysicsActuator::GetMjcDynTypeAttr(), Possible value for
|
||||
/// MjcPhysicsActuator::GetMjcGainTypeAttr()
|
||||
const TfToken muscle;
|
||||
/// \brief "newton"
|
||||
///
|
||||
/// Fallback value for MjcPhysicsSceneAPI::GetSolverAttr(), This token
|
||||
/// represents the Newton constraint solver algorithm.
|
||||
const TfToken newton;
|
||||
/// \brief "none"
|
||||
///
|
||||
/// Fallback value for MjcPhysicsActuator::GetMjcBiasTypeAttr(), Fallback
|
||||
/// value for MjcPhysicsActuator::GetMjcDynTypeAttr()
|
||||
const TfToken none;
|
||||
/// \brief "pgs"
|
||||
///
|
||||
/// Possible value for MjcPhysicsSceneAPI::GetSolverAttr(), This token
|
||||
/// represents the PGS constraint solver algorithm.
|
||||
const TfToken pgs;
|
||||
/// \brief "pyramidal"
|
||||
///
|
||||
/// Fallback value for MjcPhysicsSceneAPI::GetConeAttr(), This token
|
||||
/// represents the pyramidal contact friction cone type.
|
||||
const TfToken pyramidal;
|
||||
/// \brief "radian"
|
||||
///
|
||||
/// Possible value for MjcPhysicsSceneAPI::GetAngleAttr()
|
||||
const TfToken radian;
|
||||
/// \brief "rk4"
|
||||
///
|
||||
/// Possible value for MjcPhysicsSceneAPI::GetIntegratorAttr(), This token
|
||||
/// represents the RK4 numerical integrator.
|
||||
const TfToken rk4;
|
||||
/// \brief "shell"
|
||||
///
|
||||
/// Possible value for MjcPhysicsMeshCollisionAPI::GetInertiaAttr()
|
||||
const TfToken shell;
|
||||
/// \brief "sparse"
|
||||
///
|
||||
/// Possible value for MjcPhysicsSceneAPI::GetJacobianAttr(), This token
|
||||
/// represents the sparse constraint Jacobian and matrices computed from it.
|
||||
const TfToken sparse;
|
||||
/// \brief "true"
|
||||
///
|
||||
/// Possible value for MjcPhysicsSceneAPI::GetInertiaFromGeomAttr(), Possible
|
||||
/// value for MjcPhysicsActuator::GetMjcActLimitedAttr(), Possible value for
|
||||
/// MjcPhysicsActuator::GetMjcCtrlLimitedAttr(), Possible value for
|
||||
/// MjcPhysicsActuator::GetMjcForceLimitedAttr(), Possible value for
|
||||
/// MjcPhysicsJointAPI::GetMjcActuatorfrclimitedAttr()
|
||||
const TfToken true_;
|
||||
/// \brief "user"
|
||||
///
|
||||
/// Possible value for MjcPhysicsActuator::GetMjcBiasTypeAttr(), Possible
|
||||
/// value for MjcPhysicsActuator::GetMjcDynTypeAttr(), Possible value for
|
||||
/// MjcPhysicsActuator::GetMjcGainTypeAttr()
|
||||
const TfToken user;
|
||||
/// \brief "MjcActuator"
|
||||
///
|
||||
/// Schema identifier and family for MjcPhysicsActuator
|
||||
const TfToken MjcActuator;
|
||||
/// \brief "MjcCollisionAPI"
|
||||
///
|
||||
/// Schema identifier and family for MjcPhysicsCollisionAPI
|
||||
const TfToken MjcCollisionAPI;
|
||||
/// \brief "MjcImageableAPI"
|
||||
///
|
||||
/// Schema identifier and family for MjcPhysicsImageableAPI
|
||||
const TfToken MjcImageableAPI;
|
||||
/// \brief "MjcJointAPI"
|
||||
///
|
||||
/// Schema identifier and family for MjcPhysicsJointAPI
|
||||
const TfToken MjcJointAPI;
|
||||
/// \brief "MjcKeyframe"
|
||||
///
|
||||
/// Schema identifier and family for MjcPhysicsKeyframe
|
||||
const TfToken MjcKeyframe;
|
||||
/// \brief "MjcMaterialAPI"
|
||||
///
|
||||
/// Schema identifier and family for MjcPhysicsMaterialAPI
|
||||
const TfToken MjcMaterialAPI;
|
||||
/// \brief "MjcMeshCollisionAPI"
|
||||
///
|
||||
/// Schema identifier and family for MjcPhysicsMeshCollisionAPI
|
||||
const TfToken MjcMeshCollisionAPI;
|
||||
/// \brief "MjcSceneAPI"
|
||||
///
|
||||
/// Schema identifier and family for MjcPhysicsSceneAPI
|
||||
const TfToken MjcSceneAPI;
|
||||
/// \brief "MjcSiteAPI"
|
||||
///
|
||||
/// Schema identifier and family for MjcPhysicsSiteAPI
|
||||
const TfToken MjcSiteAPI;
|
||||
/// A vector of all of the tokens listed above.
|
||||
const std::vector<TfToken> allTokens;
|
||||
};
|
||||
|
||||
/// \var MjcPhysicsTokens
|
||||
///
|
||||
/// A global variable with static, efficient \link TfToken TfTokens\endlink
|
||||
/// for use in all public USD API. \sa MjcPhysicsTokensType
|
||||
extern MJCPHYSICS_API TfStaticData<MjcPhysicsTokensType> MjcPhysicsTokens;
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif
|
||||
44
third_party/mujoco/3.3.7/include/mujoco/experimental/usd/usd.h
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
// Copyright 2025 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MUJOCO_EXPERIMENTAL_SRC_USD_USD_TO_MJSPEC_H_
|
||||
#define MUJOCO_EXPERIMENTAL_SRC_USD_USD_TO_MJSPEC_H_
|
||||
|
||||
#include <mujoco/mujoco.h>
|
||||
#include <pxr/usd/usd/common.h>
|
||||
|
||||
// Given a USD file parse to a spec, then compile and return the low-level
|
||||
// model.
|
||||
//
|
||||
// Particular care is taken for physics data to be lossless but visual
|
||||
// data such as materials may be lossy.
|
||||
MJAPI mjModel* mj_loadUSD(const char* filename, const mjVFS* vfs, char* error,
|
||||
int error_sz);
|
||||
|
||||
// Given a USD layer identifier, this function will do a best effort conversion
|
||||
// from the composed stage to mjSpec.
|
||||
//
|
||||
// Particular care is taken for physics data to be lossless but visual
|
||||
// data such as materials may be lossy.
|
||||
MJAPI mjSpec* mj_parseUSD(const char* identifier, const mjVFS* vfs, char* error,
|
||||
int error_sz);
|
||||
|
||||
// Given a USD stage, this function will do a best effort conversion to
|
||||
// mjSpec.
|
||||
//
|
||||
// Particular care is taken for physics data to be lossless but visual
|
||||
// data such as materials may be lossy.
|
||||
MJAPI mjSpec* mj_parseUSDStage(pxr::UsdStageRefPtr stage);
|
||||
|
||||
#endif // MUJOCO_EXPERIMENTAL_SRC_USD_USD_TO_MJSPEC_H_
|
||||
35
third_party/mujoco/3.3.7/include/mujoco/experimental/usd/utils.h
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright 2025 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MUJOCO_SRC_EXPERIMENTAL_USD_UTILS_H_
|
||||
#define MUJOCO_SRC_EXPERIMENTAL_USD_UTILS_H_
|
||||
|
||||
#include <mujoco/mujoco.h>
|
||||
#include <pxr/usd/sdf/path.h>
|
||||
|
||||
namespace mujoco {
|
||||
namespace usd {
|
||||
|
||||
// Sets a user value on an mjsElement with the key "usd_primpath".
|
||||
void SetUsdPrimPathUserValue(mjsElement* element,
|
||||
const pxr::SdfPath& prim_path);
|
||||
|
||||
// Gets the user value associated with the key "usd_primpath" from an
|
||||
// mjsElement. Returns empty pxr::SdfPath() if the value is not found.
|
||||
pxr::SdfPath GetUsdPrimPathUserValue(mjsElement* element);
|
||||
|
||||
} // namespace usd
|
||||
} // namespace mujoco
|
||||
|
||||
#endif // MUJOCO_SRC_EXPERIMENTAL_USD_UTILS_H_
|
||||
52
third_party/mujoco/3.3.7/include/mujoco/experimental/usd/writer.h
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
// Copyright 2025 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MUJOCO_SRC_EXPERIMENTAL_USD_WRITER_H_
|
||||
#define MUJOCO_SRC_EXPERIMENTAL_USD_WRITER_H_
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
#include <mujoco/mujoco.h>
|
||||
#include <pxr/usd/sdf/path.h>
|
||||
#include <pxr/usd/usd/common.h>
|
||||
|
||||
namespace mujoco {
|
||||
namespace usd {
|
||||
using PoseSinkFn =
|
||||
std::function<void(const mjData* const, std::vector<pxr::SdfPath>)>;
|
||||
|
||||
class Writer {
|
||||
public:
|
||||
Writer(pxr::UsdStageRefPtr stage, mjSpec* spec, mjModel_* model);
|
||||
~Writer();
|
||||
Writer(const Writer&) = delete;
|
||||
Writer& operator=(const Writer&) = delete;
|
||||
|
||||
void Update(const mjData* const data);
|
||||
void AddSink(PoseSinkFn sink_fn);
|
||||
|
||||
private:
|
||||
void BuildMjUsdMapping();
|
||||
|
||||
pxr::UsdStageRefPtr stage_;
|
||||
std::vector<pxr::SdfPath> body_id_to_path_;
|
||||
mjSpec* spec_ = nullptr;
|
||||
mjModel_* model_ = nullptr;
|
||||
std::vector<PoseSinkFn> pose_sinks_;
|
||||
};
|
||||
} // namespace usd
|
||||
} // namespace mujoco
|
||||
|
||||
#endif // MUJOCO_SRC_EXPERIMENTAL_USD_WRITER_H_
|
||||
504
third_party/mujoco/3.3.7/include/mujoco/mjdata.h
vendored
Normal file
@ -0,0 +1,504 @@
|
||||
// Copyright 2021 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MUJOCO_MJDATA_H_
|
||||
#define MUJOCO_MJDATA_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <mujoco/mjtnum.h>
|
||||
#include <mujoco/mjmodel.h>
|
||||
#include <mujoco/mjthread.h>
|
||||
|
||||
//---------------------------------- primitive types (mjt) -----------------------------------------
|
||||
|
||||
typedef enum mjtState_ { // state elements
|
||||
mjSTATE_TIME = 1<<0, // time
|
||||
mjSTATE_QPOS = 1<<1, // position
|
||||
mjSTATE_QVEL = 1<<2, // velocity
|
||||
mjSTATE_ACT = 1<<3, // actuator activation
|
||||
mjSTATE_WARMSTART = 1<<4, // acceleration used for warmstart
|
||||
mjSTATE_CTRL = 1<<5, // control
|
||||
mjSTATE_QFRC_APPLIED = 1<<6, // applied generalized force
|
||||
mjSTATE_XFRC_APPLIED = 1<<7, // applied Cartesian force/torque
|
||||
mjSTATE_EQ_ACTIVE = 1<<8, // enable/disable constraints
|
||||
mjSTATE_MOCAP_POS = 1<<9, // positions of mocap bodies
|
||||
mjSTATE_MOCAP_QUAT = 1<<10, // orientations of mocap bodies
|
||||
mjSTATE_USERDATA = 1<<11, // user data
|
||||
mjSTATE_PLUGIN = 1<<12, // plugin state
|
||||
|
||||
mjNSTATE = 13, // number of state elements
|
||||
|
||||
// convenience values for commonly used state specifications
|
||||
mjSTATE_PHYSICS = mjSTATE_QPOS | mjSTATE_QVEL | mjSTATE_ACT,
|
||||
mjSTATE_FULLPHYSICS = mjSTATE_TIME | mjSTATE_PHYSICS | mjSTATE_PLUGIN,
|
||||
mjSTATE_USER = mjSTATE_CTRL | mjSTATE_QFRC_APPLIED | mjSTATE_XFRC_APPLIED |
|
||||
mjSTATE_EQ_ACTIVE | mjSTATE_MOCAP_POS | mjSTATE_MOCAP_QUAT |
|
||||
mjSTATE_USERDATA,
|
||||
mjSTATE_INTEGRATION = mjSTATE_FULLPHYSICS | mjSTATE_USER | mjSTATE_WARMSTART
|
||||
} mjtState;
|
||||
|
||||
|
||||
typedef enum mjtConstraint_ { // type of constraint
|
||||
mjCNSTR_EQUALITY = 0, // equality constraint
|
||||
mjCNSTR_FRICTION_DOF, // dof friction
|
||||
mjCNSTR_FRICTION_TENDON, // tendon friction
|
||||
mjCNSTR_LIMIT_JOINT, // joint limit
|
||||
mjCNSTR_LIMIT_TENDON, // tendon limit
|
||||
mjCNSTR_CONTACT_FRICTIONLESS, // frictionless contact
|
||||
mjCNSTR_CONTACT_PYRAMIDAL, // frictional contact, pyramidal friction cone
|
||||
mjCNSTR_CONTACT_ELLIPTIC // frictional contact, elliptic friction cone
|
||||
} mjtConstraint;
|
||||
|
||||
|
||||
typedef enum mjtConstraintState_ { // constraint state
|
||||
mjCNSTRSTATE_SATISFIED = 0, // constraint satisfied, zero cost (limit, contact)
|
||||
mjCNSTRSTATE_QUADRATIC, // quadratic cost (equality, friction, limit, contact)
|
||||
mjCNSTRSTATE_LINEARNEG, // linear cost, negative side (friction)
|
||||
mjCNSTRSTATE_LINEARPOS, // linear cost, positive side (friction)
|
||||
mjCNSTRSTATE_CONE // squared distance to cone cost (elliptic contact)
|
||||
} mjtConstraintState;
|
||||
|
||||
|
||||
typedef enum mjtWarning_ { // warning types
|
||||
mjWARN_INERTIA = 0, // (near) singular inertia matrix
|
||||
mjWARN_CONTACTFULL, // too many contacts in contact list
|
||||
mjWARN_CNSTRFULL, // too many constraints
|
||||
mjWARN_VGEOMFULL, // too many visual geoms
|
||||
mjWARN_BADQPOS, // bad number in qpos
|
||||
mjWARN_BADQVEL, // bad number in qvel
|
||||
mjWARN_BADQACC, // bad number in qacc
|
||||
mjWARN_BADCTRL, // bad number in ctrl
|
||||
|
||||
mjNWARNING // number of warnings
|
||||
} mjtWarning;
|
||||
|
||||
|
||||
typedef enum mjtTimer_ { // internal timers
|
||||
// main api
|
||||
mjTIMER_STEP = 0, // step
|
||||
mjTIMER_FORWARD, // forward
|
||||
mjTIMER_INVERSE, // inverse
|
||||
|
||||
// breakdown of step/forward
|
||||
mjTIMER_POSITION, // fwdPosition
|
||||
mjTIMER_VELOCITY, // fwdVelocity
|
||||
mjTIMER_ACTUATION, // fwdActuation
|
||||
mjTIMER_CONSTRAINT, // fwdConstraint
|
||||
mjTIMER_ADVANCE, // mj_Euler, mj_implicit
|
||||
|
||||
// breakdown of fwdPosition
|
||||
mjTIMER_POS_KINEMATICS, // kinematics, com, tendon, transmission
|
||||
mjTIMER_POS_INERTIA, // inertia computations
|
||||
mjTIMER_POS_COLLISION, // collision detection
|
||||
mjTIMER_POS_MAKE, // make constraints
|
||||
mjTIMER_POS_PROJECT, // project constraints
|
||||
|
||||
// breakdown of mj_collision
|
||||
mjTIMER_COL_BROAD, // broadphase
|
||||
mjTIMER_COL_NARROW, // narrowphase
|
||||
|
||||
mjNTIMER // number of timers
|
||||
} mjtTimer;
|
||||
|
||||
|
||||
//---------------------------------- mjContact -----------------------------------------------------
|
||||
|
||||
struct mjContact_ { // result of collision detection functions
|
||||
// contact parameters set by near-phase collision function
|
||||
mjtNum dist; // distance between nearest points; neg: penetration
|
||||
mjtNum pos[3]; // position of contact point: midpoint between geoms
|
||||
mjtNum frame[9]; // normal is in [0-2], points from geom[0] to geom[1]
|
||||
|
||||
// contact parameters set by mj_collideGeoms
|
||||
mjtNum includemargin; // include if dist<includemargin=margin-gap
|
||||
mjtNum friction[5]; // tangent1, 2, spin, roll1, 2
|
||||
mjtNum solref[mjNREF]; // constraint solver reference, normal direction
|
||||
mjtNum solreffriction[mjNREF]; // constraint solver reference, friction directions
|
||||
mjtNum solimp[mjNIMP]; // constraint solver impedance
|
||||
|
||||
// internal storage used by solver
|
||||
mjtNum mu; // friction of regularized cone, set by mj_makeConstraint
|
||||
mjtNum H[36]; // cone Hessian, set by mj_constraintUpdate
|
||||
|
||||
// contact descriptors set by mj_collideXXX
|
||||
int dim; // contact space dimensionality: 1, 3, 4 or 6
|
||||
int geom1; // id of geom 1; deprecated, use geom[0]
|
||||
int geom2; // id of geom 2; deprecated, use geom[1]
|
||||
int geom[2]; // geom ids; -1 for flex
|
||||
int flex[2]; // flex ids; -1 for geom
|
||||
int elem[2]; // element ids; -1 for geom or flex vertex
|
||||
int vert[2]; // vertex ids; -1 for geom or flex element
|
||||
|
||||
// flag set by mj_setContact or mj_instantiateContact
|
||||
int exclude; // 0: include, 1: in gap, 2: fused, 3: no dofs, 4: passive
|
||||
|
||||
// address computed by mj_instantiateContact
|
||||
int efc_address; // address in efc; -1: not included
|
||||
};
|
||||
typedef struct mjContact_ mjContact;
|
||||
|
||||
|
||||
//---------------------------------- diagnostics ---------------------------------------------------
|
||||
|
||||
struct mjWarningStat_ { // warning statistics
|
||||
int lastinfo; // info from last warning
|
||||
int number; // how many times was warning raised
|
||||
};
|
||||
typedef struct mjWarningStat_ mjWarningStat;
|
||||
|
||||
|
||||
struct mjTimerStat_ { // timer statistics
|
||||
mjtNum duration; // cumulative duration
|
||||
int number; // how many times was timer called
|
||||
};
|
||||
typedef struct mjTimerStat_ mjTimerStat;
|
||||
|
||||
|
||||
struct mjSolverStat_ { // per-iteration solver statistics
|
||||
mjtNum improvement; // cost reduction, scaled by 1/trace(M(qpos0))
|
||||
mjtNum gradient; // gradient norm (primal only, scaled)
|
||||
mjtNum lineslope; // slope in linesearch
|
||||
int nactive; // number of active constraints
|
||||
int nchange; // number of constraint state changes
|
||||
int neval; // number of cost evaluations in line search
|
||||
int nupdate; // number of Cholesky updates in line search
|
||||
};
|
||||
typedef struct mjSolverStat_ mjSolverStat;
|
||||
|
||||
|
||||
//---------------------------------- mjData --------------------------------------------------------
|
||||
|
||||
struct mjData_ {
|
||||
// constant sizes
|
||||
mjtSize narena; // size of the arena in bytes (inclusive of the stack)
|
||||
mjtSize nbuffer; // size of main buffer in bytes
|
||||
int nplugin; // number of plugin instances
|
||||
|
||||
// stack pointer
|
||||
size_t pstack; // first available byte in stack (mutable)
|
||||
size_t pbase; // value of pstack when mj_markStack was last called (mutable)
|
||||
|
||||
// arena pointer
|
||||
size_t parena; // first available byte in arena
|
||||
|
||||
// memory utilization statistics
|
||||
mjtSize maxuse_stack; // maximum stack allocation in bytes (mutable)
|
||||
mjtSize maxuse_threadstack[mjMAXTHREAD]; // maximum stack allocation per thread in bytes
|
||||
mjtSize maxuse_arena; // maximum arena allocation in bytes
|
||||
int maxuse_con; // maximum number of contacts
|
||||
int maxuse_efc; // maximum number of scalar constraints
|
||||
|
||||
// solver statistics
|
||||
mjSolverStat solver[mjNISLAND*mjNSOLVER]; // solver statistics per island, per iteration
|
||||
int solver_niter[mjNISLAND]; // number of solver iterations, per island
|
||||
int solver_nnz[mjNISLAND]; // number of nonzeros in Hessian or efc_AR, per island
|
||||
mjtNum solver_fwdinv[2]; // forward-inverse comparison: qfrc, efc
|
||||
|
||||
// diagnostics
|
||||
mjWarningStat warning[mjNWARNING]; // warning statistics (mutable)
|
||||
mjTimerStat timer[mjNTIMER]; // timer statistics
|
||||
|
||||
// variable sizes
|
||||
int ncon; // number of detected contacts
|
||||
int ne; // number of equality constraints
|
||||
int nf; // number of friction constraints
|
||||
int nl; // number of limit constraints
|
||||
int nefc; // number of constraints
|
||||
int nJ; // number of non-zeros in constraint Jacobian
|
||||
int nA; // number of non-zeros in constraint inverse inertia matrix
|
||||
int nisland; // number of detected constraint islands
|
||||
int nidof; // number of dofs in all islands
|
||||
|
||||
// global properties
|
||||
mjtNum time; // simulation time
|
||||
mjtNum energy[2]; // potential, kinetic energy
|
||||
|
||||
//-------------------- end of info header
|
||||
|
||||
// buffers
|
||||
void* buffer; // main buffer; all pointers point in it (nbuffer bytes)
|
||||
void* arena; // arena+stack buffer (narena bytes)
|
||||
|
||||
//-------------------- main inputs and outputs of the computation
|
||||
|
||||
// state
|
||||
mjtNum* qpos; // position (nq x 1)
|
||||
mjtNum* qvel; // velocity (nv x 1)
|
||||
mjtNum* act; // actuator activation (na x 1)
|
||||
mjtNum* qacc_warmstart; // acceleration used for warmstart (nv x 1)
|
||||
mjtNum* plugin_state; // plugin state (npluginstate x 1)
|
||||
|
||||
// control
|
||||
mjtNum* ctrl; // control (nu x 1)
|
||||
mjtNum* qfrc_applied; // applied generalized force (nv x 1)
|
||||
mjtNum* xfrc_applied; // applied Cartesian force/torque (nbody x 6)
|
||||
mjtByte* eq_active; // enable/disable constraints (neq x 1)
|
||||
|
||||
// mocap data
|
||||
mjtNum* mocap_pos; // positions of mocap bodies (nmocap x 3)
|
||||
mjtNum* mocap_quat; // orientations of mocap bodies (nmocap x 4)
|
||||
|
||||
// dynamics
|
||||
mjtNum* qacc; // acceleration (nv x 1)
|
||||
mjtNum* act_dot; // time-derivative of actuator activation (na x 1)
|
||||
|
||||
// user data
|
||||
mjtNum* userdata; // user data, not touched by engine (nuserdata x 1)
|
||||
|
||||
// sensors
|
||||
mjtNum* sensordata; // sensor data array (nsensordata x 1)
|
||||
|
||||
// plugins
|
||||
int* plugin; // copy of m->plugin, required for deletion (nplugin x 1)
|
||||
uintptr_t* plugin_data; // pointer to plugin-managed data structure (nplugin x 1)
|
||||
|
||||
//-------------------- POSITION dependent
|
||||
|
||||
// computed by mj_fwdPosition/mj_kinematics
|
||||
mjtNum* xpos; // Cartesian position of body frame (nbody x 3)
|
||||
mjtNum* xquat; // Cartesian orientation of body frame (nbody x 4)
|
||||
mjtNum* xmat; // Cartesian orientation of body frame (nbody x 9)
|
||||
mjtNum* xipos; // Cartesian position of body com (nbody x 3)
|
||||
mjtNum* ximat; // Cartesian orientation of body inertia (nbody x 9)
|
||||
mjtNum* xanchor; // Cartesian position of joint anchor (njnt x 3)
|
||||
mjtNum* xaxis; // Cartesian joint axis (njnt x 3)
|
||||
mjtNum* geom_xpos; // Cartesian geom position (ngeom x 3)
|
||||
mjtNum* geom_xmat; // Cartesian geom orientation (ngeom x 9)
|
||||
mjtNum* site_xpos; // Cartesian site position (nsite x 3)
|
||||
mjtNum* site_xmat; // Cartesian site orientation (nsite x 9)
|
||||
mjtNum* cam_xpos; // Cartesian camera position (ncam x 3)
|
||||
mjtNum* cam_xmat; // Cartesian camera orientation (ncam x 9)
|
||||
mjtNum* light_xpos; // Cartesian light position (nlight x 3)
|
||||
mjtNum* light_xdir; // Cartesian light direction (nlight x 3)
|
||||
|
||||
// computed by mj_fwdPosition/mj_comPos
|
||||
mjtNum* subtree_com; // center of mass of each subtree (nbody x 3)
|
||||
mjtNum* cdof; // com-based motion axis of each dof (rot:lin) (nv x 6)
|
||||
mjtNum* cinert; // com-based body inertia and mass (nbody x 10)
|
||||
|
||||
// computed by mj_fwdPosition/mj_flex
|
||||
mjtNum* flexvert_xpos; // Cartesian flex vertex positions (nflexvert x 3)
|
||||
mjtNum* flexelem_aabb; // flex element bounding boxes (center, size) (nflexelem x 6)
|
||||
int* flexedge_J_rownnz; // number of non-zeros in Jacobian row (nflexedge x 1)
|
||||
int* flexedge_J_rowadr; // row start address in colind array (nflexedge x 1)
|
||||
int* flexedge_J_colind; // column indices in sparse Jacobian (nflexedge x nv)
|
||||
mjtNum* flexedge_J; // flex edge Jacobian (nflexedge x nv)
|
||||
mjtNum* flexedge_length; // flex edge lengths (nflexedge x 1)
|
||||
mjtNum* bvh_aabb_dyn; // global bounding box (center, size) (nbvhdynamic x 6)
|
||||
|
||||
// computed by mj_fwdPosition/mj_tendon
|
||||
int* ten_wrapadr; // start address of tendon's path (ntendon x 1)
|
||||
int* ten_wrapnum; // number of wrap points in path (ntendon x 1)
|
||||
int* ten_J_rownnz; // number of non-zeros in Jacobian row (ntendon x 1)
|
||||
int* ten_J_rowadr; // row start address in colind array (ntendon x 1)
|
||||
int* ten_J_colind; // column indices in sparse Jacobian (ntendon x nv)
|
||||
mjtNum* ten_J; // tendon Jacobian (ntendon x nv)
|
||||
mjtNum* ten_length; // tendon lengths (ntendon x 1)
|
||||
int* wrap_obj; // geom id; -1: site; -2: pulley (nwrap x 2)
|
||||
mjtNum* wrap_xpos; // Cartesian 3D points in all paths (nwrap x 6)
|
||||
|
||||
// computed by mj_fwdPosition/mj_transmission
|
||||
mjtNum* actuator_length; // actuator lengths (nu x 1)
|
||||
int* moment_rownnz; // number of non-zeros in actuator_moment row (nu x 1)
|
||||
int* moment_rowadr; // row start address in colind array (nu x 1)
|
||||
int* moment_colind; // column indices in sparse Jacobian (nJmom x 1)
|
||||
mjtNum* actuator_moment; // actuator moments (nJmom x 1)
|
||||
|
||||
// computed by mj_fwdPosition/mj_makeM
|
||||
mjtNum* crb; // com-based composite inertia and mass (nbody x 10)
|
||||
mjtNum* qM; // inertia (sparse) (nM x 1)
|
||||
mjtNum* M; // reduced inertia (compressed sparse row) (nC x 1)
|
||||
|
||||
// computed by mj_fwdPosition/mj_factorM
|
||||
mjtNum* qLD; // L'*D*L factorization of M (sparse) (nC x 1)
|
||||
mjtNum* qLDiagInv; // 1/diag(D) (nv x 1)
|
||||
|
||||
// computed by mj_collision/mj_collideTree
|
||||
mjtByte* bvh_active; // was bounding volume checked for collision (nbvh x 1)
|
||||
|
||||
//-------------------- POSITION, VELOCITY dependent
|
||||
|
||||
// computed by mj_fwdVelocity
|
||||
mjtNum* flexedge_velocity; // flex edge velocities (nflexedge x 1)
|
||||
mjtNum* ten_velocity; // tendon velocities (ntendon x 1)
|
||||
mjtNum* actuator_velocity; // actuator velocities (nu x 1)
|
||||
|
||||
// computed by mj_fwdVelocity/mj_comVel
|
||||
mjtNum* cvel; // com-based velocity (rot:lin) (nbody x 6)
|
||||
mjtNum* cdof_dot; // time-derivative of cdof (rot:lin) (nv x 6)
|
||||
|
||||
// computed by mj_fwdVelocity/mj_rne (without acceleration)
|
||||
mjtNum* qfrc_bias; // C(qpos,qvel) (nv x 1)
|
||||
|
||||
// computed by mj_fwdVelocity/mj_passive
|
||||
mjtNum* qfrc_spring; // passive spring force (nv x 1)
|
||||
mjtNum* qfrc_damper; // passive damper force (nv x 1)
|
||||
mjtNum* qfrc_gravcomp; // passive gravity compensation force (nv x 1)
|
||||
mjtNum* qfrc_fluid; // passive fluid force (nv x 1)
|
||||
mjtNum* qfrc_passive; // total passive force (nv x 1)
|
||||
|
||||
// computed by mj_sensorVel/mj_subtreeVel if needed
|
||||
mjtNum* subtree_linvel; // linear velocity of subtree com (nbody x 3)
|
||||
mjtNum* subtree_angmom; // angular momentum about subtree com (nbody x 3)
|
||||
|
||||
// computed by mj_Euler or mj_implicit
|
||||
mjtNum* qH; // L'*D*L factorization of modified M (nC x 1)
|
||||
mjtNum* qHDiagInv; // 1/diag(D) of modified M (nv x 1)
|
||||
|
||||
// computed by mj_implicit/mj_derivative
|
||||
mjtNum* qDeriv; // d (passive + actuator - bias) / d qvel (nD x 1)
|
||||
|
||||
// computed by mj_implicit/mju_factorLUSparse
|
||||
mjtNum* qLU; // sparse LU of (qM - dt*qDeriv) (nD x 1)
|
||||
|
||||
//-------------------- POSITION, VELOCITY, CONTROL/ACCELERATION dependent
|
||||
|
||||
// computed by mj_fwdActuation
|
||||
mjtNum* actuator_force; // actuator force in actuation space (nu x 1)
|
||||
mjtNum* qfrc_actuator; // actuator force (nv x 1)
|
||||
|
||||
// computed by mj_fwdAcceleration
|
||||
mjtNum* qfrc_smooth; // net unconstrained force (nv x 1)
|
||||
mjtNum* qacc_smooth; // unconstrained acceleration (nv x 1)
|
||||
|
||||
// computed by mj_fwdConstraint/mj_inverse
|
||||
mjtNum* qfrc_constraint; // constraint force (nv x 1)
|
||||
|
||||
// computed by mj_inverse
|
||||
mjtNum* qfrc_inverse; // net external force; should equal:
|
||||
// qfrc_applied + J'*xfrc_applied + qfrc_actuator (nv x 1)
|
||||
|
||||
// computed by mj_sensorAcc/mj_rnePostConstraint if needed; rotation:translation format
|
||||
mjtNum* cacc; // com-based acceleration (nbody x 6)
|
||||
mjtNum* cfrc_int; // com-based interaction force with parent (nbody x 6)
|
||||
mjtNum* cfrc_ext; // com-based external force on body (nbody x 6)
|
||||
|
||||
//-------------------- arena-allocated: POSITION dependent
|
||||
|
||||
// computed by mj_collision
|
||||
mjContact* contact; // array of all detected contacts (ncon x 1)
|
||||
|
||||
// computed by mj_makeConstraint
|
||||
int* efc_type; // constraint type (mjtConstraint) (nefc x 1)
|
||||
int* efc_id; // id of object of specified type (nefc x 1)
|
||||
int* efc_J_rownnz; // number of non-zeros in constraint Jacobian row (nefc x 1)
|
||||
int* efc_J_rowadr; // row start address in colind array (nefc x 1)
|
||||
int* efc_J_rowsuper; // number of subsequent rows in supernode (nefc x 1)
|
||||
int* efc_J_colind; // column indices in constraint Jacobian (nJ x 1)
|
||||
mjtNum* efc_J; // constraint Jacobian (nJ x 1)
|
||||
mjtNum* efc_pos; // constraint position (equality, contact) (nefc x 1)
|
||||
mjtNum* efc_margin; // inclusion margin (contact) (nefc x 1)
|
||||
mjtNum* efc_frictionloss; // frictionloss (friction) (nefc x 1)
|
||||
mjtNum* efc_diagApprox; // approximation to diagonal of A (nefc x 1)
|
||||
mjtNum* efc_KBIP; // stiffness, damping, impedance, imp' (nefc x 4)
|
||||
mjtNum* efc_D; // constraint mass (nefc x 1)
|
||||
mjtNum* efc_R; // inverse constraint mass (nefc x 1)
|
||||
int* tendon_efcadr; // first efc address involving tendon; -1: none (ntendon x 1)
|
||||
|
||||
// computed by mj_island (island dof structure)
|
||||
int* dof_island; // island id of this dof; -1: none (nv x 1)
|
||||
int* island_nv; // number of dofs in this island (nisland x 1)
|
||||
int* island_idofadr; // island start address in idof vector (nisland x 1)
|
||||
int* island_dofadr; // island start address in dof vector (nisland x 1)
|
||||
int* map_dof2idof; // map from dof to idof (nv x 1)
|
||||
int* map_idof2dof; // map from idof to dof; >= nidof: unconstrained (nv x 1)
|
||||
|
||||
// computed by mj_island (dofs sorted by island)
|
||||
mjtNum* ifrc_smooth; // net unconstrained force (nidof x 1)
|
||||
mjtNum* iacc_smooth; // unconstrained acceleration (nidof x 1)
|
||||
int* iM_rownnz; // inertia: non-zeros in each row (nidof x 1)
|
||||
int* iM_rowadr; // inertia: address of each row in iM_colind (nidof x 1)
|
||||
int* iM_colind; // inertia: column indices of non-zeros (nC x 1)
|
||||
mjtNum* iM; // total inertia (sparse) (nC x 1)
|
||||
mjtNum* iLD; // L'*D*L factorization of M (sparse) (nC x 1)
|
||||
mjtNum* iLDiagInv; // 1/diag(D) (nidof x 1)
|
||||
mjtNum* iacc; // acceleration (nidof x 1)
|
||||
|
||||
// computed by mj_island (island constraint structure)
|
||||
int* efc_island; // island id of this constraint (nefc x 1)
|
||||
int* island_ne; // number of equality constraints in island (nisland x 1)
|
||||
int* island_nf; // number of friction constraints in island (nisland x 1)
|
||||
int* island_nefc; // number of constraints in island (nisland x 1)
|
||||
int* island_iefcadr; // start address in iefc vector (nisland x 1)
|
||||
int* map_efc2iefc; // map from efc to iefc (nefc x 1)
|
||||
int* map_iefc2efc; // map from iefc to efc (nefc x 1)
|
||||
|
||||
// computed by mj_island (constraints sorted by island)
|
||||
int* iefc_type; // constraint type (mjtConstraint) (nefc x 1)
|
||||
int* iefc_id; // id of object of specified type (nefc x 1)
|
||||
int* iefc_J_rownnz; // number of non-zeros in constraint Jacobian row (nefc x 1)
|
||||
int* iefc_J_rowadr; // row start address in colind array (nefc x 1)
|
||||
int* iefc_J_rowsuper; // number of subsequent rows in supernode (nefc x 1)
|
||||
int* iefc_J_colind; // column indices in constraint Jacobian (nJ x 1)
|
||||
mjtNum* iefc_J; // constraint Jacobian (nJ x 1)
|
||||
mjtNum* iefc_frictionloss; // frictionloss (friction) (nefc x 1)
|
||||
mjtNum* iefc_D; // constraint mass (nefc x 1)
|
||||
mjtNum* iefc_R; // inverse constraint mass (nefc x 1)
|
||||
|
||||
// computed by mj_projectConstraint (PGS solver)
|
||||
int* efc_AR_rownnz; // number of non-zeros in AR (nefc x 1)
|
||||
int* efc_AR_rowadr; // row start address in colind array (nefc x 1)
|
||||
int* efc_AR_colind; // column indices in sparse AR (nA x 1)
|
||||
mjtNum* efc_AR; // J*inv(M)*J' + R (nA x 1)
|
||||
|
||||
//-------------------- arena-allocated: POSITION, VELOCITY dependent
|
||||
|
||||
// computed by mj_fwdVelocity/mj_referenceConstraint
|
||||
mjtNum* efc_vel; // velocity in constraint space: J*qvel (nefc x 1)
|
||||
mjtNum* efc_aref; // reference pseudo-acceleration (nefc x 1)
|
||||
|
||||
//-------------------- arena-allocated: POSITION, VELOCITY, CONTROL/ACCELERATION dependent
|
||||
|
||||
// computed by mj_fwdConstraint/mj_inverse
|
||||
mjtNum* efc_b; // linear cost term: J*qacc_smooth - aref (nefc x 1)
|
||||
mjtNum* iefc_aref; // reference pseudo-acceleration (nefc x 1)
|
||||
int* iefc_state; // constraint state (mjtConstraintState) (nefc x 1)
|
||||
mjtNum* iefc_force; // constraint force in constraint space (nefc x 1)
|
||||
int* efc_state; // constraint state (mjtConstraintState) (nefc x 1)
|
||||
mjtNum* efc_force; // constraint force in constraint space (nefc x 1)
|
||||
mjtNum* ifrc_constraint; // constraint force (nidof x 1)
|
||||
|
||||
// thread pool pointer
|
||||
uintptr_t threadpool;
|
||||
|
||||
// compilation signature
|
||||
uint64_t signature; // also held by the mjSpec that compiled the model
|
||||
};
|
||||
typedef struct mjData_ mjData;
|
||||
|
||||
|
||||
//---------------------------------- callback function types ---------------------------------------
|
||||
|
||||
// generic MuJoCo function
|
||||
typedef void (*mjfGeneric)(const mjModel* m, mjData* d);
|
||||
|
||||
// contact filter: 1- discard, 0- collide
|
||||
typedef int (*mjfConFilt)(const mjModel* m, mjData* d, int geom1, int geom2);
|
||||
|
||||
// sensor simulation
|
||||
typedef void (*mjfSensor)(const mjModel* m, mjData* d, int stage);
|
||||
|
||||
// timer
|
||||
typedef mjtNum (*mjfTime)(void);
|
||||
|
||||
// actuator dynamics, gain, bias
|
||||
typedef mjtNum (*mjfAct)(const mjModel* m, const mjData* d, int id);
|
||||
|
||||
// collision detection
|
||||
typedef int (*mjfCollision)(const mjModel* m, const mjData* d,
|
||||
mjContact* con, int g1, int g2, mjtNum margin);
|
||||
|
||||
#endif // MUJOCO_MJDATA_H_
|
||||
47
third_party/mujoco/3.3.7/include/mujoco/mjexport.h
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
// Copyright 2021 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MUJOCO_MJEXPORT_H_
|
||||
#define MUJOCO_MJEXPORT_H_
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#define MUJOCO_HELPER_DLL_IMPORT __declspec(dllimport)
|
||||
#define MUJOCO_HELPER_DLL_EXPORT __declspec(dllexport)
|
||||
#define MUJOCO_HELPER_DLL_LOCAL
|
||||
#else
|
||||
#if __GNUC__ >= 4
|
||||
#define MUJOCO_HELPER_DLL_IMPORT __attribute__ ((visibility ("default")))
|
||||
#define MUJOCO_HELPER_DLL_EXPORT __attribute__ ((visibility ("default")))
|
||||
#define MUJOCO_HELPER_DLL_LOCAL __attribute__ ((visibility ("hidden")))
|
||||
#else
|
||||
#define MUJOCO_HELPER_DLL_IMPORT
|
||||
#define MUJOCO_HELPER_DLL_EXPORT
|
||||
#define MUJOCO_HELPER_DLL_LOCAL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MJ_STATIC
|
||||
// static library
|
||||
#define MJAPI
|
||||
#define MJLOCAL
|
||||
#else
|
||||
#ifdef MUJOCO_DLL_EXPORTS
|
||||
#define MJAPI MUJOCO_HELPER_DLL_EXPORT
|
||||
#else
|
||||
#define MJAPI MUJOCO_HELPER_DLL_IMPORT
|
||||
#endif
|
||||
#define MJLOCAL MUJOCO_HELPER_DLL_LOCAL
|
||||
#endif
|
||||
|
||||
#endif // MUJOCO_MJEXPORT_H_
|
||||
38
third_party/mujoco/3.3.7/include/mujoco/mjmacro.h
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
// Copyright 2023 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MUJOCO_MJMACRO_H_
|
||||
#define MUJOCO_MJMACRO_H_
|
||||
|
||||
// max and min (use only for primitive types)
|
||||
#define mjMAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define mjMIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
// return current value of mjOption enable/disable flags
|
||||
#define mjDISABLED(x) (m->opt.disableflags & (x))
|
||||
#define mjENABLED(x) (m->opt.enableflags & (x))
|
||||
|
||||
// is actuator disabled
|
||||
#define mjACTUATORDISABLED(i) (m->opt.disableactuator & (1 << m->actuator_group[i]))
|
||||
|
||||
// annotation for functions that accept printf-like variadic arguments
|
||||
#ifndef mjPRINTFLIKE
|
||||
#if defined(__GNUC__)
|
||||
#define mjPRINTFLIKE(n, m) __attribute__((format(printf, n, m)))
|
||||
#else
|
||||
#define mjPRINTFLIKE(n, m)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // MUJOCO_MJMACRO_H_
|
||||
1231
third_party/mujoco/3.3.7/include/mujoco/mjmodel.h
vendored
Normal file
185
third_party/mujoco/3.3.7/include/mujoco/mjplugin.h
vendored
Normal file
@ -0,0 +1,185 @@
|
||||
// Copyright 2022 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MUJOCO_INCLUDE_MJPLUGIN_H_
|
||||
#define MUJOCO_INCLUDE_MJPLUGIN_H_
|
||||
|
||||
#include <mujoco/mjdata.h>
|
||||
#include <mujoco/mjmodel.h>
|
||||
#include <mujoco/mjtnum.h>
|
||||
#include <mujoco/mjvisualize.h>
|
||||
|
||||
|
||||
//---------------------------------- Resource Provider ---------------------------------------------
|
||||
|
||||
struct mjResource_ {
|
||||
char* name; // name of resource (filename, etc)
|
||||
void* data; // opaque data pointer
|
||||
char timestamp[512]; // timestamp of the resource
|
||||
const struct mjpResourceProvider* provider; // pointer to the provider
|
||||
};
|
||||
typedef struct mjResource_ mjResource;
|
||||
|
||||
// callback for opening a resource, returns zero on failure
|
||||
typedef int (*mjfOpenResource)(mjResource* resource);
|
||||
|
||||
// callback for reading a resource
|
||||
// return number of bytes stored in buffer, return -1 if error
|
||||
typedef int (*mjfReadResource)(mjResource* resource, const void** buffer);
|
||||
|
||||
// callback for closing a resource (responsible for freeing any allocated memory)
|
||||
typedef void (*mjfCloseResource)(mjResource* resource);
|
||||
|
||||
// callback for returning the directory of a resource
|
||||
// sets dir to directory string with ndir being size of directory string
|
||||
typedef void (*mjfGetResourceDir)(mjResource* resource, const char** dir, int* ndir);
|
||||
|
||||
// callback for checking if the current resource was modified from the time
|
||||
// specified by the timestamp
|
||||
// returns 0 if the resource's timestamp matches the provided timestamp
|
||||
// returns > 0 if the resource is younger than the given timestamp
|
||||
// returns < 0 if the resource is older than the given timestamp
|
||||
typedef int (*mjfResourceModified)(const mjResource* resource, const char* timestamp);
|
||||
|
||||
// struct describing a single resource provider
|
||||
struct mjpResourceProvider {
|
||||
const char* prefix; // prefix for match against a resource name
|
||||
mjfOpenResource open; // opening callback
|
||||
mjfReadResource read; // reading callback
|
||||
mjfCloseResource close; // closing callback
|
||||
mjfGetResourceDir getdir; // get directory callback (optional)
|
||||
mjfResourceModified modified; // resource modified callback (optional)
|
||||
void* data; // opaque data pointer (resource invariant)
|
||||
};
|
||||
typedef struct mjpResourceProvider mjpResourceProvider;
|
||||
|
||||
|
||||
//---------------------------------- Plugins -------------------------------------------------------
|
||||
|
||||
typedef enum mjtPluginCapabilityBit_ {
|
||||
mjPLUGIN_ACTUATOR = 1<<0, // actuator forces
|
||||
mjPLUGIN_SENSOR = 1<<1, // sensor measurements
|
||||
mjPLUGIN_PASSIVE = 1<<2, // passive forces
|
||||
mjPLUGIN_SDF = 1<<3, // signed distance fields
|
||||
} mjtPluginCapabilityBit;
|
||||
|
||||
struct mjpPlugin_ {
|
||||
const char* name; // globally unique name identifying the plugin
|
||||
|
||||
int nattribute; // number of configuration attributes
|
||||
const char* const* attributes; // name of configuration attributes
|
||||
|
||||
int capabilityflags; // plugin capabilities: bitfield of mjtPluginCapabilityBit
|
||||
int needstage; // sensor computation stage (mjtStage)
|
||||
|
||||
// number of mjtNums needed to store the state of a plugin instance (required)
|
||||
int (*nstate)(const mjModel* m, int instance);
|
||||
|
||||
// dimension of the specified sensor's output (required only for sensor plugins)
|
||||
int (*nsensordata)(const mjModel* m, int instance, int sensor_id);
|
||||
|
||||
// called when a new mjData is being created (required), returns 0 on success or -1 on failure
|
||||
int (*init)(const mjModel* m, mjData* d, int instance);
|
||||
|
||||
// called when an mjData is being freed (optional)
|
||||
void (*destroy)(mjData* d, int instance);
|
||||
|
||||
// called when an mjData is being copied (optional)
|
||||
void (*copy)(mjData* dest, const mjModel* m, const mjData* src, int instance);
|
||||
|
||||
// called when an mjData is being reset (required)
|
||||
void (*reset)(const mjModel* m, mjtNum* plugin_state, void* plugin_data, int instance);
|
||||
|
||||
// called when the plugin needs to update its outputs (required)
|
||||
void (*compute)(const mjModel* m, mjData* d, int instance, int capability_bit);
|
||||
|
||||
// called when time integration occurs (optional)
|
||||
void (*advance)(const mjModel* m, mjData* d, int instance);
|
||||
|
||||
// called by mjv_updateScene (optional)
|
||||
void (*visualize)(const mjModel*m, mjData* d, const mjvOption* opt, mjvScene* scn, int instance);
|
||||
|
||||
// methods specific to actuators (optional)
|
||||
|
||||
// updates the actuator plugin's entries in act_dot
|
||||
// called after native act_dot is computed and before the compute callback
|
||||
void (*actuator_act_dot)(const mjModel* m, mjData* d, int instance);
|
||||
|
||||
// methods specific to signed distance fields (optional)
|
||||
|
||||
// signed distance from the surface
|
||||
mjtNum (*sdf_distance)(const mjtNum point[3], const mjData* d, int instance);
|
||||
|
||||
// gradient of distance with respect to local coordinates
|
||||
void (*sdf_gradient)(mjtNum gradient[3], const mjtNum point[3], const mjData* d, int instance);
|
||||
|
||||
// called during compilation for marching cubes
|
||||
mjtNum (*sdf_staticdistance)(const mjtNum point[3], const mjtNum* attributes);
|
||||
|
||||
// convert attributes and provide defaults if not present
|
||||
void (*sdf_attribute)(mjtNum attribute[], const char* name[], const char* value[]);
|
||||
|
||||
// bounding box of implicit surface
|
||||
void (*sdf_aabb)(mjtNum aabb[6], const mjtNum* attributes);
|
||||
};
|
||||
typedef struct mjpPlugin_ mjpPlugin;
|
||||
|
||||
struct mjSDF_ {
|
||||
const mjpPlugin** plugin;
|
||||
int* id;
|
||||
mjtSDFType type;
|
||||
mjtNum* relpos;
|
||||
mjtNum* relmat;
|
||||
mjtGeom* geomtype;
|
||||
};
|
||||
typedef struct mjSDF_ mjSDF;
|
||||
|
||||
#if defined(__has_attribute)
|
||||
|
||||
#if __has_attribute(constructor)
|
||||
#define mjPLUGIN_LIB_INIT __attribute__((constructor)) static void _mjplugin_init(void)
|
||||
#endif // __has_attribute(constructor)
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
#ifndef mjDLLMAIN
|
||||
#define mjDLLMAIN DllMain
|
||||
#endif
|
||||
|
||||
#if !defined(mjEXTERNC)
|
||||
#if defined(__cplusplus)
|
||||
#define mjEXTERNC extern "C"
|
||||
#else
|
||||
#define mjEXTERNC
|
||||
#endif // defined(__cplusplus)
|
||||
#endif // !defined(mjEXTERNC)
|
||||
|
||||
// NOLINTBEGIN(runtime/int)
|
||||
#define mjPLUGIN_LIB_INIT \
|
||||
static void _mjplugin_dllmain(void); \
|
||||
mjEXTERNC int __stdcall mjDLLMAIN(void* hinst, unsigned long reason, void* reserved) { \
|
||||
if (reason == 1) { \
|
||||
_mjplugin_dllmain(); \
|
||||
} \
|
||||
return 1; \
|
||||
} \
|
||||
static void _mjplugin_dllmain(void)
|
||||
// NOLINTEND(runtime/int)
|
||||
|
||||
#endif // defined(_MSC_VER)
|
||||
|
||||
// function pointer type for mj_loadAllPluginLibraries callback
|
||||
typedef void (*mjfPluginLibraryLoadCallback)(const char* filename, int first, int count);
|
||||
|
||||
#endif // MUJOCO_INCLUDE_MJPLUGIN_H_
|
||||
177
third_party/mujoco/3.3.7/include/mujoco/mjrender.h
vendored
Normal file
@ -0,0 +1,177 @@
|
||||
// Copyright 2021 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MUJOCO_MJRENDER_H_
|
||||
#define MUJOCO_MJRENDER_H_
|
||||
|
||||
#include <mujoco/mjmodel.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define mjNAUX 10 // number of auxiliary buffers
|
||||
#define mjMAXTEXTURE 1000 // maximum number of textures
|
||||
#define mjMAXMATERIAL 1000 // maximum number of materials with textures
|
||||
|
||||
//---------------------------------- primitive types (mjt) -----------------------------------------
|
||||
|
||||
typedef enum mjtGridPos_ { // grid position for overlay
|
||||
mjGRID_TOPLEFT = 0, // top left
|
||||
mjGRID_TOPRIGHT, // top right
|
||||
mjGRID_BOTTOMLEFT, // bottom left
|
||||
mjGRID_BOTTOMRIGHT, // bottom right
|
||||
mjGRID_TOP, // top center
|
||||
mjGRID_BOTTOM, // bottom center
|
||||
mjGRID_LEFT, // left center
|
||||
mjGRID_RIGHT // right center
|
||||
} mjtGridPos;
|
||||
|
||||
|
||||
typedef enum mjtFramebuffer_ { // OpenGL framebuffer option
|
||||
mjFB_WINDOW = 0, // default/window buffer
|
||||
mjFB_OFFSCREEN // offscreen buffer
|
||||
} mjtFramebuffer;
|
||||
|
||||
typedef enum mjtDepthMap_ { // depth mapping for `mjr_readPixels`
|
||||
mjDEPTH_ZERONEAR = 0, // standard depth map; 0: znear, 1: zfar
|
||||
mjDEPTH_ZEROFAR = 1 // reversed depth map; 1: znear, 0: zfar
|
||||
} mjtDepthMap;
|
||||
|
||||
typedef enum mjtFontScale_ { // font scale, used at context creation
|
||||
mjFONTSCALE_50 = 50, // 50% scale, suitable for low-res rendering
|
||||
mjFONTSCALE_100 = 100, // normal scale, suitable in the absence of DPI scaling
|
||||
mjFONTSCALE_150 = 150, // 150% scale
|
||||
mjFONTSCALE_200 = 200, // 200% scale
|
||||
mjFONTSCALE_250 = 250, // 250% scale
|
||||
mjFONTSCALE_300 = 300 // 300% scale
|
||||
} mjtFontScale;
|
||||
|
||||
|
||||
typedef enum mjtFont_ { // font type, used at each text operation
|
||||
mjFONT_NORMAL = 0, // normal font
|
||||
mjFONT_SHADOW, // normal font with shadow (for higher contrast)
|
||||
mjFONT_BIG // big font (for user alerts)
|
||||
} mjtFont;
|
||||
|
||||
|
||||
struct mjrRect_ { // OpenGL rectangle
|
||||
int left; // left (usually 0)
|
||||
int bottom; // bottom (usually 0)
|
||||
int width; // width (usually buffer width)
|
||||
int height; // height (usually buffer height)
|
||||
};
|
||||
typedef struct mjrRect_ mjrRect;
|
||||
|
||||
|
||||
//---------------------------------- mjrContext ----------------------------------------------------
|
||||
|
||||
struct mjrContext_ { // custom OpenGL context
|
||||
// parameters copied from mjVisual
|
||||
float lineWidth; // line width for wireframe rendering
|
||||
float shadowClip; // clipping radius for directional lights
|
||||
float shadowScale; // fraction of light cutoff for spot lights
|
||||
float fogStart; // fog start = stat.extent * vis.map.fogstart
|
||||
float fogEnd; // fog end = stat.extent * vis.map.fogend
|
||||
float fogRGBA[4]; // fog rgba
|
||||
int shadowSize; // size of shadow map texture
|
||||
int offWidth; // width of offscreen buffer
|
||||
int offHeight; // height of offscreen buffer
|
||||
int offSamples; // number of offscreen buffer multisamples
|
||||
|
||||
// parameters specified at creation
|
||||
int fontScale; // font scale
|
||||
int auxWidth[mjNAUX]; // auxiliary buffer width
|
||||
int auxHeight[mjNAUX]; // auxiliary buffer height
|
||||
int auxSamples[mjNAUX]; // auxiliary buffer multisamples
|
||||
|
||||
// offscreen rendering objects
|
||||
unsigned int offFBO; // offscreen framebuffer object
|
||||
unsigned int offFBO_r; // offscreen framebuffer for resolving multisamples
|
||||
unsigned int offColor; // offscreen color buffer
|
||||
unsigned int offColor_r; // offscreen color buffer for resolving multisamples
|
||||
unsigned int offDepthStencil; // offscreen depth and stencil buffer
|
||||
unsigned int offDepthStencil_r; // offscreen depth and stencil buffer for multisamples
|
||||
|
||||
// shadow rendering objects
|
||||
unsigned int shadowFBO; // shadow map framebuffer object
|
||||
unsigned int shadowTex; // shadow map texture
|
||||
|
||||
// auxiliary buffers
|
||||
unsigned int auxFBO[mjNAUX]; // auxiliary framebuffer object
|
||||
unsigned int auxFBO_r[mjNAUX]; // auxiliary framebuffer object for resolving
|
||||
unsigned int auxColor[mjNAUX]; // auxiliary color buffer
|
||||
unsigned int auxColor_r[mjNAUX]; // auxiliary color buffer for resolving
|
||||
|
||||
// materials with textures
|
||||
int mat_texid[mjMAXMATERIAL*mjNTEXROLE]; // material texture ids (-1: no texture)
|
||||
int mat_texuniform[mjMAXMATERIAL]; // uniform cube mapping
|
||||
float mat_texrepeat[mjMAXMATERIAL*2]; // texture repetition for 2d mapping
|
||||
|
||||
// texture objects and info
|
||||
int ntexture; // number of allocated textures
|
||||
int textureType[mjMAXTEXTURE]; // type of texture (mjtTexture) (ntexture)
|
||||
unsigned int texture[mjMAXTEXTURE]; // texture names
|
||||
|
||||
// displaylist starting positions
|
||||
unsigned int basePlane; // all planes from model
|
||||
unsigned int baseMesh; // all meshes from model
|
||||
unsigned int baseHField; // all height fields from model
|
||||
unsigned int baseBuiltin; // all builtin geoms, with quality from model
|
||||
unsigned int baseFontNormal; // normal font
|
||||
unsigned int baseFontShadow; // shadow font
|
||||
unsigned int baseFontBig; // big font
|
||||
|
||||
// displaylist ranges
|
||||
int rangePlane; // all planes from model
|
||||
int rangeMesh; // all meshes from model
|
||||
int rangeHField; // all hfields from model
|
||||
int rangeBuiltin; // all builtin geoms, with quality from model
|
||||
int rangeFont; // all characters in font
|
||||
|
||||
// skin VBOs
|
||||
int nskin; // number of skins
|
||||
unsigned int* skinvertVBO; // skin vertex position VBOs (nskin)
|
||||
unsigned int* skinnormalVBO; // skin vertex normal VBOs (nskin)
|
||||
unsigned int* skintexcoordVBO; // skin vertex texture coordinate VBOs (nskin)
|
||||
unsigned int* skinfaceVBO; // skin face index VBOs (nskin)
|
||||
|
||||
// character info
|
||||
int charWidth[127]; // character widths: normal and shadow
|
||||
int charWidthBig[127]; // chacarter widths: big
|
||||
int charHeight; // character heights: normal and shadow
|
||||
int charHeightBig; // character heights: big
|
||||
|
||||
// capabilities
|
||||
int glInitialized; // is OpenGL initialized
|
||||
int windowAvailable; // is default/window framebuffer available
|
||||
int windowSamples; // number of samples for default/window framebuffer
|
||||
int windowStereo; // is stereo available for default/window framebuffer
|
||||
int windowDoublebuffer; // is default/window framebuffer double buffered
|
||||
|
||||
// framebuffer
|
||||
int currentBuffer; // currently active framebuffer: mjFB_WINDOW or mjFB_OFFSCREEN
|
||||
|
||||
// pixel output format
|
||||
int readPixelFormat; // default color pixel format for mjr_readPixels
|
||||
|
||||
// depth output format
|
||||
int readDepthMap; // depth mapping: mjDEPTH_ZERONEAR or mjDEPTH_ZEROFAR
|
||||
};
|
||||
typedef struct mjrContext_ mjrContext;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#endif // MUJOCO_MJRENDER_H_
|
||||
58
third_party/mujoco/3.3.7/include/mujoco/mjsan.h
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
// Copyright 2024 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MUJOCO_INCLUDE_MJSAN_H_
|
||||
#define MUJOCO_INCLUDE_MJSAN_H_
|
||||
|
||||
// Include asan interface header, or provide stubs for poison/unpoison macros when not using asan.
|
||||
#ifdef ADDRESS_SANITIZER
|
||||
#include <sanitizer/asan_interface.h>
|
||||
#elif defined(_MSC_VER)
|
||||
#define ASAN_POISON_MEMORY_REGION(addr, size)
|
||||
#define ASAN_UNPOISON_MEMORY_REGION(addr, size)
|
||||
#else
|
||||
#define ASAN_POISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size))
|
||||
#define ASAN_UNPOISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size))
|
||||
#endif
|
||||
|
||||
// When built and run under address sanitizer (asan), mj_markStack and mj_freeStack are instrumented
|
||||
// to detect leakage of mjData stack frames. When the compiler inlines several callees that call
|
||||
// into mark/free into the same function, this instrumentation requires that the compiler retains
|
||||
// separate mark/free calls for each original callee. The memory-clobbered asm blocks act as a
|
||||
// barrier to prevent mark/free calls from being combined under optimization.
|
||||
#ifdef ADDRESS_SANITIZER
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void mj__markStack(mjData*) __attribute__((noinline));
|
||||
static inline void mj_markStack(mjData* d) __attribute__((always_inline)) {
|
||||
asm volatile("" ::: "memory");
|
||||
mj__markStack(d);
|
||||
asm volatile("" ::: "memory");
|
||||
}
|
||||
|
||||
void mj__freeStack(mjData*) __attribute__((noinline));
|
||||
static inline void mj_freeStack(mjData* d) __attribute__((always_inline)) {
|
||||
asm volatile("" ::: "memory");
|
||||
mj__freeStack(d);
|
||||
asm volatile("" ::: "memory");
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
#endif // ADDRESS_SANITIZER
|
||||
|
||||
#endif // MUJOCO_INCLUDE_MJSAN_H_
|
||||
784
third_party/mujoco/3.3.7/include/mujoco/mjspec.h
vendored
Normal file
@ -0,0 +1,784 @@
|
||||
// Copyright 2024 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MUJOCO_INCLUDE_MJSPEC_H_
|
||||
#define MUJOCO_INCLUDE_MJSPEC_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <mujoco/mjmodel.h>
|
||||
#include <mujoco/mjtnum.h>
|
||||
|
||||
|
||||
// this is a C-API
|
||||
#ifdef __cplusplus
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//-------------------------------- handles to strings and arrays -----------------------------------
|
||||
|
||||
#ifdef __cplusplus
|
||||
// C++: defined to be compatible with corresponding std types
|
||||
using mjString = std::string;
|
||||
using mjStringVec = std::vector<std::string>;
|
||||
using mjIntVec = std::vector<int>;
|
||||
using mjIntVecVec = std::vector<std::vector<int>>;
|
||||
using mjFloatVec = std::vector<float>;
|
||||
using mjFloatVecVec = std::vector<std::vector<float>>;
|
||||
using mjDoubleVec = std::vector<double>;
|
||||
using mjByteVec = std::vector<std::byte>;
|
||||
#else
|
||||
// C: opaque types
|
||||
typedef void mjString;
|
||||
typedef void mjStringVec;
|
||||
typedef void mjIntVec;
|
||||
typedef void mjIntVecVec;
|
||||
typedef void mjFloatVec;
|
||||
typedef void mjFloatVecVec;
|
||||
typedef void mjDoubleVec;
|
||||
typedef void mjByteVec;
|
||||
#endif
|
||||
|
||||
|
||||
//-------------------------------- enum types (mjt) ------------------------------------------------
|
||||
|
||||
typedef enum mjtGeomInertia_ { // type of inertia inference
|
||||
mjINERTIA_VOLUME = 0, // mass distributed in the volume
|
||||
mjINERTIA_SHELL, // mass distributed on the surface
|
||||
} mjtGeomInertia;
|
||||
|
||||
|
||||
typedef enum mjtMeshInertia_ { // type of mesh inertia
|
||||
mjMESH_INERTIA_CONVEX = 0, // convex mesh inertia
|
||||
mjMESH_INERTIA_EXACT, // exact mesh inertia
|
||||
mjMESH_INERTIA_LEGACY, // legacy mesh inertia
|
||||
mjMESH_INERTIA_SHELL // shell mesh inertia
|
||||
} mjtMeshInertia;
|
||||
|
||||
typedef enum mjtMeshBuiltin_ { // type of built-in procedural mesh
|
||||
mjMESH_BUILTIN_NONE = 0, // no built-in mesh
|
||||
mjMESH_BUILTIN_SPHERE, // sphere
|
||||
mjMESH_BUILTIN_HEMISPHERE, // hemisphere
|
||||
mjMESH_BUILTIN_CONE, // cone
|
||||
mjMESH_BUILTIN_SUPERSPHERE, // supersphere
|
||||
mjMESH_BUILTIN_SUPERTORUS, // supertorus
|
||||
mjMESH_BUILTIN_WEDGE, // wedge
|
||||
mjMESH_BUILTIN_PLATE, // plate
|
||||
} mjtMeshBuiltin;
|
||||
|
||||
typedef enum mjtBuiltin_ { // type of built-in procedural texture
|
||||
mjBUILTIN_NONE = 0, // no built-in texture
|
||||
mjBUILTIN_GRADIENT, // gradient: rgb1->rgb2
|
||||
mjBUILTIN_CHECKER, // checker pattern: rgb1, rgb2
|
||||
mjBUILTIN_FLAT // 2d: rgb1; cube: rgb1-up, rgb2-side, rgb3-down
|
||||
} mjtBuiltin;
|
||||
|
||||
|
||||
typedef enum mjtMark_ { // mark type for procedural textures
|
||||
mjMARK_NONE = 0, // no mark
|
||||
mjMARK_EDGE, // edges
|
||||
mjMARK_CROSS, // cross
|
||||
mjMARK_RANDOM // random dots
|
||||
} mjtMark;
|
||||
|
||||
|
||||
typedef enum mjtLimited_ { // type of limit specification
|
||||
mjLIMITED_FALSE = 0, // not limited
|
||||
mjLIMITED_TRUE, // limited
|
||||
mjLIMITED_AUTO, // limited inferred from presence of range
|
||||
} mjtLimited;
|
||||
|
||||
typedef enum mjtAlignFree_ { // whether to align free joints with the inertial frame
|
||||
mjALIGNFREE_FALSE = 0, // don't align
|
||||
mjALIGNFREE_TRUE, // align
|
||||
mjALIGNFREE_AUTO, // respect the global compiler flag
|
||||
} mjtAlignFree;
|
||||
|
||||
|
||||
typedef enum mjtInertiaFromGeom_ { // whether to infer body inertias from child geoms
|
||||
mjINERTIAFROMGEOM_FALSE = 0, // do not use; inertial element required
|
||||
mjINERTIAFROMGEOM_TRUE, // always use; overwrite inertial element
|
||||
mjINERTIAFROMGEOM_AUTO // use only if inertial element is missing
|
||||
} mjtInertiaFromGeom;
|
||||
|
||||
|
||||
typedef enum mjtOrientation_ { // type of orientation specifier
|
||||
mjORIENTATION_QUAT = 0, // quaternion
|
||||
mjORIENTATION_AXISANGLE, // axis and angle
|
||||
mjORIENTATION_XYAXES, // x and y axes
|
||||
mjORIENTATION_ZAXIS, // z axis (minimal rotation)
|
||||
mjORIENTATION_EULER, // Euler angles
|
||||
} mjtOrientation;
|
||||
|
||||
|
||||
//-------------------------------- attribute structs (mjs) -----------------------------------------
|
||||
|
||||
typedef struct mjsElement_ { // element type, do not modify
|
||||
mjtObj elemtype; // element type
|
||||
uint64_t signature; // compilation signature
|
||||
} mjsElement;
|
||||
|
||||
|
||||
typedef struct mjsCompiler_ { // compiler options
|
||||
mjtByte autolimits; // infer "limited" attribute based on range
|
||||
double boundmass; // enforce minimum body mass
|
||||
double boundinertia; // enforce minimum body diagonal inertia
|
||||
double settotalmass; // rescale masses and inertias; <=0: ignore
|
||||
mjtByte balanceinertia; // automatically impose A + B >= C rule
|
||||
mjtByte fitaabb; // meshfit to aabb instead of inertia box
|
||||
mjtByte degree; // angles in radians or degrees
|
||||
char eulerseq[3]; // sequence for euler rotations
|
||||
mjtByte discardvisual; // discard visual geoms in parser
|
||||
mjtByte usethread; // use multiple threads to speed up compiler
|
||||
mjtByte fusestatic; // fuse static bodies with parent
|
||||
int inertiafromgeom; // use geom inertias (mjtInertiaFromGeom)
|
||||
int inertiagrouprange[2]; // range of geom groups used to compute inertia
|
||||
mjtByte saveinertial; // save explicit inertial clause for all bodies to XML
|
||||
int alignfree; // align free joints with inertial frame
|
||||
mjLROpt LRopt; // options for lengthrange computation
|
||||
mjString* meshdir; // mesh and hfield directory
|
||||
mjString* texturedir; // texture directory
|
||||
} mjsCompiler;
|
||||
|
||||
|
||||
typedef struct mjSpec_ { // model specification
|
||||
mjsElement* element; // element type
|
||||
mjString* modelname; // model name
|
||||
|
||||
// compiler data
|
||||
mjsCompiler compiler; // compiler options
|
||||
mjtByte strippath; // automatically strip paths from mesh files
|
||||
|
||||
// engine data
|
||||
mjOption option; // physics options
|
||||
mjVisual visual; // visual options
|
||||
mjStatistic stat; // statistics override (if defined)
|
||||
|
||||
// sizes
|
||||
mjtSize memory; // number of bytes in arena+stack memory
|
||||
int nemax; // max number of equality constraints
|
||||
int nuserdata; // number of mjtNums in userdata
|
||||
int nuser_body; // number of mjtNums in body_user
|
||||
int nuser_jnt; // number of mjtNums in jnt_user
|
||||
int nuser_geom; // number of mjtNums in geom_user
|
||||
int nuser_site; // number of mjtNums in site_user
|
||||
int nuser_cam; // number of mjtNums in cam_user
|
||||
int nuser_tendon; // number of mjtNums in tendon_user
|
||||
int nuser_actuator; // number of mjtNums in actuator_user
|
||||
int nuser_sensor; // number of mjtNums in sensor_user
|
||||
int nkey; // number of keyframes
|
||||
int njmax; // (deprecated) max number of constraints
|
||||
int nconmax; // (deprecated) max number of detected contacts
|
||||
mjtSize nstack; // (deprecated) number of mjtNums in mjData stack
|
||||
|
||||
// global data
|
||||
mjString* comment; // comment at top of XML
|
||||
mjString* modelfiledir; // path to model file
|
||||
|
||||
// other
|
||||
mjtByte hasImplicitPluginElem; // already encountered an implicit plugin sensor/actuator
|
||||
} mjSpec;
|
||||
|
||||
|
||||
typedef struct mjsOrientation_ { // alternative orientation specifiers
|
||||
mjtOrientation type; // active orientation specifier
|
||||
double axisangle[4]; // axis and angle
|
||||
double xyaxes[6]; // x and y axes
|
||||
double zaxis[3]; // z axis (minimal rotation)
|
||||
double euler[3]; // Euler angles
|
||||
} mjsOrientation;
|
||||
|
||||
|
||||
typedef struct mjsPlugin_ { // plugin specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // instance name
|
||||
mjString* plugin_name; // plugin name
|
||||
mjtByte active; // is the plugin active
|
||||
mjString* info; // message appended to compiler errors
|
||||
} mjsPlugin;
|
||||
|
||||
|
||||
typedef struct mjsBody_ { // body specification
|
||||
mjsElement* element; // element type
|
||||
mjString* childclass; // childclass name
|
||||
|
||||
// body frame
|
||||
double pos[3]; // frame position
|
||||
double quat[4]; // frame orientation
|
||||
mjsOrientation alt; // frame alternative orientation
|
||||
|
||||
// inertial frame
|
||||
double mass; // mass
|
||||
double ipos[3]; // inertial frame position
|
||||
double iquat[4]; // inertial frame orientation
|
||||
double inertia[3]; // diagonal inertia (in i-frame)
|
||||
mjsOrientation ialt; // inertial frame alternative orientation
|
||||
double fullinertia[6]; // non-axis-aligned inertia matrix
|
||||
|
||||
// other
|
||||
mjtByte mocap; // is this a mocap body
|
||||
double gravcomp; // gravity compensation
|
||||
mjDoubleVec* userdata; // user data
|
||||
mjtByte explicitinertial; // whether to save the body with explicit inertial clause
|
||||
mjsPlugin plugin; // passive force plugin
|
||||
mjString* info; // message appended to compiler errors
|
||||
} mjsBody;
|
||||
|
||||
|
||||
typedef struct mjsFrame_ { // frame specification
|
||||
mjsElement* element; // element type
|
||||
mjString* childclass; // childclass name
|
||||
double pos[3]; // position
|
||||
double quat[4]; // orientation
|
||||
mjsOrientation alt; // alternative orientation
|
||||
mjString* info; // message appended to compiler errors
|
||||
} mjsFrame;
|
||||
|
||||
|
||||
typedef struct mjsJoint_ { // joint specification
|
||||
mjsElement* element; // element type
|
||||
mjtJoint type; // joint type
|
||||
|
||||
// kinematics
|
||||
double pos[3]; // anchor position
|
||||
double axis[3]; // joint axis
|
||||
double ref; // value at reference configuration: qpos0
|
||||
int align; // align free joint with body com (mjtAlignFree)
|
||||
|
||||
// stiffness
|
||||
double stiffness; // stiffness coefficient
|
||||
double springref; // spring reference value: qpos_spring
|
||||
double springdamper[2]; // timeconst, dampratio
|
||||
|
||||
// limits
|
||||
int limited; // does joint have limits (mjtLimited)
|
||||
double range[2]; // joint limits
|
||||
double margin; // margin value for joint limit detection
|
||||
mjtNum solref_limit[mjNREF]; // solver reference: joint limits
|
||||
mjtNum solimp_limit[mjNIMP]; // solver impedance: joint limits
|
||||
int actfrclimited; // are actuator forces on joint limited (mjtLimited)
|
||||
double actfrcrange[2]; // actuator force limits
|
||||
|
||||
// dof properties
|
||||
double armature; // armature inertia (mass for slider)
|
||||
double damping; // damping coefficient
|
||||
double frictionloss; // friction loss
|
||||
mjtNum solref_friction[mjNREF]; // solver reference: dof friction
|
||||
mjtNum solimp_friction[mjNIMP]; // solver impedance: dof friction
|
||||
|
||||
// other
|
||||
int group; // group
|
||||
mjtByte actgravcomp; // is gravcomp force applied via actuators
|
||||
mjDoubleVec* userdata; // user data
|
||||
mjString* info; // message appended to compiler errors
|
||||
} mjsJoint;
|
||||
|
||||
|
||||
typedef struct mjsGeom_ { // geom specification
|
||||
mjsElement* element; // element type
|
||||
mjtGeom type; // geom type
|
||||
|
||||
// frame, size
|
||||
double pos[3]; // position
|
||||
double quat[4]; // orientation
|
||||
mjsOrientation alt; // alternative orientation
|
||||
double fromto[6]; // alternative for capsule, cylinder, box, ellipsoid
|
||||
double size[3]; // type-specific size
|
||||
|
||||
// contact related
|
||||
int contype; // contact type
|
||||
int conaffinity; // contact affinity
|
||||
int condim; // contact dimensionality
|
||||
int priority; // contact priority
|
||||
double friction[3]; // one-sided friction coefficients: slide, roll, spin
|
||||
double solmix; // solver mixing for contact pairs
|
||||
mjtNum solref[mjNREF]; // solver reference
|
||||
mjtNum solimp[mjNIMP]; // solver impedance
|
||||
double margin; // margin for contact detection
|
||||
double gap; // include in solver if dist < margin-gap
|
||||
|
||||
// inertia inference
|
||||
double mass; // used to compute density
|
||||
double density; // used to compute mass and inertia from volume or surface
|
||||
mjtGeomInertia typeinertia; // selects between surface and volume inertia
|
||||
|
||||
// fluid forces
|
||||
mjtNum fluid_ellipsoid; // whether ellipsoid-fluid model is active
|
||||
mjtNum fluid_coefs[5]; // ellipsoid-fluid interaction coefs
|
||||
|
||||
// visual
|
||||
mjString* material; // name of material
|
||||
float rgba[4]; // rgba when material is omitted
|
||||
int group; // group
|
||||
|
||||
// other
|
||||
mjString* hfieldname; // heightfield attached to geom
|
||||
mjString* meshname; // mesh attached to geom
|
||||
double fitscale; // scale mesh uniformly
|
||||
mjDoubleVec* userdata; // user data
|
||||
mjsPlugin plugin; // sdf plugin
|
||||
mjString* info; // message appended to compiler errors
|
||||
} mjsGeom;
|
||||
|
||||
|
||||
typedef struct mjsSite_ { // site specification
|
||||
mjsElement* element; // element type
|
||||
|
||||
// frame, size
|
||||
double pos[3]; // position
|
||||
double quat[4]; // orientation
|
||||
mjsOrientation alt; // alternative orientation
|
||||
double fromto[6]; // alternative for capsule, cylinder, box, ellipsoid
|
||||
double size[3]; // geom size
|
||||
|
||||
// visual
|
||||
mjtGeom type; // geom type
|
||||
mjString* material; // name of material
|
||||
int group; // group
|
||||
float rgba[4]; // rgba when material is omitted
|
||||
|
||||
// other
|
||||
mjDoubleVec* userdata; // user data
|
||||
mjString* info; // message appended to compiler errors
|
||||
} mjsSite;
|
||||
|
||||
|
||||
typedef struct mjsCamera_ { // camera specification
|
||||
mjsElement* element; // element type
|
||||
|
||||
// extrinsics
|
||||
double pos[3]; // position
|
||||
double quat[4]; // orientation
|
||||
mjsOrientation alt; // alternative orientation
|
||||
mjtCamLight mode; // tracking mode
|
||||
mjString* targetbody; // target body for tracking/targeting
|
||||
|
||||
// intrinsics
|
||||
int orthographic; // is camera orthographic
|
||||
double fovy; // y-field of view
|
||||
double ipd; // inter-pupilary distance
|
||||
float intrinsic[4]; // camera intrinsics (length)
|
||||
float sensor_size[2]; // sensor size (length)
|
||||
float resolution[2]; // resolution (pixel)
|
||||
float focal_length[2]; // focal length (length)
|
||||
float focal_pixel[2]; // focal length (pixel)
|
||||
float principal_length[2]; // principal point (length)
|
||||
float principal_pixel[2]; // principal point (pixel)
|
||||
|
||||
// other
|
||||
mjDoubleVec* userdata; // user data
|
||||
mjString* info; // message appended to compiler errors
|
||||
} mjsCamera;
|
||||
|
||||
|
||||
typedef struct mjsLight_ { // light specification
|
||||
mjsElement* element; // element type
|
||||
|
||||
// frame
|
||||
double pos[3]; // position
|
||||
double dir[3]; // direction
|
||||
mjtCamLight mode; // tracking mode
|
||||
mjString* targetbody; // target body for targeting
|
||||
|
||||
// intrinsics
|
||||
mjtByte active; // is light active
|
||||
mjtLightType type; // type of light
|
||||
mjString* texture; // texture name for image lights
|
||||
mjtByte castshadow; // does light cast shadows
|
||||
float bulbradius; // bulb radius, for soft shadows
|
||||
float intensity; // intensity, in candelas
|
||||
float range; // range of effectiveness
|
||||
float attenuation[3]; // OpenGL attenuation (quadratic model)
|
||||
float cutoff; // OpenGL cutoff
|
||||
float exponent; // OpenGL exponent
|
||||
float ambient[3]; // ambient color
|
||||
float diffuse[3]; // diffuse color
|
||||
float specular[3]; // specular color
|
||||
|
||||
// other
|
||||
mjString* info; // message appended to compiler errorsx
|
||||
} mjsLight;
|
||||
|
||||
|
||||
typedef struct mjsFlex_ { // flex specification
|
||||
mjsElement* element; // element type
|
||||
|
||||
// contact properties
|
||||
int contype; // contact type
|
||||
int conaffinity; // contact affinity
|
||||
int condim; // contact dimensionality
|
||||
int priority; // contact priority
|
||||
double friction[3]; // one-sided friction coefficients: slide, roll, spin
|
||||
double solmix; // solver mixing for contact pairs
|
||||
mjtNum solref[mjNREF]; // solver reference
|
||||
mjtNum solimp[mjNIMP]; // solver impedance
|
||||
double margin; // margin for contact detection
|
||||
double gap; // include in solver if dist<margin-gap
|
||||
|
||||
// other properties
|
||||
int dim; // element dimensionality
|
||||
double radius; // radius around primitive element
|
||||
mjtByte internal; // enable internal collisions
|
||||
mjtByte flatskin; // render flex skin with flat shading
|
||||
int selfcollide; // mode for flex self collision
|
||||
int vertcollide; // mode for vertex collision
|
||||
int passive; // mode for passive collisions
|
||||
int activelayers; // number of active element layers in 3D
|
||||
int group; // group for visualizatioh
|
||||
double edgestiffness; // edge stiffness
|
||||
double edgedamping; // edge damping
|
||||
float rgba[4]; // rgba when material is omitted
|
||||
mjString* material; // name of material used for rendering
|
||||
double young; // Young's modulus
|
||||
double poisson; // Poisson's ratio
|
||||
double damping; // Rayleigh's damping
|
||||
double thickness; // thickness (2D only)
|
||||
int elastic2d; // 2D passive forces; 0: none, 1: bending, 2: stretching, 3: both
|
||||
|
||||
// mesh properties
|
||||
mjStringVec* nodebody; // node body names
|
||||
mjStringVec* vertbody; // vertex body names
|
||||
mjDoubleVec* node; // node positions
|
||||
mjDoubleVec* vert; // vertex positions
|
||||
mjIntVec* elem; // element vertex ids
|
||||
mjFloatVec* texcoord; // vertex texture coordinates
|
||||
mjIntVec* elemtexcoord; // element texture coordinates
|
||||
|
||||
// other
|
||||
mjString* info; // message appended to compiler errors
|
||||
} mjsFlex;
|
||||
|
||||
|
||||
typedef struct mjsMesh_ { // mesh specification
|
||||
mjsElement* element; // element type
|
||||
mjString* content_type; // content type of file
|
||||
mjString* file; // mesh file
|
||||
double refpos[3]; // reference position
|
||||
double refquat[4]; // reference orientation
|
||||
double scale[3]; // rescale mesh
|
||||
mjtMeshInertia inertia; // inertia type (convex, legacy, exact, shell)
|
||||
mjtByte smoothnormal; // do not exclude large-angle faces from normals
|
||||
mjtByte needsdf; // compute sdf from mesh
|
||||
int maxhullvert; // maximum vertex count for the convex hull
|
||||
mjFloatVec* uservert; // user vertex data
|
||||
mjFloatVec* usernormal; // user normal data
|
||||
mjFloatVec* usertexcoord; // user texcoord data
|
||||
mjIntVec* userface; // user vertex indices
|
||||
mjIntVec* userfacenormal; // user face normal indices
|
||||
mjIntVec* userfacetexcoord; // user texcoord indices
|
||||
mjsPlugin plugin; // sdf plugin
|
||||
mjString* material; // name of material
|
||||
mjString* info; // message appended to compiler errors
|
||||
} mjsMesh;
|
||||
|
||||
|
||||
typedef struct mjsHField_ { // height field specification
|
||||
mjsElement* element; // element type
|
||||
mjString* content_type; // content type of file
|
||||
mjString* file; // file: (nrow, ncol, [elevation data])
|
||||
double size[4]; // hfield size (ignore referencing geom size)
|
||||
int nrow; // number of rows
|
||||
int ncol; // number of columns
|
||||
mjFloatVec* userdata; // user-provided elevation data
|
||||
mjString* info; // message appended to compiler errors
|
||||
} mjsHField;
|
||||
|
||||
|
||||
|
||||
typedef struct mjsSkin_ { // skin specification
|
||||
mjsElement* element; // element type
|
||||
mjString* file; // skin file
|
||||
mjString* material; // name of material used for rendering
|
||||
float rgba[4]; // rgba when material is omitted
|
||||
float inflate; // inflate in normal direction
|
||||
int group; // group for visualization
|
||||
|
||||
// mesh
|
||||
mjFloatVec* vert; // vertex positions
|
||||
mjFloatVec* texcoord; // texture coordinates
|
||||
mjIntVec* face; // faces
|
||||
|
||||
// skin
|
||||
mjStringVec* bodyname; // body names
|
||||
mjFloatVec* bindpos; // bind pos
|
||||
mjFloatVec* bindquat; // bind quat
|
||||
mjIntVecVec* vertid; // vertex ids
|
||||
mjFloatVecVec* vertweight; // vertex weights
|
||||
|
||||
// other
|
||||
mjString* info; // message appended to compiler errors
|
||||
} mjsSkin;
|
||||
|
||||
|
||||
typedef struct mjsTexture_ { // texture specification
|
||||
mjsElement* element; // element type
|
||||
mjtTexture type; // texture type
|
||||
mjtColorSpace colorspace; // colorspace
|
||||
|
||||
// method 1: builtin
|
||||
int builtin; // builtin type (mjtBuiltin)
|
||||
int mark; // mark type (mjtMark)
|
||||
double rgb1[3]; // first color for builtin
|
||||
double rgb2[3]; // second color for builtin
|
||||
double markrgb[3]; // mark color
|
||||
double random; // probability of random dots
|
||||
int height; // height in pixels (square for cube and skybox)
|
||||
int width; // width in pixels
|
||||
int nchannel; // number of channels
|
||||
|
||||
// method 2: single file
|
||||
mjString* content_type; // content type of file
|
||||
mjString* file; // png file to load; use for all sides of cube
|
||||
int gridsize[2]; // size of grid for composite file; (1,1)-repeat
|
||||
char gridlayout[13]; // row-major: L,R,F,B,U,D for faces; . for unused
|
||||
|
||||
// method 3: separate files
|
||||
mjStringVec* cubefiles; // different file for each side of the cube
|
||||
|
||||
// method 4: from buffer read by user
|
||||
mjByteVec* data; // texture data
|
||||
|
||||
// flip options
|
||||
mjtByte hflip; // horizontal flip
|
||||
mjtByte vflip; // vertical flip
|
||||
|
||||
// other
|
||||
mjString* info; // message appended to compiler errors
|
||||
} mjsTexture;
|
||||
|
||||
|
||||
typedef struct mjsMaterial_ { // material specification
|
||||
mjsElement* element; // element type
|
||||
mjStringVec* textures; // names of textures (empty: none)
|
||||
mjtByte texuniform; // make texture cube uniform
|
||||
float texrepeat[2]; // texture repetition for 2D mapping
|
||||
float emission; // emission
|
||||
float specular; // specular
|
||||
float shininess; // shininess
|
||||
float reflectance; // reflectance
|
||||
float metallic; // metallic
|
||||
float roughness; // roughness
|
||||
float rgba[4]; // rgba
|
||||
mjString* info; // message appended to compiler errors
|
||||
} mjsMaterial;
|
||||
|
||||
|
||||
typedef struct mjsPair_ { // pair specification
|
||||
mjsElement* element; // element type
|
||||
mjString* geomname1; // name of geom 1
|
||||
mjString* geomname2; // name of geom 2
|
||||
|
||||
// optional parameters: computed from geoms if not set by user
|
||||
int condim; // contact dimensionality
|
||||
mjtNum solref[mjNREF]; // solver reference, normal direction
|
||||
mjtNum solreffriction[mjNREF]; // solver reference, frictional directions
|
||||
mjtNum solimp[mjNIMP]; // solver impedance
|
||||
double margin; // margin for contact detection
|
||||
double gap; // include in solver if dist<margin-gap
|
||||
double friction[5]; // full contact friction
|
||||
mjString* info; // message appended to errors
|
||||
} mjsPair;
|
||||
|
||||
|
||||
typedef struct mjsExclude_ { // exclude specification
|
||||
mjsElement* element; // element type
|
||||
mjString* bodyname1; // name of geom 1
|
||||
mjString* bodyname2; // name of geom 2
|
||||
mjString* info; // message appended to errors
|
||||
} mjsExclude;
|
||||
|
||||
|
||||
typedef struct mjsEquality_ { // equality specification
|
||||
mjsElement* element; // element type
|
||||
mjtEq type; // constraint type
|
||||
double data[mjNEQDATA]; // type-dependent data
|
||||
mjtByte active; // is equality initially active
|
||||
mjString* name1; // name of object 1
|
||||
mjString* name2; // name of object 2
|
||||
mjtObj objtype; // type of both objects
|
||||
mjtNum solref[mjNREF]; // solver reference
|
||||
mjtNum solimp[mjNIMP]; // solver impedance
|
||||
mjString* info; // message appended to errors
|
||||
} mjsEquality;
|
||||
|
||||
|
||||
typedef struct mjsTendon_ { // tendon specification
|
||||
mjsElement* element; // element type
|
||||
|
||||
// stiffness, damping, friction, armature
|
||||
double stiffness; // stiffness coefficient
|
||||
double springlength[2]; // spring resting length; {-1, -1}: use qpos_spring
|
||||
double damping; // damping coefficient
|
||||
double frictionloss; // friction loss
|
||||
mjtNum solref_friction[mjNREF]; // solver reference: tendon friction
|
||||
mjtNum solimp_friction[mjNIMP]; // solver impedance: tendon friction
|
||||
double armature; // inertia associated with tendon velocity
|
||||
|
||||
// length range
|
||||
int limited; // does tendon have limits (mjtLimited)
|
||||
int actfrclimited; // does tendon have actuator force limits
|
||||
double range[2]; // length limits
|
||||
double actfrcrange[2]; // actuator force limits
|
||||
double margin; // margin value for tendon limit detection
|
||||
mjtNum solref_limit[mjNREF]; // solver reference: tendon limits
|
||||
mjtNum solimp_limit[mjNIMP]; // solver impedance: tendon limits
|
||||
|
||||
// visual
|
||||
mjString* material; // name of material for rendering
|
||||
double width; // width for rendering
|
||||
float rgba[4]; // rgba when material is omitted
|
||||
int group; // group
|
||||
|
||||
// other
|
||||
mjDoubleVec* userdata; // user data
|
||||
mjString* info; // message appended to errors
|
||||
} mjsTendon;
|
||||
|
||||
|
||||
typedef struct mjsWrap_ { // wrapping object specification
|
||||
mjsElement* element; // element type
|
||||
mjString* info; // message appended to errors
|
||||
} mjsWrap;
|
||||
|
||||
|
||||
typedef struct mjsActuator_ { // actuator specification
|
||||
mjsElement* element; // element type
|
||||
|
||||
// gain, bias
|
||||
mjtGain gaintype; // gain type
|
||||
double gainprm[mjNGAIN]; // gain parameters
|
||||
mjtBias biastype; // bias type
|
||||
double biasprm[mjNGAIN]; // bias parameters
|
||||
|
||||
// activation state
|
||||
mjtDyn dyntype; // dynamics type
|
||||
double dynprm[mjNDYN]; // dynamics parameters
|
||||
int actdim; // number of activation variables
|
||||
mjtByte actearly; // apply next activations to qfrc
|
||||
|
||||
// transmission
|
||||
mjtTrn trntype; // transmission type
|
||||
double gear[6]; // length and transmitted force scaling
|
||||
mjString* target; // name of transmission target
|
||||
mjString* refsite; // reference site, for site transmission
|
||||
mjString* slidersite; // site defining cylinder, for slider-crank
|
||||
double cranklength; // crank length, for slider-crank
|
||||
double lengthrange[2]; // transmission length range
|
||||
double inheritrange; // automatic range setting for position and intvelocity
|
||||
|
||||
// input/output clamping
|
||||
int ctrllimited; // are control limits defined (mjtLimited)
|
||||
double ctrlrange[2]; // control range
|
||||
int forcelimited; // are force limits defined (mjtLimited)
|
||||
double forcerange[2]; // force range
|
||||
int actlimited; // are activation limits defined (mjtLimited)
|
||||
double actrange[2]; // activation range
|
||||
|
||||
// other
|
||||
int group; // group
|
||||
mjDoubleVec* userdata; // user data
|
||||
mjsPlugin plugin; // actuator plugin
|
||||
mjString* info; // message appended to compiler errors
|
||||
} mjsActuator;
|
||||
|
||||
|
||||
typedef struct mjsSensor_ { // sensor specification
|
||||
mjsElement* element; // element type
|
||||
|
||||
// sensor definition
|
||||
mjtSensor type; // type of sensor
|
||||
mjtObj objtype; // type of sensorized object
|
||||
mjString* objname; // name of sensorized object
|
||||
mjtObj reftype; // type of referenced object
|
||||
mjString* refname; // name of referenced object
|
||||
int intprm[mjNSENS]; // integer parameters
|
||||
|
||||
// user-defined sensors
|
||||
mjtDataType datatype; // data type for sensor measurement
|
||||
mjtStage needstage; // compute stage needed to simulate sensor
|
||||
int dim; // number of scalar outputs
|
||||
|
||||
// output post-processing
|
||||
double cutoff; // cutoff for real and positive datatypes
|
||||
double noise; // noise stdev
|
||||
|
||||
// other
|
||||
mjDoubleVec* userdata; // user data
|
||||
mjsPlugin plugin; // sensor plugin
|
||||
mjString* info; // message appended to compiler errors
|
||||
} mjsSensor;
|
||||
|
||||
|
||||
typedef struct mjsNumeric_ { // custom numeric field specification
|
||||
mjsElement* element; // element type
|
||||
mjDoubleVec* data; // initialization data
|
||||
int size; // array size, can be bigger than data size
|
||||
mjString* info; // message appended to compiler errors
|
||||
} mjsNumeric;
|
||||
|
||||
|
||||
typedef struct mjsText_ { // custom text specification
|
||||
mjsElement* element; // element type
|
||||
mjString* data; // text string
|
||||
mjString* info; // message appended to compiler errors
|
||||
} mjsText;
|
||||
|
||||
|
||||
typedef struct mjsTuple_ { // tuple specification
|
||||
mjsElement* element; // element type
|
||||
mjIntVec* objtype; // object types
|
||||
mjStringVec* objname; // object names
|
||||
mjDoubleVec* objprm; // object parameters
|
||||
mjString* info; // message appended to compiler errors
|
||||
} mjsTuple;
|
||||
|
||||
|
||||
typedef struct mjsKey_ { // keyframe specification
|
||||
mjsElement* element; // element type
|
||||
double time; // time
|
||||
mjDoubleVec* qpos; // qpos
|
||||
mjDoubleVec* qvel; // qvel
|
||||
mjDoubleVec* act; // act
|
||||
mjDoubleVec* mpos; // mocap pos
|
||||
mjDoubleVec* mquat; // mocap quat
|
||||
mjDoubleVec* ctrl; // ctrl
|
||||
mjString* info; // message appended to compiler errors
|
||||
} mjsKey;
|
||||
|
||||
|
||||
typedef struct mjsDefault_ { // default specification
|
||||
mjsElement* element; // element type
|
||||
mjsJoint* joint; // joint defaults
|
||||
mjsGeom* geom; // geom defaults
|
||||
mjsSite* site; // site defaults
|
||||
mjsCamera* camera; // camera defaults
|
||||
mjsLight* light; // light defaults
|
||||
mjsFlex* flex; // flex defaults
|
||||
mjsMesh* mesh; // mesh defaults
|
||||
mjsMaterial* material; // material defaults
|
||||
mjsPair* pair; // pair defaults
|
||||
mjsEquality* equality; // equality defaults
|
||||
mjsTendon* tendon; // tendon defaults
|
||||
mjsActuator* actuator; // actuator defaults
|
||||
} mjsDefault;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // MUJOCO_INCLUDE_MJSPEC_H_
|
||||
42
third_party/mujoco/3.3.7/include/mujoco/mjthread.h
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
// Copyright 2023 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MUJOCO_INCLUDE_MJTHREAD_H_
|
||||
#define MUJOCO_INCLUDE_MJTHREAD_H_
|
||||
|
||||
#define mjMAXTHREAD 128 // maximum number of threads in a thread pool
|
||||
|
||||
typedef enum mjtTaskStatus_ { // status values for mjTask
|
||||
mjTASK_NEW = 0, // newly created
|
||||
mjTASK_QUEUED, // enqueued in a thread pool
|
||||
mjTASK_COMPLETED // completed execution
|
||||
} mjtTaskStatus;
|
||||
|
||||
// function pointer type for mjTask
|
||||
typedef void* (*mjfTask)(void*);
|
||||
|
||||
// An opaque type representing a thread pool.
|
||||
struct mjThreadPool_ {
|
||||
int nworker; // number of workers in the pool
|
||||
};
|
||||
typedef struct mjThreadPool_ mjThreadPool;
|
||||
|
||||
struct mjTask_ { // a task that can be executed by a thread pool.
|
||||
mjfTask func; // pointer to the function that implements the task
|
||||
void* args; // arguments to func
|
||||
volatile int status; // status of the task
|
||||
};
|
||||
typedef struct mjTask_ mjTask;
|
||||
|
||||
#endif // MUJOCO_INCLUDE_MJTHREAD_H_
|
||||
45
third_party/mujoco/3.3.7/include/mujoco/mjtnum.h
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
// Copyright 2021 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MUJOCO_INCLUDE_MJTNUM_H_
|
||||
#define MUJOCO_INCLUDE_MJTNUM_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
//---------------------------------- floating-point definition -------------------------------------
|
||||
|
||||
// floating point data type and minval
|
||||
#ifndef mjUSESINGLE
|
||||
typedef double mjtNum;
|
||||
#define mjMINVAL 1E-15 // minimum value in any denominator
|
||||
#else
|
||||
typedef float mjtNum;
|
||||
#define mjMINVAL 1E-15f
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
//-------------------------------------- byte definition -------------------------------------------
|
||||
|
||||
typedef unsigned char mjtByte; // used for true/false
|
||||
|
||||
|
||||
|
||||
//-------------------------------------- size definition -------------------------------------------
|
||||
|
||||
typedef uint64_t mjtSize; // used for buffer sizes
|
||||
|
||||
|
||||
|
||||
#endif // MUJOCO_INCLUDE_MJTNUM_H_
|
||||
345
third_party/mujoco/3.3.7/include/mujoco/mjui.h
vendored
Normal file
@ -0,0 +1,345 @@
|
||||
// Copyright 2021 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MUJOCO_MJUI_H_
|
||||
#define MUJOCO_MJUI_H_
|
||||
|
||||
#include <mujoco/mjrender.h>
|
||||
|
||||
#define mjMAXUISECT 10 // maximum number of sections
|
||||
#define mjMAXUIITEM 200 // maximum number of items per section
|
||||
#define mjMAXUITEXT 300 // maximum number of chars in edittext and other
|
||||
#define mjMAXUINAME 40 // maximum number of chars in name
|
||||
#define mjMAXUIMULTI 35 // maximum number of radio/select items in group
|
||||
#define mjMAXUIEDIT 7 // maximum number of elements in edit list
|
||||
#define mjMAXUIRECT 25 // maximum number of rectangles
|
||||
|
||||
#define mjSEPCLOSED 1000 // closed state of adjustable separator
|
||||
#define mjPRESERVE 2000 // preserve section or separator state
|
||||
|
||||
|
||||
// key codes matching GLFW (user must remap for other frameworks)
|
||||
#define mjKEY_ESCAPE 256
|
||||
#define mjKEY_ENTER 257
|
||||
#define mjKEY_TAB 258
|
||||
#define mjKEY_BACKSPACE 259
|
||||
#define mjKEY_INSERT 260
|
||||
#define mjKEY_DELETE 261
|
||||
#define mjKEY_RIGHT 262
|
||||
#define mjKEY_LEFT 263
|
||||
#define mjKEY_DOWN 264
|
||||
#define mjKEY_UP 265
|
||||
#define mjKEY_PAGE_UP 266
|
||||
#define mjKEY_PAGE_DOWN 267
|
||||
#define mjKEY_HOME 268
|
||||
#define mjKEY_END 269
|
||||
#define mjKEY_F1 290
|
||||
#define mjKEY_F2 291
|
||||
#define mjKEY_F3 292
|
||||
#define mjKEY_F4 293
|
||||
#define mjKEY_F5 294
|
||||
#define mjKEY_F6 295
|
||||
#define mjKEY_F7 296
|
||||
#define mjKEY_F8 297
|
||||
#define mjKEY_F9 298
|
||||
#define mjKEY_F10 299
|
||||
#define mjKEY_F11 300
|
||||
#define mjKEY_F12 301
|
||||
#define mjKEY_NUMPAD_0 320
|
||||
#define mjKEY_NUMPAD_9 329
|
||||
|
||||
|
||||
//---------------------------------- primitive types (mjt) -----------------------------------------
|
||||
|
||||
typedef enum mjtButton_ { // mouse button
|
||||
mjBUTTON_NONE = 0, // no button
|
||||
mjBUTTON_LEFT, // left button
|
||||
mjBUTTON_RIGHT, // right button
|
||||
mjBUTTON_MIDDLE // middle button
|
||||
} mjtButton;
|
||||
|
||||
|
||||
typedef enum mjtEvent_ { // mouse and keyboard event type
|
||||
mjEVENT_NONE = 0, // no event
|
||||
mjEVENT_MOVE, // mouse move
|
||||
mjEVENT_PRESS, // mouse button press
|
||||
mjEVENT_RELEASE, // mouse button release
|
||||
mjEVENT_SCROLL, // scroll
|
||||
mjEVENT_KEY, // key press
|
||||
mjEVENT_RESIZE, // resize
|
||||
mjEVENT_REDRAW, // redraw
|
||||
mjEVENT_FILESDROP // files drop
|
||||
} mjtEvent;
|
||||
|
||||
|
||||
typedef enum mjtItem_ { // UI item type
|
||||
mjITEM_END = -2, // end of definition list (not an item)
|
||||
mjITEM_SECTION = -1, // section (not an item)
|
||||
mjITEM_SEPARATOR = 0, // separator
|
||||
mjITEM_STATIC, // static text
|
||||
mjITEM_BUTTON, // button
|
||||
|
||||
// the rest have data pointer
|
||||
mjITEM_CHECKINT, // check box, int value
|
||||
mjITEM_CHECKBYTE, // check box, mjtByte value
|
||||
mjITEM_RADIO, // radio group
|
||||
mjITEM_RADIOLINE, // radio group, single line
|
||||
mjITEM_SELECT, // selection box
|
||||
mjITEM_SLIDERINT, // slider, int value
|
||||
mjITEM_SLIDERNUM, // slider, mjtNum value
|
||||
mjITEM_EDITINT, // editable array, int values
|
||||
mjITEM_EDITNUM, // editable array, mjtNum values
|
||||
mjITEM_EDITFLOAT, // editable array, float values
|
||||
mjITEM_EDITTXT, // editable text
|
||||
|
||||
mjNITEM // number of item types
|
||||
} mjtItem;
|
||||
|
||||
|
||||
typedef enum mjtSection_ { // UI section state
|
||||
mjSECT_CLOSED = 0, // closed state (regular section)
|
||||
mjSECT_OPEN, // open state (regular section)
|
||||
mjSECT_FIXED // fixed section: always open, no title
|
||||
} mjtSection;
|
||||
|
||||
|
||||
// predicate function: set enable/disable based on item category
|
||||
typedef int (*mjfItemEnable)(int category, void* data);
|
||||
|
||||
|
||||
//---------------------------------- mjuiState -----------------------------------------------------
|
||||
|
||||
struct mjuiState_ { // mouse and keyboard state
|
||||
// constants set by user
|
||||
int nrect; // number of rectangles used
|
||||
mjrRect rect[mjMAXUIRECT]; // rectangles (index 0: entire window)
|
||||
void* userdata; // pointer to user data (for callbacks)
|
||||
|
||||
// event type
|
||||
int type; // (type mjtEvent)
|
||||
|
||||
// mouse buttons
|
||||
int left; // is left button down
|
||||
int right; // is right button down
|
||||
int middle; // is middle button down
|
||||
int doubleclick; // is last press a double click
|
||||
int button; // which button was pressed (mjtButton)
|
||||
double buttontime; // time of last button press
|
||||
|
||||
// mouse position
|
||||
double x; // x position
|
||||
double y; // y position
|
||||
double dx; // x displacement
|
||||
double dy; // y displacement
|
||||
double sx; // x scroll
|
||||
double sy; // y scroll
|
||||
|
||||
// keyboard
|
||||
int control; // is control down
|
||||
int shift; // is shift down
|
||||
int alt; // is alt down
|
||||
int key; // which key was pressed
|
||||
double keytime; // time of last key press
|
||||
|
||||
// rectangle ownership and dragging
|
||||
int mouserect; // which rectangle contains mouse
|
||||
int dragrect; // which rectangle is dragged with mouse
|
||||
int dragbutton; // which button started drag (mjtButton)
|
||||
|
||||
// files dropping (only valid when type == mjEVENT_FILESDROP)
|
||||
int dropcount; // number of files dropped
|
||||
const char** droppaths; // paths to files dropped
|
||||
};
|
||||
typedef struct mjuiState_ mjuiState;
|
||||
|
||||
|
||||
//---------------------------------- mjuiThemeSpacing ----------------------------------------------
|
||||
|
||||
struct mjuiThemeSpacing_ { // UI visualization theme spacing
|
||||
int total; // total width
|
||||
int scroll; // scrollbar width
|
||||
int label; // label width
|
||||
int section; // section gap
|
||||
int cornersect; // corner radius for section
|
||||
int cornersep; // corner radius for separator
|
||||
int itemside; // item side gap
|
||||
int itemmid; // item middle gap
|
||||
int itemver; // item vertical gap
|
||||
int texthor; // text horizontal gap
|
||||
int textver; // text vertical gap
|
||||
int linescroll; // number of pixels to scroll
|
||||
int samples; // number of multisamples
|
||||
};
|
||||
typedef struct mjuiThemeSpacing_ mjuiThemeSpacing;
|
||||
|
||||
|
||||
//---------------------------------- mjuiThemeColor ------------------------------------------------
|
||||
|
||||
struct mjuiThemeColor_ { // UI visualization theme color
|
||||
float master[3]; // master background
|
||||
float thumb[3]; // scrollbar thumb
|
||||
float secttitle[3]; // section title
|
||||
float secttitle2[3]; // section title: bottom color
|
||||
float secttitleuncheck[3]; // section title with unchecked box
|
||||
float secttitleuncheck2[3]; // section title with unchecked box: bottom color
|
||||
float secttitlecheck[3]; // section title with checked box
|
||||
float secttitlecheck2[3]; // section title with checked box: bottom color
|
||||
float sectfont[3]; // section font
|
||||
float sectsymbol[3]; // section symbol
|
||||
float sectpane[3]; // section pane
|
||||
float separator[3]; // separator title
|
||||
float separator2[3]; // separator title: bottom color
|
||||
float shortcut[3]; // shortcut background
|
||||
float fontactive[3]; // font active
|
||||
float fontinactive[3]; // font inactive
|
||||
float decorinactive[3]; // decor inactive
|
||||
float decorinactive2[3]; // inactive slider color 2
|
||||
float button[3]; // button
|
||||
float check[3]; // check
|
||||
float radio[3]; // radio
|
||||
float select[3]; // select
|
||||
float select2[3]; // select pane
|
||||
float slider[3]; // slider
|
||||
float slider2[3]; // slider color 2
|
||||
float edit[3]; // edit
|
||||
float edit2[3]; // edit invalid
|
||||
float cursor[3]; // edit cursor
|
||||
};
|
||||
typedef struct mjuiThemeColor_ mjuiThemeColor;
|
||||
|
||||
|
||||
//---------------------------------- mjuiItem ------------------------------------------------------
|
||||
|
||||
struct mjuiItemSingle_ { // check and button-related
|
||||
int modifier; // 0: none, 1: control, 2: shift; 4: alt
|
||||
int shortcut; // shortcut key; 0: undefined
|
||||
};
|
||||
|
||||
|
||||
struct mjuiItemMulti_ { // static, radio and select-related
|
||||
int nelem; // number of elements in group
|
||||
char name[mjMAXUIMULTI][mjMAXUINAME]; // element names
|
||||
};
|
||||
|
||||
|
||||
struct mjuiItemSlider_ { // slider-related
|
||||
double range[2]; // slider range
|
||||
double divisions; // number of range divisions
|
||||
};
|
||||
|
||||
|
||||
struct mjuiItemEdit_ { // edit-related
|
||||
int nelem; // number of elements in list
|
||||
double range[mjMAXUIEDIT][2]; // element range (min>=max: ignore)
|
||||
};
|
||||
|
||||
|
||||
struct mjuiItem_ { // UI item
|
||||
// common properties
|
||||
int type; // type (mjtItem)
|
||||
char name[mjMAXUINAME]; // name
|
||||
int state; // 0: disable, 1: enable, 2+: use predicate
|
||||
void *pdata; // data pointer (type-specific)
|
||||
int sectionid; // id of section containing item
|
||||
int itemid; // id of item within section
|
||||
int userid; // user-supplied id (for event handling)
|
||||
|
||||
// type-specific properties
|
||||
union {
|
||||
struct mjuiItemSingle_ single; // check and button
|
||||
struct mjuiItemMulti_ multi; // static, radio and select
|
||||
struct mjuiItemSlider_ slider; // slider
|
||||
struct mjuiItemEdit_ edit; // edit
|
||||
};
|
||||
|
||||
// internal
|
||||
mjrRect rect; // rectangle occupied by item
|
||||
int skip; // item skipped due to closed separator
|
||||
};
|
||||
typedef struct mjuiItem_ mjuiItem;
|
||||
|
||||
|
||||
//---------------------------------- mjuiSection ---------------------------------------------------
|
||||
|
||||
struct mjuiSection_ { // UI section
|
||||
// properties
|
||||
char name[mjMAXUINAME]; // name
|
||||
int state; // section state (mjtSection)
|
||||
int modifier; // 0: none, 1: control, 2: shift; 4: alt
|
||||
int shortcut; // shortcut key; 0: undefined
|
||||
int checkbox; // 0: none, 1: unchecked, 2: checked
|
||||
int nitem; // number of items in use
|
||||
mjuiItem item[mjMAXUIITEM]; // preallocated array of items
|
||||
|
||||
// internal
|
||||
mjrRect rtitle; // rectangle occupied by title
|
||||
mjrRect rcontent; // rectangle occupied by content
|
||||
int lastclick; // last mouse click over this section
|
||||
};
|
||||
typedef struct mjuiSection_ mjuiSection;
|
||||
|
||||
|
||||
//---------------------------------- mjUI ----------------------------------------------------------
|
||||
|
||||
struct mjUI_ { // entire UI
|
||||
// constants set by user
|
||||
mjuiThemeSpacing spacing; // UI theme spacing
|
||||
mjuiThemeColor color; // UI theme color
|
||||
mjfItemEnable predicate; // callback to set item state programmatically
|
||||
void* userdata; // pointer to user data (passed to predicate)
|
||||
int rectid; // index of this ui rectangle in mjuiState
|
||||
int auxid; // aux buffer index of this ui
|
||||
int radiocol; // number of radio columns (0 defaults to 2)
|
||||
|
||||
// UI sizes (framebuffer units)
|
||||
int width; // width
|
||||
int height; // current height
|
||||
int maxheight; // height when all sections open
|
||||
int scroll; // scroll from top of UI
|
||||
|
||||
// mouse focus and count
|
||||
int mousesect; // 0: none, -1: scroll, otherwise 1+section
|
||||
int mouseitem; // item within section
|
||||
int mousehelp; // help button down: print shortcuts
|
||||
int mouseclicks; // number of mouse clicks over UI
|
||||
int mousesectcheck; // 0: none, otherwise 1+section
|
||||
|
||||
// keyboard focus and edit
|
||||
int editsect; // 0: none, otherwise 1+section
|
||||
int edititem; // item within section
|
||||
int editcursor; // cursor position
|
||||
int editscroll; // horizontal scroll
|
||||
char edittext[mjMAXUITEXT]; // current text
|
||||
mjuiItem* editchanged; // pointer to changed edit in last mjui_event
|
||||
|
||||
// sections
|
||||
int nsect; // number of sections in use
|
||||
mjuiSection sect[mjMAXUISECT]; // preallocated array of sections
|
||||
};
|
||||
typedef struct mjUI_ mjUI;
|
||||
|
||||
|
||||
//---------------------------------- mjuiDef -------------------------------------------------------
|
||||
|
||||
struct mjuiDef_ { // table passed to mjui_add()
|
||||
int type; // type (mjtItem); -1: section
|
||||
char name[mjMAXUINAME]; // name
|
||||
int state; // state
|
||||
void* pdata; // pointer to data
|
||||
char other[mjMAXUITEXT]; // string with type-specific properties
|
||||
int otherint; // int with type-specific properties
|
||||
};
|
||||
typedef struct mjuiDef_ mjuiDef;
|
||||
|
||||
#endif // MUJOCO_MJUI_H_
|
||||
412
third_party/mujoco/3.3.7/include/mujoco/mjvisualize.h
vendored
Normal file
@ -0,0 +1,412 @@
|
||||
// Copyright 2021 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MUJOCO_MJVISUALIZE_H_
|
||||
#define MUJOCO_MJVISUALIZE_H_
|
||||
|
||||
#include <mujoco/mjdata.h>
|
||||
#include <mujoco/mjmodel.h>
|
||||
#include <mujoco/mjtnum.h>
|
||||
|
||||
|
||||
#define mjNGROUP 6 // number of geom, site, joint, skin groups with visflags
|
||||
#define mjMAXLIGHT 100 // maximum number of lights in a scene
|
||||
#define mjMAXOVERLAY 500 // maximum number of characters in overlay text
|
||||
#define mjMAXLINE 100 // maximum number of lines per plot
|
||||
#define mjMAXLINEPNT 1001 // maximum number points per line
|
||||
#define mjMAXPLANEGRID 200 // maximum number of grid divisions for plane
|
||||
|
||||
|
||||
//---------------------------------- primitive types (mjt) -----------------------------------------
|
||||
|
||||
typedef enum mjtCatBit_ { // bitflags for mjvGeom category
|
||||
mjCAT_STATIC = 1, // model elements in body 0
|
||||
mjCAT_DYNAMIC = 2, // model elements in all other bodies
|
||||
mjCAT_DECOR = 4, // decorative geoms
|
||||
mjCAT_ALL = 7 // select all categories
|
||||
} mjtCatBit;
|
||||
|
||||
|
||||
typedef enum mjtMouse_ { // mouse interaction mode
|
||||
mjMOUSE_NONE = 0, // no action
|
||||
mjMOUSE_ROTATE_V, // rotate, vertical plane
|
||||
mjMOUSE_ROTATE_H, // rotate, horizontal plane
|
||||
mjMOUSE_MOVE_V, // move, vertical plane
|
||||
mjMOUSE_MOVE_H, // move, horizontal plane
|
||||
mjMOUSE_ZOOM, // zoom
|
||||
mjMOUSE_MOVE_V_REL, // move, vertical plane, relative to target
|
||||
mjMOUSE_MOVE_H_REL, // move, horizontal plane, relative to target
|
||||
} mjtMouse;
|
||||
|
||||
|
||||
typedef enum mjtPertBit_ { // mouse perturbations
|
||||
mjPERT_TRANSLATE = 1, // translation
|
||||
mjPERT_ROTATE = 2 // rotation
|
||||
} mjtPertBit;
|
||||
|
||||
|
||||
typedef enum mjtCamera_ { // abstract camera type
|
||||
mjCAMERA_FREE = 0, // free camera
|
||||
mjCAMERA_TRACKING, // tracking camera; uses trackbodyid
|
||||
mjCAMERA_FIXED, // fixed camera; uses fixedcamid
|
||||
mjCAMERA_USER // user is responsible for setting OpenGL camera
|
||||
} mjtCamera;
|
||||
|
||||
|
||||
typedef enum mjtLabel_ { // object labeling
|
||||
mjLABEL_NONE = 0, // nothing
|
||||
mjLABEL_BODY, // body labels
|
||||
mjLABEL_JOINT, // joint labels
|
||||
mjLABEL_GEOM, // geom labels
|
||||
mjLABEL_SITE, // site labels
|
||||
mjLABEL_CAMERA, // camera labels
|
||||
mjLABEL_LIGHT, // light labels
|
||||
mjLABEL_TENDON, // tendon labels
|
||||
mjLABEL_ACTUATOR, // actuator labels
|
||||
mjLABEL_CONSTRAINT, // constraint labels
|
||||
mjLABEL_FLEX, // flex labels
|
||||
mjLABEL_SKIN, // skin labels
|
||||
mjLABEL_SELECTION, // selected object
|
||||
mjLABEL_SELPNT, // coordinates of selection point
|
||||
mjLABEL_CONTACTPOINT, // contact information
|
||||
mjLABEL_CONTACTFORCE, // magnitude of contact force
|
||||
mjLABEL_ISLAND, // id of island
|
||||
|
||||
mjNLABEL // number of label types
|
||||
} mjtLabel;
|
||||
|
||||
|
||||
typedef enum mjtFrame_ { // frame visualization
|
||||
mjFRAME_NONE = 0, // no frames
|
||||
mjFRAME_BODY, // body frames
|
||||
mjFRAME_GEOM, // geom frames
|
||||
mjFRAME_SITE, // site frames
|
||||
mjFRAME_CAMERA, // camera frames
|
||||
mjFRAME_LIGHT, // light frames
|
||||
mjFRAME_CONTACT, // contact frames
|
||||
mjFRAME_WORLD, // world frame
|
||||
|
||||
mjNFRAME // number of visualization frames
|
||||
} mjtFrame;
|
||||
|
||||
|
||||
typedef enum mjtVisFlag_ { // flags enabling model element visualization
|
||||
mjVIS_CONVEXHULL = 0, // mesh convex hull
|
||||
mjVIS_TEXTURE, // textures
|
||||
mjVIS_JOINT, // joints
|
||||
mjVIS_CAMERA, // cameras
|
||||
mjVIS_ACTUATOR, // actuators
|
||||
mjVIS_ACTIVATION, // activations
|
||||
mjVIS_LIGHT, // lights
|
||||
mjVIS_TENDON, // tendons
|
||||
mjVIS_RANGEFINDER, // rangefinder sensors
|
||||
mjVIS_CONSTRAINT, // point constraints
|
||||
mjVIS_INERTIA, // equivalent inertia boxes
|
||||
mjVIS_SCLINERTIA, // scale equivalent inertia boxes with mass
|
||||
mjVIS_PERTFORCE, // perturbation force
|
||||
mjVIS_PERTOBJ, // perturbation object
|
||||
mjVIS_CONTACTPOINT, // contact points
|
||||
mjVIS_ISLAND, // constraint islands
|
||||
mjVIS_CONTACTFORCE, // contact force
|
||||
mjVIS_CONTACTSPLIT, // split contact force into normal and tangent
|
||||
mjVIS_TRANSPARENT, // make dynamic geoms more transparent
|
||||
mjVIS_AUTOCONNECT, // auto connect joints and body coms
|
||||
mjVIS_COM, // center of mass
|
||||
mjVIS_SELECT, // selection point
|
||||
mjVIS_STATIC, // static bodies
|
||||
mjVIS_SKIN, // skin
|
||||
mjVIS_FLEXVERT, // flex vertices
|
||||
mjVIS_FLEXEDGE, // flex edges
|
||||
mjVIS_FLEXFACE, // flex element faces
|
||||
mjVIS_FLEXSKIN, // flex smooth skin (disables the rest)
|
||||
mjVIS_BODYBVH, // body bounding volume hierarchy
|
||||
mjVIS_MESHBVH, // mesh bounding volume hierarchy
|
||||
mjVIS_SDFITER, // iterations of SDF gradient descent
|
||||
|
||||
mjNVISFLAG // number of visualization flags
|
||||
} mjtVisFlag;
|
||||
|
||||
|
||||
typedef enum mjtRndFlag_ { // flags enabling rendering effects
|
||||
mjRND_SHADOW = 0, // shadows
|
||||
mjRND_WIREFRAME, // wireframe
|
||||
mjRND_REFLECTION, // reflections
|
||||
mjRND_ADDITIVE, // additive transparency
|
||||
mjRND_SKYBOX, // skybox
|
||||
mjRND_FOG, // fog
|
||||
mjRND_HAZE, // haze
|
||||
mjRND_SEGMENT, // segmentation with random color
|
||||
mjRND_IDCOLOR, // segmentation with segid+1 color
|
||||
mjRND_CULL_FACE, // cull backward faces
|
||||
|
||||
mjNRNDFLAG // number of rendering flags
|
||||
} mjtRndFlag;
|
||||
|
||||
|
||||
typedef enum mjtStereo_ { // type of stereo rendering
|
||||
mjSTEREO_NONE = 0, // no stereo; use left eye only
|
||||
mjSTEREO_QUADBUFFERED, // quad buffered; revert to side-by-side if no hardware support
|
||||
mjSTEREO_SIDEBYSIDE // side-by-side
|
||||
} mjtStereo;
|
||||
|
||||
|
||||
//---------------------------------- mjvPerturb ----------------------------------------------------
|
||||
|
||||
struct mjvPerturb_ { // object selection and perturbation
|
||||
int select; // selected body id; non-positive: none
|
||||
int flexselect; // selected flex id; negative: none
|
||||
int skinselect; // selected skin id; negative: none
|
||||
int active; // perturbation bitmask (mjtPertBit)
|
||||
int active2; // secondary perturbation bitmask (mjtPertBit)
|
||||
mjtNum refpos[3]; // reference position for selected object
|
||||
mjtNum refquat[4]; // reference orientation for selected object
|
||||
mjtNum refselpos[3]; // reference position for selection point
|
||||
mjtNum localpos[3]; // selection point in object coordinates
|
||||
mjtNum localmass; // spatial inertia at selection point
|
||||
mjtNum scale; // relative mouse motion-to-space scaling (set by initPerturb)
|
||||
};
|
||||
typedef struct mjvPerturb_ mjvPerturb;
|
||||
|
||||
|
||||
//---------------------------------- mjvCamera -----------------------------------------------------
|
||||
|
||||
struct mjvCamera_ { // abstract camera
|
||||
// type and ids
|
||||
int type; // camera type (mjtCamera)
|
||||
int fixedcamid; // fixed camera id
|
||||
int trackbodyid; // body id to track
|
||||
|
||||
// abstract camera pose specification
|
||||
mjtNum lookat[3]; // lookat point
|
||||
mjtNum distance; // distance to lookat point or tracked body
|
||||
mjtNum azimuth; // camera azimuth (deg)
|
||||
mjtNum elevation; // camera elevation (deg)
|
||||
|
||||
// orthographic / perspective
|
||||
int orthographic; // 0: perspective; 1: orthographic
|
||||
};
|
||||
typedef struct mjvCamera_ mjvCamera;
|
||||
|
||||
|
||||
//---------------------------------- mjvGLCamera ---------------------------------------------------
|
||||
|
||||
struct mjvGLCamera_ { // OpenGL camera
|
||||
// camera frame
|
||||
float pos[3]; // position
|
||||
float forward[3]; // forward direction
|
||||
float up[3]; // up direction
|
||||
|
||||
// camera projection
|
||||
float frustum_center; // hor. center (left,right set to match aspect)
|
||||
float frustum_width; // width (not used for rendering)
|
||||
float frustum_bottom; // bottom
|
||||
float frustum_top; // top
|
||||
float frustum_near; // near
|
||||
float frustum_far; // far
|
||||
|
||||
// orthographic / perspective
|
||||
int orthographic; // 0: perspective; 1: orthographic
|
||||
};
|
||||
typedef struct mjvGLCamera_ mjvGLCamera;
|
||||
|
||||
|
||||
//---------------------------------- mjvGeom -------------------------------------------------------
|
||||
|
||||
struct mjvGeom_ { // abstract geom
|
||||
// type info
|
||||
int type; // geom type (mjtGeom)
|
||||
int dataid; // mesh, hfield or plane id; -1: none; mesh: 2*id or 2*id+1 (hull)
|
||||
int objtype; // mujoco object type; mjOBJ_UNKNOWN for decor
|
||||
int objid; // mujoco object id; -1 for decor
|
||||
int category; // visual category
|
||||
int matid; // material id; -1: no textured material
|
||||
int texcoord; // mesh or flex geom has texture coordinates
|
||||
int segid; // segmentation id; -1: not shown
|
||||
|
||||
// spatial transform
|
||||
float size[3]; // size parameters
|
||||
float pos[3]; // Cartesian position
|
||||
float mat[9]; // Cartesian orientation
|
||||
|
||||
// material properties
|
||||
float rgba[4]; // color and transparency
|
||||
float emission; // emission coef
|
||||
float specular; // specular coef
|
||||
float shininess; // shininess coef
|
||||
float reflectance; // reflectance coef
|
||||
|
||||
char label[100]; // text label
|
||||
|
||||
// transparency rendering (set internally)
|
||||
float camdist; // distance to camera (used by sorter)
|
||||
float modelrbound; // geom rbound from model, 0 if not model geom
|
||||
mjtByte transparent; // treat geom as transparent
|
||||
};
|
||||
typedef struct mjvGeom_ mjvGeom;
|
||||
|
||||
|
||||
//---------------------------------- mjvLight ------------------------------------------------------
|
||||
|
||||
struct mjvLight_ { // OpenGL light
|
||||
int id; // light id, -1 for headlight
|
||||
float pos[3]; // position rel. to body frame
|
||||
float dir[3]; // direction rel. to body frame
|
||||
int type; // type (mjtLightType)
|
||||
int texid; // texture id for image lights
|
||||
float attenuation[3]; // OpenGL attenuation (quadratic model)
|
||||
float cutoff; // OpenGL cutoff
|
||||
float exponent; // OpenGL exponent
|
||||
float ambient[3]; // ambient rgb (alpha=1)
|
||||
float diffuse[3]; // diffuse rgb (alpha=1)
|
||||
float specular[3]; // specular rgb (alpha=1)
|
||||
mjtByte headlight; // headlight
|
||||
mjtByte castshadow; // does light cast shadows
|
||||
float bulbradius; // bulb radius for soft shadows
|
||||
float intensity; // intensity, in candelas
|
||||
float range; // range of effectiveness
|
||||
};
|
||||
typedef struct mjvLight_ mjvLight;
|
||||
|
||||
|
||||
//---------------------------------- mjvOption -----------------------------------------------------
|
||||
|
||||
struct mjvOption_ { // abstract visualization options
|
||||
int label; // what objects to label (mjtLabel)
|
||||
int frame; // which frame to show (mjtFrame)
|
||||
mjtByte geomgroup[mjNGROUP]; // geom visualization by group
|
||||
mjtByte sitegroup[mjNGROUP]; // site visualization by group
|
||||
mjtByte jointgroup[mjNGROUP]; // joint visualization by group
|
||||
mjtByte tendongroup[mjNGROUP]; // tendon visualization by group
|
||||
mjtByte actuatorgroup[mjNGROUP]; // actuator visualization by group
|
||||
mjtByte flexgroup[mjNGROUP]; // flex visualization by group
|
||||
mjtByte skingroup[mjNGROUP]; // skin visualization by group
|
||||
mjtByte flags[mjNVISFLAG]; // visualization flags (indexed by mjtVisFlag)
|
||||
int bvh_depth; // depth of the bounding volume hierarchy to be visualized
|
||||
int flex_layer; // element layer to be visualized for 3D flex
|
||||
};
|
||||
typedef struct mjvOption_ mjvOption;
|
||||
|
||||
|
||||
//---------------------------------- mjvScene ------------------------------------------------------
|
||||
|
||||
struct mjvScene_ { // abstract scene passed to OpenGL renderer
|
||||
// abstract geoms
|
||||
int maxgeom; // size of allocated geom buffer
|
||||
int ngeom; // number of geoms currently in buffer
|
||||
mjvGeom* geoms; // buffer for geoms (ngeom)
|
||||
int* geomorder; // buffer for ordering geoms by distance to camera (ngeom)
|
||||
|
||||
// flex data
|
||||
int nflex; // number of flexes
|
||||
int* flexedgeadr; // address of flex edges (nflex)
|
||||
int* flexedgenum; // number of edges in flex (nflex)
|
||||
int* flexvertadr; // address of flex vertices (nflex)
|
||||
int* flexvertnum; // number of vertices in flex (nflex)
|
||||
int* flexfaceadr; // address of flex faces (nflex)
|
||||
int* flexfacenum; // number of flex faces allocated (nflex)
|
||||
int* flexfaceused; // number of flex faces currently in use (nflex)
|
||||
int* flexedge; // flex edge data (2*nflexedge)
|
||||
float* flexvert; // flex vertices (3*nflexvert)
|
||||
float* flexface; // flex faces vertices (9*sum(flexfacenum))
|
||||
float* flexnormal; // flex face normals (9*sum(flexfacenum))
|
||||
float* flextexcoord; // flex face texture coordinates (6*sum(flexfacenum))
|
||||
mjtByte flexvertopt; // copy of mjVIS_FLEXVERT mjvOption flag
|
||||
mjtByte flexedgeopt; // copy of mjVIS_FLEXEDGE mjvOption flag
|
||||
mjtByte flexfaceopt; // copy of mjVIS_FLEXFACE mjvOption flag
|
||||
mjtByte flexskinopt; // copy of mjVIS_FLEXSKIN mjvOption flag
|
||||
|
||||
// skin data
|
||||
int nskin; // number of skins
|
||||
int* skinfacenum; // number of faces in skin (nskin)
|
||||
int* skinvertadr; // address of skin vertices (nskin)
|
||||
int* skinvertnum; // number of vertices in skin (nskin)
|
||||
float* skinvert; // skin vertex data (3*nskinvert)
|
||||
float* skinnormal; // skin normal data (3*nskinvert)
|
||||
|
||||
// OpenGL lights
|
||||
int nlight; // number of lights currently in buffer
|
||||
mjvLight lights[mjMAXLIGHT]; // buffer for lights (nlight)
|
||||
|
||||
// OpenGL cameras
|
||||
mjvGLCamera camera[2]; // left and right camera
|
||||
|
||||
// OpenGL model transformation
|
||||
mjtByte enabletransform; // enable model transformation
|
||||
float translate[3]; // model translation
|
||||
float rotate[4]; // model quaternion rotation
|
||||
float scale; // model scaling
|
||||
|
||||
// OpenGL rendering effects
|
||||
int stereo; // stereoscopic rendering (mjtStereo)
|
||||
mjtByte flags[mjNRNDFLAG]; // rendering flags (indexed by mjtRndFlag)
|
||||
|
||||
// framing
|
||||
int framewidth; // frame pixel width; 0: disable framing
|
||||
float framergb[3]; // frame color
|
||||
int status; // status; 0: ok, 1: geoms exhausted
|
||||
};
|
||||
typedef struct mjvScene_ mjvScene;
|
||||
|
||||
|
||||
//---------------------------------- mjvFigure -----------------------------------------------------
|
||||
|
||||
struct mjvFigure_ { // abstract 2D figure passed to OpenGL renderer
|
||||
// enable flags
|
||||
int flg_legend; // show legend
|
||||
int flg_ticklabel[2]; // show grid tick labels (x,y)
|
||||
int flg_extend; // automatically extend axis ranges to fit data
|
||||
int flg_barplot; // isolated line segments (i.e. GL_LINES)
|
||||
int flg_selection; // vertical selection line
|
||||
int flg_symmetric; // symmetric y-axis
|
||||
|
||||
// style settings
|
||||
float linewidth; // line width
|
||||
float gridwidth; // grid line width
|
||||
int gridsize[2]; // number of grid points in (x,y)
|
||||
float gridrgb[3]; // grid line rgb
|
||||
float figurergba[4]; // figure color and alpha
|
||||
float panergba[4]; // pane color and alpha
|
||||
float legendrgba[4]; // legend color and alpha
|
||||
float textrgb[3]; // text color
|
||||
float linergb[mjMAXLINE][3]; // line colors
|
||||
float range[2][2]; // axis ranges; (min>=max) automatic
|
||||
char xformat[20]; // x-tick label format for sprintf
|
||||
char yformat[20]; // y-tick label format for sprintf
|
||||
char minwidth[20]; // string used to determine min y-tick width
|
||||
|
||||
// text labels
|
||||
char title[1000]; // figure title; subplots separated with 2+ spaces
|
||||
char xlabel[100]; // x-axis label
|
||||
char linename[mjMAXLINE][100]; // line names for legend
|
||||
|
||||
// dynamic settings
|
||||
int legendoffset; // number of lines to offset legend
|
||||
int subplot; // selected subplot (for title rendering)
|
||||
int highlight[2]; // if point is in legend rect, highlight line
|
||||
int highlightid; // if id>=0 and no point, highlight id
|
||||
float selection; // selection line x-value
|
||||
|
||||
// line data
|
||||
int linepnt[mjMAXLINE]; // number of points in line; (0) disable
|
||||
float linedata[mjMAXLINE][2*mjMAXLINEPNT]; // line data (x,y)
|
||||
|
||||
// output from renderer
|
||||
int xaxispixel[2]; // range of x-axis in pixels
|
||||
int yaxispixel[2]; // range of y-axis in pixels
|
||||
float xaxisdata[2]; // range of x-axis in data units
|
||||
float yaxisdata[2]; // range of y-axis in data units
|
||||
};
|
||||
typedef struct mjvFigure_ mjvFigure;
|
||||
|
||||
#endif // MUJOCO_MJVISUALIZE_H_
|
||||
899
third_party/mujoco/3.3.7/include/mujoco/mjxmacro.h
vendored
Normal file
@ -0,0 +1,899 @@
|
||||
// Copyright 2021 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MUJOCO_MJXMACRO_H_
|
||||
#define MUJOCO_MJXMACRO_H_
|
||||
|
||||
|
||||
//-------------------------------- mjOption --------------------------------------------------------
|
||||
|
||||
// scalar fields of mjOption
|
||||
#define MJOPTION_FLOATS \
|
||||
X( mjtNum, timestep ) \
|
||||
X( mjtNum, impratio ) \
|
||||
X( mjtNum, tolerance ) \
|
||||
X( mjtNum, ls_tolerance ) \
|
||||
X( mjtNum, noslip_tolerance ) \
|
||||
X( mjtNum, ccd_tolerance ) \
|
||||
X( mjtNum, density ) \
|
||||
X( mjtNum, viscosity ) \
|
||||
X( mjtNum, o_margin )
|
||||
|
||||
|
||||
#define MJOPTION_INTS \
|
||||
X( int, integrator ) \
|
||||
X( int, cone ) \
|
||||
X( int, jacobian ) \
|
||||
X( int, solver ) \
|
||||
X( int, iterations ) \
|
||||
X( int, ls_iterations ) \
|
||||
X( int, noslip_iterations ) \
|
||||
X( int, ccd_iterations ) \
|
||||
X( int, disableflags ) \
|
||||
X( int, enableflags ) \
|
||||
X( int, disableactuator ) \
|
||||
X( int, sdf_initpoints ) \
|
||||
X( int, sdf_iterations )
|
||||
|
||||
|
||||
#define MJOPTION_SCALARS \
|
||||
MJOPTION_FLOATS \
|
||||
MJOPTION_INTS
|
||||
|
||||
|
||||
// vector fields of mjOption
|
||||
#define MJOPTION_VECTORS \
|
||||
X( gravity, 3 ) \
|
||||
X( wind, 3 ) \
|
||||
X( magnetic, 3 ) \
|
||||
X( o_solref, mjNREF ) \
|
||||
X( o_solimp, mjNIMP ) \
|
||||
X( o_friction, 5 )
|
||||
|
||||
|
||||
//-------------------------------- mjModel ---------------------------------------------------------
|
||||
|
||||
// int fields of mjModel
|
||||
#define MJMODEL_INTS \
|
||||
X( nq ) \
|
||||
X( nv ) \
|
||||
X( nu ) \
|
||||
X( na ) \
|
||||
X( nbody ) \
|
||||
X( nbvh ) \
|
||||
X( nbvhstatic ) \
|
||||
X( nbvhdynamic ) \
|
||||
X( noct ) \
|
||||
X( njnt ) \
|
||||
X( ntree ) \
|
||||
X( nM ) \
|
||||
X( nB ) \
|
||||
X( nC ) \
|
||||
X( nD ) \
|
||||
X( ngeom ) \
|
||||
X( nsite ) \
|
||||
X( ncam ) \
|
||||
X( nlight ) \
|
||||
X( nflex ) \
|
||||
X( nflexnode ) \
|
||||
X( nflexvert ) \
|
||||
X( nflexedge ) \
|
||||
X( nflexelem ) \
|
||||
X( nflexelemdata ) \
|
||||
X( nflexelemedge ) \
|
||||
X( nflexshelldata ) \
|
||||
X( nflexevpair ) \
|
||||
X( nflextexcoord ) \
|
||||
X( nmesh ) \
|
||||
X( nmeshvert ) \
|
||||
X( nmeshnormal ) \
|
||||
X( nmeshtexcoord ) \
|
||||
X( nmeshface ) \
|
||||
X( nmeshgraph ) \
|
||||
X( nmeshpoly ) \
|
||||
X( nmeshpolyvert ) \
|
||||
X( nmeshpolymap ) \
|
||||
X( nskin ) \
|
||||
X( nskinvert ) \
|
||||
X( nskintexvert ) \
|
||||
X( nskinface ) \
|
||||
X( nskinbone ) \
|
||||
X( nskinbonevert ) \
|
||||
X( nhfield ) \
|
||||
X( nhfielddata ) \
|
||||
X( ntex ) \
|
||||
X( ntexdata ) \
|
||||
X( nmat ) \
|
||||
X( npair ) \
|
||||
X( nexclude ) \
|
||||
X( neq ) \
|
||||
X( ntendon ) \
|
||||
X( nwrap ) \
|
||||
X( nsensor ) \
|
||||
X( nnumeric ) \
|
||||
X( nnumericdata ) \
|
||||
X( ntext ) \
|
||||
X( ntextdata ) \
|
||||
X( ntuple ) \
|
||||
X( ntupledata ) \
|
||||
X( nkey ) \
|
||||
X( nmocap ) \
|
||||
X( nplugin ) \
|
||||
X( npluginattr ) \
|
||||
X( nuser_body ) \
|
||||
X( nuser_jnt ) \
|
||||
X( nuser_geom ) \
|
||||
X( nuser_site ) \
|
||||
X( nuser_cam ) \
|
||||
X( nuser_tendon ) \
|
||||
X( nuser_actuator ) \
|
||||
X( nuser_sensor ) \
|
||||
X( nnames ) \
|
||||
X( npaths ) \
|
||||
X( nnames_map ) \
|
||||
X( nJmom ) \
|
||||
X( ngravcomp ) \
|
||||
X( nemax ) \
|
||||
X( njmax ) \
|
||||
X( nconmax ) \
|
||||
X( nuserdata ) \
|
||||
X( nsensordata ) \
|
||||
X( npluginstate ) \
|
||||
X( narena ) \
|
||||
X( nbuffer )
|
||||
|
||||
/* nbuffer needs to be the final field */
|
||||
|
||||
|
||||
// define symbols needed in MJMODEL_POINTERS (corresponding to number of columns)
|
||||
#define MJMODEL_POINTERS_PREAMBLE( m ) \
|
||||
int nuser_body = m->nuser_body; \
|
||||
int nuser_jnt = m->nuser_jnt; \
|
||||
int nuser_geom = m->nuser_geom; \
|
||||
int nuser_site = m->nuser_site; \
|
||||
int nuser_cam = m->nuser_cam; \
|
||||
int nuser_tendon = m->nuser_tendon; \
|
||||
int nuser_actuator = m->nuser_actuator; \
|
||||
int nuser_sensor = m->nuser_sensor; \
|
||||
int nq = m->nq; \
|
||||
int nv = m->nv; \
|
||||
int na = m->na; \
|
||||
int nu = m->nu; \
|
||||
int nmocap = m->nmocap;
|
||||
|
||||
// macro for annotating that an array size in an X macro is a member of mjModel
|
||||
// by default this macro does nothing, but users can redefine it as necessary
|
||||
#define MJ_M(n) n
|
||||
|
||||
|
||||
// pointer fields of mjModel
|
||||
// XNV means that the field is not required to construct mjvScene
|
||||
// (by default we define XNV to be the same as X)
|
||||
#define MJMODEL_POINTERS_BODY \
|
||||
X ( int, body_parentid, nbody, 1 ) \
|
||||
X ( int, body_rootid, nbody, 1 ) \
|
||||
X ( int, body_weldid, nbody, 1 ) \
|
||||
X ( int, body_mocapid, nbody, 1 ) \
|
||||
X ( int, body_jntnum, nbody, 1 ) \
|
||||
X ( int, body_jntadr, nbody, 1 ) \
|
||||
X ( int, body_dofnum, nbody, 1 ) \
|
||||
X ( int, body_dofadr, nbody, 1 ) \
|
||||
X ( int, body_treeid, nbody, 1 ) \
|
||||
X ( int, body_geomnum, nbody, 1 ) \
|
||||
X ( int, body_geomadr, nbody, 1 ) \
|
||||
X ( mjtByte, body_simple, nbody, 1 ) \
|
||||
X ( mjtByte, body_sameframe, nbody, 1 ) \
|
||||
X ( mjtNum, body_pos, nbody, 3 ) \
|
||||
X ( mjtNum, body_quat, nbody, 4 ) \
|
||||
X ( mjtNum, body_ipos, nbody, 3 ) \
|
||||
X ( mjtNum, body_iquat, nbody, 4 ) \
|
||||
X ( mjtNum, body_mass, nbody, 1 ) \
|
||||
X ( mjtNum, body_subtreemass, nbody, 1 ) \
|
||||
X ( mjtNum, body_inertia, nbody, 3 ) \
|
||||
X ( mjtNum, body_invweight0, nbody, 2 ) \
|
||||
X ( mjtNum, body_gravcomp, nbody, 1 ) \
|
||||
X ( mjtNum, body_margin, nbody, 1 ) \
|
||||
X ( mjtNum, body_user, nbody, MJ_M(nuser_body) ) \
|
||||
X ( int, body_plugin, nbody, 1 ) \
|
||||
X ( int, body_contype, nbody, 1 ) \
|
||||
X ( int, body_conaffinity, nbody, 1 ) \
|
||||
X ( int, body_bvhadr, nbody, 1 ) \
|
||||
X ( int, body_bvhnum, nbody, 1 )
|
||||
|
||||
#define MJMODEL_POINTERS_JOINT \
|
||||
X ( int, jnt_type, njnt, 1 ) \
|
||||
X ( int, jnt_qposadr, njnt, 1 ) \
|
||||
X ( int, jnt_dofadr, njnt, 1 ) \
|
||||
X ( int, jnt_bodyid, njnt, 1 ) \
|
||||
X ( int, jnt_group, njnt, 1 ) \
|
||||
X ( mjtByte, jnt_limited, njnt, 1 ) \
|
||||
X ( mjtByte, jnt_actfrclimited, njnt, 1 ) \
|
||||
X ( mjtByte, jnt_actgravcomp, njnt, 1 ) \
|
||||
X ( mjtNum, jnt_solref, njnt, mjNREF ) \
|
||||
X ( mjtNum, jnt_solimp, njnt, mjNIMP ) \
|
||||
X ( mjtNum, jnt_pos, njnt, 3 ) \
|
||||
X ( mjtNum, jnt_axis, njnt, 3 ) \
|
||||
X ( mjtNum, jnt_stiffness, njnt, 1 ) \
|
||||
X ( mjtNum, jnt_range, njnt, 2 ) \
|
||||
X ( mjtNum, jnt_actfrcrange, njnt, 2 ) \
|
||||
X ( mjtNum, jnt_margin, njnt, 1 ) \
|
||||
X ( mjtNum, jnt_user, njnt, MJ_M(nuser_jnt) )
|
||||
|
||||
#define MJMODEL_POINTERS_DOF \
|
||||
X ( int, dof_bodyid, nv, 1 ) \
|
||||
X ( int, dof_jntid, nv, 1 ) \
|
||||
X ( int, dof_parentid, nv, 1 ) \
|
||||
X ( int, dof_treeid, nv, 1 ) \
|
||||
X ( int, dof_Madr, nv, 1 ) \
|
||||
X ( int, dof_simplenum, nv, 1 ) \
|
||||
X ( mjtNum, dof_solref, nv, mjNREF ) \
|
||||
X ( mjtNum, dof_solimp, nv, mjNIMP ) \
|
||||
X ( mjtNum, dof_frictionloss, nv, 1 ) \
|
||||
X ( mjtNum, dof_armature, nv, 1 ) \
|
||||
X ( mjtNum, dof_damping, nv, 1 ) \
|
||||
X ( mjtNum, dof_invweight0, nv, 1 ) \
|
||||
X ( mjtNum, dof_M0, nv, 1 )
|
||||
|
||||
#define MJMODEL_POINTERS_GEOM \
|
||||
X ( int, geom_type, ngeom, 1 ) \
|
||||
X ( int, geom_contype, ngeom, 1 ) \
|
||||
X ( int, geom_conaffinity, ngeom, 1 ) \
|
||||
X ( int, geom_condim, ngeom, 1 ) \
|
||||
X ( int, geom_bodyid, ngeom, 1 ) \
|
||||
X ( int, geom_dataid, ngeom, 1 ) \
|
||||
X ( int, geom_matid, ngeom, 1 ) \
|
||||
X ( int, geom_group, ngeom, 1 ) \
|
||||
X ( int, geom_priority, ngeom, 1 ) \
|
||||
X ( int, geom_plugin, ngeom, 1 ) \
|
||||
X ( mjtByte, geom_sameframe, ngeom, 1 ) \
|
||||
X ( mjtNum, geom_solmix, ngeom, 1 ) \
|
||||
X ( mjtNum, geom_solref, ngeom, mjNREF ) \
|
||||
X ( mjtNum, geom_solimp, ngeom, mjNIMP ) \
|
||||
X ( mjtNum, geom_size, ngeom, 3 ) \
|
||||
X ( mjtNum, geom_aabb, ngeom, 6 ) \
|
||||
X ( mjtNum, geom_rbound, ngeom, 1 ) \
|
||||
X ( mjtNum, geom_pos, ngeom, 3 ) \
|
||||
X ( mjtNum, geom_quat, ngeom, 4 ) \
|
||||
X ( mjtNum, geom_friction, ngeom, 3 ) \
|
||||
X ( mjtNum, geom_margin, ngeom, 1 ) \
|
||||
X ( mjtNum, geom_gap, ngeom, 1 ) \
|
||||
XNV ( mjtNum, geom_fluid, ngeom, mjNFLUID ) \
|
||||
X ( mjtNum, geom_user, ngeom, MJ_M(nuser_geom) ) \
|
||||
X ( float, geom_rgba, ngeom, 4 )
|
||||
|
||||
#define MJMODEL_POINTERS_SITE \
|
||||
X ( int, site_type, nsite, 1 ) \
|
||||
X ( int, site_bodyid, nsite, 1 ) \
|
||||
X ( int, site_matid, nsite, 1 ) \
|
||||
X ( int, site_group, nsite, 1 ) \
|
||||
X ( mjtByte, site_sameframe, nsite, 1 ) \
|
||||
X ( mjtNum, site_size, nsite, 3 ) \
|
||||
X ( mjtNum, site_pos, nsite, 3 ) \
|
||||
X ( mjtNum, site_quat, nsite, 4 ) \
|
||||
X ( mjtNum, site_user, nsite, MJ_M(nuser_site) ) \
|
||||
X ( float, site_rgba, nsite, 4 )
|
||||
|
||||
#define MJMODEL_POINTERS_CAMERA \
|
||||
X ( int, cam_mode, ncam, 1 ) \
|
||||
X ( int, cam_bodyid, ncam, 1 ) \
|
||||
X ( int, cam_targetbodyid, ncam, 1 ) \
|
||||
X ( mjtNum, cam_pos, ncam, 3 ) \
|
||||
X ( mjtNum, cam_quat, ncam, 4 ) \
|
||||
X ( mjtNum, cam_poscom0, ncam, 3 ) \
|
||||
X ( mjtNum, cam_pos0, ncam, 3 ) \
|
||||
X ( mjtNum, cam_mat0, ncam, 9 ) \
|
||||
X ( int, cam_orthographic, ncam, 1 ) \
|
||||
X ( mjtNum, cam_fovy, ncam, 1 ) \
|
||||
X ( mjtNum, cam_ipd, ncam, 1 ) \
|
||||
X ( int, cam_resolution, ncam, 2 ) \
|
||||
X ( float, cam_sensorsize, ncam, 2 ) \
|
||||
X ( float, cam_intrinsic, ncam, 4 ) \
|
||||
X ( mjtNum, cam_user, ncam, MJ_M(nuser_cam) )
|
||||
|
||||
#define MJMODEL_POINTERS_LIGHT \
|
||||
X ( int, light_mode, nlight, 1 ) \
|
||||
X ( int, light_bodyid, nlight, 1 ) \
|
||||
X ( int, light_targetbodyid, nlight, 1 ) \
|
||||
X ( int, light_type, nlight, 1 ) \
|
||||
X ( int, light_texid, nlight, 1 ) \
|
||||
X ( mjtByte, light_castshadow, nlight, 1 ) \
|
||||
X ( float, light_bulbradius, nlight, 1 ) \
|
||||
X ( float, light_intensity, nlight, 1 ) \
|
||||
X ( float, light_range, nlight, 1 ) \
|
||||
X ( mjtByte, light_active, nlight, 1 ) \
|
||||
X ( mjtNum, light_pos, nlight, 3 ) \
|
||||
X ( mjtNum, light_dir, nlight, 3 ) \
|
||||
X ( mjtNum, light_poscom0, nlight, 3 ) \
|
||||
X ( mjtNum, light_pos0, nlight, 3 ) \
|
||||
X ( mjtNum, light_dir0, nlight, 3 ) \
|
||||
X ( float, light_attenuation, nlight, 3 ) \
|
||||
X ( float, light_cutoff, nlight, 1 ) \
|
||||
X ( float, light_exponent, nlight, 1 ) \
|
||||
X ( float, light_ambient, nlight, 3 ) \
|
||||
X ( float, light_diffuse, nlight, 3 ) \
|
||||
X ( float, light_specular, nlight, 3 )
|
||||
|
||||
#define MJMODEL_POINTERS_FLEX \
|
||||
X ( int, flex_contype, nflex, 1 ) \
|
||||
X ( int, flex_conaffinity, nflex, 1 ) \
|
||||
X ( int, flex_condim, nflex, 1 ) \
|
||||
X ( int, flex_priority, nflex, 1 ) \
|
||||
X ( mjtNum, flex_solmix, nflex, 1 ) \
|
||||
X ( mjtNum, flex_solref, nflex, mjNREF ) \
|
||||
X ( mjtNum, flex_solimp, nflex, mjNIMP ) \
|
||||
X ( mjtNum, flex_friction, nflex, 3 ) \
|
||||
X ( mjtNum, flex_margin, nflex, 1 ) \
|
||||
X ( mjtNum, flex_gap, nflex, 1 ) \
|
||||
X ( mjtByte, flex_internal, nflex, 1 ) \
|
||||
X ( int, flex_selfcollide, nflex, 1 ) \
|
||||
X ( int, flex_activelayers, nflex, 1 ) \
|
||||
X ( int, flex_passive, nflex, 1 ) \
|
||||
X ( int, flex_dim, nflex, 1 ) \
|
||||
X ( int, flex_matid, nflex, 1 ) \
|
||||
X ( int, flex_group, nflex, 1 ) \
|
||||
X ( int, flex_interp, nflex, 1 ) \
|
||||
X ( int, flex_nodeadr, nflex, 1 ) \
|
||||
X ( int, flex_nodenum, nflex, 1 ) \
|
||||
X ( int, flex_vertadr, nflex, 1 ) \
|
||||
X ( int, flex_vertnum, nflex, 1 ) \
|
||||
X ( int, flex_edgeadr, nflex, 1 ) \
|
||||
X ( int, flex_edgenum, nflex, 1 ) \
|
||||
X ( int, flex_elemadr, nflex, 1 ) \
|
||||
X ( int, flex_elemnum, nflex, 1 ) \
|
||||
X ( int, flex_elemdataadr, nflex, 1 ) \
|
||||
X ( int, flex_elemedgeadr, nflex, 1 ) \
|
||||
X ( int, flex_shellnum, nflex, 1 ) \
|
||||
X ( int, flex_shelldataadr, nflex, 1 ) \
|
||||
X ( int, flex_evpairadr, nflex, 1 ) \
|
||||
X ( int, flex_evpairnum, nflex, 1 ) \
|
||||
X ( int, flex_texcoordadr, nflex, 1 ) \
|
||||
X ( int, flex_nodebodyid, nflexnode, 1 ) \
|
||||
X ( int, flex_vertbodyid, nflexvert, 1 ) \
|
||||
X ( int, flex_edge, nflexedge, 2 ) \
|
||||
X ( int, flex_edgeflap, nflexedge, 2 ) \
|
||||
X ( int, flex_elem, nflexelemdata, 1 ) \
|
||||
X ( int, flex_elemtexcoord, nflexelemdata, 1 ) \
|
||||
X ( int, flex_elemedge, nflexelemedge, 1 ) \
|
||||
X ( int, flex_elemlayer, nflexelem, 1 ) \
|
||||
X ( int, flex_shell, nflexshelldata,1 ) \
|
||||
X ( int, flex_evpair, nflexevpair, 2 ) \
|
||||
X ( mjtNum, flex_vert, nflexvert, 3 ) \
|
||||
X ( mjtNum, flex_vert0, nflexvert, 3 ) \
|
||||
X ( mjtNum, flex_node, nflexnode, 3 ) \
|
||||
X ( mjtNum, flex_node0, nflexnode, 3 ) \
|
||||
X ( mjtNum, flexedge_length0, nflexedge, 1 ) \
|
||||
X ( mjtNum, flexedge_invweight0, nflexedge, 1 ) \
|
||||
X ( mjtNum, flex_radius, nflex, 1 ) \
|
||||
X ( mjtNum, flex_stiffness, nflexelem, 21 ) \
|
||||
X ( mjtNum, flex_bending, nflexedge, 17 ) \
|
||||
X ( mjtNum, flex_damping, nflex, 1 ) \
|
||||
X ( mjtNum, flex_edgestiffness, nflex, 1 ) \
|
||||
X ( mjtNum, flex_edgedamping, nflex, 1 ) \
|
||||
X ( mjtByte, flex_edgeequality, nflex, 1 ) \
|
||||
X ( mjtByte, flex_rigid, nflex, 1 ) \
|
||||
X ( mjtByte, flexedge_rigid, nflexedge, 1 ) \
|
||||
X ( mjtByte, flex_centered, nflex, 1 ) \
|
||||
X ( mjtByte, flex_flatskin, nflex, 1 ) \
|
||||
X ( int, flex_bvhadr, nflex, 1 ) \
|
||||
X ( int, flex_bvhnum, nflex, 1 ) \
|
||||
X ( float, flex_rgba, nflex, 4 ) \
|
||||
X ( float, flex_texcoord, nflextexcoord, 2 )
|
||||
|
||||
#define MJMODEL_POINTERS_MESH \
|
||||
X ( int, mesh_vertadr, nmesh, 1 ) \
|
||||
X ( int, mesh_vertnum, nmesh, 1 ) \
|
||||
X ( int, mesh_faceadr, nmesh, 1 ) \
|
||||
X ( int, mesh_facenum, nmesh, 1 ) \
|
||||
X ( int, mesh_bvhadr, nmesh, 1 ) \
|
||||
X ( int, mesh_bvhnum, nmesh, 1 ) \
|
||||
X ( int, mesh_octadr, nmesh, 1 ) \
|
||||
X ( int, mesh_octnum, nmesh, 1 ) \
|
||||
X ( int, mesh_normaladr, nmesh, 1 ) \
|
||||
X ( int, mesh_normalnum, nmesh, 1 ) \
|
||||
X ( int, mesh_texcoordadr, nmesh, 1 ) \
|
||||
X ( int, mesh_texcoordnum, nmesh, 1 ) \
|
||||
X ( int, mesh_graphadr, nmesh, 1 ) \
|
||||
XNV ( float, mesh_vert, nmeshvert, 3 ) \
|
||||
XNV ( float, mesh_normal, nmeshnormal, 3 ) \
|
||||
XNV ( float, mesh_texcoord, nmeshtexcoord, 2 ) \
|
||||
XNV ( int, mesh_face, nmeshface, 3 ) \
|
||||
XNV ( int, mesh_facenormal, nmeshface, 3 ) \
|
||||
XNV ( int, mesh_facetexcoord, nmeshface, 3 ) \
|
||||
XNV ( int, mesh_graph, nmeshgraph, 1 ) \
|
||||
X ( mjtNum, mesh_scale, nmesh, 3 ) \
|
||||
X ( mjtNum, mesh_pos, nmesh, 3 ) \
|
||||
X ( mjtNum, mesh_quat, nmesh, 4 ) \
|
||||
X ( int, mesh_pathadr, nmesh, 1 ) \
|
||||
XNV ( int, mesh_polynum, nmesh, 1 ) \
|
||||
XNV ( int, mesh_polyadr, nmesh, 1 ) \
|
||||
XNV ( mjtNum, mesh_polynormal, nmeshpoly, 3 ) \
|
||||
XNV ( int, mesh_polyvertadr, nmeshpoly, 1 ) \
|
||||
XNV ( int, mesh_polyvertnum, nmeshpoly, 1 ) \
|
||||
XNV ( int, mesh_polyvert, nmeshpolyvert, 1 ) \
|
||||
XNV ( int, mesh_polymapadr, nmeshvert, 1 ) \
|
||||
XNV ( int, mesh_polymapnum, nmeshvert, 1 ) \
|
||||
XNV ( int, mesh_polymap, nmeshpolymap, 1 )
|
||||
|
||||
#define MJMODEL_POINTERS_SKIN \
|
||||
X ( int, skin_matid, nskin, 1 ) \
|
||||
X ( int, skin_group, nskin, 1 ) \
|
||||
X ( float, skin_rgba, nskin, 4 ) \
|
||||
X ( float, skin_inflate, nskin, 1 ) \
|
||||
X ( int, skin_vertadr, nskin, 1 ) \
|
||||
X ( int, skin_vertnum, nskin, 1 ) \
|
||||
X ( int, skin_texcoordadr, nskin, 1 ) \
|
||||
X ( int, skin_faceadr, nskin, 1 ) \
|
||||
X ( int, skin_facenum, nskin, 1 ) \
|
||||
X ( int, skin_boneadr, nskin, 1 ) \
|
||||
X ( int, skin_bonenum, nskin, 1 ) \
|
||||
X ( float, skin_vert, nskinvert, 3 ) \
|
||||
X ( float, skin_texcoord, nskintexvert, 2 ) \
|
||||
X ( int, skin_face, nskinface, 3 ) \
|
||||
X ( int, skin_bonevertadr, nskinbone, 1 ) \
|
||||
X ( int, skin_bonevertnum, nskinbone, 1 ) \
|
||||
X ( float, skin_bonebindpos, nskinbone, 3 ) \
|
||||
X ( float, skin_bonebindquat, nskinbone, 4 ) \
|
||||
X ( int, skin_bonebodyid, nskinbone, 1 ) \
|
||||
X ( int, skin_bonevertid, nskinbonevert, 1 ) \
|
||||
X ( float, skin_bonevertweight, nskinbonevert, 1 ) \
|
||||
X ( int, skin_pathadr, nskin, 1 )
|
||||
|
||||
#define MJMODEL_POINTERS_HFIELD \
|
||||
X ( mjtNum, hfield_size, nhfield, 4 ) \
|
||||
X ( int, hfield_nrow, nhfield, 1 ) \
|
||||
X ( int, hfield_ncol, nhfield, 1 ) \
|
||||
X ( int, hfield_adr, nhfield, 1 ) \
|
||||
XNV ( float, hfield_data, nhfielddata, 1 ) \
|
||||
X ( int, hfield_pathadr, nhfield, 1 )
|
||||
|
||||
#define MJMODEL_POINTERS_TEXTURE \
|
||||
X ( int, tex_type, ntex, 1 ) \
|
||||
X ( int, tex_colorspace, ntex, 1 ) \
|
||||
X ( int, tex_height, ntex, 1 ) \
|
||||
X ( int, tex_width, ntex, 1 ) \
|
||||
X ( int, tex_nchannel, ntex, 1 ) \
|
||||
X ( int, tex_adr, ntex, 1 ) \
|
||||
XNV ( mjtByte, tex_data, ntexdata, 1 ) \
|
||||
X ( int, tex_pathadr, ntex, 1 )
|
||||
|
||||
#define MJMODEL_POINTERS_MATERIAL \
|
||||
X ( int, mat_texid, nmat, mjNTEXROLE ) \
|
||||
X ( mjtByte, mat_texuniform, nmat, 1 ) \
|
||||
X ( float, mat_texrepeat, nmat, 2 ) \
|
||||
X ( float, mat_emission, nmat, 1 ) \
|
||||
X ( float, mat_specular, nmat, 1 ) \
|
||||
X ( float, mat_shininess, nmat, 1 ) \
|
||||
X ( float, mat_reflectance, nmat, 1 ) \
|
||||
X ( float, mat_metallic, nmat, 1 ) \
|
||||
X ( float, mat_roughness, nmat, 1 ) \
|
||||
X ( float, mat_rgba, nmat, 4 )
|
||||
|
||||
#define MJMODEL_POINTERS_PAIR \
|
||||
X ( int, pair_dim, npair, 1 ) \
|
||||
X ( int, pair_geom1, npair, 1 ) \
|
||||
X ( int, pair_geom2, npair, 1 ) \
|
||||
X ( int, pair_signature, npair, 1 ) \
|
||||
X ( mjtNum, pair_solref, npair, mjNREF ) \
|
||||
X ( mjtNum, pair_solreffriction, npair, mjNREF ) \
|
||||
X ( mjtNum, pair_solimp, npair, mjNIMP ) \
|
||||
X ( mjtNum, pair_margin, npair, 1 ) \
|
||||
X ( mjtNum, pair_gap, npair, 1 ) \
|
||||
X ( mjtNum, pair_friction, npair, 5 )
|
||||
|
||||
#define MJMODEL_POINTERS_EXCLUDE \
|
||||
X ( int, exclude_signature, nexclude, 1 )
|
||||
|
||||
#define MJMODEL_POINTERS_EQUALITY \
|
||||
X ( int, eq_type, neq, 1 ) \
|
||||
X ( int, eq_obj1id, neq, 1 ) \
|
||||
X ( int, eq_obj2id, neq, 1 ) \
|
||||
X ( int, eq_objtype, neq, 1 ) \
|
||||
X ( mjtByte, eq_active0, neq, 1 ) \
|
||||
X ( mjtNum, eq_solref, neq, mjNREF ) \
|
||||
X ( mjtNum, eq_solimp, neq, mjNIMP ) \
|
||||
X ( mjtNum, eq_data, neq, mjNEQDATA )
|
||||
|
||||
#define MJMODEL_POINTERS_TENDON \
|
||||
X ( int, tendon_adr, ntendon, 1 ) \
|
||||
X ( int, tendon_num, ntendon, 1 ) \
|
||||
X ( int, tendon_matid, ntendon, 1 ) \
|
||||
X ( int, tendon_group, ntendon, 1 ) \
|
||||
X ( mjtByte, tendon_limited, ntendon, 1 ) \
|
||||
X ( mjtByte, tendon_actfrclimited, ntendon, 1 ) \
|
||||
X ( mjtNum, tendon_width, ntendon, 1 ) \
|
||||
X ( mjtNum, tendon_solref_lim, ntendon, mjNREF ) \
|
||||
X ( mjtNum, tendon_solimp_lim, ntendon, mjNIMP ) \
|
||||
X ( mjtNum, tendon_solref_fri, ntendon, mjNREF ) \
|
||||
X ( mjtNum, tendon_solimp_fri, ntendon, mjNIMP ) \
|
||||
X ( mjtNum, tendon_range, ntendon, 2 ) \
|
||||
X ( mjtNum, tendon_actfrcrange, ntendon, 2 ) \
|
||||
X ( mjtNum, tendon_margin, ntendon, 1 ) \
|
||||
X ( mjtNum, tendon_stiffness, ntendon, 1 ) \
|
||||
X ( mjtNum, tendon_damping, ntendon, 1 ) \
|
||||
X ( mjtNum, tendon_armature, ntendon, 1 ) \
|
||||
X ( mjtNum, tendon_frictionloss, ntendon, 1 ) \
|
||||
X ( mjtNum, tendon_lengthspring, ntendon, 2 ) \
|
||||
X ( mjtNum, tendon_length0, ntendon, 1 ) \
|
||||
X ( mjtNum, tendon_invweight0, ntendon, 1 ) \
|
||||
X ( mjtNum, tendon_user, ntendon, MJ_M(nuser_tendon) ) \
|
||||
X ( float, tendon_rgba, ntendon, 4 )
|
||||
|
||||
#define MJMODEL_POINTERS_ACTUATOR \
|
||||
X ( int, actuator_trntype, nu, 1 ) \
|
||||
X ( int, actuator_dyntype, nu, 1 ) \
|
||||
X ( int, actuator_gaintype, nu, 1 ) \
|
||||
X ( int, actuator_biastype, nu, 1 ) \
|
||||
X ( int, actuator_trnid, nu, 2 ) \
|
||||
X ( int, actuator_actadr, nu, 1 ) \
|
||||
X ( int, actuator_actnum, nu, 1 ) \
|
||||
X ( int, actuator_group, nu, 1 ) \
|
||||
X ( mjtByte, actuator_ctrllimited, nu, 1 ) \
|
||||
X ( mjtByte, actuator_forcelimited, nu, 1 ) \
|
||||
X ( mjtByte, actuator_actlimited, nu, 1 ) \
|
||||
X ( mjtNum, actuator_dynprm, nu, mjNDYN ) \
|
||||
X ( mjtNum, actuator_gainprm, nu, mjNGAIN ) \
|
||||
X ( mjtNum, actuator_biasprm, nu, mjNBIAS ) \
|
||||
X ( mjtByte, actuator_actearly, nu, 1 ) \
|
||||
X ( mjtNum, actuator_ctrlrange, nu, 2 ) \
|
||||
X ( mjtNum, actuator_forcerange, nu, 2 ) \
|
||||
X ( mjtNum, actuator_actrange, nu, 2 ) \
|
||||
X ( mjtNum, actuator_gear, nu, 6 ) \
|
||||
X ( mjtNum, actuator_cranklength, nu, 1 ) \
|
||||
X ( mjtNum, actuator_acc0, nu, 1 ) \
|
||||
X ( mjtNum, actuator_length0, nu, 1 ) \
|
||||
X ( mjtNum, actuator_lengthrange, nu, 2 ) \
|
||||
X ( mjtNum, actuator_user, nu, MJ_M(nuser_actuator) ) \
|
||||
X ( int, actuator_plugin, nu, 1 )
|
||||
|
||||
#define MJMODEL_POINTERS_SENSOR \
|
||||
X ( int, sensor_type, nsensor, 1 ) \
|
||||
X ( int, sensor_datatype, nsensor, 1 ) \
|
||||
X ( int, sensor_needstage, nsensor, 1 ) \
|
||||
X ( int, sensor_objtype, nsensor, 1 ) \
|
||||
X ( int, sensor_objid, nsensor, 1 ) \
|
||||
X ( int, sensor_reftype, nsensor, 1 ) \
|
||||
X ( int, sensor_refid, nsensor, 1 ) \
|
||||
X ( int, sensor_intprm, nsensor, mjNSENS ) \
|
||||
X ( int, sensor_dim, nsensor, 1 ) \
|
||||
X ( int, sensor_adr, nsensor, 1 ) \
|
||||
X ( mjtNum, sensor_cutoff, nsensor, 1 ) \
|
||||
X ( mjtNum, sensor_noise, nsensor, 1 ) \
|
||||
X ( mjtNum, sensor_user, nsensor, MJ_M(nuser_sensor) ) \
|
||||
X ( int, sensor_plugin, nsensor, 1 )
|
||||
|
||||
#define MJMODEL_POINTERS \
|
||||
X ( mjtNum, qpos0, nq, 1 ) \
|
||||
X ( mjtNum, qpos_spring, nq, 1 ) \
|
||||
MJMODEL_POINTERS_BODY \
|
||||
X ( int, bvh_depth, nbvh, 1 ) \
|
||||
X ( int, bvh_child, nbvh, 2 ) \
|
||||
X ( int, bvh_nodeid, nbvh, 1 ) \
|
||||
X ( mjtNum, bvh_aabb, nbvhstatic, 6 ) \
|
||||
X ( int, oct_depth, noct, 1 ) \
|
||||
X ( int, oct_child, noct, 8 ) \
|
||||
X ( mjtNum, oct_aabb, noct, 6 ) \
|
||||
X ( mjtNum, oct_coeff, noct, 8 ) \
|
||||
MJMODEL_POINTERS_JOINT \
|
||||
MJMODEL_POINTERS_DOF \
|
||||
MJMODEL_POINTERS_GEOM \
|
||||
MJMODEL_POINTERS_SITE \
|
||||
MJMODEL_POINTERS_CAMERA \
|
||||
MJMODEL_POINTERS_LIGHT \
|
||||
MJMODEL_POINTERS_FLEX \
|
||||
MJMODEL_POINTERS_MESH \
|
||||
MJMODEL_POINTERS_SKIN \
|
||||
MJMODEL_POINTERS_HFIELD \
|
||||
MJMODEL_POINTERS_TEXTURE \
|
||||
MJMODEL_POINTERS_MATERIAL \
|
||||
MJMODEL_POINTERS_PAIR \
|
||||
MJMODEL_POINTERS_EXCLUDE \
|
||||
MJMODEL_POINTERS_EQUALITY \
|
||||
MJMODEL_POINTERS_TENDON \
|
||||
X ( int, wrap_type, nwrap, 1 ) \
|
||||
X ( int, wrap_objid, nwrap, 1 ) \
|
||||
X ( mjtNum, wrap_prm, nwrap, 1 ) \
|
||||
MJMODEL_POINTERS_ACTUATOR \
|
||||
MJMODEL_POINTERS_SENSOR \
|
||||
X ( int, plugin, nplugin, 1 ) \
|
||||
X ( int, plugin_stateadr, nplugin, 1 ) \
|
||||
X ( int, plugin_statenum, nplugin, 1 ) \
|
||||
X ( char, plugin_attr, npluginattr, 1 ) \
|
||||
X ( int, plugin_attradr, nplugin, 1 ) \
|
||||
X ( int, numeric_adr, nnumeric, 1 ) \
|
||||
X ( int, numeric_size, nnumeric, 1 ) \
|
||||
X ( mjtNum, numeric_data, nnumericdata, 1 ) \
|
||||
X ( int, text_adr, ntext, 1 ) \
|
||||
X ( int, text_size, ntext, 1 ) \
|
||||
X ( char, text_data, ntextdata, 1 ) \
|
||||
X ( int, tuple_adr, ntuple, 1 ) \
|
||||
X ( int, tuple_size, ntuple, 1 ) \
|
||||
X ( int, tuple_objtype, ntupledata, 1 ) \
|
||||
X ( int, tuple_objid, ntupledata, 1 ) \
|
||||
X ( mjtNum, tuple_objprm, ntupledata, 1 ) \
|
||||
X ( mjtNum, key_time, nkey, 1 ) \
|
||||
X ( mjtNum, key_qpos, nkey, MJ_M(nq) ) \
|
||||
X ( mjtNum, key_qvel, nkey, MJ_M(nv) ) \
|
||||
X ( mjtNum, key_act, nkey, MJ_M(na) ) \
|
||||
X ( mjtNum, key_mpos, nkey, MJ_M(nmocap)*3 ) \
|
||||
X ( mjtNum, key_mquat, nkey, MJ_M(nmocap)*4 ) \
|
||||
X ( mjtNum, key_ctrl, nkey, MJ_M(nu) ) \
|
||||
X ( int, name_bodyadr, nbody, 1 ) \
|
||||
X ( int, name_jntadr, njnt, 1 ) \
|
||||
X ( int, name_geomadr, ngeom, 1 ) \
|
||||
X ( int, name_siteadr, nsite, 1 ) \
|
||||
X ( int, name_camadr, ncam, 1 ) \
|
||||
X ( int, name_lightadr, nlight, 1 ) \
|
||||
X ( int, name_flexadr, nflex, 1 ) \
|
||||
X ( int, name_meshadr, nmesh, 1 ) \
|
||||
X ( int, name_skinadr, nskin, 1 ) \
|
||||
X ( int, name_hfieldadr, nhfield, 1 ) \
|
||||
X ( int, name_texadr, ntex, 1 ) \
|
||||
X ( int, name_matadr, nmat, 1 ) \
|
||||
X ( int, name_pairadr, npair, 1 ) \
|
||||
X ( int, name_excludeadr, nexclude, 1 ) \
|
||||
X ( int, name_eqadr, neq, 1 ) \
|
||||
X ( int, name_tendonadr, ntendon, 1 ) \
|
||||
X ( int, name_actuatoradr, nu, 1 ) \
|
||||
X ( int, name_sensoradr, nsensor, 1 ) \
|
||||
X ( int, name_numericadr, nnumeric, 1 ) \
|
||||
X ( int, name_textadr, ntext, 1 ) \
|
||||
X ( int, name_tupleadr, ntuple, 1 ) \
|
||||
X ( int, name_keyadr, nkey, 1 ) \
|
||||
X ( int, name_pluginadr, nplugin, 1 ) \
|
||||
X ( char, names, nnames, 1 ) \
|
||||
X ( int, names_map, nnames_map, 1 ) \
|
||||
X ( char, paths, npaths, 1 ) \
|
||||
X ( int, B_rownnz, nbody, 1 ) \
|
||||
X ( int, B_rowadr, nbody, 1 ) \
|
||||
X ( int, B_colind, nB, 1 ) \
|
||||
X ( int, M_rownnz, nv, 1 ) \
|
||||
X ( int, M_rowadr, nv, 1 ) \
|
||||
X ( int, M_colind, nC, 1 ) \
|
||||
X ( int, mapM2M, nC, 1 ) \
|
||||
X ( int, D_rownnz, nv, 1 ) \
|
||||
X ( int, D_rowadr, nv, 1 ) \
|
||||
X ( int, D_diag, nv, 1 ) \
|
||||
X ( int, D_colind, nD, 1 ) \
|
||||
X ( int, mapM2D, nD, 1 ) \
|
||||
X ( int, mapD2M, nC, 1 )
|
||||
|
||||
//-------------------------------- mjData ----------------------------------------------------------
|
||||
|
||||
// define symbols needed in MJDATA_POINTERS (corresponding to number of columns)
|
||||
#define MJDATA_POINTERS_PREAMBLE( m ) \
|
||||
int nv = m->nv;
|
||||
|
||||
|
||||
// pointer fields of mjData
|
||||
// XNV means that the field is not required to construct mjvScene
|
||||
// (by default we define XNV to be the same as X)
|
||||
#define MJDATA_POINTERS \
|
||||
X ( mjtNum, qpos, nq, 1 ) \
|
||||
X ( mjtNum, qvel, nv, 1 ) \
|
||||
X ( mjtNum, act, na, 1 ) \
|
||||
X ( mjtNum, qacc_warmstart, nv, 1 ) \
|
||||
X ( mjtNum, plugin_state, npluginstate, 1 ) \
|
||||
X ( mjtNum, ctrl, nu, 1 ) \
|
||||
X ( mjtNum, qfrc_applied, nv, 1 ) \
|
||||
X ( mjtNum, xfrc_applied, nbody, 6 ) \
|
||||
X ( mjtByte, eq_active, neq, 1 ) \
|
||||
X ( mjtNum, mocap_pos, nmocap, 3 ) \
|
||||
X ( mjtNum, mocap_quat, nmocap, 4 ) \
|
||||
X ( mjtNum, qacc, nv, 1 ) \
|
||||
X ( mjtNum, act_dot, na, 1 ) \
|
||||
X ( mjtNum, userdata, nuserdata, 1 ) \
|
||||
X ( mjtNum, sensordata, nsensordata, 1 ) \
|
||||
X ( int, plugin, nplugin, 1 ) \
|
||||
X ( uintptr_t, plugin_data, nplugin, 1 ) \
|
||||
X ( mjtNum, xpos, nbody, 3 ) \
|
||||
X ( mjtNum, xquat, nbody, 4 ) \
|
||||
X ( mjtNum, xmat, nbody, 9 ) \
|
||||
X ( mjtNum, xipos, nbody, 3 ) \
|
||||
X ( mjtNum, ximat, nbody, 9 ) \
|
||||
X ( mjtNum, xanchor, njnt, 3 ) \
|
||||
X ( mjtNum, xaxis, njnt, 3 ) \
|
||||
X ( mjtNum, geom_xpos, ngeom, 3 ) \
|
||||
X ( mjtNum, geom_xmat, ngeom, 9 ) \
|
||||
X ( mjtNum, site_xpos, nsite, 3 ) \
|
||||
X ( mjtNum, site_xmat, nsite, 9 ) \
|
||||
X ( mjtNum, cam_xpos, ncam, 3 ) \
|
||||
X ( mjtNum, cam_xmat, ncam, 9 ) \
|
||||
X ( mjtNum, light_xpos, nlight, 3 ) \
|
||||
X ( mjtNum, light_xdir, nlight, 3 ) \
|
||||
X ( mjtNum, subtree_com, nbody, 3 ) \
|
||||
X ( mjtNum, cdof, nv, 6 ) \
|
||||
X ( mjtNum, cinert, nbody, 10 ) \
|
||||
X ( mjtNum, flexvert_xpos, nflexvert, 3 ) \
|
||||
X ( mjtNum, flexelem_aabb, nflexelem, 6 ) \
|
||||
X ( int, flexedge_J_rownnz, nflexedge, 1 ) \
|
||||
X ( int, flexedge_J_rowadr, nflexedge, 1 ) \
|
||||
X ( int, flexedge_J_colind, nflexedge, MJ_M(nv) ) \
|
||||
X ( mjtNum, flexedge_J, nflexedge, MJ_M(nv) ) \
|
||||
X ( mjtNum, flexedge_length, nflexedge, 1 ) \
|
||||
X ( mjtNum, bvh_aabb_dyn, nbvhdynamic, 6 ) \
|
||||
X ( int, ten_wrapadr, ntendon, 1 ) \
|
||||
X ( int, ten_wrapnum, ntendon, 1 ) \
|
||||
X ( int, ten_J_rownnz, ntendon, 1 ) \
|
||||
X ( int, ten_J_rowadr, ntendon, 1 ) \
|
||||
X ( int, ten_J_colind, ntendon, MJ_M(nv) ) \
|
||||
X ( mjtNum, ten_J, ntendon, MJ_M(nv) ) \
|
||||
X ( mjtNum, ten_length, ntendon, 1 ) \
|
||||
X ( int, wrap_obj, nwrap, 2 ) \
|
||||
X ( mjtNum, wrap_xpos, nwrap, 6 ) \
|
||||
X ( mjtNum, actuator_length, nu, 1 ) \
|
||||
X ( int, moment_rownnz, nu, 1 ) \
|
||||
X ( int, moment_rowadr, nu, 1 ) \
|
||||
X ( int, moment_colind, nJmom, 1 ) \
|
||||
X ( mjtNum, actuator_moment, nJmom, 1 ) \
|
||||
XNV ( mjtNum, crb, nbody, 10 ) \
|
||||
XNV ( mjtNum, qM, nM, 1 ) \
|
||||
XNV ( mjtNum, M, nC, 1 ) \
|
||||
XNV ( mjtNum, qLD, nC, 1 ) \
|
||||
X ( mjtNum, qLDiagInv, nv, 1 ) \
|
||||
X ( mjtByte, bvh_active, nbvh, 1 ) \
|
||||
X ( mjtNum, flexedge_velocity, nflexedge, 1 ) \
|
||||
X ( mjtNum, ten_velocity, ntendon, 1 ) \
|
||||
X ( mjtNum, actuator_velocity, nu, 1 ) \
|
||||
X ( mjtNum, cvel, nbody, 6 ) \
|
||||
X ( mjtNum, cdof_dot, nv, 6 ) \
|
||||
X ( mjtNum, qfrc_bias, nv, 1 ) \
|
||||
X ( mjtNum, qfrc_spring, nv, 1 ) \
|
||||
X ( mjtNum, qfrc_damper, nv, 1 ) \
|
||||
X ( mjtNum, qfrc_gravcomp, nv, 1 ) \
|
||||
X ( mjtNum, qfrc_fluid, nv, 1 ) \
|
||||
X ( mjtNum, qfrc_passive, nv, 1 ) \
|
||||
X ( mjtNum, subtree_linvel, nbody, 3 ) \
|
||||
X ( mjtNum, subtree_angmom, nbody, 3 ) \
|
||||
XNV ( mjtNum, qH, nC, 1 ) \
|
||||
X ( mjtNum, qHDiagInv, nv, 1 ) \
|
||||
XNV ( mjtNum, qDeriv, nD, 1 ) \
|
||||
XNV ( mjtNum, qLU, nD, 1 ) \
|
||||
X ( mjtNum, actuator_force, nu, 1 ) \
|
||||
X ( mjtNum, qfrc_actuator, nv, 1 ) \
|
||||
X ( mjtNum, qfrc_smooth, nv, 1 ) \
|
||||
X ( mjtNum, qacc_smooth, nv, 1 ) \
|
||||
X ( mjtNum, qfrc_constraint, nv, 1 ) \
|
||||
X ( mjtNum, qfrc_inverse, nv, 1 ) \
|
||||
X ( mjtNum, cacc, nbody, 6 ) \
|
||||
X ( mjtNum, cfrc_int, nbody, 6 ) \
|
||||
X ( mjtNum, cfrc_ext, nbody, 6 )
|
||||
|
||||
|
||||
// macro for annotating that an array size in an X macro is a member of mjData
|
||||
// by default this macro does nothing, but users can redefine it as necessary
|
||||
#define MJ_D(n) n
|
||||
|
||||
// array of contacts
|
||||
#define MJDATA_ARENA_POINTERS_CONTACT \
|
||||
X( mjContact, contact, MJ_D(ncon), 1 )
|
||||
|
||||
// array fields of mjData that are used in the primal problem
|
||||
#define MJDATA_ARENA_POINTERS_SOLVER \
|
||||
X ( int, efc_type, MJ_D(nefc), 1 ) \
|
||||
X ( int, efc_id, MJ_D(nefc), 1 ) \
|
||||
XNV( int, efc_J_rownnz, MJ_D(nefc), 1 ) \
|
||||
XNV( int, efc_J_rowadr, MJ_D(nefc), 1 ) \
|
||||
XNV( int, efc_J_rowsuper, MJ_D(nefc), 1 ) \
|
||||
XNV( int, efc_J_colind, MJ_D(nJ), 1 ) \
|
||||
XNV( mjtNum, efc_J, MJ_D(nJ), 1 ) \
|
||||
X ( mjtNum, efc_pos, MJ_D(nefc), 1 ) \
|
||||
X ( mjtNum, efc_margin, MJ_D(nefc), 1 ) \
|
||||
X ( mjtNum, efc_frictionloss, MJ_D(nefc), 1 ) \
|
||||
X ( mjtNum, efc_diagApprox, MJ_D(nefc), 1 ) \
|
||||
X ( mjtNum, efc_KBIP, MJ_D(nefc), 4 ) \
|
||||
X ( mjtNum, efc_D, MJ_D(nefc), 1 ) \
|
||||
X ( mjtNum, efc_R, MJ_D(nefc), 1 ) \
|
||||
X ( int, tendon_efcadr, MJ_M(ntendon), 1 ) \
|
||||
X ( mjtNum, efc_vel, MJ_D(nefc), 1 ) \
|
||||
X ( mjtNum, efc_aref, MJ_D(nefc), 1 ) \
|
||||
X ( mjtNum, efc_b, MJ_D(nefc), 1 ) \
|
||||
X ( int, efc_state, MJ_D(nefc), 1 ) \
|
||||
X ( mjtNum, efc_force, MJ_D(nefc), 1 )
|
||||
|
||||
// array fields of mjData that are used in the dual problem
|
||||
#define MJDATA_ARENA_POINTERS_DUAL \
|
||||
XNV( int, efc_AR_rownnz, MJ_D(nefc), 1 ) \
|
||||
XNV( int, efc_AR_rowadr, MJ_D(nefc), 1 ) \
|
||||
XNV( int, efc_AR_colind, MJ_D(nA), 1 ) \
|
||||
XNV( mjtNum, efc_AR, MJ_D(nA), 1 )
|
||||
|
||||
// array fields of mjData that are used for constraint islands
|
||||
#define MJDATA_ARENA_POINTERS_ISLAND \
|
||||
X ( int, dof_island, MJ_M(nv), 1 ) \
|
||||
X ( int, island_nv, MJ_D(nisland), 1 ) \
|
||||
X ( int, island_idofadr, MJ_D(nisland), 1 ) \
|
||||
X ( int, island_dofadr, MJ_D(nisland), 1 ) \
|
||||
X ( int, map_dof2idof, MJ_M(nv), 1 ) \
|
||||
X ( int, map_idof2dof, MJ_M(nv), 1 ) \
|
||||
X ( mjtNum, ifrc_smooth, MJ_D(nidof), 1 ) \
|
||||
X ( mjtNum, iacc_smooth, MJ_D(nidof), 1 ) \
|
||||
XNV( int, iM_rownnz, MJ_D(nidof), 1 ) \
|
||||
XNV( int, iM_rowadr, MJ_D(nidof), 1 ) \
|
||||
XNV( int, iM_colind, MJ_M(nC), 1 ) \
|
||||
XNV( mjtNum, iM, MJ_M(nC), 1 ) \
|
||||
XNV( mjtNum, iLD, MJ_M(nC), 1 ) \
|
||||
X ( mjtNum, iLDiagInv, MJ_D(nidof), 1 ) \
|
||||
X ( mjtNum, iacc, MJ_D(nidof), 1 ) \
|
||||
X ( int, efc_island, MJ_D(nefc), 1 ) \
|
||||
X ( int, island_ne, MJ_D(nisland), 1 ) \
|
||||
X ( int, island_nf, MJ_D(nisland), 1 ) \
|
||||
X ( int, island_nefc, MJ_D(nisland), 1 ) \
|
||||
X ( int, island_iefcadr, MJ_D(nisland), 1 ) \
|
||||
X ( int, map_efc2iefc, MJ_D(nefc), 1 ) \
|
||||
X ( int, map_iefc2efc, MJ_D(nefc), 1 ) \
|
||||
X ( int, iefc_type, MJ_D(nefc), 1 ) \
|
||||
X ( int, iefc_id, MJ_D(nefc), 1 ) \
|
||||
XNV( int, iefc_J_rownnz, MJ_D(nefc), 1 ) \
|
||||
XNV( int, iefc_J_rowadr, MJ_D(nefc), 1 ) \
|
||||
XNV( int, iefc_J_rowsuper, MJ_D(nefc), 1 ) \
|
||||
XNV( int, iefc_J_colind, MJ_D(nJ), 1 ) \
|
||||
XNV( mjtNum, iefc_J, MJ_D(nJ), 1 ) \
|
||||
X ( mjtNum, iefc_frictionloss, MJ_D(nefc), 1 ) \
|
||||
X ( mjtNum, iefc_D, MJ_D(nefc), 1 ) \
|
||||
X ( mjtNum, iefc_R, MJ_D(nefc), 1 ) \
|
||||
X ( mjtNum, iefc_aref, MJ_D(nefc), 1 ) \
|
||||
X ( int, iefc_state, MJ_D(nefc), 1 ) \
|
||||
X ( mjtNum, iefc_force, MJ_D(nefc), 1 ) \
|
||||
X ( mjtNum, ifrc_constraint, MJ_D(nidof), 1 )
|
||||
|
||||
// array fields of mjData that live in d->arena
|
||||
#define MJDATA_ARENA_POINTERS \
|
||||
MJDATA_ARENA_POINTERS_CONTACT \
|
||||
MJDATA_ARENA_POINTERS_SOLVER \
|
||||
MJDATA_ARENA_POINTERS_DUAL \
|
||||
MJDATA_ARENA_POINTERS_ISLAND
|
||||
|
||||
|
||||
// scalar fields of mjData
|
||||
#define MJDATA_SCALAR \
|
||||
X( size_t, narena ) \
|
||||
X( size_t, nbuffer ) \
|
||||
X( int, nplugin ) \
|
||||
X( size_t, pstack ) \
|
||||
X( size_t, pbase ) \
|
||||
X( size_t, parena ) \
|
||||
X( size_t, maxuse_stack ) \
|
||||
X( size_t, maxuse_arena ) \
|
||||
X( int, maxuse_con ) \
|
||||
X( int, maxuse_efc ) \
|
||||
X( int, ncon ) \
|
||||
X( int, ne ) \
|
||||
X( int, nf ) \
|
||||
X( int, nl ) \
|
||||
X( int, nefc ) \
|
||||
X( int, nJ ) \
|
||||
X( int, nA ) \
|
||||
X( int, nisland ) \
|
||||
X( int, nidof ) \
|
||||
X( mjtNum, time ) \
|
||||
X( uintptr_t, threadpool )
|
||||
|
||||
|
||||
// vector fields of mjData
|
||||
#define MJDATA_VECTOR \
|
||||
X( size_t, maxuse_threadstack, mjMAXTHREAD, 1 ) \
|
||||
X( mjSolverStat, solver, mjNISLAND, mjNSOLVER ) \
|
||||
X( int, solver_niter, mjNISLAND, 1 ) \
|
||||
X( int, solver_nnz, mjNISLAND, 1 ) \
|
||||
X( mjtNum, solver_fwdinv, 2, 1 ) \
|
||||
X( mjWarningStat, warning, mjNWARNING, 1 ) \
|
||||
X( mjTimerStat, timer, mjNTIMER, 1 ) \
|
||||
X( mjtNum, energy, 2, 1 )
|
||||
|
||||
// alias XNV to be the same as X
|
||||
// to obtain only X macros for fields that are relevant for mjvScene creation,
|
||||
// redefine XNV to expand to nothing
|
||||
#define XNV X
|
||||
|
||||
#endif // MUJOCO_MJXMACRO_H_
|
||||
1923
third_party/mujoco/3.3.7/include/mujoco/mujoco.h
vendored
Normal file
1
third_party/mujoco/3.3.7/lib/libmujoco.so
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
libmujoco.so.3.3.7
|
||||
BIN
third_party/mujoco/3.3.7/lib/libmujoco.so.3.3.7
vendored
Executable file
9
third_party/mujoco/3.3.7/model/adhesion/README.md
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
# Active adhesion example
|
||||
|
||||
This example model shows how to use adhesion actuators.
|
||||
|
||||
The video below is a screen capture of a user interacting with the model:
|
||||
|
||||
|
||||
[](https://www.youtube.com/watch?v=BcHZ5BFeTmU)
|
||||
|
||||
148
third_party/mujoco/3.3.7/model/adhesion/active_adhesion.xml
vendored
Normal file
@ -0,0 +1,148 @@
|
||||
<mujoco model="Active adhesion example">
|
||||
<!--
|
||||
Adding some fluid viscosity to prevent the hanging sphere from jiggling too much.
|
||||
-->
|
||||
<option viscosity="1"/>
|
||||
|
||||
<size memory="10M"/>
|
||||
|
||||
<visual>
|
||||
<headlight diffuse=".2 .2 .2"/>
|
||||
</visual>
|
||||
|
||||
<default>
|
||||
<joint damping=".3" axis="0 1 0"/>
|
||||
<geom type="box" friction=".5"/>
|
||||
<default class="wall">
|
||||
<geom rgba=".5 .5 .5 .4"/>
|
||||
</default>
|
||||
<default class="mechanical">
|
||||
<geom rgba=".5 .5 .8 1"/>
|
||||
<tendon rgba=".5 .5 .8 1"/>
|
||||
</default>
|
||||
<default class="active_adhesion">
|
||||
<!--
|
||||
Geoms in the active_adhesion class are "inflated" with a margin of 1cm, but contacts are
|
||||
activated only at a depth gap of 1cm, leading to a layer of inactive contacts at a 1cm
|
||||
distance from the surface. However the contacts can be used by the adhesion actuator.
|
||||
-->
|
||||
<geom rgba=".8 .5 .5 1" margin=".01" gap=".01"/>
|
||||
</default>
|
||||
<default class="object">
|
||||
<geom rgba=".5 .8 .5 1" density="100"/>
|
||||
</default>
|
||||
</default>
|
||||
|
||||
<worldbody>
|
||||
<light pos="0.4 -.15 .6" dir="-1 .5 -1" diffuse=".7 .7 .7"/>
|
||||
<light pos="-.4 -.15 .6" dir="1 .5 -1" diffuse=".7 .7 .7"/>
|
||||
|
||||
<body name="two crates">
|
||||
<joint name="conveyor" type="slide" damping="100" axis="1 0 0"/>
|
||||
<geom size=".2 .1 .01" pos="0 0 -.01"/>
|
||||
<geom size=".01 .08 .031" pos="-.19 0 .03" class="wall"/>
|
||||
<geom size=".01 .08 .031" pos="0 0 .03" class="wall"/>
|
||||
<geom size=".01 .08 .031" pos="0.19 0 .03" class="wall"/>
|
||||
<geom size="0.2 .01 .031" pos="0 -.09 .03" class="wall"/>
|
||||
<geom size="0.2 .01 .031" pos="0 0.09 .03" class="wall"/>
|
||||
</body>
|
||||
|
||||
<body name="arm1" pos="-.1 0 .3" childclass="mechanical">
|
||||
<joint name="arm1"/>
|
||||
<geom type="cylinder" size=".015 .01" zaxis="0 1 0"/>
|
||||
<geom type="capsule" size=".01" fromto="0 0 0 -.12 0 -.07"/>
|
||||
<body name="arm2" pos="-.12 0 -.07">
|
||||
<joint name="arm2"/>
|
||||
<geom type="cylinder" size=".015 .01" zaxis="0 1 0"/>
|
||||
<geom type="capsule" size=".01" fromto="0 0 0 .12 0 -.07"/>
|
||||
<body name="4boxes" pos=".12 0 -.08" childclass="active_adhesion">
|
||||
<site name="force_sensor" group="3"/>
|
||||
<joint name="arm3" damping=".01" pos="0 -.03 0"/>
|
||||
<geom size=".015 .015 .01" pos="0.015 0.015 0"/>
|
||||
<geom size=".015 .015 .01" pos="0.015 -.015 0"/>
|
||||
<geom size=".015 .015 .01" pos="-.015 0.015 0"/>
|
||||
<geom size=".015 .015 .01" pos="-.015 -.015 0"/>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
|
||||
<body name="box" pos="-.1 0 .05">
|
||||
<freejoint/>
|
||||
<geom size=".05 .05 .05" class="object"/>
|
||||
</body>
|
||||
|
||||
<body name="winch" pos="-.01 0 .35" childclass="mechanical">
|
||||
<joint name="winch" damping="1"/>
|
||||
<geom type="cylinder" size=".015 .01" zaxis="0 1 0"/>
|
||||
<geom type="capsule" size=".01" fromto="0 0 0 .1 0 .05"/>
|
||||
<site name="anchor" pos=".1 0 .04"/>
|
||||
</body>
|
||||
<site name="pulley" pos=".1 0 .32"/>
|
||||
<site name="hook_left" pos=".08 0 .3"/>
|
||||
<site name="hook_right" pos=".12 0 .3"/>
|
||||
<body name="sphere" pos=".1 0 .2" childclass="active_adhesion">
|
||||
<freejoint/>
|
||||
<!--
|
||||
The composite balls in the crate have only 3 linear DoFs with condim=1, effectively
|
||||
frictionless point particles. In order to make them stick to the sphere we give the sphere
|
||||
priority 2, to force condim=3.
|
||||
|
||||
Also note the sphere has a margin+gap of 3cm as opposed to the 1cm of the arm box.
|
||||
-->
|
||||
<geom type="sphere" size=".03" priority="2" margin=".03" gap=".03"/>
|
||||
<site name="pin_left" pos="-.025 0 .025"/>
|
||||
<site name="pin_right" pos=".025 0 .025"/>
|
||||
</body>
|
||||
|
||||
<replicate count="4" offset=".025 0 0">
|
||||
<replicate count="4" offset="0 .025 0">
|
||||
<replicate count="4" offset="0 0 .025">
|
||||
<body pos=".06 -.04 .05">
|
||||
<joint type="slide" axis="1 0 0"/>
|
||||
<joint type="slide" axis="0 1 0"/>
|
||||
<joint type="slide" axis="0 0 1"/>
|
||||
<geom type="sphere" size=".012" rgba=".5 .8 .5 1" solref=".005 1" condim="1"/>
|
||||
</body>
|
||||
</replicate>
|
||||
</replicate>
|
||||
</replicate>
|
||||
</worldbody>
|
||||
|
||||
<equality>
|
||||
<joint joint1="arm1" joint2="arm2" polycoef="0 -.5 0 0 0"/>
|
||||
<joint joint1="arm3" joint2="arm1"/>
|
||||
</equality>
|
||||
|
||||
<!--
|
||||
By using divisor=3 in the pullies we increase the distance by which the hanging sphere moves
|
||||
relative to the motion of the winch arm. One should imagine a double spindle with two radii that
|
||||
creates a ratio of 1.5 between the motion of tendon before the pullies and after the pullies.
|
||||
(1.5 rather than 3 because the tendon has 2 branches and the length is split between them)
|
||||
-->
|
||||
<tendon>
|
||||
<spatial range="0 .19" limited="true" solreflimit=".01 2" class="mechanical">
|
||||
<site site="anchor"/>
|
||||
<site site="pulley"/>
|
||||
<pulley divisor="3"/>
|
||||
<site site="pulley"/>
|
||||
<site site="hook_left"/>
|
||||
<site site="pin_left"/>
|
||||
<pulley divisor="3"/>
|
||||
<site site="pulley"/>
|
||||
<site site="hook_right"/>
|
||||
<site site="pin_right"/>
|
||||
</spatial>
|
||||
</tendon>
|
||||
|
||||
<actuator>
|
||||
<position name="conveyor" joint="conveyor" ctrlrange="-.2 .2" ctrllimited="true" kp="400"/>
|
||||
<position name="arm" joint="arm2" ctrlrange="-.8 1" ctrllimited="true" kp="10"/>
|
||||
<adhesion name="adhere_arm" body="4boxes" ctrlrange="0 1" gain="5"/>
|
||||
<position name="winch" joint="winch" ctrlrange="-.7 .5" ctrllimited="true" kp="10"/>
|
||||
<adhesion name="adhere_winch" body="sphere" ctrlrange="0 1" gain="5"/>
|
||||
</actuator>
|
||||
|
||||
<sensor>
|
||||
<force site="force_sensor"/>
|
||||
</sensor>
|
||||
</mujoco>
|
||||
108
third_party/mujoco/3.3.7/model/balloons/balloons.xml
vendored
Normal file
@ -0,0 +1,108 @@
|
||||
<mujoco>
|
||||
<option density="1.204" viscosity="1.8e-5" integrator="implicit"/>
|
||||
|
||||
<visual>
|
||||
<global elevation="-10"/>
|
||||
</visual>
|
||||
|
||||
<default>
|
||||
<tendon limited="true" width="0.003" rgba="1 1 1 1"/>
|
||||
<geom friction=".2"/>
|
||||
<default class="weight">
|
||||
<geom rgba=".8 .4 .8 1"/>
|
||||
<site rgba=".8 .4 .8 1"/>
|
||||
</default>
|
||||
<default class="balloon">
|
||||
<!--
|
||||
0.167 is the MKS density of helium at room temperature.
|
||||
Note this does not take into account the mass of the rubber,
|
||||
which is likely not insignificant.
|
||||
-->
|
||||
<geom density="0.167" fluidshape="ellipsoid"/>
|
||||
<default class="pink">
|
||||
<geom rgba="1 .6 .7 1"/>
|
||||
<site rgba="1 .6 .7 1"/>
|
||||
</default>
|
||||
<default class="blue">
|
||||
<geom rgba=".3 .7 .9 1"/>
|
||||
<site rgba=".3 .7 .9 1"/>
|
||||
</default>
|
||||
<default class="green">
|
||||
<geom rgba=".4 .9 .5 1"/>
|
||||
<site rgba=".4 .9 .5 1"/>
|
||||
</default>
|
||||
<default class="orange">
|
||||
<geom rgba="1 .4 0 1"/>
|
||||
<site rgba="1 .4 0 1"/>
|
||||
</default>
|
||||
</default>
|
||||
</default>
|
||||
|
||||
<asset>
|
||||
<texture name="grid" type="2d" builtin="checker" width="512" height="512" rgb2="0 0 0" rgb1="1 1 1"/>
|
||||
<material name="grid" texture="grid" texrepeat="2 2" texuniform="true" reflectance=".6"/>
|
||||
</asset>
|
||||
|
||||
<worldbody>
|
||||
<geom name="ground" type="plane" size="5 5 .05" pos="0 0 -.5" material="grid"/>
|
||||
<geom name="ramp" type="box" size=".4 .2 .03" pos="0 0 -.4" euler="0 20 0" rgba="1 1 1 1"/>
|
||||
|
||||
<body name="weight" childclass="weight" pos=".3 0 .2">
|
||||
<freejoint/>
|
||||
<light pos="1 0 3" dir="-1 0 -3" mode="trackcom"/>
|
||||
<light pos="-1 0 3" dir="1 0 -3" mode="trackcom"/>
|
||||
<!-- The mass of the weight was chosen to be slightly bigger than the total buoyancy of the balloons. -->
|
||||
<geom name="weight" type="box" size=".015 .015 .015" mass=".0347"/>
|
||||
<site name="weight1" pos=" .013 .013 .013" size="0.005"/>
|
||||
<site name="weight2" pos="-.013 -.013 .013" size="0.005"/>
|
||||
</body>
|
||||
|
||||
<!-- The gravcomp value of 7.2 is the ratio of air and helium densities at room temperature. -->
|
||||
<body name="pink" gravcomp="7.2" pos="-.2 .1 .2" childclass="pink">
|
||||
<freejoint />
|
||||
<geom name="pink" type="ellipsoid" size=".11 .11 .15"/>
|
||||
<geom name="pink_knot" pos="0 0 -.15" size=".02"/>
|
||||
<site name="pink" pos="0 0 -.17" size="0.01"/>
|
||||
</body>
|
||||
|
||||
<body name="blue" gravcomp="7.2" pos=".1 .1 .2" childclass="blue">
|
||||
<freejoint />
|
||||
<geom name="blue" type="ellipsoid" size=".12 .12 .15"/>
|
||||
<geom name="blue_knot" pos="0 0 -.15" size=".02"/>
|
||||
<site name="blue" pos="0 0 -.17" size="0.01"/>
|
||||
</body>
|
||||
|
||||
<body name="green" gravcomp="7.2" pos=".1 -.1 .2" childclass="green">
|
||||
<freejoint />
|
||||
<geom name="green" type="ellipsoid" size=".12 .12 .14"/>
|
||||
<geom name="green_knot" pos="0 0 -.14" size=".02"/>
|
||||
<site name="green" pos="0 0 -.16" size="0.01"/>
|
||||
</body>
|
||||
|
||||
<body name="orange" gravcomp="7.2" pos="-.12 -.12 .2" childclass="orange">
|
||||
<freejoint />
|
||||
<geom name="orange" type="ellipsoid" size=".12 .12 .13"/>
|
||||
<geom name="orange_knot" pos="0 0 -.13" size=".02"/>
|
||||
<site name="orange" pos="0 0 -.15" size="0.01"/>
|
||||
</body>
|
||||
</worldbody>
|
||||
|
||||
<tendon>
|
||||
<spatial range="0 0.6">
|
||||
<site site="pink"/>
|
||||
<site site="weight1"/>
|
||||
</spatial>
|
||||
<spatial range="0 0.4">
|
||||
<site site="blue"/>
|
||||
<site site="weight1"/>
|
||||
</spatial>
|
||||
<spatial range="0 0.3">
|
||||
<site site="green"/>
|
||||
<site site="weight2"/>
|
||||
</spatial>
|
||||
<spatial range="0 0.5">
|
||||
<site site="orange"/>
|
||||
<site site="weight2"/>
|
||||
</spatial>
|
||||
</tendon>
|
||||
</mujoco>
|
||||
72
third_party/mujoco/3.3.7/model/car/car.xml
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
<mujoco>
|
||||
<compiler autolimits="true"/>
|
||||
|
||||
<asset>
|
||||
<texture name="grid" type="2d" builtin="checker" width="512" height="512" rgb1=".1 .2 .3" rgb2=".2 .3 .4"/>
|
||||
<material name="grid" texture="grid" texrepeat="1 1" texuniform="true" reflectance=".2"/>
|
||||
<mesh name="chasis" scale=".01 .006 .0015"
|
||||
vertex=" 9 2 0
|
||||
-10 10 10
|
||||
9 -2 0
|
||||
10 3 -10
|
||||
10 -3 -10
|
||||
-8 10 -10
|
||||
-10 -10 10
|
||||
-8 -10 -10
|
||||
-5 0 20"/>
|
||||
</asset>
|
||||
|
||||
<default>
|
||||
<joint damping=".03" actuatorfrcrange="-0.5 0.5"/>
|
||||
<default class="wheel">
|
||||
<geom type="cylinder" size=".03 .01" rgba=".5 .5 1 1"/>
|
||||
</default>
|
||||
<default class="decor">
|
||||
<site type="box" rgba=".5 1 .5 1"/>
|
||||
</default>
|
||||
</default>
|
||||
|
||||
<worldbody>
|
||||
<geom type="plane" size="3 3 .01" material="grid"/>
|
||||
<body name="car" pos="0 0 .03">
|
||||
<freejoint/>
|
||||
<light name="top light" pos="0 0 2" mode="trackcom" diffuse=".4 .4 .4"/>
|
||||
<geom name="chasis" type="mesh" mesh="chasis"/>
|
||||
<geom name="front wheel" pos=".08 0 -.015" type="sphere" size=".015" condim="1" priority="1"/>
|
||||
<light name="front light" pos=".1 0 .02" dir="2 0 -1" diffuse="1 1 1"/>
|
||||
<body name="left wheel" pos="-.07 .06 0" zaxis="0 1 0">
|
||||
<joint name="left"/>
|
||||
<geom class="wheel"/>
|
||||
<site class="decor" size=".006 .025 .012"/>
|
||||
<site class="decor" size=".025 .006 .012"/>
|
||||
</body>
|
||||
<body name="right wheel" pos="-.07 -.06 0" zaxis="0 1 0">
|
||||
<joint name="right"/>
|
||||
<geom class="wheel"/>
|
||||
<site class="decor" size=".006 .025 .012"/>
|
||||
<site class="decor" size=".025 .006 .012"/>
|
||||
</body>
|
||||
</body>
|
||||
</worldbody>
|
||||
|
||||
<tendon>
|
||||
<fixed name="forward">
|
||||
<joint joint="left" coef=".5"/>
|
||||
<joint joint="right" coef=".5"/>
|
||||
</fixed>
|
||||
<fixed name="turn">
|
||||
<joint joint="left" coef="-.5"/>
|
||||
<joint joint="right" coef=".5"/>
|
||||
</fixed>
|
||||
</tendon>
|
||||
|
||||
<actuator>
|
||||
<motor name="forward" tendon="forward" ctrlrange="-1 1"/>
|
||||
<motor name="turn" tendon="turn" ctrlrange="-1 1"/>
|
||||
</actuator>
|
||||
|
||||
<sensor>
|
||||
<jointactuatorfrc name="right" joint="right"/>
|
||||
<jointactuatorfrc name="left" joint="left"/>
|
||||
</sensor>
|
||||
</mujoco>
|
||||
BIN
third_party/mujoco/3.3.7/model/cards/assets/10_of_clubs.png
vendored
Normal file
|
After Width: | Height: | Size: 127 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/10_of_diamonds.png
vendored
Normal file
|
After Width: | Height: | Size: 124 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/10_of_hearts.png
vendored
Normal file
|
After Width: | Height: | Size: 125 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/10_of_spades.png
vendored
Normal file
|
After Width: | Height: | Size: 126 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/2_of_clubs.png
vendored
Normal file
|
After Width: | Height: | Size: 112 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/2_of_diamonds.png
vendored
Normal file
|
After Width: | Height: | Size: 111 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/2_of_hearts.png
vendored
Normal file
|
After Width: | Height: | Size: 111 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/2_of_spades.png
vendored
Normal file
|
After Width: | Height: | Size: 111 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/3_of_clubs.png
vendored
Normal file
|
After Width: | Height: | Size: 114 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/3_of_diamonds.png
vendored
Normal file
|
After Width: | Height: | Size: 112 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/3_of_hearts.png
vendored
Normal file
|
After Width: | Height: | Size: 113 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/3_of_spades.png
vendored
Normal file
|
After Width: | Height: | Size: 113 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/4_of_clubs.png
vendored
Normal file
|
After Width: | Height: | Size: 115 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/4_of_diamonds.png
vendored
Normal file
|
After Width: | Height: | Size: 113 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/4_of_hearts.png
vendored
Normal file
|
After Width: | Height: | Size: 114 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/4_of_spades.png
vendored
Normal file
|
After Width: | Height: | Size: 114 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/5_of_clubs.png
vendored
Normal file
|
After Width: | Height: | Size: 118 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/5_of_diamonds.png
vendored
Normal file
|
After Width: | Height: | Size: 116 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/5_of_hearts.png
vendored
Normal file
|
After Width: | Height: | Size: 116 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/5_of_spades.png
vendored
Normal file
|
After Width: | Height: | Size: 116 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/6_of_clubs.png
vendored
Normal file
|
After Width: | Height: | Size: 120 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/6_of_diamonds.png
vendored
Normal file
|
After Width: | Height: | Size: 118 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/6_of_hearts.png
vendored
Normal file
|
After Width: | Height: | Size: 118 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/6_of_spades.png
vendored
Normal file
|
After Width: | Height: | Size: 118 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/7_of_clubs.png
vendored
Normal file
|
After Width: | Height: | Size: 120 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/7_of_diamonds.png
vendored
Normal file
|
After Width: | Height: | Size: 118 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/7_of_hearts.png
vendored
Normal file
|
After Width: | Height: | Size: 118 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/7_of_spades.png
vendored
Normal file
|
After Width: | Height: | Size: 119 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/8_of_clubs.png
vendored
Normal file
|
After Width: | Height: | Size: 123 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/8_of_diamonds.png
vendored
Normal file
|
After Width: | Height: | Size: 121 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/8_of_hearts.png
vendored
Normal file
|
After Width: | Height: | Size: 121 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/8_of_spades.png
vendored
Normal file
|
After Width: | Height: | Size: 122 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/9_of_clubs.png
vendored
Normal file
|
After Width: | Height: | Size: 125 KiB |
BIN
third_party/mujoco/3.3.7/model/cards/assets/9_of_diamonds.png
vendored
Normal file
|
After Width: | Height: | Size: 122 KiB |