def execute(param, state, bot_id, pub): global flag1, flag2 botPos = Vector2D(param.KickToPointP.x, param.KickToPointP.y) currbotPos = Vector2D(state.homePos[bot_id].x, state.homePos[bot_id].y) ballPos = Vector2D(state.ballPos.x, state.ballPos.y) #point = Vector2D() distance = ballPos.dist(botPos) dis_bn_ball_bot = ballPos.dist(currbotPos) req_dis = BOT_BALL_THRESH - 10 angle = botPos.angle(ballPos) ang = ballPos.angle(currbotPos) par = skills_union.SParam() par.GoToPointP.x = ballPos.x + req_dis * math.cos(angle) par.GoToPointP.y = ballPos.y + req_dis * math.sin(angle) par.GoToPointP.finalSlope = ballPos.angle(botPos) par.GoToPointP.align = True par.GoToPointP.finalVelocity = 0 # par.GoToBallP.intercept = False sGoToPoint.execute(par, state, bot_id, pub) par1 = skills_union.SParam() par1.KickToPointP.x = botPos.x par1.KickToPointP.y = botPos.y par1.KickToPointP.power = 7 sKickToPoint.execute(par1, state, bot_id, pub) return
def __init__(self, bot_id, state, params=None): super(TGoalie, self).__init__(bot_id, state, params) self.bot_id = bot_id self.ballAim = Vector2D() self.goalieTarget = Vector2D(0, 0) self.sParams = skills_union.SParam() self.UPPER_HALF = Vector2D(-HALF_FIELD_MAXX, OUR_GOAL_MAXY) self.LOWER_HALF = Vector2D(-HALF_FIELD_MAXX, OUR_GOAL_MINY) self.GOAL_UPPER = Vector2D(HALF_FIELD_MAXX, OUR_GOAL_MAXY * 3) self.GOAL_LOWER = Vector2D(HALF_FIELD_MAXX, OUR_GOAL_MINY * 3) self.sParams = skills_union.SParam()
def execute(param, state, bot_id, pub): botPos = Vector2D(int(state.homePos[bot_id].x), int(state.homePos[bot_id].y)) ballPos = Vector2D(int(state.ballPos.x), int(state.ballPos.y)) destPoint = Vector2D(int(param.KickToPointP.x), int(param.KickToPointP.y)) ob = Vector2D() finalSlope = destPoint.angle(botPos) turnAngleLeft = ob.normalizeAngle( finalSlope - state.homePos[bot_id].theta) #Angle left to turn dist = ballPos.dist(botPos) if dist > BOT_BALL_THRESH: sGoToBall.execute(param, state, bot_id, pub) return if math.fabs(turnAngleLeft ) > SATISFIABLE_THETA / 2: # SATISFIABLE_THETA in config file sParam = skills_union.SParam() sParam.TurnToPointP.x = destPoint.x sParam.TurnToPointP.y = destPoint.y sParam.TurnToPointP.max_omega = MAX_BOT_OMEGA * 3 sTurnToPoint.execute(sParam, state, bot_id, pub) return skill_node.send_command(pub, state.isteamyellow, bot_id, 0, 0, 0, param.KickToPointP.power, False)
def execute(param, state, bot_id, pub): # print "in kicktopoint" botPos = Vector2D(int(state.homePos[bot_id].x), int(state.homePos[bot_id].y)) ballPos = Vector2D(int(state.ballPos.x), int(state.ballPos.y)) destPoint = Vector2D(int(param.KickToPointP.x), int(param.KickToPointP.y)) ob = Vector2D() finalSlope = destPoint.angle(botPos) turnAngleLeft = ob.normalizeAngle( finalSlope - state.homePos[bot_id].theta) #Angle left to turn ballBotAngle = ob.normalizeAngle( ballPos.angle(botPos) - state.homePos[bot_id].theta) dist = ballPos.dist(botPos) if dist > BOT_BALL_THRESH + 10: print("before kick (GoToBall) dist remaining : ", dist - BOT_BALL_THRESH, " : ", BOT_BALL_THRESH) param.GoToPointP.x = state.ballPos.x param.GoToPointP.y = state.ballPos.y param.GoToPointP.finalSlope = ballPos.angle(state.homePos[bot_id]) sGoToPoint.execute(param, state, bot_id, pub) return # print("After gotoball") if ballBotAngle > SATISFIABLE_THETA / 2: sParam = skills_union.SParam() sParam.TurnToPointP.x = ballPos.x sParam.TurnToPointP.y = ballPos.y sParam.TurnToPointP.max_omega = MAX_BOT_OMEGA print("before kick (TurnToBall) angle remaining : ", ballBotAngle) sTurnToPoint.execute(sParam, state, bot_id, pub) return if math.fabs(turnAngleLeft ) > SATISFIABLE_THETA / 2: # SATISFIABLE_THETA in config file sParam = skills_union.SParam() sParam.TurnToPointP.x = destPoint.x sParam.TurnToPointP.y = destPoint.y sParam.TurnToPointP.max_omega = MAX_BOT_OMEGA print("before kick (Turn) angle remaining : ", turnAngleLeft) sTurnToPoint.execute(sParam, state, bot_id, pub) return # print("after turn") print("____KICK____ DIST :", dist, " ANGLE : ", turnAngleLeft) skill_node.send_command(pub, state.isteamyellow, bot_id, 0, 0, 0, param.KickToPointP.power, False)
def __init__(self, bot_id, state, params=None): super(TPressureCooker, self).__init__(bot_id, state, params) self.bot_id = bot_id self.ballPos = Vector2D(int(state.ballPos.x), int(state.ballPos.y)) self.botPos = Vector2D(int(state.homePos[self.bot_id].x), int(state.homePos[self.bot_id].y)) self.sParams = skills_union.SParam()
def __init__(self, bot_id, state, param=None): super(TMark, self).__init__(bot_id, state, param) self.sParam = skills_union.SParam()