예제 #1
0
파일: pSuzhou.py 프로젝트: hwork/nao-man
    def getShootingPos(self,dist):
        ''' Returns where to position from ball location.
        Puts the robot in line with ball and goal center.'''
        destX,destY,destH = 0,0,0
        m = ((OPP_GOALBOX_TOP_Y-self.brain.ball.y)/(NogginConstants.MIDFIELD_X-self.brain.ball.x))
             
        destX = self.brain.ball.x - math.sqrt(dist**2/(1+m**2))

        destY = m*(destX-self.brain.ball.x)+self.brain.ball.y        
        if m == 0:
            destH = 0
        else:
            destH = MyMath.getRelativeHeading(destX,destY,
                                              self.brain.ball.x,
                                              self.brain.ball.y)
        return destX,destY,destH