[Experimental] MultiPush
This commit is contained in:
parent
9ddfecc846
commit
2e0c9da3d1
@ -451,7 +451,12 @@ class MazeEnv(gym.Env):
|
|||||||
|
|
||||||
|
|
||||||
def _add_object_ball(
|
def _add_object_ball(
|
||||||
worldbody: ET.Element, i: str, j: str, x: float, y: float, size: float
|
worldbody: ET.Element,
|
||||||
|
i: str,
|
||||||
|
j: str,
|
||||||
|
x: float,
|
||||||
|
y: float,
|
||||||
|
size: float,
|
||||||
) -> None:
|
) -> None:
|
||||||
body = ET.SubElement(worldbody, "body", name=f"objball_{i}_{j}", pos=f"{x} {y} 0")
|
body = ET.SubElement(worldbody, "body", name=f"objball_{i}_{j}", pos=f"{x} {y} 0")
|
||||||
mass = 0.0001 * (size ** 3)
|
mass = 0.0001 * (size ** 3)
|
||||||
|
@ -181,7 +181,7 @@ class GoalRewardPush(GoalRewardUMaze):
|
|||||||
|
|
||||||
def __init__(self, scale: float) -> None:
|
def __init__(self, scale: float) -> None:
|
||||||
super().__init__(scale)
|
super().__init__(scale)
|
||||||
self.goals = [MazeGoal(np.array([0.0, 2.375 * scale]))]
|
self.goals = [MazeGoal(np.array([0.0, 2.375]) * scale)]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create_maze() -> List[List[MazeCell]]:
|
def create_maze() -> List[List[MazeCell]]:
|
||||||
@ -199,12 +199,38 @@ class DistRewardPush(GoalRewardPush, DistRewardMixIn):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class GoalRewardMultiPush(GoalRewardUMaze):
|
||||||
|
OBSERVE_BLOCKS: bool = True
|
||||||
|
MAZE_SIZE_SCALING: Scaling = Scaling(ant=3.0, point=4.0, swimmer=None)
|
||||||
|
|
||||||
|
def __init__(self, scale: float, goal: Tuple[float, float] = (1.0, -2)) -> None:
|
||||||
|
super().__init__(scale)
|
||||||
|
self.goals = [MazeGoal(np.array(goal) * scale)]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def create_maze() -> List[List[MazeCell]]:
|
||||||
|
E, B, R, M = MazeCell.EMPTY, MazeCell.BLOCK, MazeCell.ROBOT, MazeCell.XY_BLOCK
|
||||||
|
return [
|
||||||
|
[B, B, B, B, B],
|
||||||
|
[B, B, E, B, B],
|
||||||
|
[B, E, M, E, B],
|
||||||
|
[B, R, E, B, B],
|
||||||
|
[B, E, M, E, B],
|
||||||
|
[B, B, E, B, B],
|
||||||
|
[B, B, B, B, B],
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class DistRewardMultiPush(GoalRewardMultiPush, DistRewardMixIn):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class GoalRewardFall(GoalRewardUMaze):
|
class GoalRewardFall(GoalRewardUMaze):
|
||||||
OBSERVE_BLOCKS: bool = True
|
OBSERVE_BLOCKS: bool = True
|
||||||
|
|
||||||
def __init__(self, scale: float) -> None:
|
def __init__(self, scale: float) -> None:
|
||||||
super().__init__(scale)
|
super().__init__(scale)
|
||||||
self.goals = [MazeGoal(np.array([0.0, 3.375 * scale, 4.5]))]
|
self.goals = [MazeGoal(np.array([0.0, 3.375, 4.5]) * scale)]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create_maze() -> List[List[MazeCell]]:
|
def create_maze() -> List[List[MazeCell]]:
|
||||||
@ -561,6 +587,7 @@ class TaskRegistry:
|
|||||||
"SquareRoom": [DistRewardSquareRoom, GoalRewardSquareRoom, NoRewardSquareRoom],
|
"SquareRoom": [DistRewardSquareRoom, GoalRewardSquareRoom, NoRewardSquareRoom],
|
||||||
"UMaze": [DistRewardUMaze, GoalRewardUMaze],
|
"UMaze": [DistRewardUMaze, GoalRewardUMaze],
|
||||||
"Push": [DistRewardPush, GoalRewardPush],
|
"Push": [DistRewardPush, GoalRewardPush],
|
||||||
|
"MultiPush": [DistRewardMultiPush, GoalRewardMultiPush],
|
||||||
"Fall": [DistRewardFall, GoalRewardFall],
|
"Fall": [DistRewardFall, GoalRewardFall],
|
||||||
"2Rooms": [DistReward2Rooms, GoalReward2Rooms, SubGoal2Rooms],
|
"2Rooms": [DistReward2Rooms, GoalReward2Rooms, SubGoal2Rooms],
|
||||||
"4Rooms": [DistReward4Rooms, GoalReward4Rooms, SubGoal4Rooms],
|
"4Rooms": [DistReward4Rooms, GoalReward4Rooms, SubGoal4Rooms],
|
||||||
|
Loading…
Reference in New Issue
Block a user