diff --git a/config_real_life.json b/config_real_life.json index 204f543a..529ef3f2 100644 --- a/config_real_life.json +++ b/config_real_life.json @@ -15,7 +15,7 @@ }, "match" : { "team_side": "left", - "team_color": "blue", + "team_color": "yellow", "coach_name": "IRON_2022", "category": "3v3", "robot_ids": [ diff --git a/controller/PID_control.py b/controller/PID_control.py index f83aadc2..04334134 100644 --- a/controller/PID_control.py +++ b/controller/PID_control.py @@ -39,7 +39,7 @@ def __init__(self, robot, default_fps=60): self.alpha_old = 0 # stores previous iteration alpha # Max speeds for the robot - self.v_max = 150 # 40 # linear speed + self.v_max = 130 # 40 # linear speed self.w_max = 550 # math.radians(7200) # angular speed rad/ self.v_min = 80 diff --git a/strategy/iron2022/Midfielder.py b/strategy/iron2022/Midfielder.py index 0188bb67..7c595fcc 100644 --- a/strategy/iron2022/Midfielder.py +++ b/strategy/iron2022/Midfielder.py @@ -11,6 +11,8 @@ def __init__(self, match, plot_field=False): self.lwr_margin = 0.2 self.hgr_margin = 1.1 + self.pushing_ball = False + self.def_x = 0.27 self.ga_hgr = 1 self.ga_lwr = .3 @@ -79,30 +81,30 @@ def decide(self): ball = self.match.ball ball_x, ball_y = ball.x, ball.y - if ball_x < .575 and ball_x > self.robot.x: - behaviour = self.push_ball - elif self.robot.x > .25 or self.robot.x < .15: - behaviour = self.recovery - else: - behaviour = self.defender + # if ball_x < .575 and ball_x > self.robot.x: + # behaviour = self.push_ball + # elif self.robot.x > .25 or self.robot.x < .15: + # behaviour = self.recovery + # else: + # behaviour = self.defender if ball_x == -1 or ball_y == -1: ball_x, ball_y = self.last_b_x, self.last_b_y - # if ball_x < .375: - # self.pushing_ball = True + if ball_x < .375: + self.pushing_ball = True - # if self.pushing_ball: - # if ball_x >= .575 or ball_x < .15: - # self.pushing_ball = False - # behaviour = self.defender - # else: - # behaviour = self.push_ball - # else: - # if self.robot.x > .25 or self.robot.x < .15: - # behaviour = self.recovery - # else: - # behaviour = self.defender + if self.pushing_ball: + if ball_x >= .575 or ball_x < .15: + self.pushing_ball = False + behaviour = self.defender + else: + behaviour = self.push_ball + else: + if self.robot.x > .25 or self.robot.x < .15: + behaviour = self.recovery + else: + behaviour = self.defender if ball.x > 0 and ball.y > 0: self.last_b_x, self.last_b_y = ball.x, ball.y diff --git a/strategy/tests/Idle.py b/strategy/tests/Idle.py index c82a0634..029b8a84 100644 --- a/strategy/tests/Idle.py +++ b/strategy/tests/Idle.py @@ -21,5 +21,6 @@ def reset(self, robot=None): def decide(self): + print(self.robot.x, self.robot.y) return 0, 0