Requesting the same mavlink messages at different rates over one serial port

I have a companion computer (raspberry pi) connected to a flight controller through a serial connection. I’m using mavlink router to make this serial connection accessible to a python script running on the companion computer, as well as a ground station that’s connected to the same wifi network as the companion computer by using the following command:

mavlink-routerd -e 192.168.0.135:14550 -e 127.0.0.1:14540 /dev/serial0:921600

I would like to have the python script receive attitude messages at a rate of 50 Hz, and the ground station receive attitude messages at a lower rate (4 Hz) to save wifi bandwidth. I get the feeling this is not possible to do using only one serial connection, but wanted to check.

Currently, if I run only the python script, it successfully receives the attitude message at 50 Hz. Once I connect the ground station, it requests the same message at 4 Hz, and both the ground station and the python script then receive attitude messages at 4 Hz.

Is there any way to route the same message at different rates using only one serial port? Thanks.

You will need to disable the GCS override of the message rates. In Mission Planner (for example), go to Config → Planner and set all the Telemetry Rates to -1.

EDIT:
I didn’t see that you wanted different rates on the GCS and the Pi. MAVLink-router doesn’t filter messages down to different rates. You’d need to make your own script between MAVLink-router and the GCS to filter down the messages to 4Hz.

1 Like

Or use two different serial ports.

1 Like

If you are not able to change request rate on ground station just connect it first and then start your script. Probably you won’t see any issues at higher rates on your ground station. I think that stream rates are defined per serial port.

1 Like

thanks everyone for the replies. I have a handful of messages that the python script needs at a high rate… if those messages don’t swamp the wifi connection to the ground station, I’ll just have both the python script and the ground station get the messages at the same rate… otherwise I’ll use two serial connections.

1 Like