From adcc0a814835e7ffab9095cd62779127581370ef Mon Sep 17 00:00:00 2001 From: vagrant Date: Fri, 18 Jun 2021 03:34:33 +0000 Subject: [PATCH] maid typo fixes, and fixed the recieve action to work properly --- rj_gameplay/rj_gameplay/action/receive.py | 4 +++- rj_gameplay/rj_gameplay/play/test_pass.py | 2 +- rj_gameplay/rj_gameplay/skill/capture.py | 5 +++-- rj_gameplay/rj_gameplay/skill/pivot_kick.py | 6 +++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/rj_gameplay/rj_gameplay/action/receive.py b/rj_gameplay/rj_gameplay/action/receive.py index 66657bd8dc3..942b3c6d6f1 100644 --- a/rj_gameplay/rj_gameplay/action/receive.py +++ b/rj_gameplay/rj_gameplay/action/receive.py @@ -26,7 +26,9 @@ def tick(self, intent) -> None: return intent def is_done(self, world_state) -> bool: + if self.robot_id is None: + return False #TODO: Use local params for this threshold - if np.linalg.norm(world_state.ball.vel) < 0.005: + if world_state.our_robots[self.robot_id].has_ball_sense or np.linalg.norm(world_state.ball.vel) < 10**(-6): return True return False diff --git a/rj_gameplay/rj_gameplay/play/test_pass.py b/rj_gameplay/rj_gameplay/play/test_pass.py index 20b04ccbc9b..b5974041410 100644 --- a/rj_gameplay/rj_gameplay/play/test_pass.py +++ b/rj_gameplay/rj_gameplay/play/test_pass.py @@ -49,5 +49,5 @@ def tick( return (skill_dict, skills) - def is_done(self ,world_state): + def is_done(self, world_state: rc.WorldState): return self.pass_tactic.is_done(world_state) \ No newline at end of file diff --git a/rj_gameplay/rj_gameplay/skill/capture.py b/rj_gameplay/rj_gameplay/skill/capture.py index 5be01ab2526..d8b8c50655c 100644 --- a/rj_gameplay/rj_gameplay/skill/capture.py +++ b/rj_gameplay/rj_gameplay/skill/capture.py @@ -12,6 +12,7 @@ from rj_gameplay.action import capture from stp.skill.action_behavior import ActionBehavior import stp.rc as rc +from typing import Optional class ICapture(skill.ISkill, ABC): ... @@ -22,8 +23,8 @@ class ICapture(skill.ISkill, ABC): """ class Capture(ICapture): - def __init__(self): - self.robot: rc.Robot = None + def __init__(self, robot: Optional[rc.Robot]=None): + self.robot = robot self.__name__ = 'Capture' self.capture = capture.Capture() self.capture_behavior = ActionBehavior('Capture', self.capture, self.robot) diff --git a/rj_gameplay/rj_gameplay/skill/pivot_kick.py b/rj_gameplay/rj_gameplay/skill/pivot_kick.py index 8ea0899a44e..5c525a0010b 100644 --- a/rj_gameplay/rj_gameplay/skill/pivot_kick.py +++ b/rj_gameplay/rj_gameplay/skill/pivot_kick.py @@ -24,11 +24,11 @@ class PivotKick(IPivotKick): A pivot kick skill """ - def __init__(self, target_point:np.array, chip:bool, kick_speed:float, robot:rc.Robot=None) -> None: - #TODO: Have something which automatically determines kick speed based on targert point distance + def __init__(self, target_point: np.array, chip: bool, kick_speed: float, robot: rc.Robot=None) -> None: + #TODO: Have something which automatically determines kick speed based on target point distance self.__name__ = 'pivot kick' self.robot = robot - self.chip= chip + self.chip = chip self.kick_speed = kick_speed self.root = Sequence("Sequence") self.target_point = target_point