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
c86e0041
Commit
c86e0041
authored
1 year ago
by
Fabian Heinrich
Browse files
Options
Downloads
Patches
Plain Diff
Radial view cone, if angle is 360 it is just a circle
parent
fe21742f
No related branches found
Branches containing commit
No related tags found
1 merge request
!56
Resolve "More FOV"
Pipeline
#45987
passed
1 year ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
overcooked_simulator/game_content/environment_config.yaml
+2
-2
2 additions, 2 deletions
overcooked_simulator/game_content/environment_config.yaml
overcooked_simulator/gui_2d_vis/drawing.py
+46
-32
46 additions, 32 deletions
overcooked_simulator/gui_2d_vis/drawing.py
with
48 additions
and
34 deletions
overcooked_simulator/game_content/environment_config.yaml
+
2
−
2
View file @
c86e0041
...
...
@@ -87,8 +87,8 @@ player_config:
radius
:
0.4
player_speed_units_per_seconds
:
6
interaction_range
:
1.6
restricted_view
:
Fals
e
view_angle
:
6
0
restricted_view
:
Tru
e
view_angle
:
9
0
view_range
:
3
# in grid units, can be "null"
effect_manager
:
...
...
This diff is collapsed.
Click to expand it.
overcooked_simulator/gui_2d_vis/drawing.py
+
46
−
32
View file @
c86e0041
...
...
@@ -45,11 +45,12 @@ def grayscale(img):
return
surface
def
create_polygon
(
n
,
length
):
def
create_polygon
(
n
,
start_vec
):
if
n
==
1
:
return
np
.
array
([
0
,
0
])
vector
=
np
.
array
([
length
,
0
])
vector
=
start_vec
.
copy
()
angle
=
(
2
*
np
.
pi
)
/
n
rot_matrix
=
np
.
array
(
...
...
@@ -155,51 +156,64 @@ class Visualizer:
angle
=
state
[
"
view_restriction
"
][
"
angle
"
]
/
2
range
=
state
[
"
view_restriction
"
][
"
range
"
]
angle
=
min
(
angle
,
180
)
pos
=
pos
*
grid_size
+
pygame
.
math
.
Vector2
([
grid_size
/
2
,
grid_size
/
2
])
rect_scale
=
max
(
width
,
height
)
rect_scale
=
max
(
width
,
height
)
*
2
# rect_scale = 2 * grid_size
left_beam
=
pos
+
(
direction
.
rotate
(
angle
)
*
rect_scale
*
2
)
right_beam
=
pos
+
(
direction
.
rotate
(
-
angle
)
*
rect_scale
*
2
)
offset_front
=
direction
*
grid_size
*
0.2
pygame
.
draw
.
polygon
(
screen
,
colors
[
"
black
"
],
(
pos
-
offset_front
,
left_beam
-
offset_front
,
left_beam
+
(
direction
.
rotate
(
90
)
*
rect_scale
),
pos
-
(
direction
*
rect_scale
*
2
)
+
(
direction
.
rotate
(
90
)
*
rect_scale
),
pos
-
(
direction
*
rect_scale
*
2
)
+
(
direction
.
rotate
(
-
90
)
*
rect_scale
),
right_beam
+
(
direction
.
rotate
(
-
90
)
*
rect_scale
),
right_beam
-
offset_front
,
),
)
if
range
:
offset_front
=
direction
*
grid_size
*
0.0
if
angle
!=
180
:
pygame
.
draw
.
polygon
(
screen
,
colors
[
"
black
"
],
(
pos
-
offset_front
,
left_beam
-
offset_front
,
left_beam
+
(
direction
.
rotate
(
90
)
*
rect_scale
),
pos
+
(
direction
.
rotate
(
90
)
*
rect_scale
)
+
(
direction
*
range
*
grid_size
),
pos
+
(
direction
.
rotate
(
-
90
)
*
rect_scale
)
+
(
direction
*
range
*
grid_size
),
pos
+
(
direction
.
rotate
(
-
90
)
*
rect_scale
)
+
(
direction
*
rect_scale
),
-
(
direction
*
rect_scale
*
2
)
+
(
direction
.
rotate
(
90
)
*
rect_scale
),
pos
+
(
direction
.
rotate
(
90
)
*
rect_scale
)
+
(
direction
*
rect_scale
),
-
(
direction
*
rect_scale
*
2
)
+
(
direction
.
rotate
(
-
90
)
*
rect_scale
),
right_beam
+
(
direction
.
rotate
(
-
90
)
*
rect_scale
),
right_beam
-
offset_front
,
),
)
if
range
:
n_circle_points
=
40
start_vec
=
np
.
array
(
-
direction
*
range
)
points
=
(
np
.
array
(
create_polygon
(
n_circle_points
,
start_vec
))
*
grid_size
)
+
pos
circle_closed
=
np
.
concatenate
([
points
,
points
[
0
:
1
]],
axis
=
0
)
corners
=
[
pos
-
(
direction
*
rect_scale
),
*
circle_closed
,
pos
-
(
direction
*
rect_scale
),
pos
-
(
direction
*
rect_scale
)
+
(
direction
.
rotate
(
90
)
*
rect_scale
),
pos
+
(
direction
*
rect_scale
)
+
(
direction
.
rotate
(
90
)
*
rect_scale
),
pos
+
(
direction
*
rect_scale
)
+
(
direction
.
rotate
(
-
90
)
*
rect_scale
),
pos
-
(
direction
*
rect_scale
)
+
(
direction
.
rotate
(
-
90
)
*
rect_scale
),
]
pygame
.
draw
.
polygon
(
screen
,
colors
[
"
black
"
],
[
*
corners
])
def
draw_background
(
self
,
surface
:
pygame
.
Surface
,
width
:
int
,
height
:
int
,
grid_size
:
int
...
...
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