diff --git a/examples/pybullet/gym/pybullet_data/data/policies/humanoid3d/humanoid3d_backflip.ckpt.data-00000-of-00001 b/examples/pybullet/gym/pybullet_data/data/policies/humanoid3d/humanoid3d_backflip.ckpt.data-00000-of-00001 index f7c81535f..1057a5393 100644 Binary files a/examples/pybullet/gym/pybullet_data/data/policies/humanoid3d/humanoid3d_backflip.ckpt.data-00000-of-00001 and b/examples/pybullet/gym/pybullet_data/data/policies/humanoid3d/humanoid3d_backflip.ckpt.data-00000-of-00001 differ diff --git a/examples/pybullet/gym/pybullet_data/data/policies/humanoid3d/humanoid3d_backflip.ckpt.index b/examples/pybullet/gym/pybullet_data/data/policies/humanoid3d/humanoid3d_backflip.ckpt.index index bba79f10d..e682c4897 100644 Binary files a/examples/pybullet/gym/pybullet_data/data/policies/humanoid3d/humanoid3d_backflip.ckpt.index and b/examples/pybullet/gym/pybullet_data/data/policies/humanoid3d/humanoid3d_backflip.ckpt.index differ diff --git a/examples/pybullet/gym/pybullet_data/data/policies/humanoid3d/humanoid3d_walk.ckpt.data-00000-of-00001 b/examples/pybullet/gym/pybullet_data/data/policies/humanoid3d/humanoid3d_walk.ckpt.data-00000-of-00001 index ff127cecf..4c6c09385 100644 Binary files a/examples/pybullet/gym/pybullet_data/data/policies/humanoid3d/humanoid3d_walk.ckpt.data-00000-of-00001 and b/examples/pybullet/gym/pybullet_data/data/policies/humanoid3d/humanoid3d_walk.ckpt.data-00000-of-00001 differ diff --git a/examples/pybullet/gym/pybullet_data/data/policies/humanoid3d/humanoid3d_walk.ckpt.index b/examples/pybullet/gym/pybullet_data/data/policies/humanoid3d/humanoid3d_walk.ckpt.index index d61de05ef..5213e412c 100644 Binary files a/examples/pybullet/gym/pybullet_data/data/policies/humanoid3d/humanoid3d_walk.ckpt.index and b/examples/pybullet/gym/pybullet_data/data/policies/humanoid3d/humanoid3d_walk.ckpt.index differ diff --git a/examples/pybullet/gym/pybullet_envs/deep_mimic/DeepMimic_Optimizer.py b/examples/pybullet/gym/pybullet_envs/deep_mimic/DeepMimic_Optimizer.py index b6e9e6607..25427f16d 100644 --- a/examples/pybullet/gym/pybullet_envs/deep_mimic/DeepMimic_Optimizer.py +++ b/examples/pybullet/gym/pybullet_envs/deep_mimic/DeepMimic_Optimizer.py @@ -12,6 +12,7 @@ from pybullet_envs.deep_mimic.learning.rl_world import RLWorld from pybullet_utils.logger import Logger from pybullet_envs.deep_mimic.testrl import update_world, update_timestep, build_world import pybullet_utils.mpi_util as MPIUtil +from mpi4py import MPI args = [] world = None @@ -20,9 +21,15 @@ world = None def run(): global update_timestep global world - + rank = MPI.COMM_WORLD.Get_rank() + name = "timings"+str(rank)+".json" + slot = world.env._pybullet_client.startStateLogging(world.env._pybullet_client.STATE_LOGGING_PROFILE_TIMINGS,name) + count=1000 done = False while not (done): + count-=1 + if (count<0): + world.env._pybullet_client.stopStateLogging(slot) update_world(world, update_timestep) return diff --git a/examples/pybullet/gym/pybullet_envs/deep_mimic/env/humanoid_stable_pd.py b/examples/pybullet/gym/pybullet_envs/deep_mimic/env/humanoid_stable_pd.py index c846ed33b..244112a1e 100644 --- a/examples/pybullet/gym/pybullet_envs/deep_mimic/env/humanoid_stable_pd.py +++ b/examples/pybullet/gym/pybullet_envs/deep_mimic/env/humanoid_stable_pd.py @@ -341,7 +341,7 @@ class HumanoidStablePD(object): #static char* kwlist[] = { "bodyUniqueId", #"jointIndices", #"controlMode", "targetPositions", "targetVelocities", "forces", "positionGains", "velocityGains", "maxVelocities", "physicsClientId", NULL }; - + self._pybullet_client.setJointMotorControlMultiDofArray(self._sim_model, indices, self._pybullet_client.STABLE_PD_CONTROL, @@ -822,6 +822,9 @@ class HumanoidStablePD(object): jointIndices = range(num_joints) simJointStates = self._pybullet_client.getJointStatesMultiDof(self._sim_model, jointIndices) kinJointStates = self._pybullet_client.getJointStatesMultiDof(self._kin_model, jointIndices) + if useArray: + linkStatesSim = self._pybullet_client.getLinkStates(self._sim_model, jointIndices) + linkStatesKin = self._pybullet_client.getLinkStates(self._kin_model, jointIndices) for j in range(num_joints): curr_pose_err = 0 curr_vel_err = 0 @@ -859,10 +862,15 @@ class HumanoidStablePD(object): vel_err += w * curr_vel_err is_end_eff = j in self._end_effectors + if is_end_eff: - linkStateSim = self._pybullet_client.getLinkState(self._sim_model, j) - linkStateKin = self._pybullet_client.getLinkState(self._kin_model, j) + if useArray: + linkStateSim = linkStatesSim[j] + linkStateKin = linkStatesKin[j] + else: + linkStateSim = self._pybullet_client.getLinkState(self._sim_model, j) + linkStateKin = self._pybullet_client.getLinkState(self._kin_model, j) linkPosSim = linkStateSim[0] linkPosKin = linkStateKin[0] linkPosDiff = [ diff --git a/examples/pybullet/gym/pybullet_envs/deep_mimic/env/pybullet_deep_mimic_env.py b/examples/pybullet/gym/pybullet_envs/deep_mimic/env/pybullet_deep_mimic_env.py index d0b0bd11b..77c3970fe 100644 --- a/examples/pybullet/gym/pybullet_envs/deep_mimic/env/pybullet_deep_mimic_env.py +++ b/examples/pybullet/gym/pybullet_envs/deep_mimic/env/pybullet_deep_mimic_env.py @@ -240,7 +240,7 @@ class PyBulletDeepMimicEnv(Env): #print("action=",) #for a in action: # print(a) - np.savetxt("pb_action.csv", action, delimiter=",") + #np.savetxt("pb_action.csv", action, delimiter=",") self.desiredPose = self._humanoid.convertActionToPose(action) #we need the target root positon and orientation to be zero, to be compatible with deep mimic self.desiredPose[0] = 0 @@ -252,7 +252,7 @@ class PyBulletDeepMimicEnv(Env): self.desiredPose[6] = 0 target_pose = np.array(self.desiredPose) - np.savetxt("pb_target_pose.csv", target_pose, delimiter=",") + #np.savetxt("pb_target_pose.csv", target_pose, delimiter=",") #print("set_action: desiredPose=", self.desiredPose) diff --git a/examples/pybullet/gym/pybullet_envs/deep_mimic/testrl.py b/examples/pybullet/gym/pybullet_envs/deep_mimic/testrl.py index 1693fe7d4..9b9549359 100644 --- a/examples/pybullet/gym/pybullet_envs/deep_mimic/testrl.py +++ b/examples/pybullet/gym/pybullet_envs/deep_mimic/testrl.py @@ -1,3 +1,4 @@ +import time import os import inspect currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) @@ -17,7 +18,7 @@ import random update_timestep = 1. / 240. animating = True - +step = False def update_world(world, time_elapsed): timeStep = update_timestep @@ -82,11 +83,15 @@ if __name__ == '__main__': world = build_world(args, True) while (world.env._pybullet_client.isConnected()): + timeStep = update_timestep + time.sleep(timeStep) keys = world.env.getKeyboardEvents() if world.env.isKeyTriggered(keys, ' '): animating = not animating - if (animating): + if world.env.isKeyTriggered(keys, 'i'): + step = True + if (animating or step): update_world(world, timeStep) - #animating=False + step = False diff --git a/setup.py b/setup.py index d499a18ea..e6f2f7ef9 100644 --- a/setup.py +++ b/setup.py @@ -485,7 +485,7 @@ if 'BT_USE_EGL' in EGL_CXX_FLAGS: setup( name='pybullet', - version='2.5.1', + version='2.5.3', description= 'Official Python Interface for the Bullet Physics SDK specialized for Robotics Simulation and Reinforcement Learning', long_description= diff --git a/src/LinearMath/btScalar.h b/src/LinearMath/btScalar.h index ba49d6700..c09085ebd 100644 --- a/src/LinearMath/btScalar.h +++ b/src/LinearMath/btScalar.h @@ -63,7 +63,12 @@ inline int btGetVersion() #endif #ifdef _WIN32 - #if defined(__MINGW32__) || defined(__CYGWIN__) || (defined (_MSC_VER) && _MSC_VER < 1300) + #if defined(__GNUC__) // it should handle both MINGW and CYGWIN + #define SIMD_FORCE_INLINE __inline__ __attribute__((always_inline)) + #define ATTRIBUTE_ALIGNED16(a) a __attribute__((aligned(16))) + #define ATTRIBUTE_ALIGNED64(a) a __attribute__((aligned(64))) + #define ATTRIBUTE_ALIGNED128(a) a __attribute__((aligned(128))) + #elif ( defined(_MSC_VER) && _MSC_VER < 1300 ) #define SIMD_FORCE_INLINE inline #define ATTRIBUTE_ALIGNED16(a) a #define ATTRIBUTE_ALIGNED64(a) a