Check if goto_location has reached target position

This surely has been asked before and I just cannot find it. I can’t be the first one.

How to check if a drone has reached a target position after issuing a goto_location command?

Right now, my solution is to regularly check the drone’s position and consider the waypoint done when the difference between actual and target position lies within a certain tolerance. It then waits a few seconds to let the drone settle itself at the new position and moves on.

    import math
    from mavsdk import System

    TOLERANCE_DEG = 0.00005
    TOLERANCE_M = 0.3
    WAIT_FOR_TARGET = 2
    uav = System()
    lat = ...
    lon = ...
    alt = ...
    yaw = ...
    ...
    await uav.action.goto_location(lat, lon, alt, yaw)
    
    last = 0
    async for position in uav.telemetry.position():
        curr = time.time()
        if (curr - last >= 1):
            last = curr
            diff_lat = math.fabs(position.latitude_deg - lat) - TOLERANCE_DEG
            diff_lon = math.fabs(position.longitude_deg - lon) - TOLERANCE_DEG
            diff_alt = math.fabs(position.relative_altitude_m - alt) - TOLERANCE_M
            if (diff_lat <= 0 and diff_lon <= 0 and diff_alt <= 0):
                print("Reached target vincinity, wait another " + str(WAIT_FOR_TARGET) + " s")
                asyncio.sleep(WAIT_FOR_TARGET)
                print("Reached target position")
                break

However, this feels a little hacky. This approach is based on a lot of estimates that may change with drone model or situation.

Is there a better solution to do this?

Thanks and best regards.