Add sensors to MJX. Implements jointpos and actuatorpos as examples.

PiperOrigin-RevId: 660891329
Change-Id: Ie6c282a397de2f52843775ec747495e9be46d307
This commit is contained in:
Taylor Howell
2024-08-08 10:31:48 -07:00
committed by Copybara-Service
parent 2c56946547
commit ebf887e14d
8 changed files with 179 additions and 3 deletions
+9
View File
@@ -0,0 +1,9 @@
<!-- For validating model with no sensor -->
<mujoco model="no_sensor">
<worldbody>
<body>
<joint type="hinge"/>
<geom size="1"/>
</body>
</worldbody>
</mujoco>
+29
View File
@@ -0,0 +1,29 @@
<!-- For validating sensors:
* position-dependent:
-jointpos
-actuatorpos
* velocity-dependent:
* acceleration/force-dependent:
-->
<mujoco model="sensor">
<worldbody>
<!-- body 0 -->
<body name="body0" pos="1 2 3">
<joint name="hinge0" type="hinge" axis="1 0 0"/>
<geom size="1"/>
</body>
</worldbody>
<actuator>
<motor name="motor0" joint="hinge0" ctrlrange="-1 1" ctrllimited="true"/>
</actuator>
<sensor>
<!-- position-dependent sensors -->
<jointpos name="jointpos0" joint="hinge0"/>
<actuatorpos name="actuatorpos0" actuator="motor0"/>
<!-- velocity-dependent sensors -->
<!-- acceleration/force-dependent sensors -->
</sensor>
</mujoco>