-
Notifications
You must be signed in to change notification settings - Fork 186
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
New gameplay passing #1644
New gameplay passing #1644
Changes from 6 commits
02a5b66
aeebbe4
cc59d58
c4105a6
41c02dc
352f9f2
01e4f41
3d56812
01ce151
0cdec0d
b172cf6
edecfe4
939eddf
7dd7a0d
09c45df
b3a0fdc
5d9eee2
adcc0a8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
|
||
class Pivot(action.IFiniteAction): | ||
|
||
def __init__(self, robot_id:int, pivot_point:np.ndarray, target_point:np.ndarray, dribble_speed:float=1.0, priority:int=1): | ||
def __init__(self, robot_id:int, pivot_point:np.ndarray, target_point:np.ndarray, dribble_speed:float, priority:int=1): | ||
self.robot_id = robot_id | ||
self.pivot_point = pivot_point | ||
self.target_point = target_point | ||
|
@@ -32,6 +32,7 @@ def tick(self, intent: RobotIntent) -> None: | |
def is_done(self, world_state:rc.WorldState) -> bool: | ||
#TODO: Change this when we get action state feedback | ||
angle_threshold = 0.1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is definitely too big, it's about 6°. It should be closer to 1° (0.02 or so) |
||
#TODO: Make these local params | ||
stopped_threshold = 1*10**(-5) | ||
kfu02 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if self.robot_id is None: | ||
return False | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -14,6 +14,8 @@ | |||||
import stp.rc as rc | ||||||
import numpy as np | ||||||
|
||||||
MAX_DRIBBLER_SPEED = 1.0 | ||||||
|
||||||
class IPivotKick(skill.ISkill, ABC): | ||||||
... | ||||||
|
||||||
|
@@ -22,17 +24,21 @@ class PivotKick(IPivotKick): | |||||
A pivot kick skill | ||||||
""" | ||||||
|
||||||
def __init__(self, target_point:np.array, robot:rc.Robot=None) -> None: | ||||||
def __init__(self, target_point:np.array, chip:bool, kick_speed:float, robot:rc.Robot=None) -> None: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also maybe consider putting robot first? for consistency w/ other skills |
||||||
#TODO: Have something which automatically determines kick speed based on targert point distance | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
self.__name__ = 'pivot kick' | ||||||
self.robot = robot | ||||||
self.chip= chip | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
self.kick_speed = kick_speed | ||||||
self.root = Sequence("Sequence") | ||||||
self.target_point = target_point | ||||||
if robot is not None: | ||||||
self.pivot = action.pivot.Pivot(robot.id ,robot.pose[0:2], target_point) | ||||||
self.pivot = action.pivot.Pivot(robot.id ,robot.pose[0:2], target_point, MAX_DRIBBLER_SPEED) | ||||||
self.kick = action.kick.Kick(self.robot.id, self.chip, self.kick_speed) | ||||||
else: | ||||||
self.pivot = action.pivot.Pivot(None, np.array([0.0,0.0]), target_point) | ||||||
self.pivot = action.pivot.Pivot(None, np.array([0.0,0.0]), target_point, MAX_DRIBBLER_SPEED) | ||||||
self.kick = action.kick.Kick(self.robot, self.chip, self.kick_speed) | ||||||
self.capture = action.capture.Capture() | ||||||
self.kick = action.kick.Kick() | ||||||
self.capture_behavior = ActionBehavior('Capture', self.capture) | ||||||
self.pivot_behavior = ActionBehavior('Pivot', self.pivot) | ||||||
self.kick_behavior = ActionBehavior('Kick', self.kick) | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,16 +27,14 @@ class IReceive(skill.ISkill, ABC): | |
class Receive(IReceive): | ||
|
||
def __init__(self, | ||
robot:rc.Robot = None, | ||
one_touch_target:np.ndarray = None): | ||
robot:rc.Robot = None): | ||
|
||
self.robot = robot | ||
self.one_touch_target = one_touch_target | ||
if self.robot is not None: | ||
self.receive = receive.Receive(self.robot.id, self.one_touch_target) | ||
self.receive = receive.Receive(self.robot.id) | ||
self.capture = capture.Capture(self.robot.id) | ||
else: | ||
self.receive = receive.Receive(self.robot, self.one_touch_target) | ||
self.receive = receive.Receive(self.robot) | ||
self.capture = capture.Capture() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm confused by these constructors here. Why do we pass in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. self.robot is None is the else block so it works, I agree that it's confusing tho |
||
self.receive_behavior = ActionBehavior('Receive', self.receive) | ||
kylestach marked this conversation as resolved.
Show resolved
Hide resolved
|
||
self.capture_behavior = ActionBehavior('Capture', self.capture) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
import numpy as np | ||
|
||
|
||
class receiver_cost(role.CostFn): | ||
class Receiver_cost(role.CostFn): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @HussainGynai the cost functions in other tactics are styled as if they're methods, since we use/call these classes as methods. What are we going with? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to Kyle seems like class style is better here, when they're instantiated they should probably be in method form though I think. |
||
""" | ||
A cost function for how to choose a robot to pass to | ||
TODO: Implement a better cost function | ||
|
@@ -33,7 +33,7 @@ def __call__( | |
return 0.0 | ||
kylestach marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return 1.0 | ||
|
||
class passer_cost(role.CostFn): | ||
class Passer_cost(role.CostFn): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: |
||
""" | ||
A cost function for how to choose a robot that will pass | ||
TODO: Implement a better cost function | ||
|
@@ -59,10 +59,10 @@ class Pass(tactic.ITactic): | |
|
||
def __init__(self, target_point:np.ndarray): | ||
self.target_point = target_point | ||
self.pivot_kick = tactic.SkillEntry(pivot_kick.PivotKick(target_point = target_point)) | ||
self.pivot_kick = tactic.SkillEntry(pivot_kick.PivotKick(target_point = target_point, chip=False, kick_speed=4.0)) | ||
self.receive = tactic.SkillEntry(receive.Receive()) | ||
self.receiver_cost = receiver_cost(target_point) | ||
self.passer_cost = passer_cost() | ||
self.receiver_cost = Receiver_cost(target_point) | ||
self.Passer_cost = Passer_cost() | ||
|
||
def compute_props(self): | ||
pass | ||
|
@@ -81,7 +81,7 @@ def get_requests( | |
|
||
role_requests: tactic.RoleRequests = {} | ||
|
||
passer_request = role.RoleRequest(role.Priority.HIGH, True, self.passer_cost) | ||
passer_request = role.RoleRequest(role.Priority.HIGH, True, self.Passer_cost) | ||
role_requests[self.pivot_kick] = [passer_request] | ||
receive_request = role.RoleRequest(role.Priority.HIGH, True, self.receiver_cost) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on understanding, it requests receive skill and capture skill simultaneously. so when robot 1 passes the ball, robot 7 moves toward the kicker, and it makes it difficult for the receiver to settle the ball, I believe. Capture skill should be applied only when the ball gets closer to the receiver?? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is what does happen, kind of, if you check the receive action its based off of the speed of the ball, so when the ball is slow the capture starts. I am also changing it so that if the robot has ball sense it starts capture. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great! Now I understand what was happening! |
||
role_requests[self.receive] = [receive_request] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This threshold should be higher, vision noise can probably hit this pretty easily.