14.19 isInNeighbourhood

This function is used to check if one position obj is “close” to another position target. Closeness is defined by a double parameter called threshold. This function is useful for conducting passing to specific locations. The idea being if the agent would like to pass to a x,y coordinate, that they first check if a teammate isInNeighbourhood or close enough to receive the pass. This is achieved simply by checking the distance that obj is away from target and determining if it is less than the threshold. The limitation to this function is that you need to have the position of the object for which you want to check first.

bool NaoBehavior::isInNeighbourhood(VecPosition obj, VecPosition target, double threshold){

    double distance =  obj.getDistanceTo(target);
    if(distance < threshold){
        return true;
    }
    return false;
}