PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
7.91k stars 13.25k forks source link

Packet drop while using mavlink forwarding in px4 mavlink module #14287

Open myeabhishek opened 4 years ago

myeabhishek commented 4 years ago

Hello Team,

I am using Mavlink forwarding to route mavlink messages between Telem1 and Telem 2 ports. I have observed on sending high-frequency data on telem1 i.e. 400 bytes/second, I am getting about 10% packet drop on telem2. This increases linearly with increase in frequency of data. There is no other interference in the system. I am able to receive 100 percent of the data on other hardwares. This is not a communication/RF link issue.

I can see that there are alot of parameters in PX4 controlling the message buffer size and data rate. How can I tune these parameters to get best results for my application?

Following are my settings in RCS script: Telem 1: MAVLINK_F "-r 1200 -f -b 57600 Telem 2: mavlink start -d ${MAVLINK_COMPANION_DEVICE} -b 57600 -m onboard -r 5000 -x -f

julianoes commented 4 years ago

Can you provide the output of mavlink status for the ok and no-ok case?

myeabhishek commented 4 years ago

Hi,

I have attached the output of mavlink status command for both cases. Thank you for your assistance.

Okay Case:

okay_case

Not Okay Case:

not_okay_case

julianoes commented 4 years ago

I was expecting to see a rate mult of 1 for the working case and a number smaller than 1 for the not ok case. Instead the rate mult seems the same for both cases. However, the ping statistics seem bogus but that might not matter.

Have you tried choosing a higher -r rate for the companion side? Basically, the rate mult is < 1 if the asked rates of all the messages is too much compared to the available rate (-r).

myeabhishek commented 4 years ago

Yes, I increased the -r for companion link to 10000. The packet loss increased from 10 % to 45 %.

Is serial baud rate related to these configurations? I have set 57600 for both ports.

myeabhishek commented 4 years ago

Following is the screenshot for mavlink status. I increased the baud rate for telem2 to 921600 with 10000 as my -r value.

My packet loss has decreased from 45% in last attempt to 15% and rate multiplier is also set to 1 now.

inreased_telem2_baudrate_and_data_rate

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

Jackiemesser commented 3 years ago

Hey, did you ever find a solution to your problem? I'm having a similar issue

USS-ICI commented 9 months ago

Code on my embedded computer works for Ardupilot, but drops packets continually with PX4 Firmware, did ya'll find a fix?

julianoes commented 9 months ago

Fix coming #21074