Mission Planner and WP uploading does not work

I have developped a propietary Groundstation software and I am trying to use Mission Planner for WP editing and uploading of the way points to my Groundstation and also displaying airplane position in Mission Planner.

I started with Heartbeat and GPS Raw sentences; I was sending them to Mission Planner using MAVLink v.1 sentences. Mission Planner recognized them, displays correctly aiplane position, etc. so far so good.

Next step: I tried to upload from Mission Planner WP to my groundstation. (By pressing Upload WP button).

When I do this,

Mission Planner sends MISSION_COUNT
My Groundstation responds with MISSION_REQUEST,

but Mission Planner seems not to recognize this sentence, sends MISSION_COUNT a couple more times, and then displays an Error Message, something like timeout for WP, within a function which seems to include Mission_Type. Mavlink v1 does not have this parameter for MISSION_REQUEST. So I think that the problem is that I am using v1 and not v2.

I changed the sentences to v2. Again Mission Planner recognizes perfectly my heartbeat and GPS raw, but with MISSION_COUNT things start to look weird: for v2, Mission Count has a new variable added, Mission_Type, and the sentence length for MISSION_COUNT increased from 4 to 5 bytes. however, Mission Planner sends me an FD (=V2) and then LEN=4 (=message length for V1!!!).

And when I try to return MISSION_REQUEST in V2 format (where Mission_Type is also added), it still does not recognize it…

HOW CAN I UPLOAD WPs to my system??? That is the only functionality I want from Mission Planner (in addition to displaying position).
What is the protocol?

The link is through cable Ethernet TCP, so it is 100 % solid.

I can upload the software code if needed

Please provide a Wireshark log or similar

Hi, Michael,

This is what I receive from Mission Planner when I press Write WP button
<<<<<<<<<<<< MISSION_COUNT 3 12 16 b’fd 04 00 00 6d ff be 2c 00 00 03 00 0c 10 d0a7’

Note that V2 has 4 variables, one of which, count, is unsigned integer, so length should be 5, not 4.

I am not sure if this is the issue which causes the problem with my mission request being ignored (it has also 5 data bytes for V2, instead of 4 as in V1). Still V1 was not recognized either by Mission Planner.

/HERE I PRESS Write WPs. There are 3 WP in Mission Planner/

Mission Count Data Length: 4
<<<<<<<<<<<< MISSION_COUNT 3 12 16 b’fd0400006dffbe2c000003000c10d0a7’

MISSION REQUEST SENT: 1 12 16 0 b’fd0500001a0c1028000001000c10008292’
HEART BEAT SENT: b’fd0900001b0c10000000000000000100dc00036738’
GPS RAW SENT: b’fd3200001c0c10180000c826020000000000f43fd7eae87faed5140100000200020029098700010e0700000008000000090000000a0000000b0000007d1d’

I also enclose full dump of the exchange between my test program and Mission Planner as well as the test program. It is in python, but I had to change the .py extension to .txt

MAvlink Dump.txt (11.4 KB) tcpip06.txt (8.8 KB)

so at first glance you might be missing that mavlink 2 does 0 padding trimming.

ie all 0’s at the end of a packet are removed.
so if you send a message that has 20 0’s at the end of the packet, they will all be removed, and transmitted without the 0’s. on reading however the V2 packet, they will be reconstructed as 0’s

in MP, turn on the console (help > console, and restart mp)
then in mp settings, tick the debug checkbox down the bottom.

also have you read
https://mavlink.io/en/services/mission.html

image

the fix is set seq to 0 for the first waypoint

I will try seq=0 for the first sentence, but during my tests with V1 protocol, I tried seq=0,1,2,3 as first sentence, but Mission Planner did not recognize. With V2 I believe I did not, since I found somewhere a mention that first WP=1, not =0.

I have read https://mavlink.io/en/services/mission.html and was following the communication exchange from there.

I did not get the issue of the 0 padding, but it seemed to work any way, and the mission request sentence does not contain 00’s

actually, https://mavlink.io/en/services/mission.html states:

“Drone responds with MISSION_REQUEST_INT requesting the first mission item ( seq==1 ).”

What i have not done so far is to try using MISSION_REQUEST_INT, I was sending MISSION_REQUEST.

The problem is that I am not getting any response… I tried seq =0 but still no answer…

Possibly a much simpler solution would be to run a python script on PC, save the WP file from Mission Planner and then make the python script transmit it to Groundstation (a Raspberry Pi)… Because Mission Planner Displays perfectly the live data generated by Groundstation, the WPs will be uploaded only rarely, so file exchange may be a better solution…

Below is the printout from the console:

INFO MissionPlanner.MAVLinkInterface - set giveComport ProgressReporterDialogue Background thread current False new True

INFO MissionPlanner.MAVLinkInterface - setWPTotal req MISSION_COUNT {“count”:3,“target_system”:12,“target_component”:16,“mission_type”:0}

map render 0,0225446

bps 83 loss 0 left 0 mem 43,37109375 mav2 True sign False mav1 0 mav2 2 signed 0

map render 0,0156411

INFO MissionPlanner.MAVLinkInterface - setWPTotal Retry 3

map render 0,0148539

map render 0,0060387

bps 183 loss 0 left 0 mem 43,0146484375 mav2 True sign False mav1 0 mav2 5 signed 0

INFO MissionPlanner.MAVLinkInterface - setWPTotal Retry 2

bps 83 loss 0 left 0 mem 44,0537109375 mav2 True sign False mav1 0 mav2 2 signed 0

map render 0,0152068

INFO MissionPlanner.MAVLinkInterface - setWPTotal Retry 1

map render 0,0148337

bps 83 loss 0 left 0 mem 41,8505859375 mav2 True sign False mav1 0 mav2 2 signed 0

INFO MissionPlanner.MAVLinkInterface - set giveComport ProgressReporterDialogue Background thread current True new False

ERROR MissionPlanner.ArduPilot.mav_mission - System.TimeoutException: Timeout on read - setWPTotal

at MissionPlanner.MAVLinkInterface.setWPTotal(UInt16 wp_total, MAV_MISSION_TYPE type)

at MissionPlanner.ArduPilot.mav_mission.upload(MAVLinkInterface port, MAV_MISSION_TYPE type, List1 commandlist, Action2 progress)

ERROR MissionPlanner.GCSViews.FlightPlannerBase - System.TimeoutException: Timeout on read - setWPTotal

at MissionPlanner.MAVLinkInterface.setWPTotal(UInt16 wp_total, MAV_MISSION_TYPE type)

at MissionPlanner.ArduPilot.mav_mission.upload(MAVLinkInterface port, MAV_MISSION_TYPE type, List1 commandlist, Action2 progress)

at MissionPlanner.GCSViews.FlightPlannerBase.saveWPs(IProgressReporterDialogue sender)

map render 0,0150134

map render 0,0135036

This is groundstation console…

it appears the spec has changed then. also the_int message requirement is also new.

MP requires a response with seq 0 as the first item

and

OK. Sorry to bother you… would it be possible to give me the hex sequence which I have to send to Mission Planner to get the first Way Point? I was trying all the different things, and it still does not work (retried out all the seq from 0…to 3, etc)…

Something like “b’fd0500001a0c1028000001000c10008292’” format.
I will “reverse-engineer” to see what part I am missing. because I still can not make Mission Planner send me the first WP. Probably the issue is not the seq, but something else.

Frankly, I prefer to implement my communications from scratch rather than relying on libraries (maybe this is not the correct way of doing things).