Initialize portable humanoid RL framework with licenses, locks and CI
Core and layout checks / core (push) Has been cancelled
Core and layout checks / core (push) Has been cancelled
This commit is contained in:
+395
@@ -0,0 +1,395 @@
|
||||
{
|
||||
"added_since_import": [
|
||||
"rl/mjlab/licenses/IsaacLab.txt",
|
||||
"rl/mjlab/licenses/mujoco_menagerie-i2rt_yam.txt",
|
||||
"rl/mjlab/licenses/mujoco_menagerie-unitree_g1.txt",
|
||||
"rl/mjlab/licenses/mujoco_menagerie-unitree_go1.txt",
|
||||
"rl/rsl_rl/licenses/pfrl.txt",
|
||||
"rl/upstream/import.json"
|
||||
],
|
||||
"changed_since_import": [
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/t1_constants.py",
|
||||
"rl/mjlab/sim/sim.py",
|
||||
"rl/mjlab/tasks/velocity/mdp/velocity_command.py"
|
||||
],
|
||||
"files": {
|
||||
"rl/mjlab/LICENSE": "8ca04d9dbbccd20f0f1842fb33e13949f9e57064b150dad36af8e7a751ca3321",
|
||||
"rl/mjlab/__init__.py": "7a447eb4e744ff67a0557c32c3aa1a27c352b7eaccc6df80ebb1b9cad71a646b",
|
||||
"rl/mjlab/actuator/__init__.py": "ae89d8f9cab9ab238a881597ec94f729feee7058b0d9773dca83000783a790df",
|
||||
"rl/mjlab/actuator/actuator.py": "85c5744fe149d7a7886450f15e30317f4b01a3d2f1807730946fdd808e91716e",
|
||||
"rl/mjlab/actuator/builtin_actuator.py": "4bd44d70c59a150313a0e8321c4700d8ab85c856c2554d55507d5d99e3544c03",
|
||||
"rl/mjlab/actuator/builtin_group.py": "f4429b846fc645c443734e45435618958d9f24502b2c627156e7d5a69cbbd9e3",
|
||||
"rl/mjlab/actuator/dc_actuator.py": "a24fc574b1606d66338bde4905e83d24ca2e66a2f7b11e0235fa441a81d253f6",
|
||||
"rl/mjlab/actuator/fused_group.py": "21a5d5ca68c0b886ba5d5abf89665bbc8c63991eb0bad9f4cb204f5300df46e1",
|
||||
"rl/mjlab/actuator/learned_actuator.py": "aefb27cc12881e67c87171cb94e38a5aee0171299ffd952e07053fbbd7fac487",
|
||||
"rl/mjlab/actuator/pd_actuator.py": "b2c36f1759827890055cb3549aa7b441a50abd914c883fde8bbfd631e6f2f101",
|
||||
"rl/mjlab/actuator/xml_actuator.py": "a8df6bbf07dda9e182d5ef248b0022816d1aa211ba321fa00ab676286b9c9548",
|
||||
"rl/mjlab/asset_zoo/README.md": "e6bed2af0c36ad4768c4cdba7710ff07354a76f5e0573ec60070baa69212b9db",
|
||||
"rl/mjlab/asset_zoo/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
"rl/mjlab/asset_zoo/robots/__init__.py": "7b64b50e70acf42fca4be9fe23b4793c725876847a81bd0fa540a7e55e60e449",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/__init__.py": "6630c30df59a46d1f341f8dfc350cb99a723a839ec643745a1fa0790d60bfdf4",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/LICENSE": "056db8cc7dcb21feae042d97185d4689c21bb1ba7fe59cefdc7ef5917c0ea77f",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/T1_23dof.xml": "f00e3410362b1e2267e6db05d25c33d6240bbf2436d62a409f07042bad4f7fb2",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/AL1.STL": "43f5d268152b3c169d34731545ddfa2a510a7e16f209a2a80f8ba9ae0e1a40aa",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/AL2.STL": "4bca60adb29c73f701350abd23e8a8d660dc61e87c5163a80157650dd3ad88c3",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/AL3.STL": "bfdf5611dfe90f8e02b07b037c36a244f4ce7184b45113371ef46e624fb30854",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/AR1.STL": "6dbbd3dab4486600747be9d0e7f8523d67bf00d24d0dc9c23db1766c4d808fcf",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/AR2.STL": "0499136785fe1bc0289d9e503e1e0ea48f5a63420a2e45b0fcd9e6b3bcf8f999",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/AR3.STL": "92330bd8286fe420fb76949ee4c5d5bdec2e6bb30426acdc4d6fae9257464631",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/Ankle_Cross_Left.STL": "e6ec38741838475834c147f2ad18196c0254741e602c2b676f888fd12b5d7981",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/Ankle_Cross_Right.STL": "b15d91f0f2470fc4d5634db906a3d7efaf1f700302e6671824494da8faf50308",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/H1.STL": "527a2e426db4e3d476a195754764b7f9565a950b809a34e47618f177b139c3f2",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/H2.STL": "9cbf4fe83a721c809de65b1f0d0a379314f4523f7e2f8af7f0edc27c2ce385aa",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/Hip_Pitch_Left.STL": "7bcb8be569aeb5379cb75a0827d682bc1d73a52a7f515d3aeffece43842c33c9",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/Hip_Pitch_Right.STL": "054d579c3c6ccc1f97aaf1461d802dec748ce1bf26c6fdd289283a2d0dbb2032",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/Hip_Roll_Left.STL": "72dbd65bdb4e87444c8e538474f631d63bf8c0960922517456b8cf2be9e1d0f0",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/Hip_Roll_Right.STL": "d715a7649ea4bf20d7ee17b3a57bae31732e467b9da1053fee2242c90f50980f",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/Hip_Yaw_Left.STL": "8d7de83ab4034639db3d1be1e6f43ae16e004dc2f1c2bec170b615686d187918",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/Hip_Yaw_Right.STL": "1a7d98e021884e313c55780a3c7c24ef2aa322807d8f9f8b18b2a63c7e2b9bf6",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/Logo.STL": "221b00d090fdc9e684892805db75265c9688b152b3ccf641084f950f220596c8",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/Shank_Left.STL": "6ae8dd7f88cb70a4a3cb3972cad4035a76f1604fd73ea66e285da553b3703c40",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/Shank_Right.STL": "dc66a8a0e2e31e413884a053e427d9b5007bef4508986587916a638a8a448599",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/Trunk.STL": "39d9610b23ef8ac7ea4343231a499f9c485903bede62df9729a2cd1254fede8f",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/Waist.STL": "2fe0a9ccfc284beca402e554db38e83022592192afa00f02db13cb374ffe9fbc",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/left_foot_link.STL": "2de026f2269fc55f80d4a8abd2e33dfd152adf9eb2c240d7d7e1dc40c13b55aa",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/left_hand_link.STL": "34df992aed438446481cfa20e78327810cd5cc5ecbb4a6f32ba2bf625462f53d",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/right_foot_link.STL": "313a9ff2f95da5727dce2b98c50b60226bf0a3affc72050ee251ea503e4b370a",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/assets/meshes/right_hand_link.STL": "c5a73e493e17db7611a81785f80c01167f51018271b4042f72fa8d2351d8b0eb",
|
||||
"rl/mjlab/asset_zoo/robots/booster_t1/t1_constants.py": "04c351bff19f6d63d860f5eebfb41eb783a616e58298254d140dadf9d68c2cc7",
|
||||
"rl/mjlab/asset_zoo/robots/i2rt_yam/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
"rl/mjlab/asset_zoo/robots/i2rt_yam/xmls/assets/d405.stl": "6617f3fb22b604a66c27e16d2397f305fcdca8a781248abdbabbf69c9fe6a3c5",
|
||||
"rl/mjlab/asset_zoo/robots/i2rt_yam/xmls/assets/model2.stl": "5ac61c0313ed00c38655e41681af1b8b307cf8d5ef57209a75f215cea02df754",
|
||||
"rl/mjlab/asset_zoo/robots/i2rt_yam/xmls/assets/model2__10.stl": "b879cc07f547b7a2ac52e428dd206e80a0d4b0e805cb56b9a8230df04a690923",
|
||||
"rl/mjlab/asset_zoo/robots/i2rt_yam/xmls/assets/model2__11.stl": "af220d2a51e8444392aef36e2fe4a6f69aed22bc292a7f38e54da3b4f5253434",
|
||||
"rl/mjlab/asset_zoo/robots/i2rt_yam/xmls/assets/model2__12.stl": "e79614869bd2283f70fafa150ce748d5b6c03377a651448c6fe9893a22f6d1de",
|
||||
"rl/mjlab/asset_zoo/robots/i2rt_yam/xmls/assets/model2__13.stl": "32b62f14f00ea82bfc79b935f7dac32c7cb276a3abc0aae8362cbba3fb1326de",
|
||||
"rl/mjlab/asset_zoo/robots/i2rt_yam/xmls/assets/model2__14.stl": "72d2178789dd5e0358c2caf9dad90b8881e505f4c52a8d6d18c71b5e93e8c84b",
|
||||
"rl/mjlab/asset_zoo/robots/i2rt_yam/xmls/assets/model2__15.stl": "ca8788184d54f30c18482cb9b48dffb010a93dbc029054b6cc515083a740d324",
|
||||
"rl/mjlab/asset_zoo/robots/i2rt_yam/xmls/assets/model2__16.stl": "18bb99691eed524393e8f3a0ff29e79d97ab75689bc92144bbdfafa2cc79d37b",
|
||||
"rl/mjlab/asset_zoo/robots/i2rt_yam/xmls/assets/model2__17.stl": "6513dbd192d2bf3a4f7016231f1ba5eca93916c9ebfdc334e9b435ca1d302ff6",
|
||||
"rl/mjlab/asset_zoo/robots/i2rt_yam/xmls/assets/model2__2.stl": "30dab41f14bae95d737abca3c934eb5d570ab107dff0b40952fbdfb9d07eab79",
|
||||
"rl/mjlab/asset_zoo/robots/i2rt_yam/xmls/assets/model2__3.stl": "9fd96f5ad387fe7dd96eaa65e386637800e2f5637b6167fbad4ecb37d8598f47",
|
||||
"rl/mjlab/asset_zoo/robots/i2rt_yam/xmls/assets/model2__4.stl": "33c0e7ef538e2c4473efa9c4ef2a8441b6094b65090b4dec71abe82001d974df",
|
||||
"rl/mjlab/asset_zoo/robots/i2rt_yam/xmls/assets/model2__5.stl": "09f08e7dead2d6363618471adadb1b94af39e8056676670f3fd21ec06c197b20",
|
||||
"rl/mjlab/asset_zoo/robots/i2rt_yam/xmls/assets/model2__6.stl": "888b5919d10dbfb59b964c3cafc2ddbdac3b5426e20dd13bcaf4baedd5ee15c9",
|
||||
"rl/mjlab/asset_zoo/robots/i2rt_yam/xmls/assets/model2__7.stl": "2d64b18f1e70b0460eb53335d340b7c879976a3093ec67b07bcb7245e371a91d",
|
||||
"rl/mjlab/asset_zoo/robots/i2rt_yam/xmls/assets/model2__8.stl": "db3708da6b14daf3fc9a1909a8325b68f65ff69146cdd20b69a9ddc4ce51f50d",
|
||||
"rl/mjlab/asset_zoo/robots/i2rt_yam/xmls/assets/model2__9.stl": "74969d09b8b7f75cc984c5c7e5526d2941c6724f48b3efa1fa8730cc7820f4f5",
|
||||
"rl/mjlab/asset_zoo/robots/i2rt_yam/xmls/yam.xml": "79078fe009fd31c90343d5240b6f7df475ea30848aa994108b90d342e5b37d06",
|
||||
"rl/mjlab/asset_zoo/robots/i2rt_yam/yam_constants.py": "3aa54282545d9c42534e9410ceedfda08e0f199addf14a64d7322aafa7843c2e",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/__init__.py": "c11e649d6d5209becaf6dbca2d09dee83c17844b5d941c2e1cc6f16ba618bf14",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/g1_constants.py": "30805e420c1dd03518ee582465fbce9cf097f4dc2eb0c1c2fce55c0332040c07",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/head_link.STL": "005fb67fbd3eff94aa8bf4a6e83238174e9f91b6721f7111594322f223724411",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_ankle_pitch_link.STL": "d49e3abc6f5b12e532062cd575b87b5ef40cd2a3fc18f54a1ca5bba4f773d51d",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_ankle_roll_link.STL": "c4092af943141d4d9f74232f3cfa345afc6565f46a077793b8ae0e68b39dc33f",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_elbow_link.STL": "fa752198accd104d5c4c3a01382e45165b944fbbc5acce085059223324e5bed3",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_hip_pitch_link.STL": "4725168105ee768ee31638ef22b53f6be2d7641bfd7cfefe803488d884776fa4",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_hip_roll_link.STL": "91f25922ee8a7c3152790051bebad17b4d9cd243569c38fe340285ff93a97acf",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_hip_yaw_link.STL": "a16d88aa6ddac8083aa7ad55ed317bea44b1fa003d314fba88965b7ed0f3b55b",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_knee_link.STL": "8d92b9e3d3a636761150bb8025e32514c4602b91c7028d523ee42b3e632de477",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_rubber_hand.STL": "cff2221a690fa69303f61fce68f2d155c1517b52efb6ca9262dd56e0bc6e70fe",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_shoulder_pitch_link.STL": "f0d1cfd02fcf0d42f95e678eeca33da3afbcc366ffba5c052847773ec4f31d52",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_shoulder_roll_link.STL": "fb9df21687773522598dc384f1a2945c7519f11cbc8bd372a49170316d6eee88",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_shoulder_yaw_link.STL": "1aa97e9748e924336567992181f78c7cd0652fd52a4afcca3df6b2ef6f9e712e",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_wrist_pitch_link.STL": "b251d8e05047f695d0f536cd78c11973cfa4e78d08cfe82759336cc3471de3a9",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_wrist_roll_link.STL": "edc387c9a0ba8c2237e9b296d32531426fabeb6f53e58df45c76106bca74148c",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/left_wrist_yaw_link.STL": "83f8fb3a726bf9613d65dd14f0f447cb918c3c95b3938042a0c9c09749267d3b",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/logo_link.STL": "8571a0a19bc4916fa55f91449f51d5fdefd751000054865a842449429d5f155b",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/pelvis.STL": "5ba6bbc888e630550140d3c26763f10206da8c8bd30ed886b8ede41c61f57a31",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/pelvis_contour_link.STL": "5cc5c2c7a312329e3feeb2b03d3fc09fc29705bd01864f6767e51be959662420",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_ankle_pitch_link.STL": "15be426539ec1be70246d4d82a168806db64a41301af8b35c197a33348c787a9",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_ankle_roll_link.STL": "4b66222ea56653e627711b56d0a8949b4920da5df091da0ceb343f54e884e3a5",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_elbow_link.STL": "1be925d7aa268bb8fddf5362b9173066890c7d32092c05638608126e59d1e2ab",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_hip_pitch_link.STL": "e4f3c99d7f4a7d34eadbef9461fc66e3486cb5442db1ec50c86317d459f1a9c6",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_hip_roll_link.STL": "4c254ef66a356f492947f360dd931965477b631e3fcc841f91ccc46d945d54f6",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_hip_yaw_link.STL": "e479c2936ca2057e9eb2f7dff6c189b7419d7b8484dea0b298cbb36a2a6aa668",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_knee_link.STL": "63c4008449c9bbe701a6e2b557b7a252e90cf3a5abcf54cee46862b9a69f8ec8",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_rubber_hand.STL": "99533b778bca6246144fa511bb9d4e555e075c641f2a0251e04372869cd99d67",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_shoulder_pitch_link.STL": "24cdb387e0128dfe602770a81c56cdce3a0181d34d039a11d1aaf8819b7b8c02",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_shoulder_roll_link.STL": "962b97c48f9ce9e8399f45dd9522e0865d19aa9fd299406b2d475a8fc4a53e81",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_shoulder_yaw_link.STL": "a0b76489271da0c72461a344c9ffb0f0c6e64f019ea5014c1624886c442a2fe5",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_wrist_pitch_link.STL": "d22f8f3b3127f15a63e5be1ee273cd5075786c3142f1c3d9f76cbf43d2a26477",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_wrist_roll_link.STL": "a7ee9212ff5b94d6cb7f52bb1bbf3f352194d5b598acff74f4c77d340c5b344f",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/right_wrist_yaw_link.STL": "bc9dece2d12509707e0057ba2e48df8f3d56db0c79410212963a25e8a50f61a6",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/torso_link_rev_1_0.STL": "11ddb46f2098efbbd8816b1d65893632d8e78be936376c7cdcd6771899ccc723",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/waist_roll_link_rev_1_0.STL": "b67c347a05abc3e8ddae600d98a082bee273bb39f8e651647708b0a7140a8a97",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/assets/waist_yaw_link_rev_1_0.STL": "ec6db442b11f25eed898b5add07940c85d804f300de24dcbd264ccd8be7d554c",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_g1/xmls/g1.xml": "febdcbeffbbf84051556ae41a5ac1b43fb479a5d76bdb3f54824dbc2721c20aa",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_go1/__init__.py": "976aec5cf5633d29630ae1ef74d1139504a22cdffc2ef18ba1617ae679144f2f",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_go1/go1_constants.py": "fca9478fa292b4a0d7c473be31d6537ae613df7490f4941a885ad31d9723f565",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_go1/xmls/assets/calf.stl": "ad3685e132454fd64e4ca3e5089f0d812fb53958e95c14913a22e3193e9e9ed8",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_go1/xmls/assets/hip.stl": "b6599b9dd2751ebd87449203223f5683a6c235268b76fcc443e00e0d974a06c0",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_go1/xmls/assets/thigh.stl": "bbf7c0a441323088c59276dbec8a32e708a1c61f42d30a6f6775176366ea23f8",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_go1/xmls/assets/thigh_mirror.stl": "1a90b89de47a57cb12a2d703f6b008a6ace8a1890a381c27723296fd0d00b9d8",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_go1/xmls/assets/trunk.stl": "051a57995dc6f892fc9bc53cd94e9a894f3dc209fd646e94d55d764150013970",
|
||||
"rl/mjlab/asset_zoo/robots/unitree_go1/xmls/go1.xml": "2f1856b0c83994c009cafbad1f5eac38d09efa1a64db73681ff72c9237822db3",
|
||||
"rl/mjlab/entity/__init__.py": "2718cbce89ff2c6549d855d096329a72a87d5d77e92daa18b257ee946489cba6",
|
||||
"rl/mjlab/entity/data.py": "03deabf1afc122192f031ef71a328e1443d602801d70da5cefe4b754980cfb71",
|
||||
"rl/mjlab/entity/entity.py": "f0353cfc1e689d6e4cf0dc8d59d26847367cc90842ecebd9bc1a5a3044613eda",
|
||||
"rl/mjlab/entity/variants.py": "f3c3ca5c2712f87a1647b3e9a27bf5d538a6e28a60f3e871ce2d8be65474e41d",
|
||||
"rl/mjlab/envs/__init__.py": "5c41a9f8cfb59196dbd322e81a54df719d74fd30ff4e1e1958b5778ebc9831a1",
|
||||
"rl/mjlab/envs/manager_based_rl_env.py": "e05034969baaa6ca38d7587190eef95d468fd413f182edd2c8d387c2950701f1",
|
||||
"rl/mjlab/envs/mdp/__init__.py": "69d5a26435e69f8636093ef71a977bcb4f45ded4a4277c80c60defda41be1da9",
|
||||
"rl/mjlab/envs/mdp/actions/__init__.py": "af023e77e5e624d86121742acab67a3eae2d67a7d2f1c595c9a59ba168386859",
|
||||
"rl/mjlab/envs/mdp/actions/actions.py": "9cae83a2b0006320a8e15e040a0edbf5b4ae76d023832563f1ac36630f3b28d1",
|
||||
"rl/mjlab/envs/mdp/actions/differential_ik.py": "b8b9654921afb7a46abb57719e2429c2274653296ea345469df7b92bc101124d",
|
||||
"rl/mjlab/envs/mdp/curriculums.py": "844336b87cf71dfc6d6e60ba8001fdae42736deb9c8cd3e2cb81c1af0f7cb652",
|
||||
"rl/mjlab/envs/mdp/dr/__init__.py": "633547b48443bffb3e0a04db289559e684e7c75b6c7becb069a82886930b04e1",
|
||||
"rl/mjlab/envs/mdp/dr/_core.py": "166781592b42e07845acb9e836036b57d377c9b2ef8bc062a7059f6e3b5da41e",
|
||||
"rl/mjlab/envs/mdp/dr/_types.py": "0dadb1cbf88bdf97cd92f636742715520cc5d27c7a6b0a2863a1be703c8c044b",
|
||||
"rl/mjlab/envs/mdp/dr/actuator.py": "20ecdff1cb0d590726b1f5ed9d4e9d1de5a6380ca51ec7b05c0cf2ce34812b9f",
|
||||
"rl/mjlab/envs/mdp/dr/body.py": "87a1135a03648880438270467301ff78b47297d1ec74755734b0859c12f6e15d",
|
||||
"rl/mjlab/envs/mdp/dr/camera.py": "ee102f4a08fe984765cd6744c44b9a9a50f99229abc498002338b992835b38db",
|
||||
"rl/mjlab/envs/mdp/dr/geom.py": "634dfe88eb5118d48708b9851cb42e9c9b38bf83b2f11b194686b644806f66a1",
|
||||
"rl/mjlab/envs/mdp/dr/joint.py": "8ca0f9626b5c8b5fedb57013d3ed229ca00fa397378cfde329ebbfe1b2617e19",
|
||||
"rl/mjlab/envs/mdp/dr/light.py": "26bf5a2209bd381319bff624b572918b5966e18c876851cccb0f7b0032710b24",
|
||||
"rl/mjlab/envs/mdp/dr/material.py": "582ce46c775deb750648970c279fc0f7a3c0e8d021d99286fa27bb571b5c4b45",
|
||||
"rl/mjlab/envs/mdp/dr/pair.py": "d1f99a5f200ff29da98761330a00a6e4cda9cc8073191697fc85b4ce0b46115d",
|
||||
"rl/mjlab/envs/mdp/dr/site.py": "a3ed4a1d072a7417653d37f5ddcd8474278901b57f5309d0955d335985bec694",
|
||||
"rl/mjlab/envs/mdp/dr/tendon.py": "eaf357196128be8c06af0e79715981509bd08ae427c367cdb0c6564c8f5ce42e",
|
||||
"rl/mjlab/envs/mdp/events.py": "922a2475e58fe5ef15bb8a4dbae43608b874b9fb25cf12c0d794e6682ef646ad",
|
||||
"rl/mjlab/envs/mdp/metrics.py": "5a0d5582aa7fe8c2d530dc5afdf151eace17d529429176a2fbff003d7d60e1ba",
|
||||
"rl/mjlab/envs/mdp/observations.py": "610b2682fada5fbd7784416e53ba3375cd9e480542737ee4bd5b1f5af79b4b72",
|
||||
"rl/mjlab/envs/mdp/rewards.py": "9a5908d02ee9ab05390961f70d021fb5762c03db53413b2bbe1fe8ce0699697a",
|
||||
"rl/mjlab/envs/mdp/terminations.py": "3c0d64bdc9aa69d8fd372f343e47ab6f9da59a77d2efd8e3d860eff2c1ebf68a",
|
||||
"rl/mjlab/envs/types.py": "9508db1d92998c2465bd24ff24b6966f5634a7b0ad7ecb0fcdb9df6e6fdf93d0",
|
||||
"rl/mjlab/licenses/IsaacLab.txt": "df351ebfa8af317bf5a9ad83df63a8b68e4f5c04b71f30767cdb27aa434eac62",
|
||||
"rl/mjlab/licenses/mujoco_menagerie-i2rt_yam.txt": "dc46c3a7dc48221aa783e634d15db0f816ba83ba5cdb77bbaa91525c61c7552f",
|
||||
"rl/mjlab/licenses/mujoco_menagerie-unitree_g1.txt": "98335465f43a20b5850e4651db6e74c4aa1e9fc8e8813d38f345178045c0da50",
|
||||
"rl/mjlab/licenses/mujoco_menagerie-unitree_go1.txt": "2b794acf1e250f5545ae5a47d81e5685ea5488ce077d1087ed8be5f81e9ba5c0",
|
||||
"rl/mjlab/managers/__init__.py": "6fd6c581b1f283290e1e03d8a9feb5516a4e505763885e870ea47af38ddf20ae",
|
||||
"rl/mjlab/managers/action_manager.py": "fec79f933fd9437dc9fcb784e4f214b9bae4aad2252c2d2d1387b11b605a5332",
|
||||
"rl/mjlab/managers/command_manager.py": "e9cf2e6697722af77fa32060844819287e3a12fffb091234514b74c18762342a",
|
||||
"rl/mjlab/managers/curriculum_manager.py": "cc34f5b0897ac148d1a51503a63d987e8b549549fcb1713cd35c12e20147cf0a",
|
||||
"rl/mjlab/managers/event_manager.py": "c8d74e87aab629238ee6b4d0cb458e97a6938670fe492f76ce74bc0488401689",
|
||||
"rl/mjlab/managers/manager_base.py": "90dedd602785e8a439a2eca5789137bb128674d181709a1be6ec42901a0326cd",
|
||||
"rl/mjlab/managers/metrics_manager.py": "5c1f24e75fd21220b5c96f974127568150ce6e9ee16d0abb97dcd933173f6723",
|
||||
"rl/mjlab/managers/observation_manager.py": "1be6b23b36b595e359f4b7d055dc51f59885579fc904767b5aa499f08e6d14fe",
|
||||
"rl/mjlab/managers/recorder_manager.py": "9c30862b75b2c2a77b49f331125be382912099147c6ae982aa682a58ce7c3e66",
|
||||
"rl/mjlab/managers/reward_manager.py": "c43705a88730a16b5dc9031367cfe423259fa1d752bf85aa20165d5e10174f04",
|
||||
"rl/mjlab/managers/scene_entity_config.py": "12f0ac1baf8894a6435b2733f148cb0282dab561e481e657e7324a40c1e7fe92",
|
||||
"rl/mjlab/managers/termination_manager.py": "87cc51aa9738e6d137ee936317d76d0b7472c24c58776b4f99dd1bde81d29a6a",
|
||||
"rl/mjlab/py.typed": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
"rl/mjlab/rl/__init__.py": "d67a01c3df70b1d481498bf8f258c3c7f589e9d163605a7dc70fee83e9189597",
|
||||
"rl/mjlab/rl/config.py": "7d391cc0d7a37a4f86c3c4f4a0adc6d75c546273085feed0ddf597aedba6134a",
|
||||
"rl/mjlab/rl/exporter_utils.py": "4841e3c17518e51286670d6e5e7ff11ec0faec12a6555216312d442f9c1c33be",
|
||||
"rl/mjlab/rl/runner.py": "61e9200bf304e3df71096cd69f28f4d5973157e61cdc549fc21b6f156326f77e",
|
||||
"rl/mjlab/rl/spatial_softmax.py": "413922be88fe797c528f59409f9975979cd1886d8ed51b17e28b9377ceadec7e",
|
||||
"rl/mjlab/rl/vecenv_wrapper.py": "d458aa421d72c979d0269a24e51a4b49a02e4ec8cb5a9d10e47290aa5d86a3e2",
|
||||
"rl/mjlab/scene/__init__.py": "ff411f5da07d192bd797040453398eb68f5577c35e41b1e8f41aef58a02b9610",
|
||||
"rl/mjlab/scene/scene.py": "42893e03dc3cc3ad2199831f5b70331bfe8be56cd0b785e07b8dad6b8fb73897",
|
||||
"rl/mjlab/scene/scene.xml": "0fa9355112e117328986cda47e4fbf4f5d47904b7fccb805d70dccaccdd038a4",
|
||||
"rl/mjlab/scripts/_cli.py": "bcb1f4394126ee112578c905fb4ba89d8f8e67c9e7df55205e0c425ab3759219",
|
||||
"rl/mjlab/scripts/csv_to_npz.py": "ea412e75427b61150eb9a8bb72bdbc0ecb0c42b062538195cf360cd53cfc2d7a",
|
||||
"rl/mjlab/scripts/demo.py": "b20dec8c1e9c71fec5929294d242ea34a9e2fc7f81fb384346b13a5dcfa6917a",
|
||||
"rl/mjlab/scripts/export_scene.py": "da4519902a6e31a7883105d596521fd4db0bb1a14f55764c603e944a2ee2469b",
|
||||
"rl/mjlab/scripts/gcs.py": "521bfdbd95156026ec568a11e3da24caab3826d9ece8852d3a8d015fc6d82143",
|
||||
"rl/mjlab/scripts/list_envs.py": "0fd1214a8be3e0e757a620f4d547b6b733dee1203aac053c3e4bcf31bdc32e91",
|
||||
"rl/mjlab/scripts/nan_viz.py": "2766d372e6ae5f2250b2b781e1307a3ec26f87d7884a1a28a56b016a10aa0826",
|
||||
"rl/mjlab/scripts/play.py": "606f537c568247c5e9ba2e94ac1a197675411b360fb1db3231f1b46710539456",
|
||||
"rl/mjlab/scripts/train.py": "25da18c990b2267dfa14db97b10397caa089fe9fafa071a614e166cbb75af0f7",
|
||||
"rl/mjlab/scripts/visualize_terrain.py": "8e260e01a2abf5acb1ca73f26e9e9aef668132a4bb2b934730ea44b95317c588",
|
||||
"rl/mjlab/sensor/__init__.py": "7961da9847ef0fe23e107bccf0b795cda90008e456e7dc85dfed000f86bfb332",
|
||||
"rl/mjlab/sensor/builtin_sensor.py": "401e495124fa96a89c87cd510da8f43c693db3f9110b93000dcb515171e57adf",
|
||||
"rl/mjlab/sensor/camera_sensor.py": "52e9761f838a224ea71c276aeddc11af47bee7050664fe0a88ede724471f1597",
|
||||
"rl/mjlab/sensor/contact_sensor.py": "8b55ab0d6a21d0256e2fc29187c00cbfe4412cd08993050386c6a1f08197fac7",
|
||||
"rl/mjlab/sensor/raycast_sensor.py": "9e714ac82a7916d1c9bc0f7c15fb209834a5c2b3c6198e4dc3f4c172127263d6",
|
||||
"rl/mjlab/sensor/sensor.py": "c700983150dbd74fbceec7486b842af4dc8917a251af0277436aee09a69dd077",
|
||||
"rl/mjlab/sensor/sensor_context.py": "9cb90de6639bcaf38756a584ea9c34f6b35626a5ccaa4a44a3db435f8a7600ca",
|
||||
"rl/mjlab/sensor/terrain_height_sensor.py": "18a7b190a01fe57cf1e2dcf597dedc3da410eef1d571f4ae000edb6a68e5d692",
|
||||
"rl/mjlab/sim/__init__.py": "6c7e8c6d5bd848c06b243d54522ca446a94e023235c0c8cb8dd53e13551cf3e2",
|
||||
"rl/mjlab/sim/randomization.py": "96762d28662fea35c410245df8281fd45794ace4b69a2765f873d4c285dece94",
|
||||
"rl/mjlab/sim/sim.py": "73ba9898c14cbac674e1e08cec0bdac8e22289c84d17c783e67daefcbc7709b8",
|
||||
"rl/mjlab/sim/sim_data.py": "fe0191280f56e6a51c39f94363c1306d9dda65588a05a96177f6cf2ff8578667",
|
||||
"rl/mjlab/tasks/__init__.py": "310ff3bbeed45f4792394e36ff98eb4b5b70e0657c2e5ef67dd363d510133d9b",
|
||||
"rl/mjlab/tasks/cartpole/__init__.py": "161dd6cccab68333cd14fa206aba646b78ea2fb0ed191e59bdc943f9e761bd5a",
|
||||
"rl/mjlab/tasks/cartpole/cartpole.xml": "c4adb6759cea1f380d8b20c067339976ca21a5d824a515a3cd5f75e0969bdbe1",
|
||||
"rl/mjlab/tasks/cartpole/cartpole_env_cfg.py": "4523135d867e3ba3492147d056c3916f1db427d57866f57e9ac0a8f3bdaec7bc",
|
||||
"rl/mjlab/tasks/manipulation/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
"rl/mjlab/tasks/manipulation/config/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
"rl/mjlab/tasks/manipulation/config/yam/__init__.py": "9f5978bf241f6890a2b64459c8b365818ab22068c1100b0f97d1de67a64af36c",
|
||||
"rl/mjlab/tasks/manipulation/config/yam/env_cfgs.py": "d6358310e5a97e3d0254b249b6e19be9a1e30e42ed8ef348f3a0d6c11fdd7b5b",
|
||||
"rl/mjlab/tasks/manipulation/config/yam/rl_cfg.py": "c013e8f318d51c3cacf6198986dcd5c3781d10a618165d9681b54e9975d25cbe",
|
||||
"rl/mjlab/tasks/manipulation/lift_cube_env_cfg.py": "093b235694fb99d8c2bea79f9bf1ad0bc3078f0c97b981b46b8c10488206b390",
|
||||
"rl/mjlab/tasks/manipulation/mdp/__init__.py": "02b2ea12a27078ba3ab5c444da0cdb461a765b0fec17f06d9120c4f767568802",
|
||||
"rl/mjlab/tasks/manipulation/mdp/commands.py": "a8f9ccb2040f8e82452d4c82c1d7caedc41b4e1cbdac740da16202c2d0e26c26",
|
||||
"rl/mjlab/tasks/manipulation/mdp/observations.py": "ef3a2dae26b4a626990474881d2daef485c9c7c26b78b0e873430767a2f04065",
|
||||
"rl/mjlab/tasks/manipulation/mdp/rewards.py": "716b20339ffbdfdd839b28f855da257ff3cada2db587bfed995fe483f3674345",
|
||||
"rl/mjlab/tasks/manipulation/mdp/terminations.py": "8da09eb99b1365c7e6bd5f7cf68e6b77a57da2c93975b265d6f211c757186186",
|
||||
"rl/mjlab/tasks/manipulation/rl/__init__.py": "52e7cb371a86b6f62d3d0df8ad4fe6ac08875858b2e0ae11d33ac401935628f6",
|
||||
"rl/mjlab/tasks/manipulation/rl/runner.py": "c9c43b3b8aebc444d655f40a5caa1ef145a8ce48745b7f08ce53eae1bd09ec37",
|
||||
"rl/mjlab/tasks/registry.py": "f1c82c8f1ff5d24263787f4cfc2805b7b4103253fe59c054bf649d24c7cc9476",
|
||||
"rl/mjlab/tasks/tracking/__init__.py": "269e19fac2c24adc6064d7c868741fa265f12d78ca07dd12ef7333febde21adf",
|
||||
"rl/mjlab/tasks/tracking/config/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
"rl/mjlab/tasks/tracking/config/g1/__init__.py": "fe1f3b8b0fb27d8a353f7d5875b1624c3bdbe04802e2f65c56231b3ccb72e590",
|
||||
"rl/mjlab/tasks/tracking/config/g1/env_cfgs.py": "ce67f0a0e4f8246aa13e7a1e855b30cbd5f5c40fec7ee8ee1c92ddf72ac44d50",
|
||||
"rl/mjlab/tasks/tracking/config/g1/rl_cfg.py": "88a8a0acc8052a4bb64957a93ab2a88fa345ee84f63e405ffc6fa70148c6e104",
|
||||
"rl/mjlab/tasks/tracking/mdp/__init__.py": "1c2637ed117786d35fc7a8b72fa36e11134268d8a2aaefa7109ed826c7eb75bf",
|
||||
"rl/mjlab/tasks/tracking/mdp/commands.py": "b8700e65bb519b5e68962216ed78a107f6a3c02bab2ff75854e62b1983d1ad97",
|
||||
"rl/mjlab/tasks/tracking/mdp/metrics.py": "d13a3af779454b911eea976e01115d11f35da64f14c8cf3a83c8a9b934f4c23a",
|
||||
"rl/mjlab/tasks/tracking/mdp/observations.py": "af2cf6613d657529455eb254c7b13892ab67a0cf8ea5aec2d4df5fad6b4a5330",
|
||||
"rl/mjlab/tasks/tracking/mdp/rewards.py": "fd7ef49a8015ca19c12586c6b87afca8c8ee7c03c3bb4b3f0a4b58c1dde6c7d4",
|
||||
"rl/mjlab/tasks/tracking/mdp/terminations.py": "5f88576b5995408a744cde451c7e43982d2f03284cfeebb8856969ca3dc76019",
|
||||
"rl/mjlab/tasks/tracking/rl/__init__.py": "95fe9fdc0cf223f6415d67607fbd4b2c6653df184cbb15f36403d0cb5ff7052b",
|
||||
"rl/mjlab/tasks/tracking/rl/runner.py": "978b6f1c783d67bafd942d8790f1021108054441cdd6dd59be3f1c14262d705f",
|
||||
"rl/mjlab/tasks/tracking/scripts/evaluate.py": "6ca116e3d5273f39acac3117e68871952c55a000c236e4dbcd762035cc99d742",
|
||||
"rl/mjlab/tasks/tracking/tracking_env_cfg.py": "631b446ffc478c170ce5ef2a1a74b766e963f13a660f78b168060cd425cac243",
|
||||
"rl/mjlab/tasks/velocity/__init__.py": "479a0ae48d56e95521d9cfd6ccb3bbcebc2bf985355d96879ce3a50d20a142ea",
|
||||
"rl/mjlab/tasks/velocity/config/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
"rl/mjlab/tasks/velocity/config/booster_t1/__init__.py": "1a612197876f9187ace170cfd2e7c84f0e23232d5bfb578350185ca8e5e6eb40",
|
||||
"rl/mjlab/tasks/velocity/config/booster_t1/env_cfgs.py": "eb2d8707af01380de8f718585b92912861f9e2172dc06fcfbaddd0e51baa1aa3",
|
||||
"rl/mjlab/tasks/velocity/config/booster_t1/mdp.py": "14342b21816900df66c61223b9752f60ce383219abb411ce439ff24481e1d690",
|
||||
"rl/mjlab/tasks/velocity/config/booster_t1/rl_cfg.py": "eafeaa715631bebb0cfbaf46e91fe299c66f62d3671726135911379010706b90",
|
||||
"rl/mjlab/tasks/velocity/config/g1/__init__.py": "f4482cf1f1bb27989b0de3f1f45c0c1568185a632c9eb36cc18595cf95ac79cf",
|
||||
"rl/mjlab/tasks/velocity/config/g1/env_cfgs.py": "5d891ef40987118d1bb2d4bb8791922387d8fdae22752f1e1420dc31f4ddeabf",
|
||||
"rl/mjlab/tasks/velocity/config/g1/rl_cfg.py": "dcf4a23e031064085e081798c4d3b5bd1cda6ec58ad0081907f2e72c9142a131",
|
||||
"rl/mjlab/tasks/velocity/config/go1/__init__.py": "9688ac3d4f925a59fcdfe5870753fb52ffc62c6944bb259bae6a3b7143f908cf",
|
||||
"rl/mjlab/tasks/velocity/config/go1/env_cfgs.py": "3fe9a3f2882d0bb627c791fd009447911bf02dcb977d739ee87c26355909a7af",
|
||||
"rl/mjlab/tasks/velocity/config/go1/rl_cfg.py": "ac9744e0a2c11db9e60f819c0e8423e6479e094c4aaebe189a6965b06bb90f63",
|
||||
"rl/mjlab/tasks/velocity/mdp/__init__.py": "231f35d88929e89ae17dbf403b6d049dd9f1f8bba21bfaf74a087bb9435e7dfe",
|
||||
"rl/mjlab/tasks/velocity/mdp/curriculums.py": "60a857b7e3456f48ba0ddcc33a70c154998a04ef215dbd40200cbdcdad4cea8b",
|
||||
"rl/mjlab/tasks/velocity/mdp/observations.py": "4e56cefa6481c42e641902cc124cfdd02c3c92b45d8b294253aad0fc87ec9134",
|
||||
"rl/mjlab/tasks/velocity/mdp/rewards.py": "da3a7b51d5d5c8c67493714e0a26ad29adc7c159e8df875f88bd4bcf5e1de4d4",
|
||||
"rl/mjlab/tasks/velocity/mdp/terminations.py": "afebaf4170ed51e44e45626ed32e295d29dc43e96f93ca82ccb7b5c0c2c873cf",
|
||||
"rl/mjlab/tasks/velocity/mdp/terrain_utils.py": "cb03bece16e1848746738404a4070454c4f753261b1c6537dfb1549c3ef7e627",
|
||||
"rl/mjlab/tasks/velocity/mdp/velocity_command.py": "f20680098726b4f2811a02cbfe3391c946a493ef4536432762b63778e8a81231",
|
||||
"rl/mjlab/tasks/velocity/rl/__init__.py": "998d67bb2c79979ed2999b14c74231e39a6d018f97c5429405b2991c36cdffa5",
|
||||
"rl/mjlab/tasks/velocity/rl/runner.py": "05c396737a75720c09ea4495b6b500a5a21e66d9bf60162a2353245d54b5a91e",
|
||||
"rl/mjlab/tasks/velocity/velocity_env_cfg.py": "8a272a8b3c81c4a0321027e404645c99a4143076522ed3521636bf293dd3137b",
|
||||
"rl/mjlab/terrains/README.md": "2cf265575a9b76418306a1b4a3c053c3a4c04e181a6b37130b610efa22113021",
|
||||
"rl/mjlab/terrains/__init__.py": "76c3c30dcc3027e9f8fc7929d9f473db22022eb2fc6cf68dcda556b74e30389a",
|
||||
"rl/mjlab/terrains/config.py": "3005acad2ae9420be19c0c3c6a8954a190d70cbf19952e86e51c1ce7ba5d06ab",
|
||||
"rl/mjlab/terrains/heightfield_terrains.py": "98ae7a098ac55a59c0958e3f040e1603395a87c643d93df89b7a44c1105eb08e",
|
||||
"rl/mjlab/terrains/primitive_terrains.py": "8c526781a1e757fa7af1e165283d9b03f059298fc6704f4f147fdafaf60fd4b7",
|
||||
"rl/mjlab/terrains/terrain_entity.py": "272a6e1c39f4221ded391f75792982c31f6ede8f44393f8a705d6acf83be9ca1",
|
||||
"rl/mjlab/terrains/terrain_generator.py": "7f390739f8d074ce9b02b3e2df3d79780899b83096f9efa339d987aa533a4e65",
|
||||
"rl/mjlab/terrains/utils.py": "a2a1650176f084b447d7c3a6a704dae17bc3a7c050f0cf4aa800c8430f64aa94",
|
||||
"rl/mjlab/utils/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
"rl/mjlab/utils/actuator.py": "064435b65ac6f6c117c351882652ebe00a9cb36523d82f94a6aa9502276b1fbd",
|
||||
"rl/mjlab/utils/buffers/__init__.py": "bfe46ad1bdc8c29555f2f6d675e703d91b4698d1cc735d90ffb86d23b120a929",
|
||||
"rl/mjlab/utils/buffers/circular_buffer.py": "90713e0d41615b627337bfd245761e47f5650fa7373011cc6bfe0eaeb8b71809",
|
||||
"rl/mjlab/utils/buffers/delay_buffer.py": "c9ab3fca0d384dce6d28478c8b0c1e48fc2a85b2a5180c4a392aa6937717b4d7",
|
||||
"rl/mjlab/utils/color.py": "ac8c048df0c21ba48558f048d31a4298595105d02fefa1940b226d86f2188ef9",
|
||||
"rl/mjlab/utils/gpu.py": "73995a8a2f38323463101e2db2621173682709d4347d610a94f62cdccf3c6e7a",
|
||||
"rl/mjlab/utils/lab_api/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
"rl/mjlab/utils/lab_api/math.py": "85e267ee202dc8dc2b340be07ec7abe9b10da9b82c3bf33e16889f422fcf9ca8",
|
||||
"rl/mjlab/utils/lab_api/string.py": "d0edaedbb1c0a6fed7dd4a72e1b0d8e7f2aa149bbc1ebc52547405e6f669371d",
|
||||
"rl/mjlab/utils/lab_api/tasks/importer.py": "350f36e86224bcbec60bf427cb53c5fa1de111b34e3c489f3ab67ba766c7839d",
|
||||
"rl/mjlab/utils/logging.py": "cbd7d5dceb22b84edc27a782925d080a0df2ee776df69d9df3d30c99af1a2200",
|
||||
"rl/mjlab/utils/mujoco.py": "879b8109e03c4a32143899be4648ef02aa57125a40b36658d1fb361dd74216de",
|
||||
"rl/mjlab/utils/nan_guard.py": "b3ba9d2c3f34c5e8f1c5249e28699141bd389971eed41cf8d05e0bf5f3199943",
|
||||
"rl/mjlab/utils/noise/__init__.py": "cd43d801881ad37bc9d34c5263cf1f0c4aaad12355b1a565dfba5d2a722fd958",
|
||||
"rl/mjlab/utils/noise/noise_cfg.py": "1132aa0bc88f498e5641504e9d79a26545513b123a526c91f61d5823693d54c8",
|
||||
"rl/mjlab/utils/noise/noise_model.py": "1b6caa33ad612e512027072365ac2ecd3e761ae470cfff38ea945a7763da76bb",
|
||||
"rl/mjlab/utils/os.py": "8364587683fd9c062e85a40302ed792b8ace389f64b6e0ebd5ec4dde1a9f6241",
|
||||
"rl/mjlab/utils/random.py": "5ba445435efa5f064aac4b572d035c6a6e98ca3ce459faf1f00dc6f73cbabbc8",
|
||||
"rl/mjlab/utils/spaces.py": "42eb28b6a48b06886df1c6b385243d340b14f89e71c0e407fda54e0907a53a60",
|
||||
"rl/mjlab/utils/spec.py": "585b3fc90df15a12984b58e9fbc657950344a3cd45438fd73e35544c6d983719",
|
||||
"rl/mjlab/utils/spec_config.py": "ac8cd1c7ec64a079d91a27b9f51c0dd4ded4cb7abf0fb85df1cca5acf5d6abcb",
|
||||
"rl/mjlab/utils/string.py": "702c5ee5bc6b9a3fc5b27a1419daa0653301494bda9f7e5981eda898a601f8bc",
|
||||
"rl/mjlab/utils/torch.py": "4ba058efa94cc779d2de54db969465338f365372b59943417bbce9193bf33536",
|
||||
"rl/mjlab/utils/wandb.py": "f70e9108282c6fe115218ec0f5b6fcd0dc9f69b5a945ac2fe43f2e73fb47f155",
|
||||
"rl/mjlab/utils/wrappers/__init__.py": "bd180f557c3fff4267fab0a7cc838c792a274b4f5d5e6590a3b694d2cad55fe6",
|
||||
"rl/mjlab/utils/wrappers/video_recorder.py": "1e1dbf62726c711c0b4bd51c523ff0d89435a909a4a28f151c6a9ba959cfd29d",
|
||||
"rl/mjlab/utils/xml.py": "5976ce00b501a39b42ac5605c2ed9bd05ea4feb5fbf1a2d778a1656ec0caaa3b",
|
||||
"rl/mjlab/viewer/__init__.py": "6215875f50dd7fd1459682b707ce82da953f70dbcaedf0d363d55a49679b7d1f",
|
||||
"rl/mjlab/viewer/base.py": "26da5b876828fd72387c351ef74ebe308c83beccae9b006d856780670a7dea29",
|
||||
"rl/mjlab/viewer/debug_visualizer.py": "d96616c4d9f0ace6921350da19fb6d2d011675e67cba32d42510a6b4ba4d1b3a",
|
||||
"rl/mjlab/viewer/model_sync.py": "bb23b1c23192a6c4f81364a45e8e0fc32c846d98fc1ec1b438fb1646748afd5c",
|
||||
"rl/mjlab/viewer/native/__init__.py": "1cc4c390f38e36f2f708330fb39695a789d6ff5557503e5af64862ab2c29f928",
|
||||
"rl/mjlab/viewer/native/keys.py": "30cf4d7872f7af74d9c8238289d22c6ffca82a56767debe54f4074ec41db9cf9",
|
||||
"rl/mjlab/viewer/native/viewer.py": "95149f0266a546f9a9ba11215a6f13dcdafbe8324f38d07bbca49234d96a928c",
|
||||
"rl/mjlab/viewer/native/visualizer.py": "4d91ee004f502740e726d44469073b1a2ab5dc5b94927ead0ab5a7cb9f6fd85a",
|
||||
"rl/mjlab/viewer/offscreen_renderer.py": "4f8ecc4552413529b4559ea8112211f23603f78a091dd6491e75e324258660a6",
|
||||
"rl/mjlab/viewer/viewer_config.py": "8040b01ebf951c59f56ec73f965cb9555b03dd11f711de49210c38109bb23154",
|
||||
"rl/mjlab/viewer/viser/__init__.py": "ea76203023f96327501a320fe3012632d0bee61174152beb98fe3cb556ed71c0",
|
||||
"rl/mjlab/viewer/viser/camera_viewer.py": "b60f0ed335e40f018847f172ce7e0f70c8ba152d61e2f25eda7092ac1e7fbca4",
|
||||
"rl/mjlab/viewer/viser/overlays.py": "f6184f1571964fbc94c81a9a607548b4a7d691e54c72ca74e06cf978f9a2eb56",
|
||||
"rl/mjlab/viewer/viser/reward_bar_panel.py": "bff4194a48f6deaf929ee4945d670d73946bb302e13bddca782179f6ec6a4872",
|
||||
"rl/mjlab/viewer/viser/scene.py": "107bbbf30da399289161c9815ed6dd53d4e2aa889f56eb32dde822f734bea0b2",
|
||||
"rl/mjlab/viewer/viser/term_plotter.py": "4b2694fb5633fae6c01e71cf5e2c05a68ad2e5bbe6579f9339296572b6c5371d",
|
||||
"rl/mjlab/viewer/viser/viewer.py": "8f11f8a13f6240178dcd5ea00df7ca387fe9e136cef839393d8ebfd93138b17e",
|
||||
"rl/rsl_rl/LICENSE": "3f58bb6b9272e416b8ccbe65889463f75a2fdf66e0e5722513f8622fb23dc778",
|
||||
"rl/rsl_rl/__init__.py": "9b4c420fef3ae39683544833b6d2efbb26aecfc0583ec59be7f4eeb748fecf66",
|
||||
"rl/rsl_rl/algorithms/__init__.py": "e370271e689bada5cdf2b4623e0d16d75e8439864a2ae913b22215f7b2985843",
|
||||
"rl/rsl_rl/algorithms/distillation.py": "3d9fb8e010346ab42f3f4a84584e7e175a7632b39700e7778d0a01746a6317a7",
|
||||
"rl/rsl_rl/algorithms/ppo.py": "01a82cea45fa9d8ccb161bd75e07d8623d25450ff92982e9c9d59ca8a9b78393",
|
||||
"rl/rsl_rl/env/__init__.py": "33bfc9562580377c2ce6388c37b0df2b8e992c22ce46923443681cbbf1960d60",
|
||||
"rl/rsl_rl/env/vec_env.py": "4a72df2fbf9b3e162e0e4b10e0b473511f02ad8c3ebaab0b7993ddfd63a9fa43",
|
||||
"rl/rsl_rl/extensions/__init__.py": "20dc79170fb9777b7267abe4296b5c22f4b417d5a18c4346fb8159f9d4aea62f",
|
||||
"rl/rsl_rl/extensions/rnd.py": "7ff5a34f54bcfe8e9494cf5c27155102b6f50c9b10dff49f7a1d98f32e6e16ca",
|
||||
"rl/rsl_rl/extensions/symmetry.py": "4121d8804c9555118f031f604bc5232c85db0b41ce8d8295a5a22b85190b4048",
|
||||
"rl/rsl_rl/licenses/LICENSE": "3f58bb6b9272e416b8ccbe65889463f75a2fdf66e0e5722513f8622fb23dc778",
|
||||
"rl/rsl_rl/licenses/licenses/dependencies/codespell-license.txt": "8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643",
|
||||
"rl/rsl_rl/licenses/licenses/dependencies/furo-license.txt": "f68043bb5f4701df244347c82cd2fe24741a56c56a767a1d02bea053670a1ec4",
|
||||
"rl/rsl_rl/licenses/licenses/dependencies/gitpython-license.txt": "b63a4621e0151014fea8bf668b04c9fd633ea16745d5041a29594ebb12a97ba4",
|
||||
"rl/rsl_rl/licenses/licenses/dependencies/lucas-c-pre-commit-hooks-license.txt": "6465878993b3f6bbec852eceb213d8163731a637f3e422707377aadf557590f2",
|
||||
"rl/rsl_rl/licenses/licenses/dependencies/neptune-license.txt": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4",
|
||||
"rl/rsl_rl/licenses/licenses/dependencies/numpy-license.txt": "c17011467b4fe6e20fbfbeda4df09e58c2bca5480a063e55735a4000a379aad9",
|
||||
"rl/rsl_rl/licenses/licenses/dependencies/onnx-license.txt": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30",
|
||||
"rl/rsl_rl/licenses/licenses/dependencies/onnxscript-license.txt": "2f07c72751aed99790b8a4869cf2311df85a860b22ded05fa22803587a48922c",
|
||||
"rl/rsl_rl/licenses/licenses/dependencies/pre-commit-hooks-license.txt": "ea2ca27cba7cc35822d95a46d59bcd3cc88e196592e6390d1949a359ffc990e8",
|
||||
"rl/rsl_rl/licenses/licenses/dependencies/pre-commit-license.txt": "ea2ca27cba7cc35822d95a46d59bcd3cc88e196592e6390d1949a359ffc990e8",
|
||||
"rl/rsl_rl/licenses/licenses/dependencies/pytest-license.txt": "ca836a5f9ecca3b2f350230faa20a48fb8b145653b5568d784862df864706b9b",
|
||||
"rl/rsl_rl/licenses/licenses/dependencies/ruff-license.txt": "aaa18222a10861f3210e4c843794bf87cc56ce62f6732caa52b9525c2117ab25",
|
||||
"rl/rsl_rl/licenses/licenses/dependencies/setuptools-license.txt": "dc0589ce4ab317782b1bfe5b24d1a3528eed3c028be8f197c516997c777cdd0c",
|
||||
"rl/rsl_rl/licenses/licenses/dependencies/sphinx-license.txt": "98eac23a35c127d59613f757846b6af90cd4137bbdde8bc3feaf38e28e92f913",
|
||||
"rl/rsl_rl/licenses/licenses/dependencies/tensorboard-license.txt": "edba09b5279dd73272b22c60479221736076dc3866352712db760cc8179061a4",
|
||||
"rl/rsl_rl/licenses/licenses/dependencies/tensordict-license.txt": "c5d8d2e3fc64f88c272ee2050af4d84e5f58f1a5d17a3aa99a47b77466a6fe72",
|
||||
"rl/rsl_rl/licenses/licenses/dependencies/torch-license.txt": "6f598239866f2794b1170c870217a604b6acc98d4aeb4694d1a2f855da1f289c",
|
||||
"rl/rsl_rl/licenses/licenses/dependencies/wandb-license.txt": "8b338a449a463b1d4fac988638a4741ec35d941e49747d9dd19e0fedaeecb137",
|
||||
"rl/rsl_rl/licenses/licenses/dependencies/wheel-license.txt": "30c23618679108f3e8ea1d2a658c7ca417bdfc891c98ef1a89fa4ff0c9828654",
|
||||
"rl/rsl_rl/licenses/pfrl.txt": "1d68cbdc99c9967f63a588ff73fb59461882b21508fe2f91a22f5cf3a4d7ef65",
|
||||
"rl/rsl_rl/models/__init__.py": "6444fc1df8bc94d40ab1911f0e8e6b3f777459986e7f7944d25b7e5ca9b3e206",
|
||||
"rl/rsl_rl/models/cnn_model.py": "bc8119274d2058f0abe3482563e6e391aba312fa19c59d961413cfe09f4b0d93",
|
||||
"rl/rsl_rl/models/mlp_model.py": "86a8ea5c77fdae8167b84d817e5280fe226bf15d2aafab8455c6366155ab2eee",
|
||||
"rl/rsl_rl/models/rnn_model.py": "80c1d6452ef021e4d7b174231ed7abac1ed0db8de9604561f8060148d4333ccc",
|
||||
"rl/rsl_rl/modules/__init__.py": "336085b45fb1e4a807f29cb2703b63f933cdf2c2ff00279cef3cfed14bdccc49",
|
||||
"rl/rsl_rl/modules/cnn.py": "4f5bab5f192c42180125f32a4af350108dd1c247e1e84c81f6cf4ea560037ccf",
|
||||
"rl/rsl_rl/modules/distribution.py": "ef490fac4baa8a6e6c2b6541cddd4c17f8838097c4298fc7c7efdfefa119941f",
|
||||
"rl/rsl_rl/modules/mlp.py": "bad934b364b26cd47b6d1612e00ace107a425ae4d272c0cd0c82cbfc57bbcdbc",
|
||||
"rl/rsl_rl/modules/normalization.py": "67a70c88b540f212759c6e6c023aed41321ea9ad949e5faf428670fafbdf73bd",
|
||||
"rl/rsl_rl/modules/rnn.py": "07f0eec06c7f2638edbdbc3ba25f56122a7941cb0543138f4a6b04675b2a97e6",
|
||||
"rl/rsl_rl/runners/__init__.py": "26f4130a403414e13041b62a848d04da3fb0166757603950ea758b151d4b5aaa",
|
||||
"rl/rsl_rl/runners/distillation_runner.py": "7445cbaf3e1fa241d742447ab17d941a659c92b6f8365ef22c5d818923d9e275",
|
||||
"rl/rsl_rl/runners/on_policy_runner.py": "c2dbe47974b047e6992e37ff39ac0a236c8fa5cb595cb9e1715e1344e81dc852",
|
||||
"rl/rsl_rl/storage/__init__.py": "7c9d96df3cad10aa27f34e77f7105a29f74e2d7dd10467b2919f99867a69298e",
|
||||
"rl/rsl_rl/storage/rollout_storage.py": "d2728ab2cbc280c163a3d33289216d807ac60e1edf41fb85dd09560e966c9b04",
|
||||
"rl/rsl_rl/utils/__init__.py": "b04e7ce7ccbbaefa275930e5ffc33edd84e77364a14d7e5717e6a5cb02338066",
|
||||
"rl/rsl_rl/utils/log_writer.py": "53e9447d4337ab7e2d9f48f6ee8ee07ab865789ff1c722e2bc8b3f44ee247693",
|
||||
"rl/rsl_rl/utils/logger.py": "ff9a592899c6eb803d4a434cef8712aa0424575ac01b13575f3efe2596d4116e",
|
||||
"rl/rsl_rl/utils/neptune_log_writer.py": "971784c3291d7d7dc8e93202fb8d0102fa67214227440569719cbad278c2cf77",
|
||||
"rl/rsl_rl/utils/utils.py": "37e1cf2961d91204633e3d3e46951c3abd695c9c4b48a269cbc97846ac155751",
|
||||
"rl/rsl_rl/utils/wandb_log_writer.py": "69effd6926c8eb7ca4de96d3311e33ccef9cfe8556ca13fec9421e9c8f17ad8d",
|
||||
"rl/upstream/import.json": "4d2a13b00f229418012b5acd9afa26f3d4fb7f0ab611905dce111392f19671a0",
|
||||
"rl/upstream/mjlab-local.patch": "178cb15db535a057fd1a064b58f4658f9b0a35e119b1c08d7e37dbb833e4938c",
|
||||
"rl/upstream/mjlab-pyproject.toml": "2ef132b218db99f26aef59e9df221b520003a83bd7fc4ad0112d9cada2ca9b44",
|
||||
"rl/upstream/rsl_rl-METADATA": "de4a41da7206f3310ea8f1c9149a0a17859e72cdf4ec8e53888e7a89ef7bc9f3",
|
||||
"rl/upstream/tests/test_booster_t1.py": "6c8c2549db932150fb87edf58ff8240fd539f4f90fdb9fb074ae5c8c9349a088",
|
||||
"rl/upstream/tests/test_sim.py": "d6caca50e5e5d86556cd713f3497cd3dcb39a32556738883ea1e5fd08c8ab737",
|
||||
"rl/upstream/tests/test_velocity_command.py": "4ed39d6345958a48d76db11562f64f4d84d5d2099ed391255f9d0dd78173ff99"
|
||||
},
|
||||
"schema_version": 1,
|
||||
"upstream": {
|
||||
"booster_assets": {
|
||||
"commit": "12a97516f57469078707afb587a5f84c1cb110d1",
|
||||
"model": "T1_23dof.xml",
|
||||
"upstream": "https://github.com/BoosterRobotics/booster_assets.git"
|
||||
},
|
||||
"mjlab": {
|
||||
"added_modules": [
|
||||
"asset_zoo/robots/booster_t1",
|
||||
"tasks/velocity/config/booster_t1"
|
||||
],
|
||||
"commit": "8bb2bc9e187797689ec82c78c35019afd2fd0376",
|
||||
"inherited_patch": "rl/upstream/mjlab-local.patch",
|
||||
"upstream": "https://github.com/mujocolab/mjlab",
|
||||
"version": "1.6.0"
|
||||
},
|
||||
"rsl_rl": {
|
||||
"installed_RECORD_verified": true,
|
||||
"upstream": "https://github.com/leggedrobotics/rsl_rl",
|
||||
"version": "5.5.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
|
||||
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 2025, The mjlab Developers
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,75 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Default to EGL for GPU-accelerated offscreen rendering on Linux. Must be set
|
||||
# before any mujoco import: mujoco's gl_context module captures MUJOCO_GL once
|
||||
# at load time. Override with e.g. MUJOCO_GL=osmesa on clusters without EGL.
|
||||
# Linux-only because mujoco's gl_context rejects "egl" on macOS/Windows and
|
||||
# raises at import. On those platforms we leave MUJOCO_GL alone so mujoco
|
||||
# defaults to GLFW.
|
||||
if sys.platform.startswith("linux"):
|
||||
os.environ.setdefault("MUJOCO_GL", "egl")
|
||||
|
||||
import traceback
|
||||
from importlib.metadata import entry_points
|
||||
from pathlib import Path
|
||||
|
||||
import tyro
|
||||
import warp as wp
|
||||
|
||||
MJLAB_SRC_PATH: Path = Path(__file__).parent
|
||||
|
||||
TYRO_FLAGS = (
|
||||
# Don't let users switch between types in unions. This produces a simpler CLI
|
||||
# with flatter helptext, at the cost of some flexibility. Type changes can
|
||||
# just be done in code.
|
||||
tyro.conf.AvoidSubcommands,
|
||||
# Disable automatic flag conversion (e.g., use `--flag False` instead of
|
||||
# `--no-flag` for booleans).
|
||||
tyro.conf.FlagConversionOff,
|
||||
# Use Python syntax for collections: --tuple (1,2,3) instead of --tuple 1 2 3.
|
||||
# Helps with wandb sweep compatibility: https://brentyi.github.io/tyro/wandb_sweeps/
|
||||
tyro.conf.UsePythonSyntaxForLiteralCollections,
|
||||
)
|
||||
|
||||
|
||||
def _configure_warp() -> None:
|
||||
"""Configure Warp globally for mjlab."""
|
||||
wp.config.enable_backward = False
|
||||
|
||||
# Keep warp verbose by default to show kernel compilation progress.
|
||||
# Override with MJLAB_WARP_QUIET=1 environment variable if needed.
|
||||
quiet = os.environ.get("MJLAB_WARP_QUIET", "0").lower() in ("1", "true", "yes")
|
||||
wp.config.log_level = wp.LOG_WARNING if quiet else wp.LOG_INFO
|
||||
|
||||
|
||||
def _import_registered_packages() -> None:
|
||||
"""Auto-discover and import packages registered via entry points.
|
||||
|
||||
Looks for packages registered under the 'mjlab.tasks' entry point group.
|
||||
Each discovered package is imported, which allows it to register custom
|
||||
environments with gymnasium.
|
||||
"""
|
||||
mjlab_tasks = entry_points().select(group="mjlab.tasks")
|
||||
for entry_point in mjlab_tasks:
|
||||
try:
|
||||
entry_point.load()
|
||||
except Exception:
|
||||
print(
|
||||
f"[WARN] Failed to load task package '{entry_point.name}' ({entry_point.value}):",
|
||||
file=sys.stderr,
|
||||
)
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
|
||||
|
||||
def _configure_mediapy() -> None:
|
||||
"""Point mediapy at the bundled imageio-ffmpeg binary."""
|
||||
import imageio_ffmpeg
|
||||
import mediapy
|
||||
|
||||
mediapy.set_ffmpeg(imageio_ffmpeg.get_ffmpeg_exe())
|
||||
|
||||
|
||||
_configure_warp()
|
||||
_configure_mediapy()
|
||||
_import_registered_packages()
|
||||
@@ -0,0 +1,63 @@
|
||||
"""Actuator implementations for mjlab."""
|
||||
|
||||
from mjlab.actuator.actuator import Actuator as Actuator
|
||||
from mjlab.actuator.actuator import ActuatorCfg as ActuatorCfg
|
||||
from mjlab.actuator.actuator import ActuatorCmd as ActuatorCmd
|
||||
from mjlab.actuator.actuator import CommandField as CommandField
|
||||
from mjlab.actuator.builtin_actuator import (
|
||||
BuiltinDcMotorActuator as BuiltinDcMotorActuator,
|
||||
)
|
||||
from mjlab.actuator.builtin_actuator import (
|
||||
BuiltinDcMotorActuatorCfg as BuiltinDcMotorActuatorCfg,
|
||||
)
|
||||
from mjlab.actuator.builtin_actuator import (
|
||||
BuiltinMotorActuator as BuiltinMotorActuator,
|
||||
)
|
||||
from mjlab.actuator.builtin_actuator import (
|
||||
BuiltinMotorActuatorCfg as BuiltinMotorActuatorCfg,
|
||||
)
|
||||
from mjlab.actuator.builtin_actuator import (
|
||||
BuiltinMuscleActuator as BuiltinMuscleActuator,
|
||||
)
|
||||
from mjlab.actuator.builtin_actuator import (
|
||||
BuiltinMuscleActuatorCfg as BuiltinMuscleActuatorCfg,
|
||||
)
|
||||
from mjlab.actuator.builtin_actuator import (
|
||||
BuiltinPdActuator as BuiltinPdActuator,
|
||||
)
|
||||
from mjlab.actuator.builtin_actuator import (
|
||||
BuiltinPdActuatorCfg as BuiltinPdActuatorCfg,
|
||||
)
|
||||
from mjlab.actuator.builtin_actuator import (
|
||||
BuiltinPositionActuator as BuiltinPositionActuator,
|
||||
)
|
||||
from mjlab.actuator.builtin_actuator import (
|
||||
BuiltinPositionActuatorCfg as BuiltinPositionActuatorCfg,
|
||||
)
|
||||
from mjlab.actuator.builtin_actuator import (
|
||||
BuiltinVelocityActuator as BuiltinVelocityActuator,
|
||||
)
|
||||
from mjlab.actuator.builtin_actuator import (
|
||||
BuiltinVelocityActuatorCfg as BuiltinVelocityActuatorCfg,
|
||||
)
|
||||
from mjlab.actuator.builtin_actuator import (
|
||||
DcMotorDatasheetParams as DcMotorDatasheetParams,
|
||||
)
|
||||
from mjlab.actuator.builtin_actuator import (
|
||||
DcMotorInputMode as DcMotorInputMode,
|
||||
)
|
||||
from mjlab.actuator.builtin_actuator import (
|
||||
DcMotorPhysicalParams as DcMotorPhysicalParams,
|
||||
)
|
||||
from mjlab.actuator.builtin_group import BuiltinActuatorGroup as BuiltinActuatorGroup
|
||||
from mjlab.actuator.dc_actuator import DcMotorActuator as DcMotorActuator
|
||||
from mjlab.actuator.dc_actuator import DcMotorActuatorCfg as DcMotorActuatorCfg
|
||||
from mjlab.actuator.fused_group import FusedActuatorGroup as FusedActuatorGroup
|
||||
from mjlab.actuator.learned_actuator import LearnedMlpActuator as LearnedMlpActuator
|
||||
from mjlab.actuator.learned_actuator import (
|
||||
LearnedMlpActuatorCfg as LearnedMlpActuatorCfg,
|
||||
)
|
||||
from mjlab.actuator.pd_actuator import IdealPdActuator as IdealPdActuator
|
||||
from mjlab.actuator.pd_actuator import IdealPdActuatorCfg as IdealPdActuatorCfg
|
||||
from mjlab.actuator.xml_actuator import XmlActuator as XmlActuator
|
||||
from mjlab.actuator.xml_actuator import XmlActuatorCfg as XmlActuatorCfg
|
||||
@@ -0,0 +1,436 @@
|
||||
"""Base actuator interface."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import dataclasses
|
||||
from abc import ABC, abstractmethod
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
from typing import TYPE_CHECKING, ClassVar, Generic, Literal, TypeVar
|
||||
|
||||
import mujoco
|
||||
import mujoco_warp as mjwarp
|
||||
import torch
|
||||
|
||||
from mjlab.utils.buffers import DelayBuffer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from mjlab.entity import Entity
|
||||
from mjlab.entity.data import EntityData
|
||||
|
||||
ActuatorCfgT = TypeVar("ActuatorCfgT", bound="ActuatorCfg")
|
||||
|
||||
CommandField = Literal["position", "velocity", "effort"]
|
||||
|
||||
|
||||
class TransmissionType(str, Enum):
|
||||
"""Transmission types for actuators."""
|
||||
|
||||
JOINT = "joint"
|
||||
TENDON = "tendon"
|
||||
SITE = "site"
|
||||
|
||||
|
||||
@dataclass(kw_only=True)
|
||||
class ActuatorCfg(ABC):
|
||||
target_names_expr: tuple[str, ...]
|
||||
"""Targets that are part of this actuator group.
|
||||
|
||||
Can be a tuple of names or tuple of regex expressions. Interpreted based on
|
||||
transmission_type.
|
||||
"""
|
||||
|
||||
transmission_type: TransmissionType = TransmissionType.JOINT
|
||||
"""Transmission type. Defaults to JOINT."""
|
||||
|
||||
armature: float | None = None
|
||||
"""Reflected rotor inertia. None preserves the XML value."""
|
||||
|
||||
frictionloss: float | None = None
|
||||
"""Friction loss force limit. None preserves the XML value.
|
||||
|
||||
Applies a constant friction force opposing motion, independent of load or velocity.
|
||||
Also known as dry friction or load-independent friction.
|
||||
"""
|
||||
|
||||
viscous_damping: float | None = None
|
||||
"""Passive viscous damping coefficient. None preserves the XML value.
|
||||
|
||||
Produces a dissipative force f(v) = -b·v proportional to velocity. Always present
|
||||
regardless of actuator activity. Unlike ``damping`` (the PD derivative gain kv, which
|
||||
is active control), this is a passive property.
|
||||
|
||||
Maps to ``<joint damping>`` for JOINT transmission and ``<tendon damping>``
|
||||
for TENDON transmission. Ignored for SITE.
|
||||
"""
|
||||
|
||||
delay_min_lag: int = 0
|
||||
"""Minimum command delay in physics timesteps.
|
||||
|
||||
Each step, a lag is sampled uniformly from [min, max]. The command target arrives
|
||||
that many steps late at the actuator's control law. Models communication and bus
|
||||
latency between the policy and the motor (as opposed to observation delay, which
|
||||
models sensor pipeline latency).
|
||||
"""
|
||||
|
||||
delay_max_lag: int = 0
|
||||
"""Maximum command delay in physics timesteps. Set > 0 to enable delay."""
|
||||
|
||||
delay_hold_prob: float = 0.0
|
||||
"""Probability of keeping the current lag instead of resampling."""
|
||||
|
||||
delay_update_period: int = 0
|
||||
"""How often to resample the lag, in physics timesteps (0 = every step)."""
|
||||
|
||||
delay_per_env_phase: bool = True
|
||||
"""Stagger lag resampling across environments so they don't all update
|
||||
on the same step."""
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
if self.armature is not None:
|
||||
assert self.armature >= 0.0, "armature must be non-negative."
|
||||
if self.frictionloss is not None:
|
||||
assert self.frictionloss >= 0.0, "frictionloss must be non-negative."
|
||||
if self.viscous_damping is not None:
|
||||
assert self.viscous_damping >= 0.0, "viscous_damping must be non-negative."
|
||||
if self.transmission_type == TransmissionType.SITE:
|
||||
if (
|
||||
(self.armature is not None and self.armature > 0.0)
|
||||
or (self.frictionloss is not None and self.frictionloss > 0.0)
|
||||
or (self.viscous_damping is not None and self.viscous_damping > 0.0)
|
||||
):
|
||||
raise ValueError(
|
||||
f"{self.__class__.__name__}: armature, frictionloss, and viscous_damping are "
|
||||
"not supported for SITE transmission type."
|
||||
)
|
||||
assert self.delay_min_lag >= 0, "delay_min_lag must be non-negative."
|
||||
assert self.delay_max_lag >= 0, "delay_max_lag must be non-negative."
|
||||
assert self.delay_min_lag <= self.delay_max_lag, (
|
||||
"delay_min_lag must be <= delay_max_lag."
|
||||
)
|
||||
assert 0.0 <= self.delay_hold_prob <= 1.0, "delay_hold_prob must be in [0, 1]."
|
||||
assert self.delay_update_period >= 0, "delay_update_period must be non-negative."
|
||||
|
||||
@abstractmethod
|
||||
def build(
|
||||
self, entity: Entity, target_ids: list[int], target_names: list[str]
|
||||
) -> Actuator:
|
||||
"""Build actuator instance.
|
||||
|
||||
Args:
|
||||
entity: Entity this actuator belongs to.
|
||||
target_ids: Local target indices (for indexing entity arrays).
|
||||
target_names: Target names corresponding to target_ids.
|
||||
|
||||
Returns:
|
||||
Actuator instance.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
@dataclass
|
||||
class ActuatorCmd:
|
||||
"""High-level actuator command with targets and current state.
|
||||
|
||||
Passed to actuator's `compute()` method to generate low-level control signals.
|
||||
All tensors have shape (num_envs, num_targets).
|
||||
"""
|
||||
|
||||
position_target: torch.Tensor
|
||||
"""Desired positions (joint positions, tendon lengths, or site positions)."""
|
||||
velocity_target: torch.Tensor
|
||||
"""Desired velocities (joint velocities, tendon velocities, or site velocities)."""
|
||||
effort_target: torch.Tensor
|
||||
"""Feedforward effort (torques or forces)."""
|
||||
pos: torch.Tensor
|
||||
"""Current positions (joint positions, tendon lengths, or site positions)."""
|
||||
vel: torch.Tensor
|
||||
"""Current velocities (joint velocities, tendon velocities, or site velocities)."""
|
||||
|
||||
|
||||
def delay_command(
|
||||
buffer: DelayBuffer,
|
||||
position_target: torch.Tensor,
|
||||
velocity_target: torch.Tensor,
|
||||
effort_target: torch.Tensor,
|
||||
) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
|
||||
"""Delay the three command-target fields through one shared channel.
|
||||
|
||||
Every target the policy issues (position, velocity, effort) travels the same
|
||||
command bus and incurs the same latency, so they are stacked and delayed
|
||||
together by a single DelayBuffer. Feedback (pos, vel) is never delayed. Shared
|
||||
by Actuator.apply_delay and the fused group so the command-delay semantics
|
||||
live in exactly one place.
|
||||
|
||||
Args:
|
||||
buffer: The delay buffer to append to and read the delayed command from.
|
||||
position_target: Position targets, shape (num_envs, num_targets).
|
||||
velocity_target: Velocity targets, shape (num_envs, num_targets).
|
||||
effort_target: Feedforward effort targets, shape (num_envs, num_targets).
|
||||
|
||||
Returns:
|
||||
The delayed (position_target, velocity_target, effort_target) tuple.
|
||||
"""
|
||||
stacked = torch.stack((position_target, velocity_target, effort_target), dim=-1)
|
||||
buffer.append(stacked)
|
||||
delayed = buffer.compute()
|
||||
return delayed[..., 0], delayed[..., 1], delayed[..., 2]
|
||||
|
||||
|
||||
class Actuator(ABC, Generic[ActuatorCfgT]):
|
||||
"""Base actuator interface."""
|
||||
|
||||
# Fusion contract. An actuator whose control output is a stateless function of
|
||||
# per-target parameters and the command implements control_law over the
|
||||
# parameter tensors named in param_names, and applies it through the shared
|
||||
# compute (see IdealPdActuator). Such actuators are fused automatically (see
|
||||
# mjlab.actuator.fused_group). Actuators with a custom compute (built-ins, XML,
|
||||
# learned networks) are not fused; they need no opt-out flag, since overriding
|
||||
# compute is itself the signal.
|
||||
param_names: ClassVar[tuple[str, ...]] = ()
|
||||
|
||||
@staticmethod
|
||||
def control_law(params: dict[str, torch.Tensor], cmd: ActuatorCmd) -> torch.Tensor:
|
||||
"""Stateless control law over per-target parameters.
|
||||
|
||||
params maps each name in param_names to its tensor of shape
|
||||
(num_envs, num_targets); for a fused group these are the concatenated
|
||||
tensors. Returns the control signal of the same trailing shape. Implemented
|
||||
by stateless-law actuator types.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
cfg: ActuatorCfgT,
|
||||
entity: Entity,
|
||||
target_ids: list[int],
|
||||
target_names: list[str],
|
||||
) -> None:
|
||||
self.cfg = cfg
|
||||
self.entity = entity
|
||||
self._target_ids_list = target_ids
|
||||
self._target_names = target_names
|
||||
self._target_ids: torch.Tensor | None = None
|
||||
self._ctrl_ids: torch.Tensor | None = None
|
||||
self._global_ctrl_ids: torch.Tensor | None = None
|
||||
self._mjs_actuators: list[mujoco.MjsActuator] = []
|
||||
self._site_zeros: torch.Tensor | None = None
|
||||
self._delay_buffer: DelayBuffer | None = None
|
||||
|
||||
@property
|
||||
def has_delay(self) -> bool:
|
||||
"""Whether this actuator has delay configured."""
|
||||
return self.cfg.delay_max_lag > 0
|
||||
|
||||
@property
|
||||
def target_ids(self) -> torch.Tensor:
|
||||
"""Local indices of targets controlled by this actuator."""
|
||||
assert self._target_ids is not None
|
||||
return self._target_ids
|
||||
|
||||
@property
|
||||
def target_names(self) -> list[str]:
|
||||
"""Names of targets controlled by this actuator."""
|
||||
return self._target_names
|
||||
|
||||
@property
|
||||
def transmission_type(self) -> TransmissionType:
|
||||
"""Transmission type of this actuator."""
|
||||
return self.cfg.transmission_type
|
||||
|
||||
@property
|
||||
def ctrl_ids(self) -> torch.Tensor:
|
||||
"""Local indices of control inputs within the entity."""
|
||||
assert self._ctrl_ids is not None
|
||||
return self._ctrl_ids
|
||||
|
||||
@property
|
||||
def global_ctrl_ids(self) -> torch.Tensor:
|
||||
"""Global indices of control inputs in the MuJoCo model."""
|
||||
assert self._global_ctrl_ids is not None
|
||||
return self._global_ctrl_ids
|
||||
|
||||
@abstractmethod
|
||||
def edit_spec(self, spec: mujoco.MjSpec, target_names: list[str]) -> None:
|
||||
"""Edit the MjSpec to add actuators.
|
||||
|
||||
This is called during entity construction, before the model is compiled.
|
||||
|
||||
Args:
|
||||
spec: The entity's MjSpec to edit.
|
||||
target_names: Names of targets (joints, tendons, or sites) as they
|
||||
appear in the spec. When the entity's ``spec_fn`` uses internal
|
||||
``MjSpec.attach(prefix=...)``, these will include the prefix
|
||||
(e.g., ``"left/elbow"`` rather than ``"elbow"``).
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def initialize(
|
||||
self,
|
||||
mj_model: mujoco.MjModel,
|
||||
model: mjwarp.Model,
|
||||
data: mjwarp.Data,
|
||||
device: str,
|
||||
) -> None:
|
||||
"""Initialize the actuator after model compilation.
|
||||
|
||||
This is called after the MjSpec is compiled into an MjModel.
|
||||
|
||||
Args:
|
||||
mj_model: The compiled MuJoCo model.
|
||||
model: The compiled mjwarp model.
|
||||
data: The mjwarp data arrays.
|
||||
device: Device for tensor operations (e.g., "cuda", "cpu").
|
||||
"""
|
||||
del mj_model, model # Unused.
|
||||
self._target_ids = torch.tensor(
|
||||
self._target_ids_list, dtype=torch.long, device=device
|
||||
)
|
||||
global_ctrl_ids_list = [act.id for act in self._mjs_actuators]
|
||||
self._global_ctrl_ids = torch.tensor(
|
||||
global_ctrl_ids_list, dtype=torch.long, device=device
|
||||
)
|
||||
entity_ctrl_ids = self.entity.indexing.ctrl_ids
|
||||
global_to_local = {gid.item(): i for i, gid in enumerate(entity_ctrl_ids)}
|
||||
self._ctrl_ids = torch.tensor(
|
||||
[global_to_local[gid] for gid in global_ctrl_ids_list],
|
||||
dtype=torch.long,
|
||||
device=device,
|
||||
)
|
||||
|
||||
# Pre-allocate zeros for SITE transmission type to avoid repeated allocations.
|
||||
if self.transmission_type == TransmissionType.SITE:
|
||||
nenvs = data.nworld
|
||||
ntargets = len(self._target_ids_list)
|
||||
self._site_zeros = torch.zeros((nenvs, ntargets), device=device)
|
||||
|
||||
self._init_delay_buffer(data.nworld, device)
|
||||
|
||||
def _init_delay_buffer(self, num_envs: int, device: str) -> None:
|
||||
"""Create delay buffer. Called during initialize()."""
|
||||
if not self.has_delay:
|
||||
return
|
||||
self._delay_buffer = DelayBuffer(
|
||||
min_lag=self.cfg.delay_min_lag,
|
||||
max_lag=self.cfg.delay_max_lag,
|
||||
batch_size=num_envs,
|
||||
device=device,
|
||||
hold_prob=self.cfg.delay_hold_prob,
|
||||
update_period=self.cfg.delay_update_period,
|
||||
per_env_phase=self.cfg.delay_per_env_phase,
|
||||
)
|
||||
|
||||
def apply_delay(self, cmd: ActuatorCmd) -> ActuatorCmd:
|
||||
"""Delay all command targets with one shared lag. No-op without delay.
|
||||
|
||||
Every target the policy issues (position, velocity, effort) travels the same
|
||||
command channel and experiences the same latency, so they are stacked and
|
||||
delayed together. Feedback fields (``pos``, ``vel``) are never delayed.
|
||||
"""
|
||||
if self._delay_buffer is None:
|
||||
return cmd
|
||||
position_target, velocity_target, effort_target = delay_command(
|
||||
self._delay_buffer,
|
||||
cmd.position_target,
|
||||
cmd.velocity_target,
|
||||
cmd.effort_target,
|
||||
)
|
||||
return dataclasses.replace(
|
||||
cmd,
|
||||
position_target=position_target,
|
||||
velocity_target=velocity_target,
|
||||
effort_target=effort_target,
|
||||
)
|
||||
|
||||
def set_lags(
|
||||
self,
|
||||
lags: torch.Tensor,
|
||||
env_ids: torch.Tensor | slice | None = None,
|
||||
) -> None:
|
||||
"""Set delay lag values for specified environments.
|
||||
|
||||
Built-in actuators with the same delay config share a fused delay
|
||||
buffer for performance. Calling ``set_lags`` on any one of them
|
||||
affects the entire fused group.
|
||||
|
||||
Args:
|
||||
lags: Lag values in physics timesteps. Shape: (num_env_ids,) or scalar.
|
||||
env_ids: Environment indices to set. If None, sets all environments.
|
||||
"""
|
||||
if self._delay_buffer is not None:
|
||||
self._delay_buffer.set_lags(lags, env_ids)
|
||||
|
||||
def get_command(self, data: EntityData) -> ActuatorCmd:
|
||||
"""Extract command data for this actuator from entity data.
|
||||
|
||||
Args:
|
||||
data: The entity data containing all state and target information.
|
||||
|
||||
Returns:
|
||||
ActuatorCmd with appropriate data based on transmission type.
|
||||
"""
|
||||
if self.transmission_type == TransmissionType.JOINT:
|
||||
return ActuatorCmd(
|
||||
position_target=data.joint_pos_target[:, self.target_ids],
|
||||
velocity_target=data.joint_vel_target[:, self.target_ids],
|
||||
effort_target=data.joint_effort_target[:, self.target_ids],
|
||||
pos=data.joint_pos[:, self.target_ids],
|
||||
vel=data.joint_vel[:, self.target_ids],
|
||||
)
|
||||
elif self.transmission_type == TransmissionType.TENDON:
|
||||
return ActuatorCmd(
|
||||
position_target=data.tendon_len_target[:, self.target_ids],
|
||||
velocity_target=data.tendon_vel_target[:, self.target_ids],
|
||||
effort_target=data.tendon_effort_target[:, self.target_ids],
|
||||
pos=data.tendon_len[:, self.target_ids],
|
||||
vel=data.tendon_vel[:, self.target_ids],
|
||||
)
|
||||
elif self.transmission_type == TransmissionType.SITE:
|
||||
assert self._site_zeros is not None
|
||||
return ActuatorCmd(
|
||||
position_target=self._site_zeros,
|
||||
velocity_target=self._site_zeros,
|
||||
effort_target=data.site_effort_target[:, self.target_ids],
|
||||
pos=self._site_zeros,
|
||||
vel=self._site_zeros,
|
||||
)
|
||||
else:
|
||||
raise ValueError(f"Unknown transmission type: {self.transmission_type}")
|
||||
|
||||
@abstractmethod
|
||||
def compute(self, cmd: ActuatorCmd) -> torch.Tensor:
|
||||
"""Compute low-level actuator control signal from high-level commands.
|
||||
|
||||
Args:
|
||||
cmd: High-level actuator command.
|
||||
|
||||
Returns:
|
||||
Control signal tensor of shape (num_envs, num_actuators).
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
# Optional methods.
|
||||
|
||||
def reset(self, env_ids: torch.Tensor | slice | None = None) -> None:
|
||||
"""Reset actuator state for specified environments.
|
||||
|
||||
Resets delay buffers if present. Subclasses that override this should
|
||||
call ``super().reset(env_ids)``.
|
||||
|
||||
Args:
|
||||
env_ids: Environment indices to reset. If None, reset all environments.
|
||||
"""
|
||||
if self._delay_buffer is not None:
|
||||
self._delay_buffer.reset(env_ids)
|
||||
|
||||
def update(self, dt: float) -> None:
|
||||
"""Update actuator state after a simulation step.
|
||||
|
||||
Base implementation does nothing. Override in subclasses that need
|
||||
per-step updates.
|
||||
|
||||
Args:
|
||||
dt: Time step in seconds.
|
||||
"""
|
||||
del dt # Unused.
|
||||
@@ -0,0 +1,631 @@
|
||||
"""MuJoCo built-in actuators.
|
||||
|
||||
This module provides actuators that use MuJoCo's native actuator implementations,
|
||||
created programmatically via the MjSpec API.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from enum import IntEnum
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import mujoco
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
from mjlab.actuator.actuator import (
|
||||
Actuator,
|
||||
ActuatorCfg,
|
||||
ActuatorCmd,
|
||||
TransmissionType,
|
||||
)
|
||||
from mjlab.utils.spec import (
|
||||
apply_target_overrides,
|
||||
create_motor_actuator,
|
||||
create_muscle_actuator,
|
||||
create_position_actuator,
|
||||
create_velocity_actuator,
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from mjlab.entity import Entity
|
||||
|
||||
|
||||
@dataclass(kw_only=True)
|
||||
class BuiltinPositionActuatorCfg(ActuatorCfg):
|
||||
"""Configuration for MuJoCo built-in position actuator.
|
||||
|
||||
Under the hood, this creates a <position> actuator for each target and sets the
|
||||
stiffness, damping and effort limits accordingly. If armature or frictionloss are
|
||||
set, they override the corresponding joint/tendon properties from XML.
|
||||
"""
|
||||
|
||||
stiffness: float
|
||||
"""PD proportional gain."""
|
||||
damping: float
|
||||
"""PD derivative gain."""
|
||||
effort_limit: float | None = None
|
||||
"""Maximum actuator force/torque. If None, no limit is applied."""
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
super().__post_init__()
|
||||
if self.transmission_type == TransmissionType.SITE:
|
||||
raise ValueError(
|
||||
"BuiltinPositionActuatorCfg does not support SITE transmission. "
|
||||
"Use BuiltinMotorActuatorCfg for site transmission."
|
||||
)
|
||||
|
||||
def build(
|
||||
self, entity: Entity, target_ids: list[int], target_names: list[str]
|
||||
) -> BuiltinPositionActuator:
|
||||
return BuiltinPositionActuator(self, entity, target_ids, target_names)
|
||||
|
||||
|
||||
class BuiltinPositionActuator(Actuator[BuiltinPositionActuatorCfg]):
|
||||
"""MuJoCo built-in position actuator."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
cfg: BuiltinPositionActuatorCfg,
|
||||
entity: Entity,
|
||||
target_ids: list[int],
|
||||
target_names: list[str],
|
||||
) -> None:
|
||||
super().__init__(cfg, entity, target_ids, target_names)
|
||||
|
||||
def edit_spec(self, spec: mujoco.MjSpec, target_names: list[str]) -> None:
|
||||
# Add <position> actuator to spec, one per target.
|
||||
for target_name in target_names:
|
||||
actuator = create_position_actuator(
|
||||
spec,
|
||||
target_name,
|
||||
stiffness=self.cfg.stiffness,
|
||||
damping=self.cfg.damping,
|
||||
effort_limit=self.cfg.effort_limit,
|
||||
armature=self.cfg.armature,
|
||||
frictionloss=self.cfg.frictionloss,
|
||||
viscous_damping=self.cfg.viscous_damping,
|
||||
transmission_type=self.cfg.transmission_type,
|
||||
)
|
||||
self._mjs_actuators.append(actuator)
|
||||
|
||||
def compute(self, cmd: ActuatorCmd) -> torch.Tensor:
|
||||
return cmd.position_target
|
||||
|
||||
|
||||
@dataclass(kw_only=True)
|
||||
class BuiltinPdActuatorCfg(ActuatorCfg):
|
||||
"""Implicit-integration version of IdealPdActuator.
|
||||
|
||||
Both consume a position target and a velocity target with kp/kd gains. The
|
||||
difference is in how the PD is delivered to MuJoCo: IdealPdActuator computes
|
||||
the PD force in Python and feeds it to a ``<motor>`` element, which MuJoCo
|
||||
sees as an opaque external force. This actuator expresses the PD as native
|
||||
MuJoCo elements (a ``<position>`` carrying kp, a ``<velocity>`` carrying kd),
|
||||
so the implicit and implicitfast integrators include the kp/kd derivatives
|
||||
in their velocity update. That makes the actuator numerically stable at
|
||||
gain/timestep combinations where explicit Python PD would diverge, which
|
||||
matters when you want to run a real motor's stiff on-board PD gains in sim.
|
||||
"""
|
||||
|
||||
stiffness: float
|
||||
"""Proportional gain (kp)."""
|
||||
damping: float
|
||||
"""Derivative gain (kd)."""
|
||||
effort_limit: float | None = None
|
||||
"""Maximum total torque applied to the joint or tendon. Enforced as a
|
||||
sum-clamp on the two PD terms via jnt_actfrcrange (JOINT) or
|
||||
tendon_actfrcrange (TENDON). None leaves the limit unset."""
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
super().__post_init__()
|
||||
if self.transmission_type == TransmissionType.SITE:
|
||||
raise ValueError(
|
||||
"BuiltinPdActuatorCfg does not support SITE transmission. "
|
||||
"Use BuiltinMotorActuatorCfg for site transmission."
|
||||
)
|
||||
|
||||
def build(
|
||||
self, entity: Entity, target_ids: list[int], target_names: list[str]
|
||||
) -> BuiltinPdActuator:
|
||||
return BuiltinPdActuator(self, entity, target_ids, target_names)
|
||||
|
||||
|
||||
class BuiltinPdActuator(Actuator[BuiltinPdActuatorCfg]):
|
||||
"""MuJoCo native PD: paired <position> + <velocity> elements per target."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
cfg: BuiltinPdActuatorCfg,
|
||||
entity: Entity,
|
||||
target_ids: list[int],
|
||||
target_names: list[str],
|
||||
) -> None:
|
||||
super().__init__(cfg, entity, target_ids, target_names)
|
||||
|
||||
@property
|
||||
def num_targets(self) -> int:
|
||||
"""Number of targets. ``ctrl_ids`` is laid out as ``[pos..., vel...]``,
|
||||
each block of length ``num_targets``."""
|
||||
return len(self._target_ids_list)
|
||||
|
||||
def edit_spec(self, spec: mujoco.MjSpec, target_names: list[str]) -> None:
|
||||
# Position elements first, then velocity elements, so ctrl_ids is laid out
|
||||
# as [pos_0..pos_{N-1}, vel_0..vel_{N-1}].
|
||||
for target_name in target_names:
|
||||
pos_act = create_position_actuator(
|
||||
spec,
|
||||
target_name,
|
||||
actuator_name=f"{target_name}_pd_pos",
|
||||
stiffness=self.cfg.stiffness,
|
||||
damping=0.0, # damping lives on the <velocity> element.
|
||||
armature=self.cfg.armature,
|
||||
frictionloss=self.cfg.frictionloss,
|
||||
viscous_damping=self.cfg.viscous_damping,
|
||||
transmission_type=self.cfg.transmission_type,
|
||||
)
|
||||
self._mjs_actuators.append(pos_act)
|
||||
for target_name in target_names:
|
||||
vel_act = create_velocity_actuator(
|
||||
spec,
|
||||
target_name,
|
||||
actuator_name=f"{target_name}_pd_vel",
|
||||
damping=self.cfg.damping,
|
||||
transmission_type=self.cfg.transmission_type,
|
||||
)
|
||||
self._mjs_actuators.append(vel_act)
|
||||
# Effort limit: sum-clamp on the joint/tendon, not on each element.
|
||||
if self.cfg.effort_limit is not None:
|
||||
lim = self.cfg.effort_limit
|
||||
for target_name in target_names:
|
||||
if self.cfg.transmission_type == TransmissionType.JOINT:
|
||||
target = spec.joint(target_name)
|
||||
else:
|
||||
target = spec.tendon(target_name)
|
||||
target.actfrclimited = mujoco.mjtLimited.mjLIMITED_TRUE
|
||||
target.actfrcrange[:] = np.array([-lim, lim])
|
||||
|
||||
def compute(self, cmd: ActuatorCmd) -> torch.Tensor:
|
||||
return torch.cat((cmd.position_target, cmd.velocity_target), dim=1)
|
||||
|
||||
|
||||
@dataclass(kw_only=True)
|
||||
class BuiltinMotorActuatorCfg(ActuatorCfg):
|
||||
"""Configuration for MuJoCo built-in motor actuator.
|
||||
|
||||
Under the hood, this creates a <motor> actuator for each target and sets its effort
|
||||
limit and gear ratio accordingly. If armature or frictionloss are set, they override
|
||||
the corresponding joint/tendon properties from XML.
|
||||
"""
|
||||
|
||||
effort_limit: float
|
||||
"""Maximum actuator effort."""
|
||||
gear: float = 1.0
|
||||
"""Actuator gear ratio."""
|
||||
|
||||
def build(
|
||||
self, entity: Entity, target_ids: list[int], target_names: list[str]
|
||||
) -> BuiltinMotorActuator:
|
||||
return BuiltinMotorActuator(self, entity, target_ids, target_names)
|
||||
|
||||
|
||||
class BuiltinMotorActuator(Actuator[BuiltinMotorActuatorCfg]):
|
||||
"""MuJoCo built-in motor actuator."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
cfg: BuiltinMotorActuatorCfg,
|
||||
entity: Entity,
|
||||
target_ids: list[int],
|
||||
target_names: list[str],
|
||||
) -> None:
|
||||
super().__init__(cfg, entity, target_ids, target_names)
|
||||
|
||||
def edit_spec(self, spec: mujoco.MjSpec, target_names: list[str]) -> None:
|
||||
# Add <motor> actuator to spec, one per target.
|
||||
for target_name in target_names:
|
||||
actuator = create_motor_actuator(
|
||||
spec,
|
||||
target_name,
|
||||
effort_limit=self.cfg.effort_limit,
|
||||
gear=self.cfg.gear,
|
||||
armature=self.cfg.armature,
|
||||
frictionloss=self.cfg.frictionloss,
|
||||
viscous_damping=self.cfg.viscous_damping,
|
||||
transmission_type=self.cfg.transmission_type,
|
||||
)
|
||||
self._mjs_actuators.append(actuator)
|
||||
|
||||
def compute(self, cmd: ActuatorCmd) -> torch.Tensor:
|
||||
return cmd.effort_target
|
||||
|
||||
|
||||
def _or_zeros(t: tuple[float, ...] | None, n: int) -> list[float]:
|
||||
return list(t) if t is not None else [0.0] * n
|
||||
|
||||
|
||||
class DcMotorInputMode(IntEnum):
|
||||
"""What the ``ctrl`` signal of a ``<dcmotor>`` represents.
|
||||
|
||||
Values match mjtCtrlInput, consumed by mjs_setToDCMotor and stored in
|
||||
actuator_ctrlspec.
|
||||
"""
|
||||
|
||||
VOLTAGE = mujoco.mjtCtrlInput.mjINPUT_VOLTAGE.value
|
||||
POSITION = mujoco.mjtCtrlInput.mjINPUT_POS.value
|
||||
VELOCITY = mujoco.mjtCtrlInput.mjINPUT_VEL.value
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class DcMotorDatasheetParams:
|
||||
"""Datasheet characterization of a DC motor."""
|
||||
|
||||
nominal_voltage: float
|
||||
"""Nominal (rated) voltage V_n [V]."""
|
||||
stall_torque: float
|
||||
"""Stall torque tau_stall at V_n [N*m]."""
|
||||
no_load_speed: float
|
||||
"""No-load angular velocity omega_no_load at V_n [rad/s]."""
|
||||
|
||||
def _pack(self) -> tuple[list[float], float, list[float]]:
|
||||
"""Returns (motorconst, resistance, nominal) for set_to_dcmotor."""
|
||||
return (
|
||||
[0.0, 0.0],
|
||||
0.0,
|
||||
[self.nominal_voltage, self.stall_torque, self.no_load_speed],
|
||||
)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class DcMotorPhysicalParams:
|
||||
"""Physical characterization of a DC motor."""
|
||||
|
||||
kt: float
|
||||
"""Torque constant [N*m/A]."""
|
||||
ke: float
|
||||
"""Back-EMF constant [V*s/rad]."""
|
||||
resistance: float
|
||||
"""Terminal resistance R [Ohm]."""
|
||||
|
||||
def _pack(self) -> tuple[list[float], float, list[float]]:
|
||||
"""Returns (motorconst, resistance, nominal) for set_to_dcmotor."""
|
||||
return [self.kt, self.ke], self.resistance, [0.0, 0.0, 0.0]
|
||||
|
||||
|
||||
@dataclass(kw_only=True)
|
||||
class BuiltinDcMotorActuatorCfg(ActuatorCfg):
|
||||
"""Native MuJoCo ``<dcmotor>`` wrapper.
|
||||
|
||||
Models a DC motor: torque is derived from voltage via the motor constant K and
|
||||
back-EMF, tau = K * (V - K * omega) / R. The back-EMF term lives in biasprm, so
|
||||
MuJoCo's implicit / implicitfast integrators pick up its velocity derivative as
|
||||
effective damping.
|
||||
|
||||
Three input modes select what ctrl carries:
|
||||
|
||||
* VOLTAGE: ctrl is the drive voltage. cmd.effort_target carries volts, not torque.
|
||||
* POSITION / VELOCITY: an internal PID closes on the setpoint with torque-space
|
||||
gains, stiffness on the position error and damping on the velocity error. The
|
||||
driver compensates back-EMF, so the commanded torque is delivered until the
|
||||
drive voltage reaches Vmax.
|
||||
|
||||
Motor characterization: pass either DcMotorDatasheetParams or DcMotorPhysicalParams
|
||||
as motor_params. mjs_setToDCMotor derives K and R (including the viscous-damping
|
||||
correction) and packs the generic gainprm / biasprm / dynprm slots.
|
||||
|
||||
Optional extensions, off by default: integral_gain / integral_limit, slew_rate,
|
||||
inductance / electrical_time_constant, thermal, lugre, cogging.
|
||||
|
||||
dr.pd_gains randomizes only kp and kd; for DR over the extensions, write directly to
|
||||
actuator_gainprm or actuator_dynprm.
|
||||
"""
|
||||
|
||||
motor_params: DcMotorDatasheetParams | DcMotorPhysicalParams
|
||||
"""Motor characterization. Datasheet form: (V_n, tau_stall, omega_no_load).
|
||||
Physical form: (Kt, Ke, R)."""
|
||||
|
||||
mode: DcMotorInputMode = DcMotorInputMode.POSITION
|
||||
"""ctrl input semantics. See class docstring."""
|
||||
|
||||
stiffness: float = 0.0
|
||||
"""PID gain kp on the position error, in torque space. Required in POSITION
|
||||
mode; must be 0 otherwise."""
|
||||
|
||||
damping: float = 0.0
|
||||
"""PID gain kd on the velocity error, in torque space. Required in VELOCITY
|
||||
mode, optional in POSITION mode; must be 0 in VOLTAGE mode."""
|
||||
|
||||
voltage_limit: float = 0.0
|
||||
"""Max drive voltage Vmax. Required in POSITION / VELOCITY mode (clamps the
|
||||
PID's drive voltage); must be 0 in VOLTAGE mode."""
|
||||
|
||||
integral_gain: float = 0.0
|
||||
"""PID integral gain ki on the accumulated position error. POSITION mode
|
||||
only."""
|
||||
|
||||
integral_limit: float = 0.0
|
||||
"""Anti-windup clamp Imax on the integrator state. 0 disables (the
|
||||
integrator can run away)."""
|
||||
|
||||
slew_rate: float = 0.0
|
||||
"""Max rate of change of the setpoint per second. Must be 0 in VOLTAGE mode.
|
||||
0 disables."""
|
||||
|
||||
effort_limit: float | None = None
|
||||
"""Continuous torque cap [N*m]. Sets actuator_forcerange. None leaves the
|
||||
per-element forcerange unset."""
|
||||
|
||||
gear: float = 1.0
|
||||
"""Mechanical gear ratio."""
|
||||
|
||||
inductance: float = 0.0
|
||||
"""Winding inductance L [H]. Enables first-order electrical dynamics on the
|
||||
motor current. MuJoCo internally uses te = L / R; pass
|
||||
electrical_time_constant directly to skip the divide. 0 disables."""
|
||||
|
||||
electrical_time_constant: float = 0.0
|
||||
"""Alternative to inductance: specify te [s] directly. Ignored if
|
||||
inductance > 0. 0 disables."""
|
||||
|
||||
thermal: tuple[float, float, float, float, float, float] | None = None
|
||||
"""Thermal model (R_thermal, C_thermal, tau_thermal, alpha, T0, T_ambient).
|
||||
See MuJoCo's ``<dcmotor thermal=...>`` reference for units and which of the
|
||||
first three may be underspecified. Effective resistance becomes
|
||||
R * (1 + alpha * (T + T_ambient - T0)). None disables."""
|
||||
|
||||
cogging: tuple[float, float, float] | None = None
|
||||
"""Cogging torque (amplitude, periodicity, phase) in (N*m, cycles per unit
|
||||
length, rad). Models magnetic torque ripple from rotor-stator interaction;
|
||||
at joint angle q the contribution is amplitude * sin(periodicity * q + phase).
|
||||
|
||||
Added *after* effort_limit is enforced, matching MuJoCo's physical model:
|
||||
effort_limit bounds the electromagnetic torque (the current limit), not the
|
||||
mechanical torque. Total joint torque can exceed effort_limit by up to
|
||||
amplitude. None disables."""
|
||||
|
||||
lugre: tuple[float, float, float, float, float] | None = None
|
||||
"""LuGre friction (sigma0, sigma1, F_Coulomb, F_Stribeck, v_Stribeck).
|
||||
Stick-slip friction with bristle-deflection state. Subtracted from joint
|
||||
torque after the effort_limit clamp (mechanical, like cogging). None
|
||||
disables."""
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
super().__post_init__()
|
||||
if self.transmission_type == TransmissionType.SITE:
|
||||
raise ValueError(
|
||||
"BuiltinDcMotorActuatorCfg does not support SITE transmission. "
|
||||
"Use BuiltinMotorActuatorCfg for site transmission."
|
||||
)
|
||||
|
||||
if self.mode in (DcMotorInputMode.POSITION, DcMotorInputMode.VELOCITY):
|
||||
if self.mode == DcMotorInputMode.POSITION and self.stiffness <= 0.0:
|
||||
raise ValueError("POSITION mode requires stiffness > 0.")
|
||||
if self.mode == DcMotorInputMode.VELOCITY and (
|
||||
self.stiffness != 0.0 or self.damping <= 0.0
|
||||
):
|
||||
raise ValueError("VELOCITY mode requires damping > 0 and stiffness = 0.")
|
||||
if self.voltage_limit <= 0.0:
|
||||
raise ValueError(f"{self.mode.name} mode requires voltage_limit > 0.")
|
||||
elif any((self.stiffness, self.damping, self.voltage_limit, self.slew_rate)):
|
||||
raise ValueError(
|
||||
"stiffness, damping, voltage_limit, and slew_rate are unused in VOLTAGE mode."
|
||||
)
|
||||
if self.integral_gain != 0.0 and self.mode != DcMotorInputMode.POSITION:
|
||||
raise ValueError("integral_gain requires POSITION mode.")
|
||||
|
||||
for name in (
|
||||
"integral_gain",
|
||||
"integral_limit",
|
||||
"slew_rate",
|
||||
"inductance",
|
||||
"electrical_time_constant",
|
||||
):
|
||||
if getattr(self, name) < 0.0:
|
||||
raise ValueError(f"{name} must be non-negative.")
|
||||
|
||||
def build(
|
||||
self, entity: Entity, target_ids: list[int], target_names: list[str]
|
||||
) -> BuiltinDcMotorActuator:
|
||||
return BuiltinDcMotorActuator(self, entity, target_ids, target_names)
|
||||
|
||||
|
||||
class BuiltinDcMotorActuator(Actuator[BuiltinDcMotorActuatorCfg]):
|
||||
"""MuJoCo native ``<dcmotor>``: one actuator per target."""
|
||||
|
||||
def edit_spec(self, spec: mujoco.MjSpec, target_names: list[str]) -> None:
|
||||
cfg = self.cfg
|
||||
motorconst, resistance, nominal = cfg.motor_params._pack()
|
||||
saturation = (
|
||||
[cfg.effort_limit, 0.0, 0.0] if cfg.effort_limit is not None else [0.0] * 3
|
||||
)
|
||||
controller = [
|
||||
cfg.stiffness, # kp
|
||||
cfg.integral_gain, # ki
|
||||
cfg.damping, # kd
|
||||
cfg.slew_rate, # slewmax
|
||||
cfg.integral_limit, # Imax (anti-windup)
|
||||
cfg.voltage_limit, # v_max
|
||||
]
|
||||
# SITE is rejected in __post_init__, so only JOINT and TENDON remain.
|
||||
trntype = (
|
||||
mujoco.mjtTrn.mjTRN_JOINT
|
||||
if cfg.transmission_type == TransmissionType.JOINT
|
||||
else mujoco.mjtTrn.mjTRN_TENDON
|
||||
)
|
||||
|
||||
for target_name in target_names:
|
||||
actuator = spec.add_actuator(name=target_name, target=target_name)
|
||||
actuator.trntype = trntype
|
||||
actuator.gear[0] = cfg.gear
|
||||
actuator.set_to_dcmotor(
|
||||
motorconst=motorconst,
|
||||
resistance=resistance,
|
||||
nominal=nominal,
|
||||
saturation=saturation,
|
||||
controller=controller,
|
||||
cogging=_or_zeros(cfg.cogging, 3),
|
||||
inductance=[cfg.inductance, cfg.electrical_time_constant],
|
||||
thermal=_or_zeros(cfg.thermal, 6),
|
||||
lugre=_or_zeros(cfg.lugre, 5),
|
||||
ctrlspec=cfg.mode,
|
||||
)
|
||||
|
||||
apply_target_overrides(
|
||||
spec,
|
||||
target_name,
|
||||
cfg.transmission_type,
|
||||
armature=cfg.armature,
|
||||
frictionloss=cfg.frictionloss,
|
||||
viscous_damping=cfg.viscous_damping,
|
||||
)
|
||||
|
||||
self._mjs_actuators.append(actuator)
|
||||
|
||||
def compute(self, cmd: ActuatorCmd) -> torch.Tensor:
|
||||
if self.cfg.mode == DcMotorInputMode.POSITION:
|
||||
return cmd.position_target
|
||||
if self.cfg.mode == DcMotorInputMode.VELOCITY:
|
||||
return cmd.velocity_target
|
||||
# voltage mode: ctrl is the drive voltage carried in effort_target.
|
||||
return cmd.effort_target
|
||||
|
||||
|
||||
@dataclass(kw_only=True)
|
||||
class BuiltinVelocityActuatorCfg(ActuatorCfg):
|
||||
"""Configuration for MuJoCo built-in velocity actuator.
|
||||
|
||||
Under the hood, this creates a <velocity> actuator for each target and sets the
|
||||
damping gain. If armature or frictionloss are set, they override the corresponding
|
||||
joint/tendon properties from XML.
|
||||
"""
|
||||
|
||||
damping: float
|
||||
"""Damping gain."""
|
||||
effort_limit: float | None = None
|
||||
"""Maximum actuator force/torque. If None, no limit is applied."""
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
super().__post_init__()
|
||||
if self.transmission_type == TransmissionType.SITE:
|
||||
raise ValueError(
|
||||
"BuiltinVelocityActuatorCfg does not support SITE transmission. "
|
||||
"Use BuiltinMotorActuatorCfg for site transmission."
|
||||
)
|
||||
|
||||
def build(
|
||||
self, entity: Entity, target_ids: list[int], target_names: list[str]
|
||||
) -> BuiltinVelocityActuator:
|
||||
return BuiltinVelocityActuator(self, entity, target_ids, target_names)
|
||||
|
||||
|
||||
class BuiltinVelocityActuator(Actuator[BuiltinVelocityActuatorCfg]):
|
||||
"""MuJoCo built-in velocity actuator."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
cfg: BuiltinVelocityActuatorCfg,
|
||||
entity: Entity,
|
||||
target_ids: list[int],
|
||||
target_names: list[str],
|
||||
) -> None:
|
||||
super().__init__(cfg, entity, target_ids, target_names)
|
||||
|
||||
def edit_spec(self, spec: mujoco.MjSpec, target_names: list[str]) -> None:
|
||||
# Add <velocity> actuator to spec, one per target.
|
||||
for target_name in target_names:
|
||||
actuator = create_velocity_actuator(
|
||||
spec,
|
||||
target_name,
|
||||
damping=self.cfg.damping,
|
||||
effort_limit=self.cfg.effort_limit,
|
||||
armature=self.cfg.armature,
|
||||
frictionloss=self.cfg.frictionloss,
|
||||
viscous_damping=self.cfg.viscous_damping,
|
||||
transmission_type=self.cfg.transmission_type,
|
||||
)
|
||||
self._mjs_actuators.append(actuator)
|
||||
|
||||
def compute(self, cmd: ActuatorCmd) -> torch.Tensor:
|
||||
return cmd.velocity_target
|
||||
|
||||
|
||||
@dataclass(kw_only=True)
|
||||
class BuiltinMuscleActuatorCfg(ActuatorCfg):
|
||||
"""Configuration for MuJoCo built-in muscle actuator."""
|
||||
|
||||
length_range: tuple[float, float] = (0.0, 0.0)
|
||||
"""Length range for muscle actuator."""
|
||||
gear: float = 1.0
|
||||
"""Gear ratio."""
|
||||
timeconst: tuple[float, float] = (0.01, 0.04)
|
||||
"""Activation and deactivation time constants."""
|
||||
tausmooth: float = 0.0
|
||||
"""Smoothing time constant."""
|
||||
range: tuple[float, float] = (0.75, 1.05)
|
||||
"""Operating range of normalized muscle length."""
|
||||
force: float = -1.0
|
||||
"""Peak force (if -1, defaults to scale * FLV)."""
|
||||
scale: float = 200.0
|
||||
"""Force scaling factor."""
|
||||
lmin: float = 0.5
|
||||
"""Minimum normalized muscle length."""
|
||||
lmax: float = 1.6
|
||||
"""Maximum normalized muscle length."""
|
||||
vmax: float = 1.5
|
||||
"""Maximum normalized muscle velocity."""
|
||||
fpmax: float = 1.3
|
||||
"""Passive force at lmax."""
|
||||
fvmax: float = 1.2
|
||||
"""Active force at -vmax."""
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
super().__post_init__()
|
||||
if self.transmission_type == TransmissionType.SITE:
|
||||
raise ValueError(
|
||||
"BuiltinMuscleActuatorCfg does not support SITE transmission. "
|
||||
"Use BuiltinMotorActuatorCfg for site transmission."
|
||||
)
|
||||
|
||||
def build(
|
||||
self, entity: Entity, target_ids: list[int], target_names: list[str]
|
||||
) -> BuiltinMuscleActuator:
|
||||
return BuiltinMuscleActuator(self, entity, target_ids, target_names)
|
||||
|
||||
|
||||
class BuiltinMuscleActuator(Actuator[BuiltinMuscleActuatorCfg]):
|
||||
"""MuJoCo built-in muscle actuator."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
cfg: BuiltinMuscleActuatorCfg,
|
||||
entity: Entity,
|
||||
target_ids: list[int],
|
||||
target_names: list[str],
|
||||
) -> None:
|
||||
super().__init__(cfg, entity, target_ids, target_names)
|
||||
|
||||
def edit_spec(self, spec: mujoco.MjSpec, target_names: list[str]) -> None:
|
||||
# Add <muscle> actuator to spec, one per target.
|
||||
for target_name in target_names:
|
||||
actuator = create_muscle_actuator(
|
||||
spec,
|
||||
target_name,
|
||||
length_range=self.cfg.length_range,
|
||||
gear=self.cfg.gear,
|
||||
timeconst=self.cfg.timeconst,
|
||||
tausmooth=self.cfg.tausmooth,
|
||||
range=self.cfg.range,
|
||||
force=self.cfg.force,
|
||||
scale=self.cfg.scale,
|
||||
lmin=self.cfg.lmin,
|
||||
lmax=self.cfg.lmax,
|
||||
vmax=self.cfg.vmax,
|
||||
fpmax=self.cfg.fpmax,
|
||||
fvmax=self.cfg.fvmax,
|
||||
transmission_type=self.cfg.transmission_type,
|
||||
)
|
||||
self._mjs_actuators.append(actuator)
|
||||
|
||||
def compute(self, cmd: ActuatorCmd) -> torch.Tensor:
|
||||
return cmd.effort_target
|
||||
@@ -0,0 +1,192 @@
|
||||
"""Batch ctrl writes for builtin actuators.
|
||||
|
||||
Builtin actuators have identity compute(): they just pass the target through to ctrl.
|
||||
Instead of looping over each actuator individually, this module reads the target tensor
|
||||
and writes ctrl in one batched operation per actuator type. Delayed builtins go through
|
||||
a shared DelayBuffer first.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import torch
|
||||
|
||||
from mjlab.actuator.actuator import TransmissionType
|
||||
from mjlab.actuator.builtin_actuator import (
|
||||
BuiltinMotorActuator,
|
||||
BuiltinMuscleActuator,
|
||||
BuiltinPositionActuator,
|
||||
BuiltinVelocityActuator,
|
||||
)
|
||||
from mjlab.utils.buffers import DelayBuffer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from mjlab.actuator.actuator import Actuator
|
||||
from mjlab.entity.data import EntityData
|
||||
|
||||
BuiltinActuatorType = (
|
||||
BuiltinMotorActuator
|
||||
| BuiltinMuscleActuator
|
||||
| BuiltinPositionActuator
|
||||
| BuiltinVelocityActuator
|
||||
)
|
||||
|
||||
# Maps (actuator_type, transmission_type) to EntityData target tensor attribute name.
|
||||
_TARGET_TENSOR_MAP: dict[tuple[type[BuiltinActuatorType], TransmissionType], str] = {
|
||||
(BuiltinPositionActuator, TransmissionType.JOINT): "joint_pos_target",
|
||||
(BuiltinVelocityActuator, TransmissionType.JOINT): "joint_vel_target",
|
||||
(BuiltinMotorActuator, TransmissionType.JOINT): "joint_effort_target",
|
||||
(BuiltinPositionActuator, TransmissionType.TENDON): "tendon_len_target",
|
||||
(BuiltinVelocityActuator, TransmissionType.TENDON): "tendon_vel_target",
|
||||
(BuiltinMotorActuator, TransmissionType.TENDON): "tendon_effort_target",
|
||||
(BuiltinMotorActuator, TransmissionType.SITE): "site_effort_target",
|
||||
(BuiltinMuscleActuator, TransmissionType.JOINT): "joint_effort_target",
|
||||
(BuiltinMuscleActuator, TransmissionType.TENDON): "tendon_effort_target",
|
||||
}
|
||||
|
||||
|
||||
@dataclass
|
||||
class _FusedDelayGroup:
|
||||
"""A fused group of delayed builtin actuators sharing delay config."""
|
||||
|
||||
target_attr: str
|
||||
target_ids: torch.Tensor
|
||||
ctrl_ids: torch.Tensor
|
||||
min_lag: int
|
||||
max_lag: int
|
||||
hold_prob: float
|
||||
update_period: int
|
||||
per_env_phase: bool
|
||||
absorbed_actuators: list[Actuator] = field(default_factory=list)
|
||||
delay_buffer: DelayBuffer | None = field(default=None, init=False)
|
||||
|
||||
|
||||
@dataclass
|
||||
class BuiltinActuatorGroup:
|
||||
"""Groups builtin actuators for batch processing."""
|
||||
|
||||
_index_groups: dict[
|
||||
tuple[type[BuiltinActuatorType], TransmissionType],
|
||||
tuple[torch.Tensor, torch.Tensor],
|
||||
]
|
||||
_delayed_groups: list[_FusedDelayGroup]
|
||||
|
||||
@staticmethod
|
||||
def process(
|
||||
actuators: list[Actuator],
|
||||
) -> tuple[BuiltinActuatorGroup, tuple[Actuator, ...]]:
|
||||
"""Classify actuators into builtin groups and custom actuators.
|
||||
|
||||
Non-delayed builtins go into direct index groups. Delayed builtins with matching
|
||||
delay config are fused into shared delay buffer groups. Everything else is returned
|
||||
as custom actuators.
|
||||
|
||||
Args:
|
||||
actuators: List of initialized actuators to process.
|
||||
|
||||
Returns:
|
||||
A tuple of (builtin group, custom actuators).
|
||||
"""
|
||||
builtin_groups: dict[
|
||||
tuple[type[BuiltinActuatorType], TransmissionType], list[Actuator]
|
||||
] = {}
|
||||
delayed_grouped: dict[tuple, list[Actuator]] = {}
|
||||
custom_actuators: list[Actuator] = []
|
||||
|
||||
for act in actuators:
|
||||
if not isinstance(act, BuiltinActuatorType):
|
||||
custom_actuators.append(act)
|
||||
continue
|
||||
|
||||
if not act.has_delay:
|
||||
key: tuple[type[BuiltinActuatorType], TransmissionType] = (
|
||||
type(act),
|
||||
act.cfg.transmission_type,
|
||||
)
|
||||
builtin_groups.setdefault(key, []).append(act)
|
||||
continue
|
||||
|
||||
# Delayed builtin: fuse into shared delay buffer group.
|
||||
delay_key = (
|
||||
type(act),
|
||||
act.cfg.transmission_type,
|
||||
act.cfg.delay_min_lag,
|
||||
act.cfg.delay_max_lag,
|
||||
act.cfg.delay_hold_prob,
|
||||
act.cfg.delay_update_period,
|
||||
act.cfg.delay_per_env_phase,
|
||||
)
|
||||
delayed_grouped.setdefault(delay_key, []).append(act)
|
||||
|
||||
# Build non-delayed index groups.
|
||||
index_groups: dict[
|
||||
tuple[type[BuiltinActuatorType], TransmissionType],
|
||||
tuple[torch.Tensor, torch.Tensor],
|
||||
] = {
|
||||
key: (
|
||||
torch.cat([a.target_ids for a in acts], dim=0),
|
||||
torch.cat([a.ctrl_ids for a in acts], dim=0),
|
||||
)
|
||||
for key, acts in builtin_groups.items()
|
||||
}
|
||||
|
||||
# Build delayed fused groups.
|
||||
delayed_groups: list[_FusedDelayGroup] = []
|
||||
for (base_type, transmission_type, *_), acts in delayed_grouped.items():
|
||||
target_attr = _TARGET_TENSOR_MAP[(base_type, transmission_type)]
|
||||
target_ids = torch.cat([a.target_ids for a in acts], dim=0)
|
||||
ctrl_ids = torch.cat([a.ctrl_ids for a in acts], dim=0)
|
||||
cfg = acts[0].cfg
|
||||
delayed_groups.append(
|
||||
_FusedDelayGroup(
|
||||
target_attr=target_attr,
|
||||
target_ids=target_ids,
|
||||
ctrl_ids=ctrl_ids,
|
||||
min_lag=cfg.delay_min_lag,
|
||||
max_lag=cfg.delay_max_lag,
|
||||
hold_prob=cfg.delay_hold_prob,
|
||||
update_period=cfg.delay_update_period,
|
||||
per_env_phase=cfg.delay_per_env_phase,
|
||||
absorbed_actuators=list(acts),
|
||||
)
|
||||
)
|
||||
|
||||
return BuiltinActuatorGroup(index_groups, delayed_groups), tuple(custom_actuators)
|
||||
|
||||
def initialize(self, num_envs: int, device: str) -> None:
|
||||
"""Create fused delay buffers for delayed builtin groups."""
|
||||
for group in self._delayed_groups:
|
||||
group.delay_buffer = DelayBuffer(
|
||||
min_lag=group.min_lag,
|
||||
max_lag=group.max_lag,
|
||||
batch_size=num_envs,
|
||||
device=device,
|
||||
hold_prob=group.hold_prob,
|
||||
update_period=group.update_period,
|
||||
per_env_phase=group.per_env_phase,
|
||||
)
|
||||
# Alias the fused buffer into each absorbed actuator so that per-actuator reset
|
||||
# and set_lags operate on the shared buffer.
|
||||
for act in group.absorbed_actuators:
|
||||
act._delay_buffer = group.delay_buffer
|
||||
|
||||
def apply_controls(self, data: EntityData) -> None:
|
||||
"""Write builtin actuator controls to simulation data."""
|
||||
# Non-delayed: direct write.
|
||||
for (actuator_type, transmission_type), (
|
||||
target_ids,
|
||||
ctrl_ids,
|
||||
) in self._index_groups.items():
|
||||
attr_name = _TARGET_TENSOR_MAP[(actuator_type, transmission_type)]
|
||||
target_tensor = getattr(data, attr_name)
|
||||
data.write_ctrl(target_tensor[:, target_ids], ctrl_ids)
|
||||
|
||||
# Delayed: append to buffer, compute delayed value, write.
|
||||
for group in self._delayed_groups:
|
||||
assert group.delay_buffer is not None
|
||||
target_tensor = getattr(data, group.target_attr)
|
||||
targets = target_tensor[:, group.target_ids]
|
||||
group.delay_buffer.append(targets)
|
||||
data.write_ctrl(group.delay_buffer.compute(), group.ctrl_ids)
|
||||
@@ -0,0 +1,189 @@
|
||||
"""DC motor actuator with velocity-based saturation model.
|
||||
|
||||
This module provides a DC motor actuator that implements a realistic torque-speed
|
||||
curve for more accurate motor behavior simulation.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import TYPE_CHECKING, Generic, TypeVar
|
||||
|
||||
import mujoco
|
||||
import mujoco_warp as mjwarp
|
||||
import torch
|
||||
|
||||
from mjlab.actuator.actuator import ActuatorCmd
|
||||
from mjlab.actuator.pd_actuator import IdealPdActuator, IdealPdActuatorCfg, pd_torque
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from mjlab.entity import Entity
|
||||
|
||||
DcMotorCfgT = TypeVar("DcMotorCfgT", bound="DcMotorActuatorCfg")
|
||||
|
||||
|
||||
def dc_motor_clip(
|
||||
effort: torch.Tensor,
|
||||
saturation_effort: torch.Tensor,
|
||||
velocity_limit: torch.Tensor,
|
||||
force_limit: torch.Tensor,
|
||||
vel: torch.Tensor,
|
||||
) -> torch.Tensor:
|
||||
"""Clip effort to the DC motor torque-speed curve.
|
||||
|
||||
Linear torque-speed curve: full saturation_effort at zero velocity falling to
|
||||
zero at velocity_limit, further bounded by the continuous force_limit. Shared
|
||||
by DcMotorActuator._clip_effort and the fused control law so the curve lives in
|
||||
one place.
|
||||
|
||||
The corner velocity where the curve intersects force_limit is recomputed from
|
||||
force_limit every call rather than cached, since force_limit can be
|
||||
domain-randomized after initialize() (e.g. via set_effort_limit); caching it
|
||||
would silently go stale.
|
||||
"""
|
||||
vel_at_effort_lim = velocity_limit * (1 + force_limit / saturation_effort)
|
||||
vel_clipped = torch.clamp(vel, min=-vel_at_effort_lim, max=vel_at_effort_lim)
|
||||
torque_speed_top = saturation_effort * (1.0 - vel_clipped / velocity_limit)
|
||||
torque_speed_bottom = saturation_effort * (-1.0 - vel_clipped / velocity_limit)
|
||||
max_effort = torch.clamp(torque_speed_top, max=force_limit)
|
||||
min_effort = torch.clamp(torque_speed_bottom, min=-force_limit)
|
||||
return torch.clamp(effort, min=min_effort, max=max_effort)
|
||||
|
||||
|
||||
@dataclass(kw_only=True)
|
||||
class DcMotorActuatorCfg(IdealPdActuatorCfg):
|
||||
"""Configuration for DC motor actuator with velocity-based saturation.
|
||||
|
||||
This actuator implements a DC motor torque-speed curve for more realistic
|
||||
actuator behavior. The motor produces maximum torque (saturation_effort) at
|
||||
zero velocity and reduces linearly to zero torque at maximum velocity.
|
||||
|
||||
Note: effort_limit should be explicitly set to a realistic value for proper
|
||||
motor modeling. Using the default (inf) will trigger a warning. Use
|
||||
IdealPdActuator if unlimited torque is desired.
|
||||
|
||||
For a native MuJoCo ``<dcmotor>`` with back-EMF, voltage saturation, and
|
||||
configurable ``Kt`` / ``Ke`` / ``R``, see ``BuiltinDcMotorActuator``.
|
||||
"""
|
||||
|
||||
saturation_effort: float
|
||||
"""Peak motor torque at zero velocity (stall torque)."""
|
||||
|
||||
velocity_limit: float
|
||||
"""Maximum motor velocity (no-load speed)."""
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
"""Validate DC motor parameters."""
|
||||
super().__post_init__()
|
||||
import warnings
|
||||
|
||||
if self.effort_limit == float("inf"):
|
||||
warnings.warn(
|
||||
"effort_limit is set to inf for DcMotorActuator, which creates an "
|
||||
"unrealistic motor with unlimited continuous torque. Consider setting "
|
||||
"effort_limit to your motor's continuous rating (<= saturation_effort). "
|
||||
"Use IdealPdActuator if you truly want unlimited torque.",
|
||||
UserWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
if self.effort_limit > self.saturation_effort:
|
||||
warnings.warn(
|
||||
f"effort_limit ({self.effort_limit}) exceeds saturation_effort "
|
||||
f"({self.saturation_effort}). For realistic motors, continuous torque "
|
||||
"should be <= peak torque.",
|
||||
UserWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
def build(
|
||||
self, entity: Entity, target_ids: list[int], target_names: list[str]
|
||||
) -> DcMotorActuator:
|
||||
return DcMotorActuator(self, entity, target_ids, target_names)
|
||||
|
||||
|
||||
class DcMotorActuator(IdealPdActuator[DcMotorCfgT], Generic[DcMotorCfgT]):
|
||||
"""DC motor actuator with velocity-based saturation model.
|
||||
|
||||
This actuator extends IdealPdActuator with a realistic DC motor model
|
||||
that limits torque based on current joint velocity. The model implements
|
||||
a linear torque-speed curve where:
|
||||
- At zero velocity: can produce full saturation_effort (stall torque)
|
||||
- At max velocity: can produce zero torque
|
||||
- Between: torque limit varies linearly
|
||||
|
||||
The continuous torque limit (effort_limit) further constrains the output.
|
||||
"""
|
||||
|
||||
# Same stateless-law compute as IdealPd, with the torque-speed curve added to
|
||||
# the law. The velocity feedback the curve needs comes straight from cmd.vel.
|
||||
param_names = (
|
||||
*IdealPdActuator.param_names,
|
||||
"saturation_effort",
|
||||
"velocity_limit_motor",
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def control_law(params: dict[str, torch.Tensor], cmd: ActuatorCmd) -> torch.Tensor:
|
||||
torque = pd_torque(params["stiffness"], params["damping"], cmd)
|
||||
return dc_motor_clip(
|
||||
torque,
|
||||
params["saturation_effort"],
|
||||
params["velocity_limit_motor"],
|
||||
params["force_limit"],
|
||||
cmd.vel,
|
||||
)
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
cfg: DcMotorCfgT,
|
||||
entity: Entity,
|
||||
target_ids: list[int],
|
||||
target_names: list[str],
|
||||
) -> None:
|
||||
super().__init__(cfg, entity, target_ids, target_names)
|
||||
self.saturation_effort: torch.Tensor | None = None
|
||||
self.velocity_limit_motor: torch.Tensor | None = None
|
||||
self._joint_vel_clipped: torch.Tensor | None = None
|
||||
|
||||
def initialize(
|
||||
self,
|
||||
mj_model: mujoco.MjModel,
|
||||
model: mjwarp.Model,
|
||||
data: mjwarp.Data,
|
||||
device: str,
|
||||
) -> None:
|
||||
super().initialize(mj_model, model, data, device)
|
||||
|
||||
num_envs = data.nworld
|
||||
num_joints = len(self._target_names)
|
||||
|
||||
self.saturation_effort = torch.full(
|
||||
(num_envs, num_joints),
|
||||
self.cfg.saturation_effort,
|
||||
dtype=torch.float,
|
||||
device=device,
|
||||
)
|
||||
self.velocity_limit_motor = torch.full(
|
||||
(num_envs, num_joints),
|
||||
self.cfg.velocity_limit,
|
||||
dtype=torch.float,
|
||||
device=device,
|
||||
)
|
||||
self._joint_vel_clipped = torch.zeros(num_envs, num_joints, device=device)
|
||||
|
||||
def _clip_effort(self, effort: torch.Tensor) -> torch.Tensor:
|
||||
# Retained for LearnedMlpActuator, which has its own (stateful) compute and
|
||||
# reuses this torque-speed clip. DcMotorActuator itself clips inside
|
||||
# control_law via dc_motor_clip.
|
||||
assert self.saturation_effort is not None
|
||||
assert self.velocity_limit_motor is not None
|
||||
assert self.force_limit is not None
|
||||
assert self._joint_vel_clipped is not None
|
||||
return dc_motor_clip(
|
||||
effort,
|
||||
self.saturation_effort,
|
||||
self.velocity_limit_motor,
|
||||
self.force_limit,
|
||||
self._joint_vel_clipped,
|
||||
)
|
||||
@@ -0,0 +1,223 @@
|
||||
"""Batch compute for stateless-control-law actuators.
|
||||
|
||||
Actuators like IdealPdActuator and DcMotorActuator evaluate their control law in
|
||||
PyTorch every physics substep. Done per actuator, a robot split into several
|
||||
groups (e.g. one per motor type) issues that many gathers, delay-buffer updates,
|
||||
control-law evaluations, and ctrl writes each substep. At small env counts (play
|
||||
mode with a synchronizing viewer) this is host-launch-bound and noticeably slow,
|
||||
whereas built-in actuators are already fused into one batched write.
|
||||
|
||||
This module brings the same fusion to actuators whose control output is a
|
||||
stateless function of per-target parameters and the command. Such actuators apply
|
||||
their control law through the shared compute inherited from IdealPdActuator;
|
||||
keeping that compute is exactly what marks an actuator as fusable. Actuators with
|
||||
a custom compute (built-ins, XML, learned networks) are skipped, with no opt-out
|
||||
flag required.
|
||||
|
||||
Fusable actuators sharing an exact type, transmission type, and delay config are
|
||||
fused into one group: their per-target parameters and indices are concatenated so
|
||||
the gather, optional delay, control law, and ctrl write each happen once for the
|
||||
whole group, behind a single shared DelayBuffer. SITE transmission is not fused.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import torch
|
||||
|
||||
from mjlab.actuator.actuator import ActuatorCmd, TransmissionType, delay_command
|
||||
from mjlab.actuator.pd_actuator import IdealPdActuator
|
||||
from mjlab.utils.buffers import DelayBuffer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from mjlab.actuator.actuator import Actuator
|
||||
from mjlab.entity.data import EntityData
|
||||
|
||||
# Per transmission type, the EntityData attribute names for the five fields the
|
||||
# control law reads: (position_target, velocity_target, effort_target, position,
|
||||
# velocity).
|
||||
_FIELD_MAP: dict[TransmissionType, tuple[str, str, str, str, str]] = {
|
||||
TransmissionType.JOINT: (
|
||||
"joint_pos_target",
|
||||
"joint_vel_target",
|
||||
"joint_effort_target",
|
||||
"joint_pos",
|
||||
"joint_vel",
|
||||
),
|
||||
TransmissionType.TENDON: (
|
||||
"tendon_len_target",
|
||||
"tendon_vel_target",
|
||||
"tendon_effort_target",
|
||||
"tendon_len",
|
||||
"tendon_vel",
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
def _is_fusable(act: Actuator) -> bool:
|
||||
"""An actuator is fusable iff it keeps the shared stateless-law compute.
|
||||
|
||||
IdealPd and DcMotor apply their control law through that inherited compute;
|
||||
anything with a custom compute (built-ins, XML, and learned actuators,
|
||||
including DcMotor subclasses that override it) is not fusable. Comparing the
|
||||
bound function is immune to the inheritance trap an isinstance check would hit.
|
||||
"""
|
||||
return (
|
||||
type(act).compute is IdealPdActuator.compute
|
||||
and act.cfg.transmission_type in _FIELD_MAP
|
||||
)
|
||||
|
||||
|
||||
def _require(t: torch.Tensor | None) -> torch.Tensor:
|
||||
assert t is not None
|
||||
return t
|
||||
|
||||
|
||||
@dataclass
|
||||
class _FusedGroup:
|
||||
"""A fused group of actuators sharing type, transmission, and delay config."""
|
||||
|
||||
actuator_type: type[Actuator]
|
||||
transmission_type: TransmissionType
|
||||
target_ids: torch.Tensor
|
||||
ctrl_ids: torch.Tensor
|
||||
min_lag: int
|
||||
max_lag: int
|
||||
hold_prob: float
|
||||
update_period: int
|
||||
per_env_phase: bool
|
||||
absorbed_actuators: list[Actuator] = field(default_factory=list)
|
||||
params: dict[str, torch.Tensor] = field(default_factory=dict, init=False)
|
||||
delay_buffer: DelayBuffer | None = field(default=None, init=False)
|
||||
|
||||
@property
|
||||
def has_delay(self) -> bool:
|
||||
return self.max_lag > 0
|
||||
|
||||
|
||||
@dataclass
|
||||
class FusedActuatorGroup:
|
||||
"""Groups stateless-control-law actuators for batch processing."""
|
||||
|
||||
_groups: list[_FusedGroup]
|
||||
|
||||
@staticmethod
|
||||
def process(
|
||||
actuators: tuple[Actuator, ...] | list[Actuator],
|
||||
) -> tuple[FusedActuatorGroup, tuple[Actuator, ...]]:
|
||||
"""Classify actuators into fused groups and remaining custom actuators.
|
||||
|
||||
Fusable actuators (see _is_fusable) with JOINT or TENDON transmission are
|
||||
fused by (exact type, transmission type, delay config). Everything else is
|
||||
returned unchanged for the per-actuator path.
|
||||
|
||||
Args:
|
||||
actuators: List of initialized actuators to process.
|
||||
|
||||
Returns:
|
||||
A tuple of (fused group, remaining custom actuators).
|
||||
"""
|
||||
grouped: dict[tuple, list[Actuator]] = {}
|
||||
remaining: list[Actuator] = []
|
||||
|
||||
for act in actuators:
|
||||
if not _is_fusable(act):
|
||||
remaining.append(act)
|
||||
continue
|
||||
key = (
|
||||
type(act),
|
||||
act.cfg.transmission_type,
|
||||
act.cfg.delay_min_lag,
|
||||
act.cfg.delay_max_lag,
|
||||
act.cfg.delay_hold_prob,
|
||||
act.cfg.delay_update_period,
|
||||
act.cfg.delay_per_env_phase,
|
||||
)
|
||||
grouped.setdefault(key, []).append(act)
|
||||
|
||||
groups: list[_FusedGroup] = []
|
||||
for (actuator_type, transmission_type, *_), acts in grouped.items():
|
||||
cfg = acts[0].cfg
|
||||
groups.append(
|
||||
_FusedGroup(
|
||||
actuator_type=actuator_type,
|
||||
transmission_type=transmission_type,
|
||||
target_ids=torch.cat([a.target_ids for a in acts], dim=0),
|
||||
ctrl_ids=torch.cat([a.ctrl_ids for a in acts], dim=0),
|
||||
min_lag=cfg.delay_min_lag,
|
||||
max_lag=cfg.delay_max_lag,
|
||||
hold_prob=cfg.delay_hold_prob,
|
||||
update_period=cfg.delay_update_period,
|
||||
per_env_phase=cfg.delay_per_env_phase,
|
||||
absorbed_actuators=list(acts),
|
||||
)
|
||||
)
|
||||
|
||||
return FusedActuatorGroup(groups), tuple(remaining)
|
||||
|
||||
def initialize(self, num_envs: int, device: str) -> None:
|
||||
"""Concatenate parameters and create shared delay buffers for fused groups."""
|
||||
for group in self._groups:
|
||||
# Concatenate each control-law parameter across absorbed actuators, then
|
||||
# alias every actuator's parameter back to a slice view of the fused tensor.
|
||||
#
|
||||
# Invariant: after this an absorbed actuator's parameter tensors are views
|
||||
# into the group tensors. Mutations must be in-place (e.g. set_gains and
|
||||
# set_effort_limit assign into a slice) so they write through to what the
|
||||
# group computes with. Rebinding the attribute would silently detach it; the
|
||||
# only rebind site is the actuator's initialize(), which runs before fusion.
|
||||
for name in group.actuator_type.param_names:
|
||||
group.params[name] = torch.cat(
|
||||
[_require(getattr(a, name)) for a in group.absorbed_actuators], dim=1
|
||||
)
|
||||
offset = 0
|
||||
for act in group.absorbed_actuators:
|
||||
n = act.target_ids.numel()
|
||||
for name in group.actuator_type.param_names:
|
||||
setattr(act, name, group.params[name][:, offset : offset + n])
|
||||
offset += n
|
||||
|
||||
if group.has_delay:
|
||||
group.delay_buffer = DelayBuffer(
|
||||
min_lag=group.min_lag,
|
||||
max_lag=group.max_lag,
|
||||
batch_size=num_envs,
|
||||
device=device,
|
||||
hold_prob=group.hold_prob,
|
||||
update_period=group.update_period,
|
||||
per_env_phase=group.per_env_phase,
|
||||
)
|
||||
# Alias the shared buffer into each absorbed actuator so per-actuator
|
||||
# reset and set_lags operate on it.
|
||||
for act in group.absorbed_actuators:
|
||||
act._delay_buffer = group.delay_buffer
|
||||
|
||||
def apply_controls(self, data: EntityData) -> None:
|
||||
"""Compute and write fused actuator controls to simulation data."""
|
||||
for group in self._groups:
|
||||
pos_attr, vel_attr, eff_attr, cur_pos_attr, cur_vel_attr = _FIELD_MAP[
|
||||
group.transmission_type
|
||||
]
|
||||
ids = group.target_ids
|
||||
pos_target = getattr(data, pos_attr)[:, ids]
|
||||
vel_target = getattr(data, vel_attr)[:, ids]
|
||||
effort_target = getattr(data, eff_attr)[:, ids]
|
||||
pos = getattr(data, cur_pos_attr)[:, ids]
|
||||
vel = getattr(data, cur_vel_attr)[:, ids]
|
||||
|
||||
if group.delay_buffer is not None:
|
||||
pos_target, vel_target, effort_target = delay_command(
|
||||
group.delay_buffer, pos_target, vel_target, effort_target
|
||||
)
|
||||
|
||||
cmd = ActuatorCmd(
|
||||
position_target=pos_target,
|
||||
velocity_target=vel_target,
|
||||
effort_target=effort_target,
|
||||
pos=pos,
|
||||
vel=vel,
|
||||
)
|
||||
torques = group.actuator_type.control_law(group.params, cmd)
|
||||
data.write_ctrl(torques, group.ctrl_ids)
|
||||
@@ -0,0 +1,208 @@
|
||||
"""Learned actuator models."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import TYPE_CHECKING, Literal
|
||||
|
||||
import mujoco
|
||||
import mujoco_warp as mjwarp
|
||||
import torch
|
||||
|
||||
from mjlab.actuator.actuator import ActuatorCmd
|
||||
from mjlab.actuator.dc_actuator import DcMotorActuator, DcMotorActuatorCfg
|
||||
from mjlab.utils.buffers import CircularBuffer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from mjlab.entity import Entity
|
||||
|
||||
|
||||
@dataclass(kw_only=True)
|
||||
class LearnedMlpActuatorCfg(DcMotorActuatorCfg):
|
||||
"""Configuration for MLP-based learned actuator model.
|
||||
|
||||
This actuator learns the mapping from joint commands and state history to
|
||||
actual torque output. It's useful for capturing actuator dynamics that are
|
||||
difficult to model analytically, such as delays, non-linearities, and
|
||||
friction effects.
|
||||
|
||||
The network is trained offline using data from the real system and loaded
|
||||
as a TorchScript file. The model uses a sliding window of historical joint
|
||||
position errors and velocities as inputs.
|
||||
"""
|
||||
|
||||
network_file: str
|
||||
"""Path to the TorchScript file containing the trained MLP model."""
|
||||
|
||||
pos_scale: float
|
||||
"""Scaling factor for joint position error inputs to the network."""
|
||||
|
||||
vel_scale: float
|
||||
"""Scaling factor for joint velocity inputs to the network."""
|
||||
|
||||
torque_scale: float
|
||||
"""Scaling factor for torque outputs from the network."""
|
||||
|
||||
input_order: Literal["pos_vel", "vel_pos"] = "pos_vel"
|
||||
"""Order of inputs to the network.
|
||||
|
||||
- "pos_vel": position errors followed by velocities
|
||||
- "vel_pos": velocities followed by position errors
|
||||
"""
|
||||
|
||||
history_length: int = 3
|
||||
"""Number of timesteps of history to use as network inputs.
|
||||
|
||||
For example, history_length=3 uses the current timestep plus the previous
|
||||
2 timesteps (total of 3 frames).
|
||||
"""
|
||||
|
||||
# Learned actuators don't use stiffness/damping from PD controller.
|
||||
stiffness: float = 0.0
|
||||
damping: float = 0.0
|
||||
|
||||
def build(
|
||||
self, entity: Entity, target_ids: list[int], target_names: list[str]
|
||||
) -> LearnedMlpActuator:
|
||||
return LearnedMlpActuator(self, entity, target_ids, target_names)
|
||||
|
||||
|
||||
class LearnedMlpActuator(DcMotorActuator[LearnedMlpActuatorCfg]):
|
||||
"""MLP-based learned actuator with joint history.
|
||||
|
||||
This actuator uses a trained neural network to map from joint commands and
|
||||
state history to torque outputs. The network captures complex actuator
|
||||
dynamics that are difficult to model analytically.
|
||||
|
||||
The actuator maintains circular buffers of joint position errors and
|
||||
velocities, which are used as inputs to the MLP. The network outputs are
|
||||
then scaled and clipped using the DC motor limits from the parent class.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
cfg: LearnedMlpActuatorCfg,
|
||||
entity: Entity,
|
||||
target_ids: list[int],
|
||||
target_names: list[str],
|
||||
) -> None:
|
||||
super().__init__(cfg, entity, target_ids, target_names)
|
||||
self.network: torch.jit.ScriptModule | None = None
|
||||
self._pos_error_history: CircularBuffer | None = None
|
||||
self._vel_history: CircularBuffer | None = None
|
||||
|
||||
def initialize(
|
||||
self,
|
||||
mj_model: mujoco.MjModel,
|
||||
model: mjwarp.Model,
|
||||
data: mjwarp.Data,
|
||||
device: str,
|
||||
) -> None:
|
||||
super().initialize(mj_model, model, data, device)
|
||||
|
||||
# Load the trained network from TorchScript file.
|
||||
self.network = torch.jit.load(self.cfg.network_file, map_location=device)
|
||||
assert self.network is not None
|
||||
self.network.eval()
|
||||
|
||||
# Create history buffers.
|
||||
num_envs = data.nworld
|
||||
|
||||
self._pos_error_history = CircularBuffer(
|
||||
max_len=self.cfg.history_length,
|
||||
batch_size=num_envs,
|
||||
device=device,
|
||||
)
|
||||
self._vel_history = CircularBuffer(
|
||||
max_len=self.cfg.history_length,
|
||||
batch_size=num_envs,
|
||||
device=device,
|
||||
)
|
||||
|
||||
def reset(self, env_ids: torch.Tensor | slice | None = None) -> None:
|
||||
"""Reset history buffers for specified environments.
|
||||
|
||||
Args:
|
||||
env_ids: Environment indices to reset. If None, reset all environments.
|
||||
"""
|
||||
super().reset(env_ids)
|
||||
assert self._pos_error_history is not None
|
||||
assert self._vel_history is not None
|
||||
|
||||
if env_ids is None:
|
||||
self._pos_error_history.reset()
|
||||
self._vel_history.reset()
|
||||
elif isinstance(env_ids, slice):
|
||||
# Convert slice to indices for CircularBuffer.
|
||||
batch_size = self._pos_error_history.batch_size
|
||||
indices = list(range(*env_ids.indices(batch_size)))
|
||||
self._pos_error_history.reset(indices)
|
||||
self._vel_history.reset(indices)
|
||||
else:
|
||||
self._pos_error_history.reset(env_ids)
|
||||
self._vel_history.reset(env_ids)
|
||||
|
||||
def compute(self, cmd: ActuatorCmd) -> torch.Tensor:
|
||||
"""Compute actuator torques using the learned MLP model.
|
||||
|
||||
Args:
|
||||
cmd: High-level actuator command containing targets and current state.
|
||||
|
||||
Returns:
|
||||
Computed torque tensor of shape (num_envs, num_joints).
|
||||
"""
|
||||
assert self.network is not None
|
||||
assert self._pos_error_history is not None
|
||||
assert self._vel_history is not None
|
||||
assert self._joint_vel_clipped is not None
|
||||
|
||||
# Update history buffers with current state.
|
||||
pos_error = cmd.position_target - cmd.pos
|
||||
self._pos_error_history.append(pos_error)
|
||||
self._vel_history.append(cmd.vel)
|
||||
|
||||
# Save velocity for DC motor clipping in parent class.
|
||||
self._joint_vel_clipped[:] = cmd.vel
|
||||
|
||||
num_envs = cmd.pos.shape[0]
|
||||
num_joints = cmd.pos.shape[1]
|
||||
|
||||
# Extract history from current to history_length-1 steps back.
|
||||
# Each returns shape: (num_envs, num_joints).
|
||||
pos_inputs = [
|
||||
self._pos_error_history[lag] for lag in range(self.cfg.history_length)
|
||||
]
|
||||
vel_inputs = [self._vel_history[lag] for lag in range(self.cfg.history_length)]
|
||||
|
||||
# Stack along feature dimension: (num_envs, num_joints, history_length).
|
||||
pos_stacked = torch.stack(pos_inputs, dim=2)
|
||||
vel_stacked = torch.stack(vel_inputs, dim=2)
|
||||
|
||||
# Reshape to (num_envs * num_joints, num_history_steps) for network.
|
||||
pos_flat = pos_stacked.reshape(num_envs * num_joints, -1)
|
||||
vel_flat = vel_stacked.reshape(num_envs * num_joints, -1)
|
||||
|
||||
# Scale and concatenate inputs based on specified order.
|
||||
if self.cfg.input_order == "pos_vel":
|
||||
network_input = torch.cat(
|
||||
[pos_flat * self.cfg.pos_scale, vel_flat * self.cfg.vel_scale], dim=1
|
||||
)
|
||||
elif self.cfg.input_order == "vel_pos":
|
||||
network_input = torch.cat(
|
||||
[vel_flat * self.cfg.vel_scale, pos_flat * self.cfg.pos_scale], dim=1
|
||||
)
|
||||
else:
|
||||
raise ValueError(
|
||||
f"Invalid input order: {self.cfg.input_order}. Must be 'pos_vel' or 'vel_pos'."
|
||||
)
|
||||
|
||||
# Run network inference.
|
||||
with torch.inference_mode():
|
||||
torques_flat = self.network(network_input)
|
||||
|
||||
# Reshape and scale output torques.
|
||||
computed_torques = torques_flat.reshape(num_envs, num_joints)
|
||||
computed_torques = computed_torques * self.cfg.torque_scale
|
||||
|
||||
# Clip using DC motor limits from parent class.
|
||||
return self._clip_effort(computed_torques)
|
||||
@@ -0,0 +1,163 @@
|
||||
"""An ideal PD control actuator."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import TYPE_CHECKING, Generic, TypeVar
|
||||
|
||||
import mujoco
|
||||
import mujoco_warp as mjwarp
|
||||
import torch
|
||||
|
||||
from mjlab.actuator.actuator import Actuator, ActuatorCfg, ActuatorCmd
|
||||
from mjlab.utils.spec import create_motor_actuator
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from mjlab.entity import Entity
|
||||
|
||||
IdealPdCfgT = TypeVar("IdealPdCfgT", bound="IdealPdActuatorCfg")
|
||||
|
||||
|
||||
def pd_torque(
|
||||
stiffness: torch.Tensor, damping: torch.Tensor, cmd: ActuatorCmd
|
||||
) -> torch.Tensor:
|
||||
"""Ideal PD control torque, unclamped.
|
||||
|
||||
kp * (pos_target - pos) + kd * (vel_target - vel) + effort_target. Shared by
|
||||
the ideal PD and DC motor control laws so the PD sum lives in one place.
|
||||
"""
|
||||
torque = stiffness * (cmd.position_target - cmd.pos)
|
||||
torque += damping * (cmd.velocity_target - cmd.vel)
|
||||
torque += cmd.effort_target
|
||||
return torque
|
||||
|
||||
|
||||
@dataclass(kw_only=True)
|
||||
class IdealPdActuatorCfg(ActuatorCfg):
|
||||
"""Configuration for ideal PD actuator."""
|
||||
|
||||
stiffness: float
|
||||
"""PD stiffness (proportional gain)."""
|
||||
damping: float
|
||||
"""PD damping (derivative gain)."""
|
||||
effort_limit: float = float("inf")
|
||||
"""Maximum force/torque limit."""
|
||||
|
||||
def build(
|
||||
self, entity: Entity, target_ids: list[int], target_names: list[str]
|
||||
) -> IdealPdActuator:
|
||||
return IdealPdActuator(self, entity, target_ids, target_names)
|
||||
|
||||
|
||||
class IdealPdActuator(Actuator, Generic[IdealPdCfgT]):
|
||||
"""Ideal PD control actuator."""
|
||||
|
||||
param_names = ("stiffness", "damping", "force_limit")
|
||||
|
||||
def compute(self, cmd: ActuatorCmd) -> torch.Tensor:
|
||||
# Shared stateless-law compute. Keeping this (rather than writing a custom
|
||||
# compute) is what marks an actuator as fusable; subclasses with a different
|
||||
# control law (e.g. learned networks) override compute instead.
|
||||
params = {name: getattr(self, name) for name in self.param_names}
|
||||
return type(self).control_law(params, cmd)
|
||||
|
||||
@staticmethod
|
||||
def control_law(params: dict[str, torch.Tensor], cmd: ActuatorCmd) -> torch.Tensor:
|
||||
torque = pd_torque(params["stiffness"], params["damping"], cmd)
|
||||
force_limit = params["force_limit"]
|
||||
return torch.clamp(torque, -force_limit, force_limit)
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
cfg: IdealPdCfgT,
|
||||
entity: Entity,
|
||||
target_ids: list[int],
|
||||
target_names: list[str],
|
||||
) -> None:
|
||||
super().__init__(cfg, entity, target_ids, target_names)
|
||||
self.stiffness: torch.Tensor | None = None
|
||||
self.damping: torch.Tensor | None = None
|
||||
self.force_limit: torch.Tensor | None = None
|
||||
self.default_stiffness: torch.Tensor | None = None
|
||||
self.default_damping: torch.Tensor | None = None
|
||||
self.default_force_limit: torch.Tensor | None = None
|
||||
|
||||
def edit_spec(self, spec: mujoco.MjSpec, target_names: list[str]) -> None:
|
||||
# Add <motor> actuator to spec, one per target.
|
||||
for target_name in target_names:
|
||||
actuator = create_motor_actuator(
|
||||
spec,
|
||||
target_name,
|
||||
effort_limit=self.cfg.effort_limit,
|
||||
armature=self.cfg.armature,
|
||||
frictionloss=self.cfg.frictionloss,
|
||||
viscous_damping=self.cfg.viscous_damping,
|
||||
transmission_type=self.cfg.transmission_type,
|
||||
)
|
||||
self._mjs_actuators.append(actuator)
|
||||
|
||||
def initialize(
|
||||
self,
|
||||
mj_model: mujoco.MjModel,
|
||||
model: mjwarp.Model,
|
||||
data: mjwarp.Data,
|
||||
device: str,
|
||||
) -> None:
|
||||
super().initialize(mj_model, model, data, device)
|
||||
|
||||
num_envs = data.nworld
|
||||
num_joints = len(self._target_names)
|
||||
self.stiffness = torch.full(
|
||||
(num_envs, num_joints), self.cfg.stiffness, dtype=torch.float, device=device
|
||||
)
|
||||
self.damping = torch.full(
|
||||
(num_envs, num_joints), self.cfg.damping, dtype=torch.float, device=device
|
||||
)
|
||||
self.force_limit = torch.full(
|
||||
(num_envs, num_joints), self.cfg.effort_limit, dtype=torch.float, device=device
|
||||
)
|
||||
|
||||
self.default_stiffness = self.stiffness.clone()
|
||||
self.default_damping = self.damping.clone()
|
||||
self.default_force_limit = self.force_limit.clone()
|
||||
|
||||
def set_gains(
|
||||
self,
|
||||
env_ids: torch.Tensor | slice,
|
||||
kp: torch.Tensor | None = None,
|
||||
kd: torch.Tensor | None = None,
|
||||
) -> None:
|
||||
"""Set PD gains for specified environments.
|
||||
|
||||
Args:
|
||||
env_ids: Environment indices to update.
|
||||
kp: New proportional gains. Shape: (num_envs, num_actuators) or (num_envs,).
|
||||
kd: New derivative gains. Shape: (num_envs, num_actuators) or (num_envs,).
|
||||
"""
|
||||
assert self.stiffness is not None
|
||||
assert self.damping is not None
|
||||
|
||||
if kp is not None:
|
||||
if kp.ndim == 1:
|
||||
kp = kp.unsqueeze(-1)
|
||||
self.stiffness[env_ids] = kp
|
||||
|
||||
if kd is not None:
|
||||
if kd.ndim == 1:
|
||||
kd = kd.unsqueeze(-1)
|
||||
self.damping[env_ids] = kd
|
||||
|
||||
def set_effort_limit(
|
||||
self, env_ids: torch.Tensor | slice, effort_limit: torch.Tensor
|
||||
) -> None:
|
||||
"""Set effort limits for specified environments.
|
||||
|
||||
Args:
|
||||
env_ids: Environment indices to update.
|
||||
effort_limit: New effort limits. Shape: (num_envs, num_actuators) or (num_envs,).
|
||||
"""
|
||||
assert self.force_limit is not None
|
||||
|
||||
if effort_limit.ndim == 1:
|
||||
effort_limit = effort_limit.unsqueeze(-1)
|
||||
self.force_limit[env_ids] = effort_limit
|
||||
@@ -0,0 +1,132 @@
|
||||
"""Use actuators already defined in your robot XML.
|
||||
|
||||
When your MJCF already has ``<position>``, ``<velocity>``, ``<motor>``, or ``<muscle>``
|
||||
elements, ``XmlActuatorCfg`` wraps them without re-specifying gains or limits. The
|
||||
actuator type is auto-detected from the spec element. Delay and other ``ActuatorCfg``
|
||||
fields work as usual.
|
||||
|
||||
If your XML has actuators on both joints and tendons, use two configs with different
|
||||
``transmission_type`` values; a single config can only target one namespace.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import TYPE_CHECKING, cast
|
||||
|
||||
import mujoco
|
||||
import torch
|
||||
|
||||
from mjlab.actuator.actuator import Actuator, ActuatorCfg, ActuatorCmd, CommandField
|
||||
from mjlab.utils.mujoco import detect_command_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from mjlab.entity import Entity
|
||||
|
||||
|
||||
@dataclass(kw_only=True)
|
||||
class XmlActuatorCfg(ActuatorCfg):
|
||||
"""Wrap existing XML-defined actuators.
|
||||
|
||||
Detects the actuator type (position, velocity, motor, muscle) from the MuJoCo spec
|
||||
element during ``edit_spec``, or validates against an explicit ``command_field`` if
|
||||
provided.
|
||||
"""
|
||||
|
||||
command_field: CommandField | None = None
|
||||
"""If provided, require XML actuators to match this command field.
|
||||
If None, auto-detect strictly from the spec element."""
|
||||
|
||||
def build(
|
||||
self, entity: Entity, target_ids: list[int], target_names: list[str]
|
||||
) -> XmlActuator:
|
||||
return XmlActuator(self, entity, target_ids, target_names)
|
||||
|
||||
|
||||
class XmlActuator(Actuator[XmlActuatorCfg]):
|
||||
"""Wrapper for XML-defined actuators."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
cfg: XmlActuatorCfg,
|
||||
entity: Entity,
|
||||
target_ids: list[int],
|
||||
target_names: list[str],
|
||||
) -> None:
|
||||
super().__init__(cfg, entity, target_ids, target_names)
|
||||
self._command_field: CommandField | None = None
|
||||
|
||||
@property
|
||||
def command_field(self) -> CommandField:
|
||||
"""The resolved command field (detected or explicit), not the raw config value.
|
||||
|
||||
Set during ``edit_spec``. Use ``self.cfg.command_field`` to access the user's
|
||||
original input (which may be None for auto-detection).
|
||||
"""
|
||||
assert self._command_field is not None
|
||||
return self._command_field
|
||||
|
||||
def edit_spec(self, spec: mujoco.MjSpec, target_names: list[str]) -> None:
|
||||
# Filter to only targets that have corresponding XML actuators.
|
||||
filtered_target_ids = []
|
||||
filtered_target_names = []
|
||||
for i, target_name in enumerate(target_names):
|
||||
actuator = self._find_actuator_for_target(spec, target_name)
|
||||
if actuator is not None:
|
||||
self._mjs_actuators.append(actuator)
|
||||
filtered_target_ids.append(self._target_ids_list[i])
|
||||
# Store the user-facing (stripped) name, not the spec name.
|
||||
filtered_target_names.append(self._target_names[i])
|
||||
|
||||
if len(filtered_target_names) == 0:
|
||||
raise ValueError(
|
||||
f"No XML actuators found for any targets matching the patterns. "
|
||||
f"Searched targets: {target_names}. "
|
||||
f"XML actuator config expects actuators to already exist in the XML."
|
||||
)
|
||||
|
||||
# Update target IDs and names to only include those with actuators.
|
||||
self._target_ids_list = filtered_target_ids
|
||||
self._target_names = filtered_target_names
|
||||
|
||||
if self.cfg.command_field is not None:
|
||||
# Validate that every matched actuator is compatible with the
|
||||
# requested command field.
|
||||
for act, name in zip(self._mjs_actuators, self._target_names, strict=True):
|
||||
try:
|
||||
detected = detect_command_field(act)
|
||||
except ValueError:
|
||||
continue # Unrecognized type; trust the explicit override.
|
||||
if detected != self.cfg.command_field:
|
||||
raise ValueError(
|
||||
f"XML actuator for '{name}' is type '{detected}', but "
|
||||
f"command_field='{self.cfg.command_field}' was requested."
|
||||
)
|
||||
self._command_field = self.cfg.command_field
|
||||
else:
|
||||
# Auto-detect from spec elements. Raises for unrecognized types.
|
||||
fields = [detect_command_field(a) for a in self._mjs_actuators]
|
||||
unique = set(fields)
|
||||
if len(unique) > 1:
|
||||
breakdown = dict(zip(self._target_names, fields, strict=True))
|
||||
raise ValueError(
|
||||
f"Mixed XML actuator types for targets: {breakdown}. "
|
||||
f"Split into separate XmlActuatorCfg groups."
|
||||
)
|
||||
self._command_field = cast(CommandField, fields[0])
|
||||
|
||||
def compute(self, cmd: ActuatorCmd) -> torch.Tensor:
|
||||
if self._command_field == "position":
|
||||
return cmd.position_target
|
||||
if self._command_field == "velocity":
|
||||
return cmd.velocity_target
|
||||
return cmd.effort_target
|
||||
|
||||
def _find_actuator_for_target(
|
||||
self, spec: mujoco.MjSpec, target_name: str
|
||||
) -> mujoco.MjsActuator | None:
|
||||
"""Find an actuator that targets the given target."""
|
||||
for actuator in spec.actuators:
|
||||
if actuator.target == target_name:
|
||||
return actuator
|
||||
return None
|
||||
@@ -0,0 +1,7 @@
|
||||
# Asset Zoo
|
||||
|
||||
| Robot | Image |
|
||||
|-------|-------|
|
||||
| **Unitree G1** | <img src="../../../docs/source/_static/content/g1.png" width="200" height="150" alt="Unitree G1 Humanoid"> |
|
||||
| **Unitree Go1** | <img src="../../../docs/source/_static/content/go1.png" width="200" height="150" alt="Unitree Go1 Quadruped"> |
|
||||
| **i2rt YAM** | <img src="../../../docs/source/_static/content/yam.png" width="200" height="150" alt="i2rt YAM Robot Arm"> |
|
||||
@@ -0,0 +1,18 @@
|
||||
from mjlab.asset_zoo.robots.i2rt_yam.yam_constants import (
|
||||
YAM_ACTION_SCALE as YAM_ACTION_SCALE,
|
||||
)
|
||||
from mjlab.asset_zoo.robots.i2rt_yam.yam_constants import (
|
||||
get_yam_robot_cfg as get_yam_robot_cfg,
|
||||
)
|
||||
from mjlab.asset_zoo.robots.unitree_g1.g1_constants import (
|
||||
G1_ACTION_SCALE as G1_ACTION_SCALE,
|
||||
)
|
||||
from mjlab.asset_zoo.robots.unitree_g1.g1_constants import (
|
||||
get_g1_robot_cfg as get_g1_robot_cfg,
|
||||
)
|
||||
from mjlab.asset_zoo.robots.unitree_go1.go1_constants import (
|
||||
GO1_ACTION_SCALE as GO1_ACTION_SCALE,
|
||||
)
|
||||
from mjlab.asset_zoo.robots.unitree_go1.go1_constants import (
|
||||
get_go1_robot_cfg as get_go1_robot_cfg,
|
||||
)
|
||||
@@ -0,0 +1 @@
|
||||
"""Booster T1 external asset adapter."""
|
||||
@@ -0,0 +1,28 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2025, BoosterRobotics
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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.
|
||||
@@ -0,0 +1,216 @@
|
||||
<mujoco model="T1">
|
||||
<compiler angle="radian" meshdir="meshes/" autolimits="true"/>
|
||||
|
||||
<asset>
|
||||
<texture type="skybox" builtin="gradient" rgb1="0.3 0.5 0.7" rgb2="0 0 0" width="512" height="512"/>
|
||||
<texture name="texplane" type="2d" builtin="checker" rgb1=".2 .3 .4" rgb2=".1 0.15 0.2" width="512" height="512" mark="cross" markrgb=".8 .8 .8"/>
|
||||
<material name="matplane" reflectance="0.3" texture="texplane" texrepeat="1 1" texuniform="true"/>
|
||||
|
||||
<mesh name="Trunk" file="Trunk.STL"/>
|
||||
<mesh name="H1" file="H1.STL"/>
|
||||
<mesh name="H2" file="H2.STL"/>
|
||||
<mesh name="AL1" file="AL1.STL"/>
|
||||
<mesh name="AL2" file="AL2.STL"/>
|
||||
<mesh name="AL3" file="AL3.STL"/>
|
||||
<mesh name="left_hand_link" file="left_hand_link.STL"/>
|
||||
<mesh name="AR1" file="AR1.STL"/>
|
||||
<mesh name="AR2" file="AR2.STL"/>
|
||||
<mesh name="AR3" file="AR3.STL"/>
|
||||
<mesh name="right_hand_link" file="right_hand_link.STL"/>
|
||||
<mesh name="Waist" file="Waist.STL"/>
|
||||
<mesh name="Hip_Pitch_Left" file="Hip_Pitch_Left.STL"/>
|
||||
<mesh name="Hip_Roll_Left" file="Hip_Roll_Left.STL"/>
|
||||
<mesh name="Hip_Yaw_Left" file="Hip_Yaw_Left.STL"/>
|
||||
<mesh name="Shank_Left" file="Shank_Left.STL"/>
|
||||
<mesh name="Ankle_Cross_Left" file="Ankle_Cross_Left.STL"/>
|
||||
<mesh name="left_foot_link" file="left_foot_link.STL"/>
|
||||
<mesh name="Hip_Pitch_Right" file="Hip_Pitch_Right.STL"/>
|
||||
<mesh name="Hip_Roll_Right" file="Hip_Roll_Right.STL"/>
|
||||
<mesh name="Hip_Yaw_Right" file="Hip_Yaw_Right.STL"/>
|
||||
<mesh name="Shank_Right" file="Shank_Right.STL"/>
|
||||
<mesh name="Ankle_Cross_Right" file="Ankle_Cross_Right.STL"/>
|
||||
<mesh name="right_foot_link" file="right_foot_link.STL"/>
|
||||
<mesh name="Logo" file="Logo.STL"/>
|
||||
</asset>
|
||||
|
||||
<worldbody>
|
||||
<light directional="true" diffuse=".4 .4 .4" specular="0.1 0.1 0.1" pos="0 0 5.0" dir="0 0 -1" castshadow="false" />
|
||||
<light directional="true" diffuse=".6 .6 .6" specular="0.2 0.2 0.2" pos="0 0 4" dir="0 0 -1" />
|
||||
<geom name="ground" type="plane" pos="0 0 0" size="0 0 1" material="matplane" condim="1"/>
|
||||
|
||||
<body name="trunk" pos="0 0 0.7">
|
||||
<inertial pos="0.055138 -1.42184e-06 0.105043" quat="0.999959 1.39867e-05 -0.00902028 -1.39205e-05" mass="11.7016" diaginertia="0.0915734 0.0768118 0.0556067"/>
|
||||
<site name='imu' size='0.01' pos='0.0 0.0 0.0' />
|
||||
<joint name="world_joint" type="free" limited="false" actuatorfrclimited="false"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.76 0.76 0.76 1." mesh="Trunk"/>
|
||||
<geom size="0.085 0.09 0.145" pos="0.06 0 0.12" type="box" rgba="0.76 0.76 0.76 0."/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.1 0.1 0.1 1" mesh="Logo"/>
|
||||
<body name="aahead_yaw_link" pos="0.0625 0 0.243">
|
||||
<inertial pos="-0.000508 -0.001403 0.057432" quat="0.763881 -0.0132172 0.00173419 0.645219" mass="0.44391" diaginertia="0.000241549 0.00022351 0.000149941"/>
|
||||
<joint name="aahead_yaw_joint" pos="0 0 0" axis="0 0 1" range="-1.309 1.309" armature="0.0018"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.4 0.4 0.4 1." mesh="H1"/>
|
||||
<geom size="0.025 0.035" pos="0 0 0.06" quat="0.707105 0.707108 0 0" type="cylinder" rgba="0.4 0.4 0.4 0."/>
|
||||
<body name="aahead_pitch_link" pos="0 0 0.06185">
|
||||
<inertial pos="0.007802 0.001262 0.098631" quat="0.988453 0.106172 -0.0745686 -0.0782786" mass="0.631019" diaginertia="0.00203553 0.00192467 0.00172381"/>
|
||||
<joint name="aahead_pitch_joint" pos="0 0 0" axis="0 1 0" range="-0.35 0.96" armature="0.0018"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.4 0.4 0.4 1." mesh="H2"/>
|
||||
<geom size="0.08" pos="0.01 0 0.11" rgba="0.4 0.4 0.4 0.5"/>
|
||||
<body name="head_realsense_rgb_link" pos="0.063961 -0.0115 0.108406" quat="0.46390386 -0.53366035 0.53366018 -0.46390371"/>
|
||||
</body>
|
||||
</body>
|
||||
<body name="left_shoulder_pitch_link" pos="0.0575 0.1063 0.219" quat="1 0 0.000440565 0">
|
||||
<inertial pos="-0.000677 0.044974 0" quat="0.50423 0.495734 -0.50423 0.495734" mass="0.53" diaginertia="0.001367 0.00129329 0.000292711"/>
|
||||
<joint name="left_shoulder_pitch_joint" pos="0 0 0" axis="0 1 0" range="-3.276 1.196" armature="0.0282528"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.76 0.76 0.76 1." mesh="AL1"/>
|
||||
<geom size="0.03 0.035" pos="0 0.047 0" quat="0.707105 0 0.707108 0" type="cylinder" rgba="0.76 0.76 0.76 0."/>
|
||||
<body name="left_shoulder_roll_link" pos="0 0.047 0">
|
||||
<inertial pos="0.003862 0.037976 0" quat="0.487991 0.511727 -0.487991 0.511727" mass="0.16" diaginertia="0.000401 0.00034538 0.00017662"/>
|
||||
<joint name="left_shoulder_roll_joint" pos="0 0 0" axis="1 0 0" range="-1.623 1.736" armature="0.0282528"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.4 0.4 0.4 1." mesh="AL2"/>
|
||||
<body name="left_elbow_pitch_link" pos="0.00025 0.0605 0">
|
||||
<inertial pos="0 0.085353 -9.9e-05" quat="0.70641 0.707803 0 0" mass="1.02" diaginertia="0.012869 0.012798 0.000620953"/>
|
||||
<joint name="left_elbow_pitch_joint" pos="0 0 0" axis="0 1 0" range="-2.235 2.235" armature="0.0282528"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.4 0.4 0.4 1." mesh="AL3"/>
|
||||
<geom size="0.03 0.095" pos="0 0.07 0" quat="0.707105 0.707108 0 0" type="cylinder" rgba="0.4 0.4 0.4 0."/>
|
||||
<body name="left_elbow_yaw_link" pos="0 0.1471 0">
|
||||
<inertial pos="-0.000107344 0.11022 0.00058741" quat="0.707869 0.706344 -5.3547e-05 -0.000214933" mass="0.329214" diaginertia="0.00819152 0.00816355 0.000224963"/>
|
||||
<joint name="left_elbow_yaw_joint" pos="0 0 0" axis="0 0 1" range="-2.077 1.658" armature="0.0282528"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.4 0.4 0.4 1." mesh="left_hand_link"/>
|
||||
<geom size="0.029 0.065" pos="0 0.12 0" quat="0.707105 0.707108 0 0" type="cylinder" rgba="0.4 0.4 0.4 0."/>
|
||||
<geom size="0.031" pos="0 0.216 0"/>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
<body name="right_shoulder_pitch_link" pos="0.0575 -0.1063 0.219" quat="1 0 0.000440565 0">
|
||||
<inertial pos="-0.000677 -0.044974 0" quat="0.50423 0.495734 -0.50423 0.495734" mass="0.53" diaginertia="0.001367 0.00129329 0.000292711"/>
|
||||
<joint name="right_shoulder_pitch_joint" pos="0 0 0" axis="0 1 0" range="-3.276 1.196" armature="0.0282528"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.76 0.76 0.76 1." mesh="AR1"/>
|
||||
<geom size="0.03 0.035" pos="0 -0.047 0" quat="0.707105 0 0.707108 0" type="cylinder" rgba="0.76 0.76 0.76 0."/>
|
||||
<body name="right_shoulder_roll_link" pos="0 -0.047 0">
|
||||
<inertial pos="0.003862 -0.037976 0" quat="0.511727 0.487991 -0.511727 0.487991" mass="0.16" diaginertia="0.000401 0.00034538 0.00017662"/>
|
||||
<joint name="right_shoulder_roll_joint" pos="0 0 0" axis="1 0 0" range="-1.736 1.623" armature="0.0282528"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.4 0.4 0.4 1." mesh="AR2"/>
|
||||
<body name="right_elbow_pitch_link" pos="0.00025 -0.0605 0">
|
||||
<inertial pos="0 -0.085353 -9.9e-05" quat="0.707803 0.70641 0 0" mass="1.02" diaginertia="0.012869 0.012798 0.000620953"/>
|
||||
<joint name="right_elbow_pitch_joint" pos="0 0 0" axis="0 1 0" range="-2.235 2.235" armature="0.0282528"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.4 0.4 0.4 1." mesh="AR3"/>
|
||||
<geom size="0.03 0.095" pos="0 -0.07 0" quat="0.707105 0.707108 0 0" type="cylinder" rgba="0.4 0.4 0.4 0."/>
|
||||
<body name="right_elbow_yaw_link" pos="0 -0.1471 0">
|
||||
<inertial pos="-0.000107344 -0.11022 0.00058741" quat="0.706344 0.707869 0.000214933 5.3547e-05" mass="0.329214" diaginertia="0.00819152 0.00816355 0.000224963"/>
|
||||
<joint name="right_elbow_yaw_joint" pos="0 0 0" axis="0 0 1" range="-1.658 2.077" armature="0.0282528"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.4 0.4 0.4 1." mesh="right_hand_link"/>
|
||||
<geom size="0.029 0.065" pos="0 -0.12 0" quat="0.707105 0.707108 0 0" type="cylinder" rgba="0.4 0.4 0.4 0."/>
|
||||
<geom size="0.031" pos="0 -0.216 0"/>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
<body name="waist_yaw_link" pos="0.0625 0 -0.1155">
|
||||
<inertial pos="0.002284 3e-06 0.007301" quat="0.983649 0.000360386 -0.180076 0.00269791" mass="2.581" diaginertia="0.00536742 0.005299 0.00474258"/>
|
||||
<joint name="waist_yaw_joint" pos="0 0 0" axis="0 0 1" range="-1.012 1.012" armature="0.0478125"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.4 0.4 0.4 1." mesh="Waist"/>
|
||||
<geom size="0.06 0.05" quat="0.707105 0.707108 0 0" type="cylinder" rgba="0.4 0.4 0.4 0."/>
|
||||
<body name="left_hip_pitch_link" pos="0 0.106 0">
|
||||
<inertial pos="0.000534 -0.007296 -0.018083" quat="0.975141 0.2211 0.0145808 0.0017406" mass="1.021" diaginertia="0.00180547 0.00145926 0.00125327"/>
|
||||
<joint name="left_hip_pitch_joint" pos="0 0 0" axis="0 1 0" range="-2.967 2.191" armature="0.0523908"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.76 0.76 0.76 1." mesh="Hip_Pitch_Left"/>
|
||||
<geom size="0.045 0.0425" pos="-0.002 0 -0.02" quat="0.707105 0 0.707108 0" type="cylinder" rgba="0.76 0.76 0.76 0."/>
|
||||
<body name="left_hip_roll_link" pos="0 0 -0.02">
|
||||
<inertial pos="0.001101 2.4e-05 -0.05375" quat="0.707081 -0.00599604 -0.00599604 0.707081" mass="0.385" diaginertia="0.001743 0.00151729 0.000514712"/>
|
||||
<joint name="left_hip_roll_joint" pos="0 0 0" axis="1 0 0" range="-0.363 1.536" armature="0.0478125"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.4 0.4 0.4 1." mesh="Hip_Roll_Left"/>
|
||||
<geom size="0.045 0.04" pos="0 0 -0.11" type="cylinder" rgba="0.4 0.4 0.4 0."/>
|
||||
<body name="left_hip_yaw_link" pos="0 0 -0.081854">
|
||||
<inertial pos="-0.007233 0.000206 -0.089184" quat="0.696808 -0.033953 -0.0315708 0.715758" mass="2.166" diaginertia="0.0257334 0.0253024 0.00259215"/>
|
||||
<joint name="left_hip_yaw_joint" pos="0 0 0" axis="0 0 1" range="-1.076 1.062" armature="0.0478125"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.4 0.4 0.4 1." mesh="Hip_Yaw_Left"/>
|
||||
<geom size="0.055 0.045" pos="-0.015 0 -0.135" quat="0.707105 0.707108 0 0" type="cylinder" rgba="0.4 0.4 0.4 0."/>
|
||||
<body name="left_knee_pitch_link" pos="-0.014 0 -0.134">
|
||||
<inertial pos="-0.006012 0.000259 -0.124318" quat="0.997573 0.00144024 -0.023949 0.0653706" mass="1.82" diaginertia="0.0346951 0.0345375 0.00185844"/>
|
||||
<joint name="left_knee_pitch_joint" pos="0 0 0" axis="0 1 0" range="0 2.145" armature="0.0636012"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.4 0.4 0.4 1." mesh="Shank_Left"/>
|
||||
<geom size="0.05 0.04 0.07" pos="0 0 -0.15" type="box" rgba="0.4 0.4 0.4 0."/>
|
||||
<body name="left_ankle_pitch_link" pos="0 0 -0.28">
|
||||
<inertial pos="-0.003722 0 -0.007981" quat="0.443136 0.551027 0.551027 0.443136" mass="0.073" diaginertia="2.9e-05 2.56589e-05 1.13411e-05"/>
|
||||
<joint name="left_ankle_pitch_joint" pos="0 0 0" axis="0 1 0" range="-0.87 0.35" armature="0.0679104"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.4 0.4 0.4 1." mesh="Ankle_Cross_Left"/>
|
||||
<body name="left_ankle_roll_link" pos="0 0.00025 -0.012">
|
||||
<inertial pos="-0.000249 0 -0.00914" quat="0 0.651138 0 0.75896" mass="0.685" diaginertia="0.00269361 0.002385 0.00171539"/>
|
||||
<joint name="left_ankle_roll_joint" pos="0 0 0" axis="1 0 0" range="-0.44 0.44" armature="0.02037312"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.4 0.4 0.4 1." mesh="left_foot_link"/>
|
||||
<geom size="0.112434 0.05 0.02183" pos="0.0101079 0 -0.0214208" type="box" rgba="0.4 0.4 0.4 0."/>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
<body name="right_hip_pitch_link" pos="0 -0.106 0">
|
||||
<inertial pos="0.000534 0.007514 -0.018082" quat="0.973446 -0.228403 0.0147148 -0.00419349" mass="1.021" diaginertia="0.00180552 0.0014632 0.00124928"/>
|
||||
<joint name="right_hip_pitch_joint" pos="0 0 0" axis="0 1 0" range="-2.967 2.191" armature="0.0523908"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.76 0.76 0.76 1." mesh="Hip_Pitch_Right"/>
|
||||
<geom size="0.045 0.0425" pos="-0.002 0 -0.02" quat="0.707105 0 0.707108 0" type="cylinder" rgba="0.76 0.76 0.76 0."/>
|
||||
<body name="right_hip_roll_link" pos="0 0 -0.02">
|
||||
<inertial pos="0.001099 2.4e-05 -0.053748" quat="0.707081 -0.00599604 -0.00599604 0.707081" mass="0.385" diaginertia="0.001743 0.00151729 0.000514712"/>
|
||||
<joint name="right_hip_roll_joint" pos="0 0 0" axis="1 0 0" range="-1.536 0.363" armature="0.0478125"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.4 0.4 0.4 1." mesh="Hip_Roll_Right"/>
|
||||
<geom size="0.045 0.04" pos="0 0 -0.11" type="cylinder" rgba="0.4 0.4 0.4 0."/>
|
||||
<body name="right_hip_yaw_link" pos="0 0 -0.081854">
|
||||
<inertial pos="-0.007191 -0.000149 -0.08922" quat="0.714468 -0.0315638 -0.0336391 0.698146" mass="2.17" diaginertia="0.0257623 0.0253298 0.00259389"/>
|
||||
<joint name="right_hip_yaw_joint" pos="0 0 0" axis="0 0 1" range="-1.076 1.062" armature="0.0478125"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.4 0.4 0.4 1." mesh="Hip_Yaw_Right"/>
|
||||
<geom size="0.055 0.045" pos="-0.015 0 -0.135" quat="0.707105 0.707108 0 0" type="cylinder" rgba="0.4 0.4 0.4 0."/>
|
||||
<body name="right_knee_pitch_link" pos="-0.014 0 -0.134">
|
||||
<inertial pos="-0.005741 -0.000541 -0.122602" quat="0.99926 -0.000580963 -0.023461 -0.0304754" mass="1.82" diaginertia="0.0351717 0.0349574 0.00196589"/>
|
||||
<joint name="right_knee_pitch_joint" pos="0 0 0" axis="0 1 0" range="0 2.145" armature="0.0636012"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.4 0.4 0.4 1." mesh="Shank_Right"/>
|
||||
<geom size="0.05 0.04 0.07" pos="0 0 -0.15" type="box" rgba="0.4 0.4 0.4 0."/>
|
||||
<body name="right_ankle_pitch_link" pos="0 0 -0.28">
|
||||
<inertial pos="-0.003722 0 -0.007981" quat="0.443136 0.551027 0.551027 0.443136" mass="0.073" diaginertia="2.9e-05 2.56589e-05 1.13411e-05"/>
|
||||
<joint name="right_ankle_pitch_joint" pos="0 0 0" axis="0 1 0" range="-0.87 0.35" armature="0.0679104"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.4 0.4 0.4 1." mesh="Ankle_Cross_Right"/>
|
||||
<body name="right_ankle_roll_link" pos="0 -0.00025 -0.012">
|
||||
<inertial pos="-0.000248 0 -0.00914" quat="0 0.651138 0 0.75896" mass="0.685" diaginertia="0.00269361 0.002385 0.00171539"/>
|
||||
<joint name="right_ankle_roll_joint" pos="0 0 0" axis="1 0 0" range="-0.44 0.44" armature="0.02037312"/>
|
||||
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.4 0.4 0.4 1." mesh="right_foot_link"/>
|
||||
<geom size="0.112434 0.05 0.02183" pos="0.0101079 0 -0.0214208" type="box" rgba="0.4 0.4 0.4 0."/>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
</worldbody>
|
||||
<actuator>
|
||||
<motor name="aahead_yaw_joint" joint="aahead_yaw_joint" forcerange="-7.0 7.0"/>
|
||||
<motor name="aahead_pitch_joint" joint="aahead_pitch_joint" forcerange="-7.0 7.0"/>
|
||||
<motor name="left_shoulder_pitch_joint" joint="left_shoulder_pitch_joint" forcerange="-38.3 38.3"/>
|
||||
<motor name="left_shoulder_roll_joint" joint="left_shoulder_roll_joint" forcerange="-38.3 38.3"/>
|
||||
<motor name="left_elbow_pitch_joint" joint="left_elbow_pitch_joint" forcerange="-38.3 38.3"/>
|
||||
<motor name="left_elbow_yaw_joint" joint="left_elbow_yaw_joint" forcerange="-38.3 38.3"/>
|
||||
<motor name="right_shoulder_pitch_joint" joint="right_shoulder_pitch_joint" forcerange="-38.3 38.3"/>
|
||||
<motor name="right_shoulder_roll_joint" joint="right_shoulder_roll_joint" forcerange="-38.3 38.3"/>
|
||||
<motor name="right_elbow_pitch_joint" joint="right_elbow_pitch_joint" forcerange="-38.3 38.3"/>
|
||||
<motor name="right_elbow_yaw_joint" joint="right_elbow_yaw_joint" forcerange="-38.3 38.3"/>
|
||||
<motor name="waist_yaw_joint" joint="waist_yaw_joint" forcerange="-68.0 68.0"/>
|
||||
<motor name="left_hip_pitch_joint" joint="left_hip_pitch_joint" forcerange="-98.8 98.8"/>
|
||||
<motor name="left_hip_roll_joint" joint="left_hip_roll_joint" forcerange="-68.0 68.0"/>
|
||||
<motor name="left_hip_yaw_joint" joint="left_hip_yaw_joint" forcerange="-68.0 68.0"/>
|
||||
<motor name="left_knee_pitch_joint" joint="left_knee_pitch_joint" forcerange="-130.5 130.5"/>
|
||||
<motor name="left_ankle_pitch_joint" joint="left_ankle_pitch_joint" forcerange="-73.1 73.1"/>
|
||||
<motor name="left_ankle_roll_joint" joint="left_ankle_roll_joint" forcerange="-17.2 17.2"/>
|
||||
<motor name="right_hip_pitch_joint" joint="right_hip_pitch_joint" forcerange="-98.8 98.8"/>
|
||||
<motor name="right_hip_roll_joint" joint="right_hip_roll_joint" forcerange="-68.0 68.0"/>
|
||||
<motor name="right_hip_yaw_joint" joint="right_hip_yaw_joint" forcerange="-68.0 68.0"/>
|
||||
<motor name="right_knee_pitch_joint" joint="right_knee_pitch_joint" forcerange="-130.5 130.5"/>
|
||||
<motor name="right_ankle_pitch_joint" joint="right_ankle_pitch_joint" forcerange="-73.1 73.1"/>
|
||||
<motor name="right_ankle_roll_joint" joint="right_ankle_roll_joint" forcerange="-17.2 17.2"/>
|
||||
</actuator>
|
||||
<sensor>
|
||||
<framequat name="orientation" objtype="site" noise="0.001" objname="imu" />
|
||||
<gyro name="angular-velocity" site="imu" noise="0.005" />
|
||||
</sensor>
|
||||
</mujoco>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,144 @@
|
||||
"""Booster T1 (23 DoF), using bundled BSD-licensed assets by default.
|
||||
|
||||
[uh-vendor] External BOOSTER_ASSETS_ROOT is an explicit optional model override.
|
||||
|
||||
Inertias, limits, armatures and torque ratings come from T1_23dof.xml.
|
||||
PD gains are simulation training defaults, not a hardware deployment recipe.
|
||||
"""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import mujoco
|
||||
|
||||
from mjlab.actuator import BuiltinPositionActuatorCfg
|
||||
from mjlab.entity import EntityArticulationInfoCfg, EntityCfg
|
||||
from mjlab.utils.spec_config import CollisionCfg
|
||||
|
||||
|
||||
def get_t1_xml() -> Path:
|
||||
root = os.environ.get("BOOSTER_ASSETS_ROOT")
|
||||
if root:
|
||||
return Path(root).expanduser() / "robots/T1/T1_23dof.xml"
|
||||
return Path(__file__).parent / "assets/T1_23dof.xml"
|
||||
|
||||
|
||||
def get_spec() -> mujoco.MjSpec:
|
||||
path = get_t1_xml()
|
||||
if not path.is_file():
|
||||
raise FileNotFoundError(
|
||||
f"T1 asset not found: {path}. Check the bundled assets or BOOSTER_ASSETS_ROOT override."
|
||||
)
|
||||
spec = mujoco.MjSpec.from_file(str(path))
|
||||
# The scene owns the ground. Replace torque motors, rather than duplicating them.
|
||||
spec.delete(spec.geom("ground"))
|
||||
for actuator in list(spec.actuators):
|
||||
spec.delete(actuator)
|
||||
for sensor in list(spec.sensors):
|
||||
spec.delete(sensor)
|
||||
for light in list(spec.lights):
|
||||
spec.delete(light)
|
||||
|
||||
for body in spec.bodies:
|
||||
for i, geom in enumerate(body.geoms):
|
||||
if geom.type == mujoco.mjtGeom.mjGEOM_MESH:
|
||||
geom.name = f"{body.name}_visual_{i}"
|
||||
else:
|
||||
geom.name = f"{body.name}_collision_{i}"
|
||||
geom.group = 3
|
||||
|
||||
for side in ("left", "right"):
|
||||
foot = spec.body(f"{side}_ankle_roll_link")
|
||||
foot.add_site(
|
||||
name=f"{side}_foot",
|
||||
pos=(0.0101079, 0.0, -0.0432508),
|
||||
size=(0.01, 0.01, 0.01),
|
||||
)
|
||||
for name, sensor_type in (
|
||||
("imu_lin_vel", mujoco.mjtSensor.mjSENS_VELOCIMETER),
|
||||
("imu_ang_vel", mujoco.mjtSensor.mjSENS_GYRO),
|
||||
):
|
||||
spec.add_sensor(
|
||||
name=name, type=sensor_type, objtype=mujoco.mjtObj.mjOBJ_SITE, objname="imu"
|
||||
)
|
||||
spec.add_sensor(
|
||||
name="root_angmom",
|
||||
type=mujoco.mjtSensor.mjSENS_SUBTREEANGMOM,
|
||||
objtype=mujoco.mjtObj.mjOBJ_BODY,
|
||||
objname="trunk",
|
||||
)
|
||||
return spec
|
||||
|
||||
|
||||
# XML armatures are preserved (no armature override).
|
||||
# Each tuple is (joint expression, kp, kd, XML torque limit).
|
||||
_MOTORS = (
|
||||
("aahead_.*_joint", 5.0, 0.5, 7.0),
|
||||
(".*_shoulder_.*_joint", 40.0, 2.0, 38.3),
|
||||
(".*_elbow_.*_joint", 40.0, 2.0, 38.3),
|
||||
("waist_yaw_joint", 100.0, 3.0, 68.0),
|
||||
(".*_hip_pitch_joint", 200.0, 5.0, 98.8),
|
||||
(".*_hip_roll_joint", 150.0, 4.0, 68.0),
|
||||
(".*_hip_yaw_joint", 100.0, 3.0, 68.0),
|
||||
(".*_knee_pitch_joint", 200.0, 5.0, 130.5),
|
||||
(".*_ankle_pitch_joint", 50.0, 2.0, 73.1),
|
||||
(".*_ankle_roll_joint", 20.0, 1.0, 17.2),
|
||||
)
|
||||
T1_ACTION_SCALE = {pattern: 0.25 * effort / kp for pattern, kp, _, effort in _MOTORS}
|
||||
T1_FOOT_GEOMS = tuple(
|
||||
f"{side}_ankle_roll_link_collision_1" for side in ("left", "right")
|
||||
)
|
||||
|
||||
|
||||
def get_t1_robot_cfg() -> EntityCfg:
|
||||
"""Return independent train/play configs; defer external asset IO until build."""
|
||||
return EntityCfg(
|
||||
spec_fn=get_spec,
|
||||
sort_actuators=True,
|
||||
init_state=EntityCfg.InitialStateCfg(
|
||||
pos=(0.0, 0.0, 0.6811),
|
||||
joint_pos={
|
||||
".*_hip_pitch_joint": -0.2,
|
||||
".*_knee_pitch_joint": 0.4,
|
||||
".*_ankle_pitch_joint": -0.2,
|
||||
"left_shoulder_roll_joint": -1.3,
|
||||
"right_shoulder_roll_joint": 1.3,
|
||||
".*_shoulder_pitch_joint": 0.2,
|
||||
"left_elbow_yaw_joint": -0.4,
|
||||
"right_elbow_yaw_joint": 0.4,
|
||||
},
|
||||
joint_vel={".*": 0.0},
|
||||
),
|
||||
articulation=EntityArticulationInfoCfg(
|
||||
actuators=tuple(
|
||||
BuiltinPositionActuatorCfg(
|
||||
target_names_expr=(pattern,),
|
||||
stiffness=kp,
|
||||
damping=kd,
|
||||
effort_limit=effort,
|
||||
)
|
||||
for pattern, kp, kd, effort in _MOTORS
|
||||
),
|
||||
soft_joint_pos_limit_factor=0.9,
|
||||
),
|
||||
# Terrain contacts everywhere; opposite legs also collide. Same-chain CAD
|
||||
# overlaps and arm/torso self contacts are deliberately excluded.
|
||||
collisions=(
|
||||
CollisionCfg(
|
||||
geom_names_expr=(".*_collision_.*",),
|
||||
contype={
|
||||
"left_(hip|knee|ankle).*_collision_.*": 2,
|
||||
"right_(hip|knee|ankle).*_collision_.*": 4,
|
||||
".*": 0,
|
||||
},
|
||||
conaffinity={
|
||||
"left_(hip|knee|ankle).*_collision_.*": 5,
|
||||
"right_(hip|knee|ankle).*_collision_.*": 3,
|
||||
".*": 1,
|
||||
},
|
||||
condim={".*_ankle_roll_link_collision_.*": 3, ".*": 1},
|
||||
priority={".*_ankle_roll_link_collision_.*": 1, ".*": 0},
|
||||
friction=(0.8,),
|
||||
),
|
||||
),
|
||||
)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,184 @@
|
||||
<mujoco model="yam_v0">
|
||||
<compiler angle="radian" meshdir="assets"/>
|
||||
|
||||
<default>
|
||||
<default class="yam">
|
||||
<site group="5" size="0.005" rgba="0 1 0 1"/>
|
||||
<joint axis="0 0 1"/>
|
||||
<default class="visual">
|
||||
<geom type="mesh" contype="0" conaffinity="0" density="0" group="2" material="black"/>
|
||||
</default>
|
||||
<default class="collision">
|
||||
<geom group="3" type="capsule"/>
|
||||
<default class="sphere_collision">
|
||||
<geom size="0.0006 0 0" type="sphere" rgba="1 0 0 1" group="4"/>
|
||||
</default>
|
||||
</default>
|
||||
<default class="finger">
|
||||
<joint type="slide"/>
|
||||
</default>
|
||||
</default>
|
||||
</default>
|
||||
|
||||
<asset>
|
||||
<material name="black" rgba="0.25 0.25 0.25 1"/>
|
||||
<material name="white" rgba="0.9 0.9 0.9 1"/>
|
||||
|
||||
<mesh file="model2.stl"/>
|
||||
<mesh file="model2__2.stl"/>
|
||||
<mesh file="model2__3.stl"/>
|
||||
<mesh file="model2__4.stl"/>
|
||||
<mesh file="model2__5.stl"/>
|
||||
<mesh file="model2__6.stl"/>
|
||||
<mesh file="model2__7.stl"/>
|
||||
<mesh file="model2__8.stl"/>
|
||||
<mesh file="model2__9.stl"/>
|
||||
<mesh file="model2__10.stl"/>
|
||||
<mesh file="model2__11.stl"/>
|
||||
<mesh file="model2__12.stl"/>
|
||||
<mesh file="model2__13.stl"/>
|
||||
<mesh file="model2__14.stl"/>
|
||||
<mesh file="model2__15.stl"/>
|
||||
<mesh file="model2__16.stl"/>
|
||||
<mesh file="model2__17.stl"/>
|
||||
|
||||
<mesh name="camera_d405" file="d405.stl"/>
|
||||
</asset>
|
||||
|
||||
<worldbody>
|
||||
<light name="spotlight" mode="targetbodycom" target="link_6" pos="0 0 1"/>
|
||||
<camera name="front_cam" pos="1.1 0 .5" xyaxes="0 1 0 -0.3 0 0.7"/>
|
||||
<body name="arm" childclass="yam">
|
||||
<geom class="visual" pos="0 0 -0.0006" quat="1 0 0 1" mesh="model2"/>
|
||||
<geom name="base_collision" class="collision" size="0.033 0.01" pos="0.0 0.0 0.026" quat="1 0 0 0"/>
|
||||
<body name="link_1" pos="0 0 0.0631" quat="1 0 0 1">
|
||||
<inertial pos="-0.00192861 -0.00795735 0.0208176" quat="0.297851 0.642634 0.360045 0.607185" mass="0.12415"
|
||||
diaginertia="0.000180751 0.000145532 5.89179e-05"/>
|
||||
<joint name="joint1" range="-2.61799 3.05433"/>
|
||||
<geom class="visual" pos="5.26159e-07 2.34355e-07 -0.0632" quat="1 0 0 0" mesh="model2__2"/>
|
||||
<body name="link_2" pos="2.5e-05 -0.02 0.0409" quat="1 1 1 1">
|
||||
<inertial pos="0.132008 2.10599e-06 0.000293073" quat="1 1 1 1" mass="1.24434"
|
||||
diaginertia="0.0121902 0.0121318 0.000683304"/>
|
||||
<joint name="joint2" range="0 3.66519"/>
|
||||
<geom class="visual" pos="0.0199992 -0.1041 -2.44738e-05" quat="1 -1 -1 -1" mesh="model2__3"/>
|
||||
<geom class="visual" pos="0.0199992 -0.1041 -2.44738e-05" quat="1 -1 -1 -1" mesh="model2__4"/>
|
||||
<geom class="visual" pos="0.0199992 -0.1041 -2.44738e-05" quat="1 -1 -1 -1" mesh="model2__5" material="white"/>
|
||||
<geom name="link2_1_collision" class="collision" size="0.032 0.11" pos="0.13 0 0" quat="1 0 1 0"/>
|
||||
<geom name="link2_2_collision" class="collision" size="0.033 0.02" pos="0 0.0 0" quat="1 0 0 0"/>
|
||||
<geom name="link2_3_collision" class="collision" size="0.033 0.025" pos="0.265 0 0" quat="1 0 0 0"/>
|
||||
<body name="link_3" pos="0.264 0 0" quat="0 1 0 0">
|
||||
<inertial pos="-0.121816 -0.054846 -0.000111108" quat="1 1 1 1" mass="0.853698"
|
||||
diaginertia="0.00699732 0.00696112 0.000788244"/>
|
||||
<joint name="joint3" range="0 3.66519"/>
|
||||
<geom class="visual" pos="-0.244001 0.104101 2.44738e-05" quat="1 1 1 -1" mesh="model2__6"/>
|
||||
<geom class="visual" pos="-0.244001 0.104101 2.44738e-05" quat="1 1 1 -1" mesh="model2__7"/>
|
||||
<geom class="visual" pos="-0.244001 0.104101 2.44738e-05" quat="1 1 1 -1" mesh="model2__8" material="white"/>
|
||||
<geom class="visual" pos="-0.244001 0.104101 2.44738e-05" quat="1 1 1 -1" mesh="model2__9"/>
|
||||
<geom name="link3_1_collision" class="collision" size="0.034 0.12" pos="-0.14 -0.06 0.0" quat="1 0 1 0"/>
|
||||
<geom name="link3_2_collision" class="collision" size="0.034 0.015" pos="-0.24 -0.06 0.0" quat="1 0 0 0"/>
|
||||
<body name="link_4" pos="-0.245 -0.06 0" quat="1 0 0 0">
|
||||
<inertial pos="-0.0769778 -0.0527104 0.000154878" quat="0.667 0.667 -0.236 -0.236" mass="0.463511"
|
||||
diaginertia="0.000791532 0.000744733 0.000282116"/>
|
||||
<joint name="joint4" range="-1.5708 1.5708"/>
|
||||
<geom class="visual" pos="0.00100023 0.164101 2.44738e-05" quat="1 1 1 -1" mesh="model2__10"/>
|
||||
<geom name="link4_1_collision" class="collision" size="0.03 0.015" pos="-0.073 -0.06 0.0" quat="1 1 0 0"/>
|
||||
<body name="link_5" pos="-0.074 -0.0395 2.5e-05" quat="1 -1 1 1">
|
||||
<inertial pos="3.64861e-05 0.00025665 0.0353526" quat="1 0 0 0" mass="0.350962"
|
||||
diaginertia="0.000197802 0.0001775 0.000147402"/>
|
||||
<joint name="joint5" range="-1.5708 1.5708"/>
|
||||
<geom class="visual" pos="0 -0.0749971 0.203601" quat="1.32679e-06 1 0 0" mesh="model2__11"/>
|
||||
<geom name="link5_1_collision" class="collision" size="0.030 0.015" pos="0 0.025 0.0395" quat="1 1 0 0"/>
|
||||
<body name="link_6" pos="0 0.0353 0.0395" quat="1 -1 0 0">
|
||||
<inertial pos="-0.000217767 7.37059e-05 0.0270545" quat="1 1 0 0" mass="0.367476"
|
||||
diaginertia="0.000265958 0.000242686 0.000227409"/>
|
||||
<joint name="joint6" range="-2.0944 2.0944"/>
|
||||
<geom class="visual" pos="0 -0.164101 -0.110597" quat="1 -1 0 0" mesh="model2__12"/>
|
||||
<geom class="visual" pos="0 -0.164101 -0.110597" quat="1 -1 0 0" mesh="model2__13"/>
|
||||
<geom name="link6_1_collision" class="collision" size="0.01 0.035" pos="0 0.039 0.052" quat="1 0 1 0"/>
|
||||
<geom name="link6_2_collision" class="collision" size="0.030 0.005" pos="0 0.0 0.03" quat="1 0 0 1"/>
|
||||
<geom name="link6_3_collision" class="collision" size="0.01 0.035" pos="0 -0.039 0.052" quat="1 0 1 0"/>
|
||||
<site name="tcp_site" quat="1 0 0 -1"/>
|
||||
<site name="grasp_site" pos="0 -0.03 0.1247" quat="1 0 0 -1"/>
|
||||
<body name="link_left_finger" pos="-0.037 0.0392 0.0605" quat="1 0 1 0">
|
||||
<inertial pos="-0.0192995 -0.0365902 0.039774" quat="0.757351 0.568898 -0.3199 0.0" mass="0.118"
|
||||
diaginertia="0.000159084 0.000154909 4.63655e-05"/>
|
||||
<joint class="finger" name="left_finger" range="-0.00205 0.037524"/>
|
||||
<geom class="visual" pos="0.171097 -0.203301 0.037" quat="1 -1 -1 -1" mesh="model2__14"/>
|
||||
<geom class="visual" pos="0.171097 -0.203301 0.037" quat="1 -1 -1 -1" mesh="model2__15"/>
|
||||
<body name="lf_rot" quat="1 -1 -1 1" pos="0.0 -0.0392 0.037">
|
||||
<geom name="lf_rot1_collision" class="collision" size="0.01 0.03" pos="0.0 -0.02 0.012"
|
||||
quat="1 0 1 0" rgba="0.381493 0.492734 0.780446 1"/>
|
||||
<geom name="lf_rot2_collision" class="collision" size="0.01 0.02" pos="-0.02 -0.01 0.032"
|
||||
quat="1 0 2.5 0" rgba="0.381493 0.492734 0.780446 1"/>
|
||||
<body name="lf_down" quat="1 0 0 0" pos="-0.044 0.0 0.0">
|
||||
<geom name="lf_down1_collision" class="collision" size="0.01 0.01" pos="0.0 -0.020 0.012"
|
||||
quat="1 -0.1 0 0" rgba="0.381493 0.492734 0.780446 1"/>
|
||||
<geom name="lf_down2_collision" class="collision" size="0.003 0.022" pos="0.005 -0.014 0.04"
|
||||
quat="1 -0.2 0 0" rgba="0.381493 0.492734 0.780446 1"/>
|
||||
<geom name="lf_down3_collision" class="collision" size="0.003 0.022" pos="-0.005 -0.014 0.04"
|
||||
quat="1 -0.2 0 0" rgba="0.381493 0.492734 0.780446 1"/>
|
||||
<geom name="lf_down4_collision" class="collision" type="box" size="0.006 0.002 0.04"
|
||||
pos="0 -0.0024 0.046" quat="1 0 0 0" rgba="0.381493 0.492734 0.780446 1"/>
|
||||
<geom name="lf_down5_collision" class="collision" type="box" size="0.006 0.002 0.039"
|
||||
pos="0.027 -0.0024 0.053" quat="1 0 2.5 0" rgba="0.381493 0.492734 0.780446 1"/>
|
||||
<geom name="lf_down6_collision" class="sphere_collision" pos="0.003 -0.0004 0.078"/>
|
||||
<geom name="lf_down7_collision" class="sphere_collision" pos="-0.003 -0.0004 0.078"/>
|
||||
<geom name="lf_down8_collision" class="sphere_collision" pos="0.003 -0.0004 0.07"/>
|
||||
<geom name="lf_down9_collision" class="sphere_collision" pos="-0.003 -0.0004 0.07"/>
|
||||
<geom name="lf_down10_collision" class="sphere_collision" pos="0.003 -0.0004 0.06"/>
|
||||
<geom name="lf_down11_collision" class="sphere_collision" pos="-0.003 -0.0004 0.06"/>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
<body name="camera_d405" pos="-0.0107 0.079729 0.066021" quat="0.953717 0.3007058 0 0">
|
||||
<geom class="visual" mesh="camera_d405"/>
|
||||
<geom class="collision" type="box" size=".018 .018 .01" pos="0 0 -0.01" group="4"/>
|
||||
<body name="camera_frame" pos="0.009 0 0" quat="0 0 0 1">
|
||||
<camera name="camera_d405" pos="0 0 0" quat="0 1 0 0" resolution="1280 720"
|
||||
sensorsize="0.003896 0.00214" focal="0.00193 0.00193"/>
|
||||
</body>
|
||||
</body>
|
||||
<body name="link_right_finger" pos="0.037 -0.0392 0.0605" quat="1 0 1 0">
|
||||
<inertial pos="-0.0192995 0.0365902 -0.039774" quat="-0.757351 0.568898 -0.3199 0" mass="0.118"
|
||||
diaginertia="0.000159084 0.000154909 4.63655e-05"/>
|
||||
<joint class="finger" name="right_finger" range="-0.037524 0.00205"/>
|
||||
<geom class="visual" pos="0.171097 -0.124901 -0.037" quat="1 -1 -1 -1" mesh="model2__16"/>
|
||||
<geom class="visual" pos="0.171097 -0.124901 -0.037" quat="1 -1 -1 -1" mesh="model2__17"/>
|
||||
<body name="rf_rot" quat="1 1 -1 -1" pos="0.0 0.0392 -0.037">
|
||||
<geom name="rf_rot1_collision" class="collision" size="0.01 0.03" pos="0.0 -0.02 0.012"
|
||||
quat="1 0 1 0" rgba="0.381493 0.492734 0.780446 1"/>
|
||||
<geom name="rf_rot2_collision" class="collision" size="0.01 0.02" pos="0.02 -0.01 0.032"
|
||||
quat="1 0 -2.5 0" rgba="0.381493 0.492734 0.780446 1"/>
|
||||
<body name="rf_down" quat="1 0 0 0" pos="0.044 0.0 0.0">
|
||||
<geom name="rf_down1_collision" class="collision" size="0.01 0.01" pos="0.0 -0.020 0.012"
|
||||
quat="1 -0.1 0 0" rgba="0.381493 0.492734 0.780446 1"/>
|
||||
<geom name="rf_down2_collision" class="collision" size="0.003 0.022" pos="0.005 -0.014 0.04"
|
||||
quat="1 -0.2 0 0" rgba="0.381493 0.492734 0.780446 1"/>
|
||||
<geom name="rf_down3_collision" class="collision" size="0.003 0.022" pos="-0.005 -0.014 0.04"
|
||||
quat="1 -0.2 0 0" rgba="0.381493 0.492734 0.780446 1"/>
|
||||
<geom name="rf_down4_collision" class="collision" type="box" size="0.006 0.002 0.04"
|
||||
pos="0 -0.0024 0.046" quat="1 0 0 0" rgba="0.381493 0.492734 0.780446 1"/>
|
||||
<geom name="rf_down5_collision" class="collision" type="box" size="0.006 0.002 0.039"
|
||||
pos="-0.027 -0.0024 0.053" quat="1 0 -2.5 0" rgba="0.381493 0.492734 0.780446 1"/>
|
||||
<geom name="rf_down6_collision" class="sphere_collision" pos="0.003 -0.0004 0.078"/>
|
||||
<geom name="rf_down7_collision" class="sphere_collision" pos="-0.003 -0.0004 0.078"/>
|
||||
<geom name="rf_down8_collision" class="sphere_collision" pos="0.003 -0.0004 0.07"/>
|
||||
<geom name="rf_down9_collision" class="sphere_collision" pos="-0.003 -0.0004 0.07"/>
|
||||
<geom name="rf_down10_collision" class="sphere_collision" pos="0.003 -0.0004 0.06"/>
|
||||
<geom name="rf_down11_collision" class="sphere_collision" pos="-0.003 -0.0004 0.06"/>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
</body>
|
||||
</worldbody>
|
||||
|
||||
<equality>
|
||||
<joint joint1="left_finger" joint2="right_finger" polycoef="0 -1 0 0 0"/>
|
||||
</equality>
|
||||
</mujoco>
|
||||
@@ -0,0 +1,236 @@
|
||||
"""YAM constants."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import mujoco
|
||||
|
||||
from mjlab import MJLAB_SRC_PATH
|
||||
from mjlab.actuator import BuiltinPositionActuatorCfg
|
||||
from mjlab.entity import EntityArticulationInfoCfg, EntityCfg
|
||||
from mjlab.utils.actuator import (
|
||||
ElectricActuator,
|
||||
reflect_rotary_to_linear,
|
||||
)
|
||||
from mjlab.utils.spec_config import CollisionCfg
|
||||
|
||||
##
|
||||
# MJCF and assets.
|
||||
##
|
||||
|
||||
YAM_XML: Path = (
|
||||
MJLAB_SRC_PATH / "asset_zoo" / "robots" / "i2rt_yam" / "xmls" / "yam.xml"
|
||||
)
|
||||
assert YAM_XML.exists()
|
||||
|
||||
|
||||
def get_spec() -> mujoco.MjSpec:
|
||||
return mujoco.MjSpec.from_file(str(YAM_XML))
|
||||
|
||||
|
||||
##
|
||||
# Actuator config.
|
||||
##
|
||||
|
||||
EFFECTIVE_INERTIAS = {
|
||||
"joint1": 0.123153,
|
||||
"joint2": 0.277411,
|
||||
"joint3": 0.232763,
|
||||
"joint4": 0.030154,
|
||||
"joint5": 0.009126,
|
||||
"joint6": 0.002868,
|
||||
"left_finger": 2.781624,
|
||||
}
|
||||
|
||||
ARMATURE_DM_4340 = 0.032
|
||||
ARMATURE_DM_4310 = 0.0018
|
||||
|
||||
# Reference: https://github.com/i2rt-robotics/i2rt/blob/cbe48976b44aae45af856c62545be00ea2feed11/i2rt/motor_drivers/utils.py#L159-L169
|
||||
DM_4340 = ElectricActuator(
|
||||
reflected_inertia=ARMATURE_DM_4340,
|
||||
velocity_limit=10.0,
|
||||
effort_limit=28.0,
|
||||
)
|
||||
# Reference: https://github.com/i2rt-robotics/i2rt/blob/cbe48976b44aae45af856c62545be00ea2feed11/i2rt/motor_drivers/utils.py#L139-L149
|
||||
DM_4310 = ElectricActuator(
|
||||
reflected_inertia=ARMATURE_DM_4310,
|
||||
velocity_limit=30.0,
|
||||
effort_limit=10.0,
|
||||
)
|
||||
|
||||
NATURAL_FREQ = 2 * 2.0 * 3.1415926535 # 2Hz
|
||||
DAMPING_RATIO = 2.0
|
||||
|
||||
# Per-joint PD gains using effective inertia, and actuator configs.
|
||||
_ARM_JOINTS: dict[str, ElectricActuator] = {
|
||||
"joint1": DM_4340,
|
||||
"joint2": DM_4340,
|
||||
"joint3": DM_4340,
|
||||
"joint4": DM_4310,
|
||||
"joint5": DM_4310,
|
||||
"joint6": DM_4310,
|
||||
}
|
||||
ARM_ACTUATORS = tuple(
|
||||
BuiltinPositionActuatorCfg(
|
||||
target_names_expr=(name,),
|
||||
stiffness=EFFECTIVE_INERTIAS[name] * NATURAL_FREQ**2,
|
||||
damping=2.0 * DAMPING_RATIO * EFFECTIVE_INERTIAS[name] * NATURAL_FREQ,
|
||||
effort_limit=motor.effort_limit,
|
||||
armature=motor.reflected_inertia,
|
||||
)
|
||||
for name, motor in _ARM_JOINTS.items()
|
||||
)
|
||||
|
||||
##
|
||||
# Gripper transmission parameters.
|
||||
##
|
||||
|
||||
# Reference: https://github.com/i2rt-robotics/i2rt/blob/cbe48976b44aae45af856c62545be00ea2feed11/i2rt/robots/utils.py#L106-L118
|
||||
|
||||
# Crank gripper: DM 4310 drives a crank arm that converts rotation to linear motion.
|
||||
# The mechanism geometry (8° to 170°) provides 71mm stroke, but we operate over
|
||||
# 10° to 165° (2.7 rad motor range) for safety, giving ~70mm usable stroke.
|
||||
# Note: Transmission ratio varies with position as r(θ) = r_crank*sin(θ); we use
|
||||
# an effective average (dx/dθ) for simulation.
|
||||
GRIPPER_MOTOR_STROKE_CRANK = 2.7 # [rad]: operational motor range (from limits)
|
||||
GRIPPER_LINEAR_STROKE_CRANK = 0.071 # [m]: design stroke (full mechanism range)
|
||||
GRIPPER_TRANSMISSION_RATIO_CRANK = (
|
||||
GRIPPER_LINEAR_STROKE_CRANK / GRIPPER_MOTOR_STROKE_CRANK
|
||||
)
|
||||
|
||||
# Reflect motor properties to linear gripper joint.
|
||||
(
|
||||
ARMATURE_DM_4310_LINEAR_CRANK,
|
||||
VELOCITY_LIMIT_DM_4310_LINEAR_CRANK,
|
||||
EFFORT_LIMIT_DM_4310_LINEAR_CRANK,
|
||||
) = reflect_rotary_to_linear(
|
||||
armature_rotary=ARMATURE_DM_4310,
|
||||
velocity_limit_rotary=DM_4310.velocity_limit,
|
||||
effort_limit_rotary=DM_4310.effort_limit,
|
||||
transmission_ratio=GRIPPER_TRANSMISSION_RATIO_CRANK,
|
||||
)
|
||||
|
||||
# PD controller gains using effective inertia.
|
||||
NATURAL_FREQ_GRIPPER = 1.0 * 2.0 * 3.1415926535 # 1Hz
|
||||
STIFFNESS_GRIPPER = EFFECTIVE_INERTIAS["left_finger"] * NATURAL_FREQ_GRIPPER**2
|
||||
DAMPING_GRIPPER = (
|
||||
2.0 * DAMPING_RATIO * EFFECTIVE_INERTIAS["left_finger"] * NATURAL_FREQ_GRIPPER
|
||||
)
|
||||
|
||||
# Artificially limit gripper force for sim stability (must also be done on hardware).
|
||||
EFFORT_LIMIT_DM_4310_LINEAR_CRANK_SAFE = EFFORT_LIMIT_DM_4310_LINEAR_CRANK * 0.1
|
||||
|
||||
# Only actuate left_finger; right_finger is coupled via equality constraint.
|
||||
ACTUATOR_DM_4310_LINEAR_CRANK = BuiltinPositionActuatorCfg(
|
||||
target_names_expr=("left_finger",),
|
||||
stiffness=STIFFNESS_GRIPPER,
|
||||
damping=DAMPING_GRIPPER,
|
||||
effort_limit=EFFORT_LIMIT_DM_4310_LINEAR_CRANK_SAFE,
|
||||
armature=ARMATURE_DM_4310_LINEAR_CRANK,
|
||||
)
|
||||
|
||||
##
|
||||
# Keyframe config.
|
||||
##
|
||||
|
||||
HOME_KEYFRAME = EntityCfg.InitialStateCfg(
|
||||
pos=(0.0, 0.0, 0.01),
|
||||
joint_pos={
|
||||
"joint2": 1.047,
|
||||
"joint3": 1.05,
|
||||
"joint4": -0.9,
|
||||
"left_finger": 0.0375 / 2,
|
||||
"right_finger": -0.0375 / 2,
|
||||
},
|
||||
joint_vel={".*": 0.0},
|
||||
)
|
||||
|
||||
##
|
||||
# Collision config.
|
||||
##
|
||||
|
||||
FULL_COLLISION = CollisionCfg(
|
||||
geom_names_expr=(".*_collision",),
|
||||
contype=1,
|
||||
conaffinity=1,
|
||||
condim={
|
||||
"[lr]f_down(6|7|8|9|10|11)_collision": 6,
|
||||
".*_collision": 3,
|
||||
},
|
||||
friction={
|
||||
"[lr]f_down(6|7|8|9|10|11)_collision": (1, 5e-3, 5e-4),
|
||||
".*_collision": (0.6,),
|
||||
},
|
||||
solref={
|
||||
"[lr]f_down(6|7|8|9|10|11)_collision": (0.01, 1),
|
||||
},
|
||||
priority={
|
||||
"[lr]f_down(6|7|8|9|10|11)_collision": 1,
|
||||
".*": 0,
|
||||
},
|
||||
)
|
||||
|
||||
GRIPPER_ONLY_COLLISION = CollisionCfg(
|
||||
geom_names_expr=(".*_collision",),
|
||||
contype={
|
||||
"(link6|[lr]f)_.*_collision": 1,
|
||||
".*_collision": 0,
|
||||
},
|
||||
conaffinity={
|
||||
"(link6|[lr]f)_.*_collision": 1,
|
||||
".*_collision": 0,
|
||||
},
|
||||
condim={
|
||||
"[lr]f_down(6|7|8|9|10|11)_collision": 6,
|
||||
".*_collision": 3,
|
||||
},
|
||||
friction={
|
||||
"[lr]f_down(6|7|8|9|10|11)_collision": (1, 5e-3, 5e-4),
|
||||
".*_collision": (0.6,),
|
||||
},
|
||||
solref={
|
||||
"[lr]f_down(6|7|8|9|10|11)_collision": (0.01, 1),
|
||||
},
|
||||
priority={
|
||||
"[lr]f_down(6|7|8|9|10|11)_collision": 1,
|
||||
".*": 0,
|
||||
},
|
||||
)
|
||||
|
||||
##
|
||||
# Final config.
|
||||
##
|
||||
|
||||
ARTICULATION = EntityArticulationInfoCfg(
|
||||
actuators=(*ARM_ACTUATORS, ACTUATOR_DM_4310_LINEAR_CRANK),
|
||||
soft_joint_pos_limit_factor=0.9,
|
||||
)
|
||||
|
||||
|
||||
def get_yam_robot_cfg() -> EntityCfg:
|
||||
return EntityCfg(
|
||||
init_state=HOME_KEYFRAME,
|
||||
collisions=(GRIPPER_ONLY_COLLISION,),
|
||||
spec_fn=get_spec,
|
||||
articulation=ARTICULATION,
|
||||
)
|
||||
|
||||
|
||||
YAM_ACTION_SCALE: dict[str, float] = {}
|
||||
for a in ARTICULATION.actuators:
|
||||
assert isinstance(a, BuiltinPositionActuatorCfg)
|
||||
e = a.effort_limit
|
||||
s = a.stiffness
|
||||
names = a.target_names_expr
|
||||
assert e is not None
|
||||
for n in names:
|
||||
YAM_ACTION_SCALE[n] = 0.25 * e / s
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import mujoco.viewer as viewer
|
||||
|
||||
from mjlab.entity.entity import Entity
|
||||
|
||||
robot = Entity(get_yam_robot_cfg())
|
||||
|
||||
viewer.launch(robot.spec.compile())
|
||||
@@ -0,0 +1 @@
|
||||
"""Unitree G1 humanoid."""
|
||||
@@ -0,0 +1,298 @@
|
||||
"""Unitree G1 constants."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import mujoco
|
||||
|
||||
from mjlab import MJLAB_SRC_PATH
|
||||
from mjlab.actuator import BuiltinPositionActuatorCfg
|
||||
from mjlab.entity import EntityArticulationInfoCfg, EntityCfg
|
||||
from mjlab.utils.actuator import (
|
||||
ElectricActuator,
|
||||
reflected_inertia_from_two_stage_planetary,
|
||||
)
|
||||
from mjlab.utils.spec_config import CollisionCfg
|
||||
|
||||
##
|
||||
# MJCF and assets.
|
||||
##
|
||||
|
||||
G1_XML: Path = (
|
||||
MJLAB_SRC_PATH / "asset_zoo" / "robots" / "unitree_g1" / "xmls" / "g1.xml"
|
||||
)
|
||||
assert G1_XML.exists()
|
||||
|
||||
|
||||
def get_spec() -> mujoco.MjSpec:
|
||||
return mujoco.MjSpec.from_file(str(G1_XML))
|
||||
|
||||
|
||||
##
|
||||
# Actuator config.
|
||||
##
|
||||
|
||||
# Motor specs (from Unitree).
|
||||
ROTOR_INERTIAS_5020 = (
|
||||
0.139e-4,
|
||||
0.017e-4,
|
||||
0.169e-4,
|
||||
)
|
||||
GEARS_5020 = (
|
||||
1,
|
||||
1 + (46 / 18),
|
||||
1 + (56 / 16),
|
||||
)
|
||||
ARMATURE_5020 = reflected_inertia_from_two_stage_planetary(
|
||||
ROTOR_INERTIAS_5020, GEARS_5020
|
||||
)
|
||||
|
||||
ROTOR_INERTIAS_7520_14 = (
|
||||
0.489e-4,
|
||||
0.098e-4,
|
||||
0.533e-4,
|
||||
)
|
||||
GEARS_7520_14 = (
|
||||
1,
|
||||
4.5,
|
||||
1 + (48 / 22),
|
||||
)
|
||||
ARMATURE_7520_14 = reflected_inertia_from_two_stage_planetary(
|
||||
ROTOR_INERTIAS_7520_14, GEARS_7520_14
|
||||
)
|
||||
|
||||
ROTOR_INERTIAS_7520_22 = (
|
||||
0.489e-4,
|
||||
0.109e-4,
|
||||
0.738e-4,
|
||||
)
|
||||
GEARS_7520_22 = (
|
||||
1,
|
||||
4.5,
|
||||
5,
|
||||
)
|
||||
ARMATURE_7520_22 = reflected_inertia_from_two_stage_planetary(
|
||||
ROTOR_INERTIAS_7520_22, GEARS_7520_22
|
||||
)
|
||||
|
||||
ROTOR_INERTIAS_4010 = (
|
||||
0.068e-4,
|
||||
0.0,
|
||||
0.0,
|
||||
)
|
||||
GEARS_4010 = (
|
||||
1,
|
||||
5,
|
||||
5,
|
||||
)
|
||||
ARMATURE_4010 = reflected_inertia_from_two_stage_planetary(
|
||||
ROTOR_INERTIAS_4010, GEARS_4010
|
||||
)
|
||||
|
||||
ACTUATOR_5020 = ElectricActuator(
|
||||
reflected_inertia=ARMATURE_5020,
|
||||
velocity_limit=37.0,
|
||||
effort_limit=25.0,
|
||||
)
|
||||
ACTUATOR_7520_14 = ElectricActuator(
|
||||
reflected_inertia=ARMATURE_7520_14,
|
||||
velocity_limit=32.0,
|
||||
effort_limit=88.0,
|
||||
)
|
||||
ACTUATOR_7520_22 = ElectricActuator(
|
||||
reflected_inertia=ARMATURE_7520_22,
|
||||
velocity_limit=20.0,
|
||||
effort_limit=139.0,
|
||||
)
|
||||
ACTUATOR_4010 = ElectricActuator(
|
||||
reflected_inertia=ARMATURE_4010,
|
||||
velocity_limit=22.0,
|
||||
effort_limit=5.0,
|
||||
)
|
||||
|
||||
NATURAL_FREQ = 10 * 2.0 * 3.1415926535 # 10Hz
|
||||
DAMPING_RATIO = 2.0
|
||||
|
||||
STIFFNESS_5020 = ARMATURE_5020 * NATURAL_FREQ**2
|
||||
STIFFNESS_7520_14 = ARMATURE_7520_14 * NATURAL_FREQ**2
|
||||
STIFFNESS_7520_22 = ARMATURE_7520_22 * NATURAL_FREQ**2
|
||||
STIFFNESS_4010 = ARMATURE_4010 * NATURAL_FREQ**2
|
||||
|
||||
DAMPING_5020 = 2.0 * DAMPING_RATIO * ARMATURE_5020 * NATURAL_FREQ
|
||||
DAMPING_7520_14 = 2.0 * DAMPING_RATIO * ARMATURE_7520_14 * NATURAL_FREQ
|
||||
DAMPING_7520_22 = 2.0 * DAMPING_RATIO * ARMATURE_7520_22 * NATURAL_FREQ
|
||||
DAMPING_4010 = 2.0 * DAMPING_RATIO * ARMATURE_4010 * NATURAL_FREQ
|
||||
|
||||
G1_ACTUATOR_5020 = BuiltinPositionActuatorCfg(
|
||||
target_names_expr=(
|
||||
".*_elbow_joint",
|
||||
".*_shoulder_pitch_joint",
|
||||
".*_shoulder_roll_joint",
|
||||
".*_shoulder_yaw_joint",
|
||||
".*_wrist_roll_joint",
|
||||
),
|
||||
stiffness=STIFFNESS_5020,
|
||||
damping=DAMPING_5020,
|
||||
effort_limit=ACTUATOR_5020.effort_limit,
|
||||
armature=ACTUATOR_5020.reflected_inertia,
|
||||
)
|
||||
G1_ACTUATOR_7520_14 = BuiltinPositionActuatorCfg(
|
||||
target_names_expr=(".*_hip_pitch_joint", ".*_hip_yaw_joint", "waist_yaw_joint"),
|
||||
stiffness=STIFFNESS_7520_14,
|
||||
damping=DAMPING_7520_14,
|
||||
effort_limit=ACTUATOR_7520_14.effort_limit,
|
||||
armature=ACTUATOR_7520_14.reflected_inertia,
|
||||
)
|
||||
G1_ACTUATOR_7520_22 = BuiltinPositionActuatorCfg(
|
||||
target_names_expr=(".*_hip_roll_joint", ".*_knee_joint"),
|
||||
stiffness=STIFFNESS_7520_22,
|
||||
damping=DAMPING_7520_22,
|
||||
effort_limit=ACTUATOR_7520_22.effort_limit,
|
||||
armature=ACTUATOR_7520_22.reflected_inertia,
|
||||
)
|
||||
G1_ACTUATOR_4010 = BuiltinPositionActuatorCfg(
|
||||
target_names_expr=(".*_wrist_pitch_joint", ".*_wrist_yaw_joint"),
|
||||
stiffness=STIFFNESS_4010,
|
||||
damping=DAMPING_4010,
|
||||
effort_limit=ACTUATOR_4010.effort_limit,
|
||||
armature=ACTUATOR_4010.reflected_inertia,
|
||||
)
|
||||
|
||||
# Waist pitch/roll and ankles are 4-bar linkages with 2 5020 actuators.
|
||||
# Due to the parallel linkage, the effective armature at the ankle and waist joints
|
||||
# is configuration dependent. Since the exact geometry of the linkage is unknown, we
|
||||
# assume a nominal 1:1 gear ratio. Under this assumption, the joint armature in the
|
||||
# nominal configuration is approximated as the sum of the 2 actuators' armatures.
|
||||
G1_ACTUATOR_WAIST = BuiltinPositionActuatorCfg(
|
||||
target_names_expr=("waist_pitch_joint", "waist_roll_joint"),
|
||||
stiffness=STIFFNESS_5020 * 2,
|
||||
damping=DAMPING_5020 * 2,
|
||||
effort_limit=ACTUATOR_5020.effort_limit * 2,
|
||||
armature=ACTUATOR_5020.reflected_inertia * 2,
|
||||
)
|
||||
G1_ACTUATOR_ANKLE = BuiltinPositionActuatorCfg(
|
||||
target_names_expr=(".*_ankle_pitch_joint", ".*_ankle_roll_joint"),
|
||||
stiffness=STIFFNESS_5020 * 2,
|
||||
damping=DAMPING_5020 * 2,
|
||||
effort_limit=ACTUATOR_5020.effort_limit * 2,
|
||||
armature=ACTUATOR_5020.reflected_inertia * 2,
|
||||
)
|
||||
|
||||
##
|
||||
# Keyframe config.
|
||||
##
|
||||
|
||||
HOME_KEYFRAME = EntityCfg.InitialStateCfg(
|
||||
pos=(0, 0, 0.783675),
|
||||
joint_pos={
|
||||
".*_hip_pitch_joint": -0.1,
|
||||
".*_knee_joint": 0.3,
|
||||
".*_ankle_pitch_joint": -0.2,
|
||||
".*_shoulder_pitch_joint": 0.2,
|
||||
".*_elbow_joint": 1.28,
|
||||
"left_shoulder_roll_joint": 0.2,
|
||||
"right_shoulder_roll_joint": -0.2,
|
||||
},
|
||||
joint_vel={".*": 0.0},
|
||||
)
|
||||
|
||||
KNEES_BENT_KEYFRAME = EntityCfg.InitialStateCfg(
|
||||
pos=(0, 0, 0.76),
|
||||
joint_pos={
|
||||
".*_hip_pitch_joint": -0.312,
|
||||
".*_knee_joint": 0.669,
|
||||
".*_ankle_pitch_joint": -0.363,
|
||||
".*_elbow_joint": 0.6,
|
||||
"left_shoulder_roll_joint": 0.2,
|
||||
"left_shoulder_pitch_joint": 0.2,
|
||||
"right_shoulder_roll_joint": -0.2,
|
||||
"right_shoulder_pitch_joint": 0.2,
|
||||
},
|
||||
joint_vel={".*": 0.0},
|
||||
)
|
||||
|
||||
##
|
||||
# Collision config.
|
||||
##
|
||||
|
||||
# This enables all collisions, including self collisions.
|
||||
# Self-collisions are given condim=1 while foot collisions
|
||||
# are given condim=3.
|
||||
FULL_COLLISION = CollisionCfg(
|
||||
geom_names_expr=(".*_collision",),
|
||||
contype=1,
|
||||
conaffinity=1,
|
||||
condim={r"^(left|right)_foot[1-7]_collision$": 3, ".*_collision": 1},
|
||||
priority={r"^(left|right)_foot[1-7]_collision$": 1, ".*": 0},
|
||||
friction={r"^(left|right)_foot[1-7]_collision$": (0.6,)},
|
||||
)
|
||||
|
||||
FULL_COLLISION_WITHOUT_SELF = CollisionCfg(
|
||||
geom_names_expr=(".*_collision",),
|
||||
contype=0,
|
||||
conaffinity=1,
|
||||
condim={r"^(left|right)_foot[1-7]_collision$": 3, ".*_collision": 1},
|
||||
priority={r"^(left|right)_foot[1-7]_collision$": 1, ".*": 0},
|
||||
friction={r"^(left|right)_foot[1-7]_collision$": (0.6,)},
|
||||
)
|
||||
|
||||
# This disables all collisions except the feet.
|
||||
# Feet get condim=3, all other geoms are disabled.
|
||||
FEET_ONLY_COLLISION = CollisionCfg(
|
||||
geom_names_expr=(r"^(left|right)_foot[1-7]_collision$",),
|
||||
contype=0,
|
||||
conaffinity=1,
|
||||
condim=3,
|
||||
priority=1,
|
||||
friction=(0.6,),
|
||||
)
|
||||
|
||||
##
|
||||
# Final config.
|
||||
##
|
||||
|
||||
G1_ARTICULATION = EntityArticulationInfoCfg(
|
||||
actuators=(
|
||||
G1_ACTUATOR_5020,
|
||||
G1_ACTUATOR_7520_14,
|
||||
G1_ACTUATOR_7520_22,
|
||||
G1_ACTUATOR_4010,
|
||||
G1_ACTUATOR_WAIST,
|
||||
G1_ACTUATOR_ANKLE,
|
||||
),
|
||||
soft_joint_pos_limit_factor=0.9,
|
||||
)
|
||||
|
||||
|
||||
def get_g1_robot_cfg() -> EntityCfg:
|
||||
"""Get a fresh G1 robot configuration instance.
|
||||
|
||||
Returns a new EntityCfg instance each time to avoid mutation issues when
|
||||
the config is shared across multiple places.
|
||||
"""
|
||||
return EntityCfg(
|
||||
init_state=KNEES_BENT_KEYFRAME,
|
||||
collisions=(FULL_COLLISION,),
|
||||
spec_fn=get_spec,
|
||||
articulation=G1_ARTICULATION,
|
||||
)
|
||||
|
||||
|
||||
G1_ACTION_SCALE: dict[str, float] = {}
|
||||
for a in G1_ARTICULATION.actuators:
|
||||
assert isinstance(a, BuiltinPositionActuatorCfg)
|
||||
e = a.effort_limit
|
||||
s = a.stiffness
|
||||
names = a.target_names_expr
|
||||
assert e is not None
|
||||
for n in names:
|
||||
G1_ACTION_SCALE[n] = 0.25 * e / s
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import mujoco.viewer as viewer
|
||||
|
||||
from mjlab.entity.entity import Entity
|
||||
|
||||
robot = Entity(get_g1_robot_cfg())
|
||||
|
||||
viewer.launch(robot.spec.compile())
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user