Skip to content

initialize a plugin before getting subscriptions - #1714

Open
standmit wants to merge 1 commit into
mavlink:masterfrom
standmit:init_before_subscript
Open

initialize a plugin before getting subscriptions#1714
standmit wants to merge 1 commit into
mavlink:masterfrom
standmit:init_before_subscript

Conversation

@standmit

Copy link
Copy Markdown

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

@vooon vooon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like that approach. It's not portable to ROS2, as there you can't really expect parameter to be set on init stage.

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

@standmit

Copy link
Copy Markdown
Author

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.

@vooon

vooon commented Feb 18, 2022

Copy link
Copy Markdown
Member

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?

@standmit

standmit commented Feb 18, 2022

Copy link
Copy Markdown
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants