示例#1
0
 def create_observation_space(self):
     obs_space = copy.deepcopy(self.env_to_wrap.observation_space)
     # TODO: Properly compute the maximum
     obs_space.spaces['vector'] = spaces.Box(low=-1.2,
                                             high=1.2,
                                             shape=[self.obf_vector_len])
     return obs_space
示例#2
0
    def __init__(self, hand: str):
        """
        Initializes the space of the handler with a spaces.Dict
        of all of the spaces for each individual command.
        """

        self._hand = hand
        self._default = 0  # 'none'
        super().__init__(spaces.Box(low=-1, high=1562, shape=(), dtype=np.int))
示例#3
0
    def __init__(self,
                 video_resolution: Tuple[int, int],
                 include_depth: bool = False):
        self.include_depth = include_depth
        self.video_resolution = video_resolution
        space = None
        if include_depth:
            space = spaces.Box(0,
                               255,
                               list(video_resolution)[::-1] + [4],
                               dtype=np.uint8)
            self.video_depth = 4

        else:
            space = spaces.Box(0,
                               255,
                               list(video_resolution)[::-1] + [3],
                               dtype=np.uint8)
            self.video_depth = 3
        self.video_height = video_resolution[0]
        self.video_width = video_resolution[1]

        super().__init__(space)
示例#4
0
 def __init__(self, item_list):
     item_list = sorted(item_list)
     super().__init__(
         spaces.Dict(
             spaces={
                 k: spaces.Box(low=0,
                               high=2304,
                               shape=(),
                               dtype=np.int32,
                               normalizer_scale='log')
                 for k in item_list
             }))
     self.num_items = len(item_list)
     self.items = item_list
from minerl.herobraine.hero import spaces
from minerl.herobraine.env_spec import MISSIONS_DIR
import os
import numpy as np
import gym

missions_dir = MISSIONS_DIR
old_envs = []

old_envs.append(dict(
    id='MineRLTreechop-v0',
    entry_point='minerl.env:MineRLEnv',
    kwargs={
        'xml': os.path.join(missions_dir, 'treechop.xml'),
        'observation_space': spaces.Dict({
            'pov': spaces.Box(low=0, high=255, shape=(64, 64, 3), dtype=np.uint8),
        }),
        'action_space': spaces.Dict(spaces={
            "forward": spaces.Discrete(2), 
            "back": spaces.Discrete(2), 
            "left": spaces.Discrete(2), 
            "right": spaces.Discrete(2), 
            "jump": spaces.Discrete(2), 
            "sneak": spaces.Discrete(2), 
            "sprint": spaces.Discrete(2), 
            "attack": spaces.Discrete(2),
            "camera": spaces.Box(low=-180, high=180, shape=(2,), dtype=np.float32),
        }),
        'docstr': """
.. image:: ../assets/treechop1.mp4.gif
  :scale: 100 %
示例#6
0
    def __init__(self):

        super().__init__(
            spaces.Box(low=0, high=128, shape=(1, ), dtype=np.uint8))
示例#7
0
    def __init__(self):

        super().__init__(
            spaces.Box(low=-180.0, high=180.0, shape=(), dtype=np.float32))
示例#8
0
 def __init__(self):
     space = spaces.Box(0, 1, [6], dtype=np.float32)
     super().__init__(space)
示例#9
0
 def __init__(self):
     self._command = 'camera'
     super().__init__(self.command, spaces.Box(low=-180, high=180, shape=[2], dtype=np.float32))
示例#10
0
 def create_action_space(self):
     act_space = copy.deepcopy(self.env_to_wrap.action_space)
     act_space.spaces['vector'] = spaces.Box(low=-1.05,
                                             high=1.05,
                                             shape=[self.obf_vector_len])
     return act_space
示例#11
0
 def create_action_space(self):
     act_list = self.remaining_action_space
     act_list.append(('vector', spaces.Box(low=0.0, high=1.0, shape=[self.action_vector_len], dtype=np.float32)))
     return spaces.Dict(sorted(act_list))
示例#12
0
 def create_observation_space(self):
     obs_list = self.remaining_observation_space
     # Todo: add maximum.
     obs_list.append(('vector', spaces.Box(low=0.0, high=1.0, shape=[self.observation_vector_len], dtype=np.float32)))
     return spaces.Dict(sorted(obs_list))