MVSDK and Ardupilot SITL. MIssion upload

Hello everyome!

Please help me. I`m new in this :slight_smile:

I am using the latest version of Mission Planner. The latest version of SITL for Mission Planner has been downloaded. In MAVSDK I am on the main branch with the latest changes. In the Mission Planner, the TCP “server” is launched at the standard address and port 14550.
The connection is normal. Telemetry is loading. Then the mission begins loading.
I am loading the mission through MAVSDK into the Mission Planner SITL. Here’s an example (file attached). I changed it a little so that I could run it from my program, but the essence has not changed.
And I get the error InvalidArgument.
I use mission_row.
Please tell me what am I doing wrong?
fly_mission.cpp (9.5 KB)

Welcome to the community,

Which latest versions:

  1. latest stable versions?
  2. latest beta versions?
  3. latest dev versions (gitlab master branch form one hour ago or newer)?

Be more specific.

I’ve tried different ones. Both the stable version and the dev version.

@Zvereman1 I’m just trying to reproduce this. I installed MAVSDK v1.4.17 using the .deb package from Release 1.4.17 · mavlink/MAVSDK · GitHub.

Then I run your example and I can reproduce the issue:

cmake -Bbuild -S.
cmake --build build && build/fly_mission udp://:14550                                                                                 <<<
[ 50%] Building CXX object CMakeFiles/fly_mission.dir/fly_mission.cpp.o
[100%] Linking CXX executable fly_mission
[100%] Built target fly_mission
[07:16:05|Info ] MAVSDK version: v1.4.17 (mavsdk_impl.cpp:20)
Waiting to discover system...
[07:16:05|Info ] New system on: (with sysid: 1) (udp_connection.cpp:192)
[07:16:05|Debug] New: System ID: 1 Comp ID: 1 (mavsdk_impl.cpp:496)
[07:16:05|Debug] Component Autopilot (1) added. (system_impl.cpp:377)
[07:16:05|Warn ] Vehicle type changed (new type: 2, old type: 0) (system_impl.cpp:225)
[07:16:05|Debug] Discovered 1 component(s) (system_impl.cpp:578)
Discovered autopilot
Vehicle is getting ready to arm
[07:16:06|Debug] MAVLink: info: Flight plan received (system_impl.cpp:250)
[07:16:06|Warn ] Invalid sequence (mavlink_mission_transfer.cpp:242)
upload failed

Now let’s see where Invalid sequence is triggered, right here:

Now this is just a check which makes sure the items supplied have sequence increasing from 0.

I’m quickly printing the items before uploading using this:

    for (const auto& item : mission_plan) {
        std::cout << "seq: " << (int)item.seq << '\n';

And that gives me:

seq: 0
seq: 0
seq: 1
seq: 2
seq: 3
seq: 4
seq: 5
seq: 6

So why do we have seq 0 twice?

Aha, it looks like you’re downloading the mission first, so item 0 is already in the vector. Then you’re adding yet another home point, and so you end up with two home items with seq 0.

Just do:


right after extracting the home position, and before adding items.

I’ve added the example as it works (at least the mission upload) for me.

Hope that helps :wave:

fly_mission.cpp (9.6 KB)

1 Like

Thank you very much! I`ll try this.
Have a good day! :slight_smile:

1 Like

Actually, there would be a simpler way. You could probably just leave item 0 and then add items 1, and the rest without adding home first.

1 Like

Thank you Julian!!! It works for me! I`ve done as you say and mission was uploaded successfully! Now i know how to integrate this to my program. Thanks again so much :slightly_smiling_face:

I`ll try to do as you say. But a bit later. For now I need to learn about MAVSD and MAVLINK some more to have more understanding. ))