Stop default messages on mavlink stream

When starting a mavlink connection, a default set of messages is automatically sent by the autopilot. Is there a mavlink command I can send to stop sending any data on the connection? I’d like to stop all default data coming through, and then request only a specific message such that only that specific message is coming through the connection and nothing else.

Following this example, I tried doing:
master.mav.request_data_stream_send(master.target_system, master.target_component, mavutil.mavlink.MAV_DATA_STREAM_ALL, args.rate, 1)
with args.rate set to 0, but it seems to have no effect.

Not 100% sure but I think you can change it on the stream rate parameters (SR0, SR1, etc.) by setting the relevant groups to 0 Hz.

1 Like

You need to follow @copilot advice and do not connect a ground station on that link, all ground station will change the SR* parameters behind your back, unless you explicitly tell them not to do it.

1 Like

Thank you @copilot and @amilcarlucas .
That makes sense. I’m doing everything in SITL at the moment, so I’m not connected through a serial port but rather a UDP connection. Once I’m working with hardware I will try that out.

Try fiddling that last parameter:

       <message id="66" name="REQUEST_DATA_STREAM">
            <description>THIS INTERFACE IS DEPRECATED. USE 

SET_MESSAGE_INTERVAL INSTEAD.
The target
requested to send the message stream.
The target
requested to send the message stream.
The ID of the
requested data stream
The
requested message rate
1 to start sending,
0 to stop sending.

Also, beware of some other GCS on the same link restarting them :slight_smile:

1 Like

@jeff567 did you manage to stop the MAVLink messages? I am trying to do the same (Rover 4.1.2) as I have an Arduino attached to GPS2 of my Orange Cube and I would rather just poll for info that I need, when I need it.
I believe that GPS2 physical port maps to Serial4 in ArduPilot. I’m getting somewhat un predictable results. Even when I turn all SR4_XXX params to 0, Write it and reboot the Cube, I am still getting this sort of stuff coming out of the port (the mavlink_receive() print statements are all from my Arduino code).

mavlink_receive() - MSG RCVD - magic:254 seq:173 src sysid:1 src compid:1 msgid#:36
mavlink_receive() - MSG RCVD - magic:254 seq:174 src sysid:1 src compid:1 msgid#:65
mavlink_receive() - MSG RCVD - magic:254 seq:175 src sysid:1 src compid:1 msgid#:35
mavlink_receive() - MSG RCVD - magic:254 seq:176 src sysid:1 src compid:1 msgid#:0=HEARTBEAT FlightMode:4 Type:11 Autopilot:3 BaseMode:1 SystemStatus:5 MavlinkVersion:3
mavlink_receive() - MSG RCVD - magic:254 seq:177 src sysid:1 src compid:1 msgid#:36
mavlink_receive() - MSG RCVD - magic:254 seq:178 src sysid:1 src compid:1 msgid#:65
mavlink_receive() - MSG RCVD - magic:254 seq:179 src sysid:1 src compid:1 msgid#:35
mavlink_receive() - MSG RCVD - magic:254 seq:180 src sysid:1 src compid:1 msgid#:22
mavlink_receive() - MSG RCVD - magic:254 seq:120 src sysid:1 src compid:0 msgid#:0=HEARTBEAT FlightMode:0 Type:27 Autopilot:8 BaseMode:4 SystemStatus:4 MavlinkVersion:3
mavlink_receive() - MSG RCVD - magic:254 seq:233 src sysid:255 src compid:190 msgid#:0=HEARTBEAT FlightMode:0 Type:6 Autopilot:8 BaseMode:0 SystemStatus:0 MavlinkVersion:3
mavlink_receive() - MSG RCVD - magic:254 seq:181 src sysid:1 src compid:1 msgid#:36
mavlink_receive() - MSG RCVD - magic:254 seq:182 src sysid:1 src compid:1 msgid#:65
mavlink_receive() - MSG RCVD - magic:254 seq:183 src sysid:1 src compid:1 msgid#:35

I have rebooted/power cycled the Cube, nothing stops it.

I am getting less different types of MAVLink Messages out that port than when I first started messing with it, so some config has been listened too, but these last few msg types persist :frowning:

Just to try something, I even changed SERIAL4_PROTCOL to -1 and then to 3, it still spewed out MAVLink v1!

Any ideas appreciated.

Thanks,
Paul

I am connected with Mission Planner via TELEM1 and a pair of SIK radios.

Mavlink (especially the telemetry part) is not a poll-based protocol but a publish-subscribe-based one.

  1. You have to send your heartbeat. Subscribe to data streams via REQUEST_DATA_STREAM
  2. Mavlink is also a routed protocol between endpoint, and you will get messages sent to a broadcast system or component ID.

See more details here > Requesting Data From The Autopilot — Dev documentation

Ps. from firmware 4.0, you CAN request single messages via the REQUEST_MESSAGE command.

Hi @Eosbandi,
Thanks for responding.

Yes, I see that is often, but not always the case. I have done a fair bit of reading and understand the difference between using MAVLink Multicast Streams vs. Guaranteed Delivery.

So in my use case, I don’t want the Multicast Streams on the MAVLink serial connection between my ArduPilot and my Companion Computer. I just want to poll the AutoPilot via the REQUEST_MESSAGE method (as you mentioned) and just ask for what I need on the odd occasion that I need it

Once I have that working I will then move on to also use the Guaranteed Delivery method with the Mission Protocol micro service over MAVLink to allow my Companion Computer to update the Mission waypoints etc on the AutoPilot.

If it turns out it can’t all be stopped and I have to have some data streaming across the link, then I guess I will have to deal with it, but it would be so much easier if we could stop it and then my code on my Companion Computer could be a lot simpler. I’m using a very capable M4 based Arduino as my companion computer because that is what I am familiar with (and its doing other easy GPIO/sensor stuff) and so far I have got the standard MAVLink libraries running on it (I’m sending/receiving HEARTBEATs amongst other things) but I want to keep it as simple as possible.

Thanks again, any thoughts are most welcome and helpful.

Cheers,
Paul