Skip to content

Mission example does not work on ArduPilot #819

@TacticalLaptopBag

Description

@TacticalLaptopBag

When running the mission.py example found in the repo against an ArduPilot SITL simulator, I get the following error:

INFO:mavsdk_server:MAVSDK version: v3.15.0 (mavsdk_impl.cpp:33)
INFO:mavsdk_server:Waiting to discover system on udpin://0.0.0.0:14540... (connection_initiator.h:20)
INFO:mavsdk_server:New system on: 127.0.0.1:33817 (system ID: 101) (udp_connection.cpp:263)
INFO:mavsdk_server:System discovered (connection_initiator.h:62)
INFO:mavsdk_server:Server started (grpc_server.cpp:177)
INFO:mavsdk_server:Server set to listen on 0.0.0.0:50051 (grpc_server.cpp:178)
Waiting for drone to connect...
-- Connected to drone!
-- Uploading mission
Traceback (most recent call last):
  File "/home/user/dev/sandbox/ardupilot-mavsdk/mission.py", line 136, in <module>
    asyncio.run(run())
  File "/home/user/.pyenv/versions/3.12.12/lib/python3.12/asyncio/runners.py", line 195, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/home/user/.pyenv/versions/3.12.12/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.pyenv/versions/3.12.12/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/user/dev/sandbox/ardupilot-mavsdk/mission.py", line 90, in run
    await drone.mission.upload_mission(mission_plan)
  File "/home/user/dev/sandbox/ardupilot-mavsdk/.venv/lib/python3.12/site-packages/mavsdk/mission.py", line 846, in upload_mission
    raise MissionError(result, "upload_mission()", mission_plan)
mavsdk.mission.MissionError: INVALID_ARGUMENT: 'Invalid Argument'; origin: upload_mission(); params: (<mavsdk.mission.MissionPlan object at 0x7371815d05c0>,)

These are the MAVLink messages that appear in the SITL when running:

Got COMMAND_ACK: REQUEST_MESSAGE: ACCEPTED
Got COMMAND_ACK: REQUEST_MESSAGE: ACCEPTED
Got MISSION_ACK: TYPE_MISSION: INVALID_PARAM1

Running the same script against the PX4 SITL simulator results in a successful mission.

I've seen others are able to get the mission_raw plugin to work on ArduPilot, but I'm working on software that aims to support both PX4 and ArduPilot. I'd much rather use the standard mission API than have to convert a MissionPlan to a bunch of mission_raw.MissionItems. Is there any way I can use this API on ArduPilot, or do I just have a bad config?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions