diff options
author | ManifoldFR <manifoldfr@outlook.com> | 2020-07-06 16:47:22 +0200 |
---|---|---|
committer | ManifoldFR <manifoldfr@outlook.com> | 2020-07-06 16:47:22 +0200 |
commit | 2fe3fe945d20fb2dcb61bfba54cae3700da9075a (patch) | |
tree | 6ebc54109613c0a07c2fd7e3fb8cdd0504825a84 | |
parent | 53a3af89188feb5c2e5368ec4a046b1a7852cbff (diff) | |
download | bullet3-2fe3fe945d20fb2dcb61bfba54cae3700da9075a.tar.gz |
DeepMimic: Make COM reward optional
-rw-r--r-- | examples/pybullet/gym/pybullet_envs/deep_mimic/env/humanoid_stable_pd.py | 10 |
1 files changed, 5 insertions, 5 deletions
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 42c56edbb..79e4cde50 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 @@ -21,7 +21,7 @@ jointFrictionForce = 0 class HumanoidStablePD(object): def __init__( self, pybullet_client, mocap_data, timeStep, - useFixedBase=True, arg_parser=None): + useFixedBase=True, arg_parser=None, useComReward=True): self._pybullet_client = pybullet_client self._mocap_data = mocap_data self._arg_parser = arg_parser @@ -149,7 +149,7 @@ class HumanoidStablePD(object): self._totalDofs += dof self.setSimTime(0) - self._useComReward = True + self._useComReward = useComReward self.resetPose() @@ -790,8 +790,9 @@ class HumanoidStablePD(object): #tMatrix kin_origin_trans = kin_char.BuildOriginTrans(); # #tVector com0_world = sim_char.CalcCOM(); - comSim, comSimVel = self.computeCOMposVel(self._sim_model) - comKin, comKinVel = self.computeCOMposVel(self._kin_model) + if self._useComReward: + comSim, comSimVel = self.computeCOMposVel(self._sim_model) + comKin, comKinVel = self.computeCOMposVel(self._kin_model) #tVector com_vel0_world = sim_char.CalcCOMVel(); #tVector com1_world; #tVector com_vel1_world; @@ -967,7 +968,6 @@ class HumanoidStablePD(object): def computeCOMposVel(self, uid: int): """Compute center-of-mass position and velocity.""" pb = self._pybullet_client - root_pos, _ = pb.getBasePositionAndOrientation(uid) num_joints = 15 jointIndices = range(num_joints) link_states = pb.getLinkStates(uid, jointIndices, computeLinkVelocity=1) |