more work on pybullet_envs.deep_mimic.

allow btMultiBody to not wakeup (for some RL experiments)
move deep_mimic motion files to data/motions folder, so we can use the args files unmodified.
This commit is contained in:
erwincoumans
2019-02-18 17:57:02 -08:00
parent dc8a40f7dc
commit bdf9b10246
25 changed files with 176 additions and 76 deletions

View File

@@ -106,6 +106,7 @@ btMultiBody::btMultiBody(int n_links,
m_fixedBase(fixedBase),
m_awake(true),
m_canSleep(canSleep),
m_canWakeup(true),
m_sleepTimer(0),
m_userObjectPointer(0),
m_userIndex2(-1),
@@ -1882,6 +1883,8 @@ void btMultiBody::checkMotionAndSleepIfRequired(btScalar timestep)
return;
}
// motion is computed as omega^2 + v^2 + (sum of squares of joint velocities)
btScalar motion = 0;
{
@@ -1900,8 +1903,11 @@ void btMultiBody::checkMotionAndSleepIfRequired(btScalar timestep)
else
{
m_sleepTimer = 0;
if (!m_awake)
wakeUp();
if (m_canWakeup)
{
if (!m_awake)
wakeUp();
}
}
}

View File

@@ -454,7 +454,10 @@ public:
//
void setCanSleep(bool canSleep)
{
m_canSleep = canSleep;
if (m_canWakeup)
{
m_canSleep = canSleep;
}
}
bool getCanSleep() const
@@ -462,6 +465,15 @@ public:
return m_canSleep;
}
bool getCanWakeup() const
{
return m_canWakeup;
}
void setCanWakeup(bool canWakeup)
{
m_canWakeup = canWakeup;
}
bool isAwake() const { return m_awake; }
void wakeUp();
void goToSleep();
@@ -696,6 +708,7 @@ private:
// Sleep parameters.
bool m_awake;
bool m_canSleep;
bool m_canWakeup;
btScalar m_sleepTimer;
void *m_userObjectPointer;