Fix bug in muscle length-gain curve. Fixes #1342

PiperOrigin-RevId: 599165049
Change-Id: Ic5ef77b4349a8a9c343eacfd781195bfebea9aca
This commit is contained in:
Yuval Tassa
2024-01-17 07:19:11 -08:00
committed by Copybara-Service
parent 67a00a3a51
commit a14a584f1d
5 changed files with 47 additions and 38 deletions
+13
View File
@@ -135,6 +135,19 @@ TEST_F(MujocoTest, SmoothMuscleDynamics) {
}
}
TEST_F(MujocoTest, MuscleGainLength) {
mjtNum lmin = 0.5;
mjtNum lmax = 1.5;
EXPECT_EQ(mju_muscleGainLength(0.0, lmin, lmax), 0);
EXPECT_EQ(mju_muscleGainLength(0.5, lmin, lmax), 0);
EXPECT_EQ(mju_muscleGainLength(0.75, lmin, lmax), 0.5);
EXPECT_EQ(mju_muscleGainLength(1.0, lmin, lmax), 1);
EXPECT_EQ(mju_muscleGainLength(1.25, lmin, lmax), 0.5);
EXPECT_EQ(mju_muscleGainLength(1.5, lmin, lmax), 0);
EXPECT_EQ(mju_muscleGainLength(2.0, lmin, lmax), 0);
}
TEST_F(MujocoTest, mju_makefullname) {
char buffer[1000];
constexpr char path[] = "engine/testdata/";