Adjust the frequency of mavlink topics (System_status/Heartbeat)

Hello!
I am trying to build a custom state machine around PX4 for my project. The goal is to remote control the drone using the offboard mode and to reliably control autopilot functions, detect errors and i.e. abort missions in case of errors.

The state machine is being built in ROS2 and utilizes Mavlink and Mavros for communication with the FC. It eventually is supposed to run on an onboard Raspberry Pi, for now I use a SITL setup.
To reliably mirror the state of my drone I have been using the state and mode-signals from the Mavlink Heartbeat message as Signals for my Statemachine.

The problem I am facing now is, that the low Frequency of the Heartbeat of 1Hz, is not sufficent to keep my statemachine updated in near Real-Time.
How can I adjust this rate ? Are there perhaps alternative Solutions ?
Thanks in advance!

Hi. You can adjust mavlink stream rates from console like this :

mavlink stream -r 50 -s BATTERY_STATUS_DEMO -u 14556

you canfind more info about this from here

By the way, when you reboot this effect will disappears. If you want to adjust the rate permanently you should add this command to rcs script. And it will run automatically beginning of each boot.

1 Like

I missed that. Thanks for your help!