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
2269326f
Commit
2269326f
authored
1 year ago
by
Fabian Heinrich
Browse files
Options
Downloads
Patches
Plain Diff
Simple testing of collisions
parent
faf74955
No related branches found
No related tags found
1 merge request
!2
Resolve "2D movement continuous"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
overcooked_simulator/simulation_runner.py
+1
-1
1 addition, 1 deletion
overcooked_simulator/simulation_runner.py
tests/test_start.py
+24
-0
24 additions, 0 deletions
tests/test_start.py
with
25 additions
and
1 deletion
overcooked_simulator/simulation_runner.py
+
1
−
1
View file @
2269326f
...
...
@@ -23,7 +23,7 @@ class Simulator(Thread):
self
.
step_frequency
:
int
=
frequency
self
.
prefered_sleeptime_ns
:
float
=
1e9
/
self
.
step_frequency
self
.
env
=
env_class
()
self
.
env
:
Environment
=
env_class
()
super
().
__init__
()
...
...
This diff is collapsed.
Click to expand it.
tests/test_start.py
+
24
−
0
View file @
2269326f
...
...
@@ -3,6 +3,8 @@ from overcooked_simulator.player import Player
from
overcooked_simulator.overcooked_environment
import
Environment
,
Action
import
numpy
as
np
import
time
from
overcooked_simulator.counters
import
Counter
def
test_player_registration
():
...
...
@@ -47,3 +49,25 @@ def test_simulator_frequency():
lower
=
frequency
*
running_time_seconds
*
(
1
-
accepted_tolerance
)
upper
=
frequency
*
running_time_seconds
*
(
1
+
accepted_tolerance
)
assert
sim
.
env
.
c
>
lower
and
sim
.
env
.
c
<
upper
,
"
Timing error in the environment at 1000hz
"
def
test_collision_detection
():
sim
=
Simulator
(
Environment
,
200
)
counter_pos
=
np
.
array
([
0
,
100
])
counter
=
Counter
(
counter_pos
)
sim
.
env
.
counters
=
[
counter
]
player1
=
Player
(
"
p1
"
,
np
.
array
([
0
,
0
]))
player2
=
Player
(
"
p2
"
,
np
.
array
([
0
,
200
]))
sim
.
register_player
(
player1
)
sim
.
register_player
(
player2
)
# same player name
sim
.
start
()
assert
not
sim
.
env
.
detect_collision_counters
(
player1
),
"
Should not collide
"
assert
not
sim
.
env
.
detect_player_collision
(
player1
),
"
Should not collide yet.
"
player1
.
move_abs
(
counter_pos
)
assert
sim
.
env
.
detect_collision_counters
(
player1
),
"
Player and counter at same pos.
"
player2
.
move_abs
(
counter_pos
)
assert
sim
.
env
.
detect_player_collision
(
player1
),
"
Players at same pos.
"
sim
.
stop
()
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