예제 #1
0
 def __init__(self,
              agent,
              x,
              y,
              z,
              direction=Direction.NORTH,
              view_distance=5,
              view_width=1,
              view_height=1):
     """
         Initate sensor. 
         Args:\n
             agent - Used to calculate relative position
             x - x location of sensor
             y - y location of sensor
             z - z location of sensor
             direction - Specifies the direction the cone is facing
             view_distance - Specifys how far the sensor can see
             view_width - Specifies how wide the cone of vision of it
             view_height - Specifies how height the cone of vision of it
     """
     self.length = 0.3
     self.height = 0.3
     self.width = 0.3
     self.x = int(x)
     self.y = int(y)
     self.z = int(z)
     self.direction = direction
     self.view_distance = view_distance
     self.view_width = view_width
     self.view_height = view_height
     self.relative_pos = Direction.calculate_normalized_coords(
         self.direction,
         tuple((self.x - agent.x, self.y - agent.y, self.z - agent.z)),
         tuple((agent.agent_length - 1, agent.agent_height - 1,
                agent.agent_width - 1)))