diff --git a/examples/pybullet/gym/pybullet_envs/__init__.py b/examples/pybullet/gym/pybullet_envs/__init__.py index c8764cd59..d4c81d0a7 100644 --- a/examples/pybullet/gym/pybullet_envs/__init__.py +++ b/examples/pybullet/gym/pybullet_envs/__init__.py @@ -1,4 +1,10 @@ -from gym.envs.registration import registry, register, make, spec +import gym +from gym.envs.registration import registry, make, spec +def register(id,*args,**kvargs): + if id inĀ  registry.env_specs: + return + else: + return gym.envs.registration.register(id,*args,**kvargs) # ------------bullet------------- diff --git a/examples/pybullet/gym/pybullet_envs/bullet/kukaGymEnv.py b/examples/pybullet/gym/pybullet_envs/bullet/kukaGymEnv.py index d2a47935d..b9ef16017 100644 --- a/examples/pybullet/gym/pybullet_envs/bullet/kukaGymEnv.py +++ b/examples/pybullet/gym/pybullet_envs/bullet/kukaGymEnv.py @@ -275,3 +275,11 @@ class KukaGymEnv(gym.Env): #print("reward") #print(reward) return reward + + def reset(self): + """Resets the state of the environment and returns an initial observation. + + Returns: observation (object): the initial observation of the + space. + """ + return self._reset() \ No newline at end of file diff --git a/examples/pybullet/gym/pybullet_envs/gym_manipulator_envs.py b/examples/pybullet/gym/pybullet_envs/gym_manipulator_envs.py index 52026925e..2fbf1fdd7 100644 --- a/examples/pybullet/gym/pybullet_envs/gym_manipulator_envs.py +++ b/examples/pybullet/gym/pybullet_envs/gym_manipulator_envs.py @@ -41,7 +41,7 @@ class ReacherBulletEnv(MJCFBaseBulletEnv): class PusherBulletEnv(MJCFBaseBulletEnv): def __init__(self): self.robot = Pusher() - BaseBulletEnv.__init__(self, self.robot) + MJCFBaseBulletEnv.__init__(self, self.robot) def create_single_player_scene(self): return SingleRobotEmptyScene(gravity=9.81, timestep=0.0020, frame_skip=5) @@ -95,7 +95,7 @@ class PusherBulletEnv(MJCFBaseBulletEnv): class StrikerBulletEnv(MJCFBaseBulletEnv): def __init__(self): self.robot = Striker() - BaseBulletEnv.__init__(self, self.robot) + MJCFBaseBulletEnv.__init__(self, self.robot) self._striked = False self._min_strike_dist = np.inf self.strike_threshold = 0.1 @@ -171,7 +171,7 @@ class StrikerBulletEnv(MJCFBaseBulletEnv): class ThrowerBulletEnv(MJCFBaseBulletEnv): def __init__(self): self.robot = Thrower() - BaseBulletEnv.__init__(self, self.robot) + MJCFBaseBulletEnv.__init__(self, self.robot) def create_single_player_scene(self): return SingleRobotEmptyScene(gravity=0.0, timestep=0.0020, frame_skip=5) diff --git a/src/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp b/src/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp index f849e31e3..91c76a8da 100644 --- a/src/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp +++ b/src/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp @@ -261,13 +261,11 @@ void btSimulationIslandManager::buildIslands(btDispatcher* dispatcher,btCollisio btAssert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1)); if (colObj0->getIslandTag() == islandId) { - if (colObj0->getActivationState()== ACTIVE_TAG) - { - allSleeping = false; - } - if (colObj0->getActivationState()== DISABLE_DEACTIVATION) + if (colObj0->getActivationState()== ACTIVE_TAG || + colObj0->getActivationState()== DISABLE_DEACTIVATION) { allSleeping = false; + break; } } } diff --git a/src/BulletCollision/CollisionShapes/btCapsuleShape.h b/src/BulletCollision/CollisionShapes/btCapsuleShape.h index 7d64b46ab..5a3362834 100644 --- a/src/BulletCollision/CollisionShapes/btCapsuleShape.h +++ b/src/BulletCollision/CollisionShapes/btCapsuleShape.h @@ -49,6 +49,7 @@ public: virtual void setMargin(btScalar collisionMargin) { //don't override the margin for capsules, their entire radius == margin + (void)collisionMargin; } virtual void getAabb (const btTransform& t, btVector3& aabbMin, btVector3& aabbMax) const diff --git a/src/BulletDynamics/Dynamics/btSimulationIslandManagerMt.cpp b/src/BulletDynamics/Dynamics/btSimulationIslandManagerMt.cpp index 99b34353c..65e1a140e 100644 --- a/src/BulletDynamics/Dynamics/btSimulationIslandManagerMt.cpp +++ b/src/BulletDynamics/Dynamics/btSimulationIslandManagerMt.cpp @@ -314,13 +314,11 @@ void btSimulationIslandManagerMt::buildIslands( btDispatcher* dispatcher, btColl btAssert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1)); if (colObj0->getIslandTag() == islandId) { - if (colObj0->getActivationState()== ACTIVE_TAG) - { - allSleeping = false; - } - if (colObj0->getActivationState()== DISABLE_DEACTIVATION) + if (colObj0->getActivationState()== ACTIVE_TAG || + colObj0->getActivationState()== DISABLE_DEACTIVATION) { allSleeping = false; + break; } } } diff --git a/src/LinearMath/btThreads.h b/src/LinearMath/btThreads.h index 05fd15ec8..cef542329 100644 --- a/src/LinearMath/btThreads.h +++ b/src/LinearMath/btThreads.h @@ -72,6 +72,8 @@ SIMD_FORCE_INLINE void btMutexLock( btSpinMutex* mutex ) { #if BT_THREADSAFE mutex->lock(); +#else + (void)mutex; #endif // #if BT_THREADSAFE } @@ -79,6 +81,8 @@ SIMD_FORCE_INLINE void btMutexUnlock( btSpinMutex* mutex ) { #if BT_THREADSAFE mutex->unlock(); +#else + (void)mutex; #endif // #if BT_THREADSAFE } @@ -87,6 +91,7 @@ SIMD_FORCE_INLINE bool btMutexTryLock( btSpinMutex* mutex ) #if BT_THREADSAFE return mutex->tryLock(); #else + (void)mutex; return true; #endif // #if BT_THREADSAFE }