subscribing and publishing
I have an application where 2 nodes are talking to each other over a certain topic, based on where the nodes are at in the program flow they either don't care about the topic or they do. My question is something that the tutorials didn't help with, is there a command that can check a topic on demand? or check a specific piece of a topic on demand?
elevator_talk.publish(status);
works great for publishing on demand, is there something similar for subscribing?
I am not sure but you may keep the track of subscribed topic by checking out the last time you received the data. For example if it was 10 seconds ago , then you would think that a problem might happen to the publishing node ? or you may use diagnostic_msgs to understand what is happening
yea your comment doesn't really help me. I guess what I'm asking is when a node is listening to a topic how would i have that node extract the most recent data from that topic and use it?
You could just always go to your callback function when you receive a message, which will be the most recent one, and have a class variable you check at the beginning of the callback function to see if you should do anything with that data. Elsewhere in your code you can set the class variable.