MAV.setGuidedModeWP doesn't seem to be telling the copter to fly to the waypoint

After constructing a waypoint, I am using MAV.setGuidedModeWP to tell a virtual quad (SITL) to fly to the waypoint. I saw a bunch of examples both in the MissionPlanner repo and online on the forums that showed this to be the way forward to fly to WPs programmatically from Python.

But alas… it’s not working. :slight_smile:

Can one of the talented devs elucidate this mystery for me? Am I doing something wrong?

import MissionPlanner
clr.AddReference("MissionPlanner.Utilities") # includes the Utilities class

wp1 = MissionPlanner.Utilities.Locationwp()
MissionPlanner.Utilities.Locationwp.lat.SetValue(wp1, cs.lat)
MissionPlanner.Utilities.Locationwp.lng.SetValue(wp1, cs.lng + 0.005)
MissionPlanner.Utilities.Locationwp.alt.SetValue(wp1, 20)

# this is where I arm and take off to some altitude. This part works fine.
... blah ...

# then, change to Guided mode and fly to a waypoint...

Script.ChangeMode("GUIDED")
Script.Sleep(3000)
print 'Current mode is ' + cs.mode

print 'Mission has ' + str(MAV.getWPCount()) + ' waypoints.'

print 'Flying to WP1...'
MAV.setGuidedModeWP(wp1)
Script.Sleep(20000)

# land and disarm. This part also works fine.
... blah ...

The quad just hovers at the current location and never flies a single inch in any given direction.
Any clues as to why setGuidedModeWP isn’t working?

I think I solved the enigma. I updated to the latest MP, and things started working. Looks like I am good for now.