Skip to content

Commit

Permalink
256_setting_start_matrx_unpaused
Browse files Browse the repository at this point in the history
  • Loading branch information
thaije committed Feb 5, 2021
1 parent 8cef68f commit 1b68dfa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions matrx/cases/vis_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def run_vis_test(nr_of_worlds=2):

# run each world
for world in builder.worlds(nr_of_worlds=nr_of_worlds):
# builder.api_info['matrx_paused'] = False
world.run(builder.api_info)

# stop MATRX scripts such as the api and visualizer (if used)
Expand Down
5 changes: 4 additions & 1 deletion matrx/grid_world.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ def initialize(self, api_info):
api_info : dictionary
A dictionary which contians information on the API. At least containing the `api_thread` key with the
API thread, and the `run_matrx_api` key which contains whether the GridWorld should start paused or not.
The `matrx_paused` key can be used to start MATRX paused (default behaviour) or unpaused when using a
visualizer and API. If the API is disabled, MATRX always starts unpaused by default.
Optionally the `nr_states_to_store` key telling the API how many past states (including the current) should
be stored (minimum of 1, the current state). Note; too big of a number increases RAM usage!
Expand Down Expand Up @@ -181,8 +183,9 @@ def initialize(self, api_info):
"vis_bg_img": self.__visualization_bg_img
}
}

# start paused
api.matrx_paused = True
api.matrx_paused = True if 'matrx_paused' not in api_info else api_info['matrx_paused']

# fetch the initial state of every agent to display
self._fetch_initial_states()
Expand Down

0 comments on commit 1b68dfa

Please sign in to comment.