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
Admin message
Looking for advice? Join the
Matrix channel for GitLab users in Bielefeld
!
Show more breadcrumbs
Social Cognitive Systems
CoCoSy
Cooperative Cuisine Environment
Commits
bf06622c
Commit
bf06622c
authored
1 year ago
by
Fabian Heinrich
Browse files
Options
Downloads
Patches
Plain Diff
Changed viz of Dispensers
parent
74b9b926
No related branches found
No related tags found
1 merge request
!33
Resolve "Determine Counter Facing Direction"
Pipeline
#45236
passed
1 year ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
overcooked_simulator/gui_2d_vis/drawing.py
+46
-34
46 additions, 34 deletions
overcooked_simulator/gui_2d_vis/drawing.py
overcooked_simulator/gui_2d_vis/visualization.yaml
+12
-7
12 additions, 7 deletions
overcooked_simulator/gui_2d_vis/visualization.yaml
with
58 additions
and
41 deletions
overcooked_simulator/gui_2d_vis/drawing.py
+
46
−
34
View file @
bf06622c
...
...
@@ -242,58 +242,62 @@ class Visualizer:
"""
for
part
in
parts
:
part_type
=
part
[
"
type
"
]
angle
,
angle_offset
=
0
,
0
draw_pos
=
pos
.
copy
()
if
orientation
is
not
None
:
angle_offset
=
calc_angle
(
orientation
,
[
0
,
1
])
if
"
rotate_image
"
in
part
.
keys
():
if
part
[
"
rotate_image
"
]:
angle
=
calc_angle
(
orientation
,
[
0
,
1
])
else
:
angle
=
angle_offset
match
part_type
:
case
"
image
"
:
angle
,
angle_offset
=
0
,
0
if
orientation
is
not
None
:
angle_offset
=
calc_angle
(
orientation
,
[
0
,
1
])
if
"
rotate_image
"
in
part
.
keys
():
if
part
[
"
rotate_image
"
]:
angle
=
calc_angle
(
orientation
,
[
0
,
1
])
else
:
angle
=
angle_offset
if
"
center_offset
"
in
part
:
d
=
pygame
.
math
.
Vector2
(
part
[
"
center_offset
"
])
*
grid_size
d
.
rotate_ip
(
angle_offset
)
pos
=
np
.
array
(
pos
)
pos
+=
np
.
array
(
d
)
draw_pos
+=
np
.
array
(
d
)
self
.
draw_image
(
screen
,
part
[
"
path
"
],
part
[
"
size
"
]
*
scale
*
grid_size
,
pos
,
draw_
pos
,
rot_angle
=
angle
,
)
case
"
rect
"
:
if
"
center_offset
"
in
part
:
d
=
pygame
.
math
.
Vector2
(
part
[
"
center_offset
"
])
*
grid_size
d
.
rotate_ip
(
angle_offset
)
draw_pos
+=
np
.
array
(
d
)
height
=
part
[
"
height
"
]
*
grid_size
width
=
part
[
"
width
"
]
*
grid_size
color
=
part
[
"
color
"
]
if
"
center_offset
"
in
part
:
dx
,
dy
=
np
.
array
(
part
[
"
center_offset
"
])
*
grid_size
rect
=
pygame
.
Rect
(
pos
[
0
]
+
dx
,
pos
[
1
]
+
dy
,
height
,
width
)
pygame
.
draw
.
rect
(
screen
,
color
,
rect
)
else
:
rect
=
pygame
.
Rect
(
pos
[
0
]
-
(
height
/
2
),
pos
[
1
]
-
(
width
/
2
),
height
,
width
,
)
rect
=
pygame
.
Rect
(
draw_pos
[
0
]
-
(
height
/
2
),
draw_pos
[
1
]
-
(
width
/
2
),
height
,
width
,
)
pygame
.
draw
.
rect
(
screen
,
color
,
rect
)
case
"
circle
"
:
if
"
center_offset
"
in
part
:
d
=
pygame
.
math
.
Vector2
(
part
[
"
center_offset
"
])
*
grid_size
d
.
rotate_ip
(
-
angle_offset
)
draw_pos
+=
np
.
array
(
d
)
radius
=
part
[
"
radius
"
]
*
grid_size
color
=
colors
[
part
[
"
color
"
]]
if
"
center_offset
"
in
part
:
pygame
.
draw
.
circle
(
screen
,
color
,
np
.
array
(
pos
)
+
(
np
.
array
(
part
[
"
center_offset
"
])
*
grid_size
),
radius
,
)
else
:
pygame
.
draw
.
circle
(
screen
,
color
,
pos
,
radius
)
pygame
.
draw
.
circle
(
screen
,
color
,
draw_pos
,
radius
,
)
def
draw_item
(
self
,
...
...
@@ -329,7 +333,7 @@ class Visualizer:
screen
=
screen
,
grid_size
=
grid_size
,
)
#
if
"
progress_percentage
"
in
item
and
item
[
"
progress_percentage
"
]
>
0.0
:
self
.
draw_progress_bar
(
screen
,
pos
,
item
[
"
progress_percentage
"
],
grid_size
=
grid_size
...
...
@@ -414,6 +418,7 @@ class Visualizer:
pos
=
pos
,
parts
=
parts
,
grid_size
=
grid_size
,
orientation
=
counter_dict
[
"
orientation
"
],
)
def
draw_counter_occupier
(
...
...
@@ -422,6 +427,7 @@ class Visualizer:
occupied_by
:
dict
|
list
,
grid_size
,
pos
:
npt
.
NDArray
[
float
],
item_scale
:
float
,
):
# Multiple plates on plate return:
if
isinstance
(
occupied_by
,
list
):
...
...
@@ -431,6 +437,7 @@ class Visualizer:
pos
=
np
.
abs
([
pos
[
0
],
pos
[
1
]
-
(
i
*
3
)]),
grid_size
=
grid_size
,
item
=
o
,
scale
=
item_scale
,
)
# All other items:
else
:
...
...
@@ -439,6 +446,7 @@ class Visualizer:
grid_size
=
grid_size
,
item
=
occupied_by
,
screen
=
screen
,
scale
=
item_scale
,
)
def
draw_counters
(
self
,
screen
:
pygame
,
state
,
grid_size
):
...
...
@@ -452,6 +460,7 @@ class Visualizer:
for
counter
in
state
[
"
counters
"
]:
if
counter
[
"
occupied_by
"
]:
item_pos
=
counter
[
"
pos
"
]
item_scale
=
1.0
counter_type
=
counter
[
"
type
"
]
if
counter_type
.
endswith
(
"
Dispenser
"
):
...
...
@@ -466,12 +475,15 @@ class Visualizer:
+
180
)
item_pos
+=
offset_vec
if
"
item_scale
"
in
self
.
config
[
"
Dispenser
"
].
keys
():
item_scale
=
self
.
config
[
"
Dispenser
"
][
"
item_scale
"
]
self
.
draw_counter_occupier
(
screen
,
counter
[
"
occupied_by
"
],
grid_size
,
np
.
array
(
item_pos
)
*
grid_size
,
item_scale
,
)
if
SHOW_COUNTER_CENTERS
:
...
...
This diff is collapsed.
Click to expand it.
overcooked_simulator/gui_2d_vis/visualization.yaml
+
12
−
7
View file @
bf06622c
...
...
@@ -88,13 +88,18 @@ Trashcan:
# width: 0.8
Dispenser
:
parts
:
[
]
# - color: gray83
# type: rect
# height: 0.8
# width: 0.8
item_offset
:
[
0
,
-0.15
]
parts
:
-
type
:
circle
color
:
gray83
radius
:
0.3
center_offset
:
[
0
,
-0.15
]
-
type
:
circle
color
:
black
radius
:
0.25
center_offset
:
[
0
,
-0.15
]
item_offset
:
[
0
,
-0.15
]
item_scale
:
0.75
ServingWindow
:
parts
:
...
...
@@ -282,7 +287,7 @@ Oven:
color
:
black
height
:
0.8
width
:
0.3
center_offset
:
[
-0.4
,
-0.1
]
center_offset
:
[
0
,
-0.1
]
Basket
:
parts
:
...
...
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