Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Cooperative Cuisine Environment
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Social Cognitive Systems
CoCoSy
Cooperative Cuisine Environment
Commits
72442594
Commit
72442594
authored
1 year ago
by
Florian Schröder
Browse files
Options
Downloads
Patches
Plain Diff
update environment class attributes docstrings
parent
f5b714af
No related branches found
No related tags found
1 merge request
!29
Resolve "docstrings"
Pipeline
#44162
passed
1 year ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
overcooked_simulator/overcooked_environment.py
+21
-4
21 additions, 4 deletions
overcooked_simulator/overcooked_environment.py
with
21 additions
and
4 deletions
overcooked_simulator/overcooked_environment.py
+
21
−
4
View file @
72442594
...
...
@@ -7,7 +7,7 @@ from datetime import timedelta
from
enum
import
Enum
from
pathlib
import
Path
from
threading
import
Lock
from
typing
import
Literal
from
typing
import
Literal
,
Any
import
numpy
as
np
import
numpy.typing
as
npt
...
...
@@ -82,16 +82,25 @@ class Environment:
def
__init__
(
self
,
env_config_path
:
Path
,
layout_path
,
item_info_path
:
Path
):
self
.
lock
=
Lock
()
"""
temporal lock for GUI until it uses the json state.
"""
self
.
players
:
dict
[
str
,
Player
]
=
{}
"""
the player, keyed by their id/name.
"""
with
open
(
env_config_path
,
"
r
"
)
as
file
:
self
.
environment_config
=
yaml
.
load
(
file
,
Loader
=
yaml
.
Loader
)
self
.
environment_config
:
dict
[
str
,
Any
]
=
yaml
.
load
(
file
,
Loader
=
yaml
.
Loader
)
"""
The environment configuration dictionary. Maybe in the future also a dataclass.
"""
self
.
layout_path
:
Path
=
layout_path
"""
The path to the layout file. Loaded by `Environment.parse_layout_file` method.
"""
# self.counter_side_length = 1 # -> this changed! is 1 now
self
.
item_info_path
:
Path
=
item_info_path
self
.
item_info
=
self
.
load_item_info
()
"""
The path to the `item_info.yml`. A default file is in `ROOT_DIR /
"
game_content
"
/
"
item_info.yaml
"
`.
"""
self
.
item_info
:
dict
[
str
,
ItemInfo
]
=
self
.
load_item_info
()
"""
The loaded item info dict. Keys are the item names.
"""
self
.
validate_item_info
()
if
self
.
environment_config
[
"
meals
"
][
"
all
"
]:
self
.
allowed_meal_names
=
set
(
[
...
...
@@ -102,7 +111,8 @@ class Environment:
)
else
:
self
.
allowed_meal_names
=
set
(
self
.
environment_config
[
"
meals
"
][
"
list
"
])
"""
The allowed meals depend on the `environment_config.yml` configured behaviour. Either all meals that
are possible or only a limited subset.
"""
self
.
order_and_score
=
OrderAndScoreManager
(
order_config
=
self
.
environment_config
[
"
orders
"
],
available_meals
=
{
...
...
@@ -111,6 +121,7 @@ class Environment:
if
info
.
type
==
ItemType
.
Meal
and
item
in
self
.
allowed_meal_names
},
)
"""
The manager for the orders and score update.
"""
plate_transitions
=
{
item
:
{
"
seconds
"
:
info
.
seconds
,
...
...
@@ -200,9 +211,13 @@ class Environment:
),
"
+
"
:
SinkAddon
,
}
"""
Map of the characters in the layout file to callables returning the object/counter. In the future,
maybe replaced with a factory and the characters defined elsewhere in an config.
"""
self
.
kitchen_height
:
int
=
0
"""
The height of the kitchen, is set by the `Environment.parse_layout_file` method
"""
self
.
kitchen_width
:
int
=
0
"""
The width of the kitchen, is set by the `Environment.parse_layout_file` method
"""
(
self
.
counters
,
...
...
@@ -217,9 +232,11 @@ class Environment:
`create_init_env_time`.
"""
self
.
order_and_score
.
create_init_orders
(
self
.
env_time
)
self
.
beginning_time
=
self
.
env_time
"""
The relative env time when it started.
"""
self
.
env_time_end
=
self
.
env_time
+
timedelta
(
seconds
=
self
.
environment_config
[
"
game
"
][
"
time_limit_seconds
"
]
)
"""
The relative env time when it will stop/end
"""
log
.
debug
(
f
"
End time:
{
self
.
env_time_end
}
"
)
def
get_env_time
(
self
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment