mavlink / qgroundcontrol

Cross-platform ground control station for drones (Android, iOS, Mac OS, Linux, Windows)
http://qgroundcontrol.io
3.29k stars 3.62k forks source link

Failure to download parameters upon startup #10749

Closed TorbjornHouge closed 1 year ago

TorbjornHouge commented 1 year ago

Expected Behavior

When starting up the UAV and connecting, parameters should transfer and the system should initialize and get ready to fly.

Current Behavior

Some times, not everytime and not in predictable circumstanses, parameter transfer seemingly stops. QGC only reports it failed, but looking in the log file from the AP, it list multiple errors of type "[mavlink] unknown parameter ID:". After multiple restarts, it suddenly starts functioning correct.

Steps to Reproduce:

Not sure how to ensure reproduction.

System Information

When posting bug reports, include the following information

Detailed Description

I am experiencing that the connection process with downloading parameters is highly inreliable. More often than not, it fails downloading parameters and I have to restart QGC or force a refresh multiple times before it succeeds (seems random to me). It happens both using UDP and TCP, possibly more often on UDP. However, TCP is not desirable once we start flying further away and get communication glitches. I tried Mission Planner which did not have any issues connecting and downloading parameters using UDP, which leads me to suspect QGC, but there may also be something else entirely. Connecting using wired Ethernet, the error happens less frequent, but it still happens. Connecting using RFD868EU telemetry radios it also occurs sporadically (however, due to the large number of parameters on a VTOL, I try to avoid using this due to its low bandwidth).

The error message is generated (note that this is where the log item is generated, it is not the cause of the error) here: https://github.com/PX4/PX4-Autopilot/blob/fc357921fd69e574a3f596be25faa8f4d9cdcea9/src/modules/mavlink/mavlink_parameters.cpp#L209

Log Files and Screenshots

DronecodeBot commented 1 year ago

This issue has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/qgc-fails-downloading-parameters-upon-startup/32707/4

DonLakeFlyer commented 1 year ago

Since the error is from the firmware side I would start there not with QGC.

TorbjornHouge commented 1 year ago

Since this occurs in QGC, not Mission Planner, I was thinking it may be QGC that has the error and for some reason request parameters that does not exist.

DonLakeFlyer commented 1 year ago

Mission Planner against PX4 Pro firmware won't really download parameters correctly. You need to ask the PX4 firmware folks what that error means. And/or build your own version of the firmware that has better logging in it so you can see for example what ID is being requested and why it is wrong.

DonLakeFlyer commented 1 year ago

Also Mission Planner has infinite retries I believe where QGC does not.

TorbjornHouge commented 1 year ago

Number of retries doesn't seem to be the issue since QGC is stuck for a significantly longer time before it gives up than MP uses to load, but if MP doesn't download all parameters that is ofcourse a difference. I have tried posting in the forum and on Discord with no result so I'll just wait and see if it goes away eventually, can't afford to spend much more time on it right now.

igal-colugo commented 9 months ago

Expected Behavior

When starting up the UAV and connecting, parameters should transfer and the system should initialize and get ready to fly.

Current Behavior

Some times, not everytime and not in predictable circumstanses, parameter transfer seemingly stops. QGC only reports it failed, but looking in the log file from the AP, it list multiple errors of type "[mavlink] unknown parameter ID:". After multiple restarts, it suddenly starts functioning correct.

Steps to Reproduce:

Not sure how to ensure reproduction.

System Information

When posting bug reports, include the following information

  • Operating System: Windows 10, Windows 11
  • QGC Version: 4.2.6, 4.2.3 (not tested any more versions)
  • QGC build: stable
  • Flight Controller: Pixhawk Orange Cube
  • Autopilot (with version): PX4 1.13.3 stable
  • Datalink: Ubiquiti Rocket high bandwidth datalink, connection distance < 10 m direct line-of-sight.
  • Mavlink Router v2 on onboard computer

Detailed Description

I am experiencing that the connection process with downloading parameters is highly inreliable. More often than not, it fails downloading parameters and I have to restart QGC or force a refresh multiple times before it succeeds (seems random to me). It happens both using UDP and TCP, possibly more often on UDP. However, TCP is not desirable once we start flying further away and get communication glitches. I tried Mission Planner which did not have any issues connecting and downloading parameters using UDP, which leads me to suspect QGC, but there may also be something else entirely. Connecting using wired Ethernet, the error happens less frequent, but it still happens. Connecting using RFD868EU telemetry radios it also occurs sporadically (however, due to the large number of parameters on a VTOL, I try to avoid using this due to its low bandwidth).

The error message is generated (note that this is where the log item is generated, it is not the cause of the error) here: https://github.com/PX4/PX4-Autopilot/blob/fc357921fd69e574a3f596be25faa8f4d9cdcea9/src/modules/mavlink/mavlink_parameters.cpp#L209

Log Files and Screenshots

i have the same issue with the same px4 version with QGC on ubuntu 20.04

DonLakeFlyer commented 9 months ago

This usually indicates a really noisy comms connection. A difference between MP and QGC is that MP will retry infinite times on parameter download, whereas QGC will only retry each parameter 3 times. The reason for this is if the connection is so bad you can download parameters after retrying 3 different times, that you probably shouldn't be flying with that connection either.

DonLakeFlyer commented 9 months ago

You should be able to verify you don't have a basic parameter download problem by trying to repro using a USB connection. If that works 100% of the time you have a comms problem.

TorbjornHouge commented 9 months ago

It's a long time since I last worked on this, and sort of gave up since we were only using it for testing. I concluded it looked like it was related to the serial port on the Pixhawk somehow. I didn't get the problem using USB, but it was present when using an FTDI USB to UART adapter directly plugged into the pixhawk Serial1 port. That seems to exclude a com link issue, as well as a Mavlink Router issue in my mind. But it doesn't make any sense whatsoever that it is not a universal problem, so I still am not convinced I have found the root of it.

DonLakeFlyer commented 9 months ago

but it was present when using an FTDI USB to UART adapter directly plugged into the pixhawk Serial1 port.

I have found similar problems when using an FTDI USB thingy to connect a companion computer to a Pixhawk. Lots of lost packets. I eventually had to move away from it since it was so crappy. So no surprise there.

If you go to the Mavlink Page of Application Settings you can see packet loss statistics. If you are not seeing any packet loss there but parameters don't download then it could still possibly be a QGC problem.