Skip to content

Commit

Permalink
Reducing the damping coefficients on half cheetah so it doesn't explode
Browse files Browse the repository at this point in the history
  • Loading branch information
keenon committed Sep 30, 2021
1 parent 7e73244 commit 4bf4b18
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 14 deletions.
12 changes: 6 additions & 6 deletions data/skel/half_cheetah.skel
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@
<upper>1.05</upper>
</limit>
<dynamics>
<damping>6.0</damping>
<damping>0.6</damping>
<spring_stiffness>240.0</spring_stiffness>
</dynamics>
</axis>
Expand All @@ -335,7 +335,7 @@
<upper>0.785</upper>
</limit>
<dynamics>
<damping>4.5</damping>
<damping>0.45</damping>
<spring_stiffness>180.0</spring_stiffness>
</dynamics>
</axis>
Expand All @@ -354,7 +354,7 @@
<upper>0.785</upper>
</limit>
<dynamics>
<damping>3.0</damping>
<damping>0.3</damping>
<spring_stiffness>120.0</spring_stiffness>
</dynamics>
</axis>
Expand All @@ -375,7 +375,7 @@
<upper>0.7</upper>
</limit>
<dynamics>
<damping>4.5</damping>
<damping>0.45</damping>
<spring_stiffness>180.0</spring_stiffness>
</dynamics>
</axis>
Expand All @@ -394,7 +394,7 @@
<upper>0.87</upper>
</limit>
<dynamics>
<damping>3.0</damping>
<damping>0.30</damping>
<spring_stiffness>120.0</spring_stiffness>
</dynamics>
</axis>
Expand All @@ -413,7 +413,7 @@
<upper>0.5</upper>
</limit>
<dynamics>
<damping>1.5</damping>
<damping>0.15</damping>
<spring_stiffness>60.0</spring_stiffness>
</dynamics>
</axis>
Expand Down
38 changes: 36 additions & 2 deletions unittests/comprehensive/test_HalfCheetahTrajectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,40 @@ using namespace neural;
using namespace server;
using namespace realtime;

TEST(HALF_CHEETAH, FIRST_DEMO)
{
// Create a world
std::shared_ptr<simulation::World> world
= dart::utils::UniversalLoader::loadWorld(
"dart://sample/skel/half_cheetah.skel");
world->setPositions(Eigen::VectorXs::Zero(world->getNumDofs()));
world->setVelocities(Eigen::VectorXs::Zero(world->getNumDofs()));

std::shared_ptr<dynamics::Skeleton> halfCheetah
= world->getSkeleton("half_cheetah");
std::cout << "Springs: " << halfCheetah->getSpringStiffVector() << std::endl;
std::cout << "Damping: " << halfCheetah->getDampingCoeffVector() << std::endl;
for (int i = 0; i < halfCheetah->getNumDofs(); i++)
{
// halfCheetah->getDof(i)->setSpringStiffness(0.0);
// halfCheetah->getDof(i)->setDampingCoefficient(0.0);
}

for (int i = 0; i < 300; i++)
{
world->step();
std::cout << i << ":" << std::endl;
std::cout << "Pos:" << std::endl << world->getPositions() << std::endl;
std::cout << "Vel:" << std::endl << world->getVelocities() << std::endl;
if (world->getPositions().hasNaN())
{
std::cout << "Got a NaN on timestep " << i << "!!" << std::endl;
EXPECT_FALSE(world->getPositions().hasNaN());
break;
}
}
}

#ifdef ALL_TESTS
TEST(HALF_CHEETAH, NUMERICAL_INSTABILITY)
{
Expand Down Expand Up @@ -151,7 +185,7 @@ TEST(HALF_CHEETAH, BROKEN_POINT)
}
#endif

// #ifdef ALL_TESTS
#ifdef ALL_TESTS
TEST(HALF_CHEETAH, CAPSULE_INTER_PENETRATION)
{
// Create a world
Expand Down Expand Up @@ -194,7 +228,7 @@ TEST(HALF_CHEETAH, CAPSULE_INTER_PENETRATION)
EXPECT_TRUE(verifyF_c(world));
EXPECT_TRUE(verifyIdentityMapping(world));
}
// #endif
#endif

#ifdef ALL_TESTS
TEST(HALF_CHEETAH, POS_VEL_ERRORS)
Expand Down
12 changes: 6 additions & 6 deletions www/docs/_static/robots/half_cheetah.skel
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@
<upper>1.05</upper>
</limit>
<dynamics>
<damping>6.0</damping>
<damping>0.6</damping>
<spring_stiffness>240.0</spring_stiffness>
</dynamics>
</axis>
Expand All @@ -335,7 +335,7 @@
<upper>0.785</upper>
</limit>
<dynamics>
<damping>4.5</damping>
<damping>0.45</damping>
<spring_stiffness>180.0</spring_stiffness>
</dynamics>
</axis>
Expand All @@ -354,7 +354,7 @@
<upper>0.785</upper>
</limit>
<dynamics>
<damping>3.0</damping>
<damping>0.3</damping>
<spring_stiffness>120.0</spring_stiffness>
</dynamics>
</axis>
Expand All @@ -375,7 +375,7 @@
<upper>0.7</upper>
</limit>
<dynamics>
<damping>4.5</damping>
<damping>0.45</damping>
<spring_stiffness>180.0</spring_stiffness>
</dynamics>
</axis>
Expand All @@ -394,7 +394,7 @@
<upper>0.87</upper>
</limit>
<dynamics>
<damping>3.0</damping>
<damping>0.30</damping>
<spring_stiffness>120.0</spring_stiffness>
</dynamics>
</axis>
Expand All @@ -413,7 +413,7 @@
<upper>0.5</upper>
</limit>
<dynamics>
<damping>1.5</damping>
<damping>0.15</damping>
<spring_stiffness>60.0</spring_stiffness>
</dynamics>
</axis>
Expand Down

0 comments on commit 4bf4b18

Please sign in to comment.