def obs_to_state(env, obs, n_states):
    """ 
    Perfom the discretisation of an observation.

    Args:
        env: OpenAI environment object
        obs: current state observation
        n_state: number of discrete bins

    Returns:
        Discretised observation
    """
    env_low = env.observation_space.low
    env_high = env.observation_space.high
    env_dx = (env_high - env_low) / n_states
    a = int((obs[0] - env_low[0]) / env_dx[0])
    b = int((obs[1] - env_low[1]) / env_dx[1])
    return a, b