correct linkpos for non-strike goals

This commit is contained in:
Bart Moyaers
2020-02-17 15:04:06 +01:00
parent 595d3af4f4
commit ad1afa8547

View File

@@ -289,7 +289,7 @@ class PyBulletDeepMimicEnv(Env):
#print("pybullet_deep_mimic_env:update timeStep=",timeStep," t=",self.t) #print("pybullet_deep_mimic_env:update timeStep=",timeStep," t=",self.t)
self._pybullet_client.setTimeStep(timeStep) self._pybullet_client.setTimeStep(timeStep)
self._humanoid._timeStep = timeStep self._humanoid._timeStep = timeStep
self.updateGoal(self._humanoid.getLinkPositionAndOrientation(self.goal.target_link)[0]) self.updateGoal()
if self.target_id is not None: # TODO: check goal type if self.target_id is not None: # TODO: check goal type
self.updateDrawStrikeGoal() self.updateDrawStrikeGoal()
@@ -413,8 +413,9 @@ class PyBulletDeepMimicEnv(Env):
distanceSquared = sum([(x - y)**2 for (x, y) in zip(goalPos, linkPos)]) distanceSquared = sum([(x - y)**2 for (x, y) in zip(goalPos, linkPos)])
return math.exp(-4*distanceSquared) return math.exp(-4*distanceSquared)
def updateGoal(self, linkPos): def updateGoal(self):
if self.goal.goal_type == GoalType.Strike: if self.goal.goal_type == GoalType.Strike:
linkPos = self._humanoid.getLinkPositionAndOrientation(self.goal.target_link)[0]
if self.prevCycleCount != self._humanoid.cycleCount: if self.prevCycleCount != self._humanoid.cycleCount:
# generate new goal # generate new goal
humanPos, humanOrient = self._humanoid.getLinkPositionAndOrientation(0) humanPos, humanOrient = self._humanoid.getLinkPositionAndOrientation(0)