minedojo.sim package¶
minedojo.sim.sim module¶
- class minedojo.sim.sim.MineDojoSim(*, initial_inventory=None, start_position=None, start_health=None, start_food=None, start_time=None, initial_weather=None, spawn_in_village=False, drawing_str=None, break_speed_multiplier=1.0, allow_time_passage=True, allow_mob_spawn=True, generate_world_type='default', regenerate_world_after_reset=False, world_seed=None, world_file_path=None, flat_world_seed_string=None, specified_biome=None, image_size, use_voxel=False, voxel_size=None, use_lidar=False, lidar_rays=None, use_depth=False, event_level_control=True, seed=None, sim_name='MineDojoSim', raise_error_on_invalid_cmds=False)[source]¶
Bases:
gym.core.Env
An environment wrapper for MineDojo simulation.
- Parameters
allow_mob_spawn¶ (
bool
) – IfTrue
, allow mobs (animals and hostiles) to spawn. Default:True
.allow_time_passage¶ (
bool
) – Time flows ifTrue
. Default:True
.break_speed_multiplier¶ (
float
) – Controls the speed of breaking blocks. A value larger than 1.0 accelerates the breaking. Default:1.0
.drawing_str¶ (
Optional
[str
]) – Draws shapes (e.g. spheres, cuboids) in the minecraft world. Default:None
.event_level_control¶ (
bool
) – IfTrue
, the agent is able to perform high-level controls including place and equip. IfFalse
, then is keyboard-mouse level control. Default:True
.flat_world_seed_string¶ (
Optional
[str
]) – A string that specifies how we want the world layers to be created ifgenerate_world_type
is “flat”. One can use the tool to generate. Default:None
.generate_world_type¶ (
Literal
[‘default’, ‘from_file’, ‘flat’, ‘specified_biome’]) – A string that specifies the type of the minecraft world. One of"default"
,"flat"
,"from_file"
,"specified_biome"
. Default:"default"
.image_size¶ (
Union
[int
,Tuple
[int
,int
]]) – The size of image observations.initial_inventory¶ (
Optional
[List
[InventoryItem
]]) – If notNone
, specifies initial items in the agent’s inventory. Use classInventoryItem
to specify items. Default:None
.initial_weather¶ (
Optional
[Literal
[‘normal’, ‘clear’, ‘rain’, ‘thunder’]]) – If notNone
, specifies the initial weather. Can be one of"clear"
,"normal"
,"rain"
,"thunder"
. Default:None
.lidar_rays¶ (
Optional
[List
[Tuple
[float
,float
,float
]]]) – Defines the directions and maximum distances of the lidar rays ifuse_lidar
isTrue
. If supplied, should be a list of tuple(pitch, yaw, distance). Pitch and yaw are in radians and relative to agent looking vector. Default:None
.raise_error_on_invalid_cmds¶ (
bool
) – IfTrue
, the cmd executor will raise error when a command is invalid. IfFalse
, the executor will just skip instead. Default:False
.regenerate_world_after_reset¶ (
bool
) – IfTrue
, the minecraft world will be re-generated when resetting. Default:False
.seed¶ (
Optional
[int
]) – The seed for an instance’s internal random number generator. Default:None
.sim_name¶ (
str
) – Name of a simulation instance. Default:"MineDojoSim"
.spawn_in_village¶ (
bool
) – IfTrue
, the agent will spawn in a village. Default:False
.specified_biome¶ (
Union
[int
,str
,None
]) – If notNone
, specifies the biome of the minecraft world by a string or an integer. Default:None
.start_food¶ (
Optional
[int
]) – If notNone
, specifies initial food of the agent. Default:None
.start_health¶ (
Optional
[float
]) – If notNone
, specifies initial health of the agent. Default:None
.start_position¶ (
Optional
[Dict
[str
,Union
[float
,int
]]]) – If notNone
, specifies the agent’s initial location and orientation. If provided, should be a dict with keysx
,y
,z
,yaw
,pitch
.yaw
andpitch
are in degrees. Default:None
.start_time¶ (
Optional
[int
]) – If notNone
, specifies the time when the agent spawns. If supplied, should be an int between 0 and 24000. See here for more information. Default:None
.use_depth¶ (
bool
) – IfTrue
, includes depth map in observations. Default:False
.use_lidar¶ (
bool
) – IfTrue
, includes lidar in observations. Default:False
.use_voxel¶ (
bool
) – IfTrue
, includes voxel in observations. Default:False
.voxel_size¶ (
Optional
[Dict
[str
,int
]]) – Defines the voxel’s range in each axis ifuse_voxel
isTrue
. If supplied, should be a dict with keysxmin
,xmax
,ymin
,ymax
,zmin
,zmax
. Each value specifies the voxel size relative to the agent. Default:None
.world_file_path¶ (
Optional
[str
]) – The path to the world file ifgenerate_world_type
is"from_file"
. Default:None
.world_seed¶ (
Union
[int
,str
,None
]) –Seed for deterministic world generation if
generate_world_type
is"default"
or"specified_biome"
. See here for more details. Default:None
.
- clear_inventory(action=None)[source]¶
Remove all items in the agent’s inventory.
- Parameters
action¶ (
Optional
[dict
]) – An action that will be simultaneously executed- Returns
A tuple (obs, reward, done, info) -
dict
- Agent’s observation of the current environment. -float
- Amount of reward returned after previous action. -bool
- Whether the episode has ended. -dict
- Contains auxiliary diagnostic information (helpful for debugging, and sometimes learning).
- close()[source]¶
Environments will automatically close() themselves when garbage collected or when the program exits.
- execute_cmd(cmd, action=None)[source]¶
Execute a given string command.
- Parameters
- Returns
A tuple (obs, reward, done, info) -
dict
- Agent’s observation of the current environment. -float
- Amount of reward returned after previous action. -bool
- Whether the episode has ended. -dict
- Contains auxiliary diagnostic information (helpful for debugging, and sometimes learning).
- kill_agent(action=None)[source]¶
Kill the agent.
- Parameters
action¶ (
Optional
[dict
]) – An action that will be simultaneously executed- Returns
A tuple (obs, reward, done, info) -
dict
- Agent’s observation of the current environment. -float
- Amount of reward returned after previous action. -bool
- Whether the episode has ended. -dict
- Contains auxiliary diagnostic information (helpful for debugging, and sometimes learning).
- random_teleport(max_range, action=None)[source]¶
Teleport the agent randomly.
- Parameters
- Returns
A tuple (obs, reward, done, info) -
dict
- Agent’s observation of the current environment. -float
- Amount of reward returned after previous action. -bool
- Whether the episode has ended. -dict
- Contains auxiliary diagnostic information (helpful for debugging, and sometimes learning).
- render(mode='human')[source]¶
Renders the environment.
- Parameters
mode¶ (
str
) – The mode to render with.
- reset()[source]¶
Resets the environment to an initial state and returns an initial observation.
- Returns
Agent’s initial observation.
- seed(seed=None)[source]¶
Sets the seed for this env’s random number generator.
- Parameters
seed¶ (
Optional
[int
]) – The seed for the number generator
- set_block(blocks, rel_positions, action=None)[source]¶
Set blocks in the world.
- Parameters
- Returns
A tuple (obs, reward, done, info) -
dict
- Agent’s observation of the current environment. -float
- Amount of reward returned after previous action. -bool
- Whether the episode has ended. -dict
- Contains auxiliary diagnostic information (helpful for debugging, and sometimes learning).
- set_inventory(inventory_list, action=None)[source]¶
Set items to the agent’s inventory.
- Parameters
- Returns
A tuple (obs, reward, done, info) -
dict
- Agent’s observation of the current environment. -float
- Amount of reward returned after previous action. -bool
- Whether the episode has ended. -dict
- Contains auxiliary diagnostic information (helpful for debugging, and sometimes learning).
- set_time(time, action=None)[source]¶
Set the world with the given time.
- Parameters
- Returns
A tuple (obs, reward, done, info) -
dict
- Agent’s observation of the current environment. -float
- Amount of reward returned after previous action. -bool
- Whether the episode has ended. -dict
- Contains auxiliary diagnostic information (helpful for debugging, and sometimes learning).
- set_weather(weather, action=None)[source]¶
Set the world with the given weather.
- Parameters
- Returns
A tuple (obs, reward, done, info) -
dict
- Agent’s observation of the current environment. -float
- Amount of reward returned after previous action. -bool
- Whether the episode has ended. -dict
- Contains auxiliary diagnostic information (helpful for debugging, and sometimes learning).
- spawn_mobs(mobs, rel_positions, action=None)[source]¶
Spawn mobs in the world.
- Parameters
- Returns
A tuple (obs, reward, done, info) -
dict
- Agent’s observation of the current environment. -float
- Amount of reward returned after previous action. -bool
- Whether the episode has ended. -dict
- Contains auxiliary diagnostic information (helpful for debugging, and sometimes learning).
- step(action)[source]¶
Run one timestep of the environment’s dynamics. Accepts an action and returns next_obs, reward, done, info.
- Parameters
action¶ (
dict
) – The action of the agent in current step.- Returns
A tuple (obs, reward, done, info) -
dict
- Agent’s next observation. -float
- Amount of reward returned after executing previous action. -bool
- Whether the episode has ended. -dict
- Contains auxiliary diagnostic information (helpful for debugging, and sometimes learning).
- teleport_agent(x, y, z, yaw, pitch, action=None)[source]¶
Teleport the agent to a given position.
- Parameters
- Returns
A tuple (obs, reward, done, info) -
dict
- Agent’s observation of the current environment. -float
- Amount of reward returned after previous action. -bool
- Whether the episode has ended. -dict
- Contains auxiliary diagnostic information (helpful for debugging, and sometimes learning).
- property action_space¶
- property is_terminated¶
- property new_seed¶
- property observation_space¶
- property prev_action¶
- property prev_info¶
- property prev_obs¶