Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic defense play #1671

Merged
merged 32 commits into from
Jun 20, 2021
Merged

Basic defense play #1671

merged 32 commits into from
Jun 20, 2021

Conversation

kfu02
Copy link
Contributor

@kfu02 kfu02 commented Jun 17, 2021

Description

There's a surprising amount of new stuff here:

  • goalie_id from the /referee/goalie_id ROS topic is now a part of WorldState (world_state.game_info.goalie_id)
  • intercept action/skill added (this is broken)
  • goalie tactic added
  • basic_defense play added

Steps to test

FIRST: Change the number of robots to 6. This can be done by clicking on grSim, then in the left menu finding Game > Robots Count and changing the count to 6. (If you can't see the current number, scroll to the right.)

Screenshot from 2021-06-18 23-00-05

Test Case 1

  1. Make sure on any and all runs that robot 0 is the goalie robot (the one in the penalty box)
    (This is set off of the /referee/goalie_id topic; you can check rqt to confirm that they match.)

Test Case 2

  1. Start sim.
  2. Drag ball around field.

Expected result:

  • Two robots mark the other team, three form a wall, one robot goes to be a goalie. This holds regardless of where the ball is.
  • Goalie stays between the ball and the center of the goal, moving closer/further depending on the ball's distance, and never going beyond the wall.
  • Non-goalie robots don't enter the goalie box (currently broken)

Test Case 3

  1. Comment out line 17 of play/basic_defense.py (to disable the wall).
  2. Move other robots out of the way
  3. Take a bunch of shots on goal from different angles/speeds.

Expected result:

  • Goalie moves to block shots & settles the ball once the shot has been blocked.
  • Goalie doesn't panic and try to block a shot that isn't coming.

This last test case is the most likely to fail, since I essentially hacked around the non-working intercept motion command with my own move to point command.

Test Case 4

  1. Reenable the wall
  2. Simulate playing soccer against the defense

Expected result:

  • No defense-breaking bugs are exposed in normal gameplay conditions.

Copy link
Contributor Author

@kfu02 kfu02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick comments to speed up review

rj_gameplay/rj_gameplay/action/kick.py Outdated Show resolved Hide resolved
@@ -9,11 +9,11 @@
from typing import Dict, Generic, Iterator, List, Optional, Tuple, Type, TypeVar
import numpy as np


Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file is identical to the file merged into ros2 recently by #1661, shows here bc I ran make pretty-lines

rj_gameplay/rj_gameplay/skill/capture.py Outdated Show resolved Hide resolved
@@ -46,7 +45,8 @@ def __init__(self,
self.root.setup_with_descendants()
self.__name__ = 'move skill'

def tick(self, robot: rc.Robot, world_state: rc.WorldState): #returns dict of robot and actions
def tick(self, robot: rc.Robot,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, make pretty-lines the only changes here

rj_gameplay/rj_gameplay/tactic/goalie_tactic.py Outdated Show resolved Hide resolved
Copy link
Contributor

@HussainGynai HussainGynai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor stuff, looks pretty good overall.

rj_gameplay/rj_gameplay/tactic/goalie_tactic.py Outdated Show resolved Hide resolved
rj_gameplay/rj_gameplay/tactic/goalie_tactic.py Outdated Show resolved Hide resolved
rj_gameplay/rj_gameplay/tactic/goalie_tactic.py Outdated Show resolved Hide resolved
@kfu02 kfu02 marked this pull request as ready for review June 19, 2021 02:40
@kfu02 kfu02 requested a review from HussainGynai June 19, 2021 02:48
Copy link
Contributor Author

@kfu02 kfu02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a bunch of comments for files that you can skip when reviewing, at least this time around.

@@ -0,0 +1,38 @@
"""This module contains the interface and action for intercept."""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broken intercept, not sure if it's motion planning side or here. Feel free to skip for now since it's not used.

rj_gameplay/rj_gameplay/gameplay_node.py Show resolved Hide resolved
@@ -0,0 +1,52 @@
from abc import ABC, abstractmethod
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, intercept isn't used because it's broken, feel free to skip

@@ -18,30 +18,33 @@
from stp.utils.constants import RobotConstants, BallConstants
import stp.global_parameters as global_parameters

MIN_WALL_RAD = None
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the only changes to this file from what's in #1661 are from make pretty-lines, skip this too

rj_gameplay/stp/rc.py Show resolved Hide resolved
Copy link
Contributor

@HussainGynai HussainGynai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I think add a pass/clear if the goalie gets the ball, otherwise it'll just sit there.

@kfu02 kfu02 changed the base branch from ros2 to comp2021 June 20, 2021 04:51
Copy link
Contributor

@Yudai-8-om Yudai-8-om left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I agree with Hussain about adding pass/clear thing
Other than that, worked great!

@kfu02 kfu02 merged commit 06ef704 into comp2021 Jun 20, 2021
@kfu02 kfu02 deleted the basic_defense branch June 20, 2021 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants