Requesting stream rates using mavros + QGC, SRx_ params, etc

I’m confused about the best way to enable message streams while using mavros + QGC.

In my typical autonomous use case, ROS nodes act as the backseat (offboard) pilot connected through mavros. Upon launch a ROS node calls /mavros/set_stream_rate to set several stream rates to 20Hz to get the appropriate telemetry. This works fine.

Often I also launch QGC for manual control before and/or after ROS-driven missions. QGC is talking to mavros via UDP. As soon as QGC starts up it also sends stream rate requests. With the default settings it reduces my telemetry to 1Hz. In the UI I can choose 10Hz or 50Hz for the streams I need – so I settled on 50Hz. This works when I set it in the UI, but when I quit and re-launched QGC I found that it is somehow still requesting the older stream rates. The workaround seems to be to change the stream rates in the UI from 50Hz to something else, then change them back to 50Hz. Is this is a known bug in QGC, or some misunderstanding on my part?

I see that I can use SRx_ parameters to control the ArduPilot stream rates, but the comment in Requesting Data From The Autopilot — Dev documentation seems to suggest that this is a bad idea: “This is not the recommended method because the ground station has no way to determine what “x” should be.” I suppose I can set SRx_ parameters for all values of x to cover my bases. What is the recommended method?

Thanks.

See Lowering Telemetry Datarates in ArduPilot

And use set message interval

Ah, /mavros/set_message_interval is much better than /mavros/set_stream_rate, thanks for the info @amilcarlucas

It looks like QGC is still hammering the stream rates, undoing whatever I set from mavros. Is there a way to tell QGC to leave the stream rates / message intervals alone?

Yes, in the qgc mavlink configuration settings

I think I found the problem – I should have mentioned that I’m running ArduSub. I skimmed the QGroundControl code and noticed that ArduSub has some custom code that requests streams at specific rates. qgroundcontrol/ArduSubFirmwarePlugin.cc at master · mavlink/qgroundcontrol · GitHub I’ll raise this on the ArduSub board.

Thanks for your help.