Ask Your Question
0

Publish/Get last message when a new subscriber subscribes to a topic

asked 2021-06-09 08:34:52 -0500

BhanuKiran.Chaluvadi gravatar image

updated 2021-06-09 08:42:30 -0500

Hi,

I have few publishers in my system, some of them publish at a pre-defined rate and other publish only when there is a change in their variable value. I was wondering if there is a way, when a new subscriber subscribes after the node has started and the subscriber should receive the last published message.

It's not related to loos of packet. It's just that the subscriber doesn't exists when the publisher published previous message.

Thank you

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-06-09 10:35:20 -0500

(With the preface that I haven't actually implemented this myself yet, so I can't guarantee that it works) it seems like setting the DDS Quality of Service setting of your publisher to transient local might do the trick. More on QoS options here

This tutorial may help with modifying the default QoS for a publisher.

edit flag offensive delete link more

Comments

1

Thanks @shonigmann . I made a quick test and it is working.. But for the benefit of other people landing here: latch is the key word, Here is an example from other ros-answer

BhanuKiran.Chaluvadi gravatar image BhanuKiran.Chaluvadi  ( 2021-06-10 02:41:25 -0500 )edit

Great to hear it worked out, thanks for the update

shonigmann gravatar image shonigmann  ( 2021-06-10 11:15:11 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2021-06-09 08:34:52 -0500

Seen: 25 times

Last updated: Jun 09