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
6c510391
Commit
6c510391
authored
1 year ago
by
Fabian Heinrich
Browse files
Options
Downloads
Patches
Plain Diff
Test inputting movement action
parent
d3381997
No related branches found
No related tags found
1 merge request
!2
Resolve "2D movement continuous"
Pipeline
#41285
failed
1 year ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_start.py
+22
-2
22 additions, 2 deletions
tests/test_start.py
with
22 additions
and
2 deletions
tests/test_start.py
+
22
−
2
View file @
6c510391
...
...
@@ -4,6 +4,7 @@ from pathlib import Path
import
numpy
as
np
from
overcooked_simulator.counters
import
Counter
from
overcooked_simulator.overcooked_environment
import
Action
from
overcooked_simulator.player
import
Player
from
overcooked_simulator.simulation_runner
import
Simulator
...
...
@@ -38,7 +39,7 @@ def test_simulator_frequency():
self
.
c
+=
1
frequency
=
2000
running_time_seconds
=
4
running_time_seconds
=
3
sim
=
Simulator
(
Path
(
"
../overcooked_simulator/layouts/basic.layout
"
),
frequency
)
sim
.
env
=
TestEnv
()
# Overwrite environment with a simple counting env
...
...
@@ -54,8 +55,27 @@ def test_simulator_frequency():
assert
lower
<
sim
.
env
.
c
<
upper
,
"
Timing error in the environment at 1000hz
"
def
test_movement
():
sim
=
Simulator
(
Path
(
"
../overcooked_simulator/layouts/empty.layout
"
),
200
)
player_name
=
"
p1
"
start_pos
=
np
.
array
([
50
,
50
])
player1
=
Player
(
player_name
,
start_pos
)
sim
.
register_player
(
player1
)
move_direction
=
np
.
array
([
1
,
0
])
move_action
=
Action
(
player_name
,
"
movement
"
,
move_direction
)
do_moves_number
=
6
for
i
in
range
(
do_moves_number
):
sim
.
enter_action
(
move_action
)
expected
=
start_pos
+
do_moves_number
*
(
move_direction
*
player1
.
move_dist
)
assert
(
np
.
linalg
.
norm
(
expected
-
sim
.
env
.
players
[
player_name
].
pos
)
==
0
),
"
Should be here?
"
def
test_collision_detection
():
sim
=
Simulator
(
Path
(
"
../overcooked_simulator/layouts/empty.layout
.layout
"
),
200
)
sim
=
Simulator
(
Path
(
"
../overcooked_simulator/layouts/empty.layout
"
),
200
)
counter_pos
=
np
.
array
([
50
,
100
])
counter
=
Counter
(
counter_pos
)
sim
.
env
.
counters
=
[
counter
]
...
...
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