Add rne_postconstraint function to MJX. This function matches mj_rnePostConstraint and computes cacc, cfrc_ext, and cfrc_int.

PiperOrigin-RevId: 671336319
Change-Id: I263b46c56a7609b9a8a30895c012798579d3dffa
This commit is contained in:
Taylor Howell
2024-09-05 05:34:27 -07:00
committed by Copybara-Service
parent cd8ff4401d
commit 7b073b60c4
10 changed files with 313 additions and 31 deletions
-9
View File
@@ -1,9 +0,0 @@
<!-- For validating model with no sensor -->
<mujoco model="no_sensor">
<worldbody>
<body>
<joint type="hinge"/>
<geom size="1"/>
</body>
</worldbody>
</mujoco>
+58
View File
@@ -0,0 +1,58 @@
<mujoco model="model">
<asset>
<material name="material"/>
</asset>
<worldbody>
<!-- tree 0 -->
<body name="body0" pos="1 2 3">
<joint name="hinge0" type="hinge" axis="1 0 0"/>
<geom size="0.1" material="material"/>
<site name="site_rangefinder0" pos="-1e-3 0 0.2"/>
<site name="site_rangefinder1" pos="-1e-3 0 0.175"/>
<site name="site0" pos=".1 .2 .3"/>
<body name="body1" pos="0.1 0.2 0.3">
<joint name="hinge1" type="hinge" axis="0 1 0"/>
<geom size="0.25"/>
<site name="site1" pos=".2 .4 .6"/>
</body>
</body>
<!-- body 2 -->
<body name="body2" pos=".1 .1 .1">
<joint name="ballquat2" type="ball" pos="0.1 0.1 0.1"/>
<geom name="geom2" size="1"/>
</body>
<!-- body 3 -->
<body name="body3" pos="-.1 -.1 -.1">
<joint name="ballquat3" type="ball" pos="0.1 0.2 0.3"/>
<geom size="1"/>
<site name="site3"/>
</body>
<!-- bodies for camera projection -->
<body pos="11.1 0 1">
<geom type="box" size=".1 .6 .375"/>
<site name="frontorigin" pos="-.1 .6 .375"/>
<site name="frontcenter" pos="-.1 0 0"/>
</body>
<body pos="10 0 0">
<joint axis="0 0 1" range="-180 180" limited="false"/>
<geom type="sphere" size=".2" pos="0 0 0.9"/>
<camera pos="0 0 1" xyaxes="0 -1 0 0 0 1" fovy="41.11209"
resolution="1920 1200" name="fixedcamera"/>
</body>
<!-- body for rangefinder -->
<body name="body_rangefinder" pos="1 2 4">
<geom size="0.01" material="material"/>
</body>
</worldbody>
<actuator>
<motor name="motor0" joint="hinge0" ctrlrange="-1 1" gear="10"
ctrllimited="true"/>
<motor name="motor1" joint="hinge1" ctrlrange="-1 1" gear="10"
ctrllimited="true"/>
</actuator>
</mujoco>
@@ -0,0 +1,65 @@
<!-- For validating model with unsupported sensors -->
<mujoco model="unsupported_sensor">
<asset>
<material name="material"/>
</asset>
<worldbody>
<!-- tree 0 -->
<body name="body0" pos="1 2 3">
<joint name="hinge0" type="hinge" axis="1 0 0"/>
<geom name="geom0" size="0.1" material="material"/>
<site name="site_rangefinder0" pos="-1e-3 0 0.2"/>
<site name="site_rangefinder1" pos="-1e-3 0 0.175"/>
<site name="site0" pos=".1 .2 .3"/>
<body name="body1" pos="0.1 0.2 0.3">
<joint name="hinge1" type="hinge" axis="0 1 0"/>
<geom name="geom1" size="0.25"/>
<site name="site1" pos=".2 .4 .6"/>
</body>
</body>
<!-- body 2 -->
<body name="body2" pos=".1 .1 .1">
<joint name="ballquat2" type="ball" pos="0.1 0.1 0.1"/>
<geom name="geom2" size="1"/>
</body>
<!-- body 3 -->
<body name="body3" pos="-.1 -.1 -.1">
<joint name="ballquat3" type="ball" pos="0.1 0.2 0.3"/>
<geom size="1"/>
<site name="site3"/>
</body>
<!-- bodies for camera projection -->
<body pos="11.1 0 1">
<geom type="box" size=".1 .6 .375"/>
<site name="frontorigin" pos="-.1 .6 .375"/>
<site name="frontcenter" pos="-.1 0 0"/>
</body>
<body pos="10 0 0">
<joint axis="0 0 1" range="-180 180" limited="false"/>
<geom type="sphere" size=".2" pos="0 0 0.9"/>
<camera pos="0 0 1" xyaxes="0 -1 0 0 0 1" fovy="41.11209"
resolution="1920 1200" name="fixedcamera"/>
</body>
<!-- body for rangefinder -->
<body name="body_rangefinder" pos="1 2 4">
<geom size="0.01" material="material"/>
</body>
</worldbody>
<actuator>
<motor name="motor0" joint="hinge0" ctrlrange="-1 1" gear="10"
ctrllimited="true"/>
<motor name="motor1" joint="hinge1" ctrlrange="-1 1" gear="10"
ctrllimited="true"/>
</actuator>
<sensor>
<distance name="distance" geom1="geom0" geom2="geom1"/>
<framelinvel name="framelinvel" objtype="site" objname="site0"/>
<touch name="touch" site="site0"/>
</sensor>
</mujoco>
@@ -1,19 +0,0 @@
<!-- For validating model with unsupported sensor -->
<mujoco model="unsupported_sensor">
<worldbody>
<body>
<joint type="hinge"/>
<geom name="geom0" size="1"/>
<site name="site"/>
</body>
<body>
<joint type="hinge"/>
<geom name="geom1" size="1"/>
</body>
</worldbody>
<sensor>
<distance name="distance" geom1="geom0" geom2="geom1"/>
<framelinvel name="framelinvel" objtype="site" objname="site"/>
<touch name="touch" site="site"/>
</sensor>
</mujoco>