mavros icon indicating copy to clipboard operation
mavros copied to clipboard

initialize a plugin before getting subscriptions

Open standmit opened this issue 2 years ago • 3 comments

After initializing and receiving parameters from a ParameterServer, a custom plugin can decide which subscriptions it needs.

standmit avatar Feb 18 '22 13:02 standmit

I'd prefer just so subscribe to all possible messages and then ignore unneeded ones.

There is no way to subscribe to all messages, isn't there? I mean, in current version you need to know MSG_ID at compile time. But earlier initializing solves this problem.

standmit avatar Feb 18 '22 14:02 standmit

If you don't know msg ID, you won't be able to decode the message. Could you please give overview on what you're trying to get. Maybe i can suggest some other ways?

vooon avatar Feb 18 '22 15:02 vooon

I need to filter messages that MAVROS forwards to GCS. I want to set a message whitelist at startup time. I would like to avoid any extra conversions and transfers between processes. My solution is to make a plugin. It must receive the whitelist of message IDs from a ParameterServer, subscribe to the allowed messages, and forward ones to a GCS using a MAVConnInterface. No decoding needed. Usually, all other plugins receives parameters at initialization step. Unfortunately, the initialization happens after subscription. Yes, I can get the parameters in get_subscriptions method. But a more elegant way is to simply move one small line in the MAVROS code a little up.

standmit avatar Feb 18 '22 17:02 standmit