enable follow_rot to be set
correct grab goal settings enable different links for different goal types
This commit is contained in:
@@ -64,8 +64,9 @@ class Strike(Goal):
|
|||||||
distance_RB: RandomBounds,
|
distance_RB: RandomBounds,
|
||||||
height_RB: RandomBounds,
|
height_RB: RandomBounds,
|
||||||
rot_RB: RandomBounds,
|
rot_RB: RandomBounds,
|
||||||
hit_range = 0.2):
|
hit_range = 0.2,
|
||||||
self.follow_rot = True
|
follow_rot = True):
|
||||||
|
self.follow_rot = follow_rot
|
||||||
self.is_hit_prev = False
|
self.is_hit_prev = False
|
||||||
self.distance_RB = distance_RB
|
self.distance_RB = distance_RB
|
||||||
self.height_RB = height_RB
|
self.height_RB = height_RB
|
||||||
@@ -127,12 +128,12 @@ class Kick(Strike):
|
|||||||
super().__init__(distance_RB, height_RB, rot_RB, hit_range=0.2)
|
super().__init__(distance_RB, height_RB, rot_RB, hit_range=0.2)
|
||||||
|
|
||||||
class Grab(Strike):
|
class Grab(Strike):
|
||||||
def __inite__(self):
|
def __init__(self):
|
||||||
distance_RB = RandomBounds(0.6, 0.8)
|
distance_RB = RandomBounds(0.6, 0.8)
|
||||||
height_RB = RandomBounds(0.8, 0.9)
|
height_RB = RandomBounds(0.8, 1.1)
|
||||||
rot_RB = RandomBounds(-1, 1)
|
rot_RB = RandomBounds(3.14159 - 0.5, 3.14159 + 0.5)
|
||||||
hit_range = 0.1
|
hit_range = 0.1
|
||||||
super().__init__(distance_RB, height_RB, rot_RB, hit_range=hit_range)
|
super().__init__(distance_RB, height_RB, rot_RB, hit_range=hit_range, follow_rot=False)
|
||||||
|
|
||||||
class TargetHeadingGoal(Goal):
|
class TargetHeadingGoal(Goal):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from pybullet_utils import bullet_client
|
|||||||
import time
|
import time
|
||||||
from pybullet_envs.deep_mimic.env import motion_capture_data
|
from pybullet_envs.deep_mimic.env import motion_capture_data
|
||||||
from pybullet_envs.deep_mimic.env import humanoid_stable_pd
|
from pybullet_envs.deep_mimic.env import humanoid_stable_pd
|
||||||
from pybullet_envs.deep_mimic.env.goals import GoalType, Goal, createGoal
|
from pybullet_envs.deep_mimic.env.goals import GoalType, Goal, createGoal, Kick, Grab
|
||||||
from pybullet_envs.deep_mimic.env.humanoid_link_ids import HumanoidLinks
|
from pybullet_envs.deep_mimic.env.humanoid_link_ids import HumanoidLinks
|
||||||
import pybullet_data
|
import pybullet_data
|
||||||
import pybullet as p1
|
import pybullet as p1
|
||||||
@@ -257,7 +257,10 @@ class PyBulletDeepMimicEnv(Env):
|
|||||||
goal_weight = 0.3
|
goal_weight = 0.3
|
||||||
|
|
||||||
if self.goal.goal_type == GoalType.Strike:
|
if self.goal.goal_type == GoalType.Strike:
|
||||||
|
if self.goal.__class__ == Kick:
|
||||||
linkPos, linkOrient = self._humanoid.getLinkPositionAndOrientation(HumanoidLinks.rightAnkle)
|
linkPos, linkOrient = self._humanoid.getLinkPositionAndOrientation(HumanoidLinks.rightAnkle)
|
||||||
|
else: #elif type(self.goal) == Grab:
|
||||||
|
linkPos, linkOrient = self._humanoid.getLinkPositionAndOrientation(HumanoidLinks.rightWrist)
|
||||||
reward = mimic_weight * reward + goal_weight * self.calcStrikeGoalReward(linkPos)
|
reward = mimic_weight * reward + goal_weight * self.calcStrikeGoalReward(linkPos)
|
||||||
|
|
||||||
return reward
|
return reward
|
||||||
|
|||||||
Reference in New Issue
Block a user