Merge branch 'master' of https://github.com/erwincoumans/bullet3
This commit is contained in:
@@ -12,6 +12,7 @@ from pybullet_envs.deep_mimic.learning.rl_world import RLWorld
|
|||||||
from pybullet_utils.logger import Logger
|
from pybullet_utils.logger import Logger
|
||||||
from pybullet_envs.deep_mimic.testrl import update_world, update_timestep, build_world
|
from pybullet_envs.deep_mimic.testrl import update_world, update_timestep, build_world
|
||||||
import pybullet_utils.mpi_util as MPIUtil
|
import pybullet_utils.mpi_util as MPIUtil
|
||||||
|
from mpi4py import MPI
|
||||||
|
|
||||||
args = []
|
args = []
|
||||||
world = None
|
world = None
|
||||||
@@ -20,9 +21,15 @@ world = None
|
|||||||
def run():
|
def run():
|
||||||
global update_timestep
|
global update_timestep
|
||||||
global world
|
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
|
done = False
|
||||||
while not (done):
|
while not (done):
|
||||||
|
count-=1
|
||||||
|
if (count<0):
|
||||||
|
world.env._pybullet_client.stopStateLogging(slot)
|
||||||
update_world(world, update_timestep)
|
update_world(world, update_timestep)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -341,7 +341,7 @@ class HumanoidStablePD(object):
|
|||||||
#static char* kwlist[] = { "bodyUniqueId",
|
#static char* kwlist[] = { "bodyUniqueId",
|
||||||
#"jointIndices",
|
#"jointIndices",
|
||||||
#"controlMode", "targetPositions", "targetVelocities", "forces", "positionGains", "velocityGains", "maxVelocities", "physicsClientId", NULL };
|
#"controlMode", "targetPositions", "targetVelocities", "forces", "positionGains", "velocityGains", "maxVelocities", "physicsClientId", NULL };
|
||||||
|
|
||||||
self._pybullet_client.setJointMotorControlMultiDofArray(self._sim_model,
|
self._pybullet_client.setJointMotorControlMultiDofArray(self._sim_model,
|
||||||
indices,
|
indices,
|
||||||
self._pybullet_client.STABLE_PD_CONTROL,
|
self._pybullet_client.STABLE_PD_CONTROL,
|
||||||
@@ -822,6 +822,9 @@ class HumanoidStablePD(object):
|
|||||||
jointIndices = range(num_joints)
|
jointIndices = range(num_joints)
|
||||||
simJointStates = self._pybullet_client.getJointStatesMultiDof(self._sim_model, jointIndices)
|
simJointStates = self._pybullet_client.getJointStatesMultiDof(self._sim_model, jointIndices)
|
||||||
kinJointStates = self._pybullet_client.getJointStatesMultiDof(self._kin_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):
|
for j in range(num_joints):
|
||||||
curr_pose_err = 0
|
curr_pose_err = 0
|
||||||
curr_vel_err = 0
|
curr_vel_err = 0
|
||||||
@@ -859,10 +862,15 @@ class HumanoidStablePD(object):
|
|||||||
vel_err += w * curr_vel_err
|
vel_err += w * curr_vel_err
|
||||||
|
|
||||||
is_end_eff = j in self._end_effectors
|
is_end_eff = j in self._end_effectors
|
||||||
|
|
||||||
if is_end_eff:
|
if is_end_eff:
|
||||||
|
|
||||||
linkStateSim = self._pybullet_client.getLinkState(self._sim_model, j)
|
if useArray:
|
||||||
linkStateKin = self._pybullet_client.getLinkState(self._kin_model, j)
|
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]
|
linkPosSim = linkStateSim[0]
|
||||||
linkPosKin = linkStateKin[0]
|
linkPosKin = linkStateKin[0]
|
||||||
linkPosDiff = [
|
linkPosDiff = [
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ class PyBulletDeepMimicEnv(Env):
|
|||||||
#print("action=",)
|
#print("action=",)
|
||||||
#for a in action:
|
#for a in action:
|
||||||
# print(a)
|
# print(a)
|
||||||
np.savetxt("pb_action.csv", action, delimiter=",")
|
#np.savetxt("pb_action.csv", action, delimiter=",")
|
||||||
self.desiredPose = self._humanoid.convertActionToPose(action)
|
self.desiredPose = self._humanoid.convertActionToPose(action)
|
||||||
#we need the target root positon and orientation to be zero, to be compatible with deep mimic
|
#we need the target root positon and orientation to be zero, to be compatible with deep mimic
|
||||||
self.desiredPose[0] = 0
|
self.desiredPose[0] = 0
|
||||||
@@ -252,7 +252,7 @@ class PyBulletDeepMimicEnv(Env):
|
|||||||
self.desiredPose[6] = 0
|
self.desiredPose[6] = 0
|
||||||
target_pose = np.array(self.desiredPose)
|
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)
|
#print("set_action: desiredPose=", self.desiredPose)
|
||||||
|
|
||||||
|
|||||||
2
setup.py
2
setup.py
@@ -485,7 +485,7 @@ if 'BT_USE_EGL' in EGL_CXX_FLAGS:
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='pybullet',
|
name='pybullet',
|
||||||
version='2.5.2',
|
version='2.5.3',
|
||||||
description=
|
description=
|
||||||
'Official Python Interface for the Bullet Physics SDK specialized for Robotics Simulation and Reinforcement Learning',
|
'Official Python Interface for the Bullet Physics SDK specialized for Robotics Simulation and Reinforcement Learning',
|
||||||
long_description=
|
long_description=
|
||||||
|
|||||||
Reference in New Issue
Block a user