示例#1
0
    def calc_block_point(self):
        ball_pos = self.bb.ball_global
        if self.bb.parameters.attackRight:
            goal = VecPos(-550, 0)
        else:
            goal = VecPos(550, 0)
        # goal.x *= -1
        theta = degree_to_radian(degree_between(goal, ball_pos))

        block_point = VecPos()
        block_point.x = ball_pos.x - AVOID_DIS * 1.5 * cos(theta)
        block_point.y = ball_pos.y - AVOID_DIS * 1.5 * sin(theta)
        block_point.z = degrees(theta)

        return block_point
示例#2
0
def calc_final_dest(enable_kick, ball_field, ball_global, target):
    theta = angle_between(target, ball_global)

    closer_to_left_foot = ball_field.y > 0

    # FIXME(MWX): may blur
    if not enable_kick or (not cfg.left_kick and not cfg.right_kick):
        kick_point = closer_to_left_foot and cfg.left_kick_point or cfg.right_kick_point
    else:
        kick_point = cfg.left_kick and cfg.left_kick_point or cfg.right_kick_point

    res = VecPos()
    res.x = ball_global.x + kick_point.x * cos(theta)
    res.y = ball_global.y + kick_point.x * sin(theta)

    theta2 = angle_between(target, res)
    res.z = degrees(theta2 + PI)
    return res