Example #1
0
 def lookAtGameBoard(self, dist):
     """
     :param dist: the supposed distance between NAO and the board
     Make NAO look to the hypothetical game board position, located at "dist" meters from the robot
     """
     self.crouch()
     height = 0.165
     b = height
     c = geom.pythagore(height, dist)  # The length of the side betwaeen NAO's head and the board to look at
     a = dist  # The difference between the theoretical position (1m) and the actual position (dist)
     pitch_angle = geom.al_kashi(b, a, c, None)
     self.moveHead(pitch_angle, 0, radians=True)
Example #2
0
 def computeMaxRadiusRatio(self, distance):
     """
     Computes the max ratio between the radius of the circle that is the farthest from the robot
     and the radius of the circle that is the closest from the robot.
     :param distance: The distance between the robot and the farthest circle in the Connect 4 grid in cm
     :return: The max radius ratio
     """
     max_angle = np.pi / 2.
     ab = distance  # The length of the vector between the robot and the
     #                farthest point of the farthest vector
     bc = self.model.circle_diameter  # The length of the vector of a circle
     ac = geom.al_kashi(b=ab, c=bc, angle=max_angle)  # The length of the vector between the robot and the closest
     #                                                   point of the farthest vector
     beta = geom.al_kashi(a=bc, b=ab, c=ac)  # Angle of vision of the robot to the farthest vector
     de = bc  # de and bc are the same vectors
     bd = self.model.length - de  # bd is the length of the game board minus one vector
     ad = geom.al_kashi(b=ab, c=bd, angle=max_angle)  # The length of the vector between the robot and the farthest
     #                                                  point of the closest vector
     be = self.model.length  # The length of the game board
     ae = geom.al_kashi(b=ab, c=be, angle=max_angle)  # The length of the vector between the robot and the
     #                                                  closest point of the closest vector
     alpha = geom.al_kashi(a=de, b=ad, c=ae)  # Angle of vision of the robot to the closest vector
     return alpha / beta