I used to be able to fly a virtual drone (SITL) around using computed WPs from a python script running in Mission Planner. I do this using MAV.setGuidedModeWP, which underneath sends the new coordinates to the autopilot via MAVLINK_MSG_ID.SET_POSITION_TARGET_GLOBAL_INT.
I suspect there was a recent change to the SITL autopilot that broke things, because all the test scripts that used to work no longer do. Guided Takeoff and Landing works, but the MAVLink command above no longer does anything.
What is the Type_Mask? I have a feeling it is because a recent PR of mine rejects any command that has the FORCE_SET type true.
The 9th bit needs to be 0. See here link for the MAVLINK spec that is a little odd compared to the rest of the message.
The need for it was that we now accept acceleration commands and we don’t want to handle Newtons as an input. Mixing the the two, m/s^2 and Newtons could have led to a bad day for someone.
Ok I found the relevant function in MissionPlanner and will put together a PR in MissionPlanner to fix it. That will take me a bit longer do since I haven’t built MissionPlanner in a long time.
@hendjosh “MAV” is a Python variable that maps to MainV2.comPort, which I believe is an instance of MAVLinkInterface. The latter, in MavLinkInterface.cs, defines the setGuidedModeWP method.
@hendjosh Oh, I just saw your second message. Thank you.
Do you know when a new MP build might become available so I can test your fix?
Also, will this fix (in MP) impact the behavior of older autopilots, such as 4.0.7? (because that’s what I have running on the real drone).
@seattleiteFPV No clue on the MP builds, but I don’t imagine it taking a long time.
BTW depending on your use the stable copter 4.1 SITL could be used in the mean time?
The files are located here.
I don’t think the MP change will effect behavior in older copter versions.
We weren’t handling that field before in ArduPilot or doing anything with acceleration. But I will check.
In the flight software,
Confirmed in Copter 4.07 we do not check the FORCE field so all good on that end.
Copter 4.1 we don’t check that bit either so good there as well.
OK, thanks for checking, @hendjosh.
The SITL gets downloaded by MP automatically into Documents\MissionPlanner\sitl. I would love to downgrade from 4.2.0-dev to an earlier version, but I am not seeing how… Are you suggesting I should just override all files in that folder, and check the “Skip Download” box in the Simulation tab in Mission Planner?
…actually nevermind, that seems to work. MP reports “Failed to download the SITL image” because of the weird linux extensions, but if I rename the “elf” files to “exe”, the sim starts just fine, and guided navigation works (as expected).
Glad you figured it out. I think when MissionPlanner downloads those files in renames them probably? There was a request recently to add a dropdown box for Stable versions of SITL in MissionPlanner. But that may be a bit.
Chiming in here 3 months later to confirm that I have upgraded to the latest MP, and your fix works as expected, @hendjosh. Guided WP navigation works once again with the latest SITL. Thanks!