-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
fbebb85
commit 778e700
Showing
4 changed files
with
64 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import math | ||
import time | ||
from rcst.communication import Communication | ||
from rcst import calc | ||
from rcst.ball import Ball | ||
from rcst.robot import RobotDict | ||
|
||
|
||
def is_in_penalty_area(x: float, y: float) -> bool: | ||
return math.fabs(x) >= 6.0 and math.fabs(y) <= 1.8 | ||
|
||
|
||
def test_emit_from_penalty_01(rcst_comm: Communication): | ||
rcst_comm.send_empty_world() | ||
rcst_comm.send_ball(5.0, 1.0) | ||
rcst_comm.send_yellow_robot(0, 6.0, 0, 0) | ||
rcst_comm.change_referee_command("FORCE_START", 3.0) | ||
|
||
rcst_comm.observer.reset() | ||
time.sleep(5) | ||
success = not is_in_penalty_area( | ||
rcst_comm.observer.get_world().get_ball().x, rcst_comm.observer.get_world().get_ball().y | ||
) | ||
assert success is True |