def conv_dir_to_action_id(self, dir):
     dir = helpers.np_array_to_vector3(dir)
     if dir in self.directions:
         ind = self.directions.index(dir)
         return ind
     else:
         # print 'direction not in the set of actions'
         # print dir
         # print 'available directions'
         # print self.directions
         return 0
    def relative_dir_to_abs_dir(self, direction):
        direction = np.array(direction)
        direction_of_agent = self.hero.get_current_direction()
        if direction_of_agent is None:
            direction_of_agent = direction.copy()
            direction_of_agent = helpers.np_array_to_vector3(direction_of_agent)
            direction_of_agent.normalize()
            direction_of_agent = helpers.discretize_vector_to_voxel(direction_of_agent)
        rotation_matrix = helpers.get_rot_matrix_from_vec1_to_vec2([0, 1, 0], direction_of_agent)

        absolute_direction = np.matmul(rotation_matrix, direction)
        absolute_direction = helpers.discretize_vector_to_voxel(absolute_direction)
        check_direction = np.matmul(rotation_matrix, np.array([0, 1, 0]))
        check_direction = helpers.discretize_vector_to_voxel(check_direction)
        assert ((check_direction == direction_of_agent).all()), "rotating the system to agent's perspective is broken"
        return absolute_direction