Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You could latch the topic in publisher. For latched topics, last message published is sent to any new subscriber. You create topic as below:

ros::Publisher chatter_pub = n.advertise<std_msgs::String>("topic_name", 1, true);

Third parameter defines if topic should be latched. You can find more info in documentation.