Repository navigation
Conversation
Add a comment indicating the target platform for the example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
mission.pyfails on ArduPilotThe upload error in #819 (
MissionError: INVALID_ARGUMENT, with ArduPilot answeringMISSION_ACK=INVALID_PARAM1) comes from the RTL item thatset_return_to_launch_after_mission(True)appends. It is sent withparam1..4 = NaN. ArduPilot'sAP_Mission::sanity_check_params()only allows NaN inparam4 for a few NAV commands, and it rejects NaN params on
NAV_RETURN_TO_LAUNCHwithMAV_MISSION_INVALID_PARAM1.This is fixed on the C++ side in mavlink/MAVSDK#3213 (in v4.2.0). This repo still pins
mavsdk_serverv4.0.5, somission.pystill fails with the publishedmavsdk-grpc.Even with that fixed, the high-level mission plugin's output can't be flown by ArduCopter
from the ground:
AP_MISSION_FIRST_REAL_COMMAND = 1), sothe first waypoint is overwritten.
NAV_TAKEOFF(
Auto: Missing Takeoff Cmd). TheVehicleAction.TAKEOFFitem is also sent with NaNparam1, which ArduPilot rejects too.
What this PR adds
examples/mission_ardupilot.pybuilds the mission withmission_raw:home at seq 0,
NAV_TAKEOFF, three waypoints offset from home (so it works wherever thevehicle/SITL is), and
NAV_RETURN_TO_LAUNCH. Unused params are 0 instead of NaN. Then itarms, runs
mission_raw.start_mission()and exits after landing. The docstring explains thethree ArduPilot requirements so users of the high-level API know why it differs.
mission.pygets a one-line pointer to it.Testing
examples/mission.py(mavsdk-grpc 4.0.5).The RTL item is uploaded as
cmd=20 params=[nan, nan, nan, nan]and rejected withINVALID_PARAM1.mission_ardupilot.pyuploads 6 items that are all accepted, then arms and switches to AUTO.sim_vehicle.py -v ArduCopter): <describe result: takeoff, 3 waypoints, RTL, land>ruff format --check/ruff check --select=ASYNC,RUF006,E,Fpass.