CurrentState.wp_dist doesn't seem to work for guided WPs. Is that by design?

I am trying to use CurrentState.wp_dist (or cs.wp_dist from a Python script) to estimate the distance to the next WP. The trouble is, if the WP is a dynamically created, Guided waypoint, wp_dist always reports 0.0. Is that by design?

def newWP(lat, lng, alt):
    wp = MissionPlanner.Utilities.Locationwp(), lat)
    MissionPlanner.Utilities.Locationwp.lng.SetValue(wp, lng)
    MissionPlanner.Utilities.Locationwp.alt.SetValue(wp, alt)
    return wp

MAV.setGuidedModeWP(newWP(lat, lng, alt))
print 'Distance to WP is ' + str(cs.wp_dist)

The above always prints 0.0 instead of the estimated distance… what’s up with that? Is that by design? Is there a different estimator that can be used for these WPs?

Thank you in advance.

Are you using ArduCopter 4.1.0-rc1 or 4.2.0-dev?

Using SITL, and it looks like it’s v4.2.0-dev. It gets downloaded automatically each time I start the simulator.

What library are you using? looks like some MissionPlanner python library? I guess that lib has a bug.

Yes, I am using a script executing in MP. The python ‘cs.wp_dist’ actually maps to the internal CurrentState.wp_dist, as defined in CurrentState.cs:

    [DisplayText("Dist to WP (dist)")]
    public float wp_dist
        get => _wpdist * multiplierdist;
        set => _wpdist = value;

So if this property produces 0.0 for guided WPs, the bug must be in the implementation of the property in CurrentState.cs.