Fix bug related to sleeping static children of mocap bodies.

PiperOrigin-RevId: 831376685
Change-Id: I8891a1d7dc6efc037e9ade5c7e8dd5c35c7e455e
This commit is contained in:
Yuval Tassa
2025-11-12 07:19:08 -08:00
committed by Copybara-Service
parent 7b52d3034e
commit b8512b9d1f
3 changed files with 36 additions and 5 deletions
+6 -4
View File
@@ -222,6 +222,7 @@ TEST_F(SleepTest, BadWakeTree) {
}
static const char* const kStaticModel = "engine/testdata/sleep/static.xml";
static const char* const kMocapcModel = "engine/testdata/sleep/mocap.xml";
static const char* const kSmoothModel = "engine/testdata/sleep/smooth.xml";
static const char* const kInitModel = "engine/testdata/sleep/init.xml";
static const char* const kInitIslandModel =
@@ -234,8 +235,8 @@ static const char* const kSensorModel = "engine/testdata/sleep/sensor.xml";
// roll out some models with sleeping enabled, valuable under ASAN and MSAN
TEST_F(SleepTest, KickTires) {
for (const char* path :
{kStaticModel, kInitModel, kInitIslandModel, kSensorModel, kTendonModel,
kContactModel, kPairModel, kSmoothModel}) {
{kStaticModel, kMocapcModel, kInitModel, kInitIslandModel, kSensorModel,
kTendonModel, kContactModel, kPairModel, kSmoothModel}) {
const std::string xml_path = GetTestDataFilePath(path);
char error[1024];
mjModel* m = mj_loadXML(xml_path.c_str(), 0, error, sizeof(error));
@@ -368,8 +369,9 @@ TEST_F(SleepTest, WakingUnaffectedBySleeping) {
// unchanged for all trees and frc/acc-dependent arrays to be the same for awake
// trees.
TEST_F(SleepTest, SleepingUnaffectedByWaking) {
for (const char* path : {kInitModel, kInitIslandModel, kTendonModel,
kContactModel, kSensorModel, kSmoothModel}) {
for (const char* path :
{kInitModel, kMocapcModel, kInitIslandModel, kTendonModel, kContactModel,
kSensorModel, kSmoothModel}) {
const std::string xml_path = GetTestDataFilePath(path);
char error[1024];
mjModel* m = mj_loadXML(xml_path.c_str(), 0, error, sizeof(error));
+28
View File
@@ -0,0 +1,28 @@
<mujoco>
<custom>
<numeric name="duration" data="0.1"/>
</custom>
<option>
<flag sleep="enable"/>
</option>
<worldbody>
<geom size="1"/>
<body name="mocap_static" pos="-5 0 0.01" mocap="true">
<geom size="1" rgba="1 0 0 1"/>
<body pos="0 0 1">
<geom size="1" rgba="0 0 1 1"/>
</body>
</body>
<body name="mocap_dynamic" pos="5 0 0.01" mocap="true">
<geom size="1" rgba="1 0 0 1"/>
<body pos="0 0 2">
<joint type="slide"/>
<geom size="1" rgba="0 0 1 1"/>
</body>
</body>
</worldbody>
</mujoco>