ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Publisher Subscriber Overview gives a good explanation on this:

When you create a publisher

ros::Publisher advertise(const std::string& topic, uint32_t queue_size, bool latch = false);

The queue_size there is the publisher/outgoing message queue (B) .. If you are publishing faster than roscpp can send the messages over the wire, roscpp will start dropping OLD messages.

When you create a subscriber

ros::Subscriber subscribe(const std::string& topic, uint32_t queue_size, <callback, which may involve multiple arguments>, const ros::TransportHints& transport_hints = ros::TransportHints());

The queue_size there is the incoming message/subscriber queue (C) size roscpp will use for your callback. If messages are arriving too fast and you are unable to keep up, roscpp will start throwing away OLD messages.

------------.

I believe that everything is FIFO. When queue is full, the oldest message will be thrown away.

------------.

From reading "publish() behavior and queueing" from the link that I put. What I understand is :

  • publish() is asynchronous.
  • When you publish, messages are pushed into a queue (A) for later processing. This queue is immediately pushed into the outgoing/publisher queue (B) . PS: If no one subscribes to the topic, the end is here.
  • When a subscriber subscribes to that topic. Messages will be sent/pushed from the corresponding outgoing/publisher queue (B) to the incoming/subscriber queue (C).--> this is done by internal thread
  • When you spin/ callback, the messages handled are from the incoming/subscriber queue (C).

Publisher Subscriber Overview gives a good explanation on this:

When you create a publisher

ros::Publisher advertise(const std::string& topic, uint32_t queue_size, bool latch = false);

The queue_size there is the publisher/outgoing message queue (B) .. If you are publishing faster than roscpp can send the messages over the wire, roscpp will start dropping OLD messages.

When you create a subscriber

ros::Subscriber subscribe(const std::string& topic, uint32_t queue_size, <callback, which may involve multiple arguments>, const ros::TransportHints& transport_hints = ros::TransportHints());

The queue_size there is the incoming message/subscriber queue (C) size roscpp will use for your callback. If messages are arriving too fast and you are unable to keep up, roscpp will start throwing away OLD messages.

------------.

I believe that everything is FIFO. When queue is full, the oldest message will be thrown away.

------------.

From reading "publish() behavior and queueing" from the link that I put. What I understand is :

  • publish() is asynchronous.
  • When you publish, messages are pushed into a queue (A) for later processing. This queue is immediately pushed into the outgoing/publisher queue (B) . PS: If no one subscribes to the topic, the end is here.
  • When a subscriber subscribes to that topic. Messages will be sent/pushed from the corresponding outgoing/publisher queue (B) to the incoming/subscriber queue (C).--> this is done by internal thread
  • When you spin/ callback, the messages handled are from the incoming/subscriber queue (C).

-----------.

That is what I know, feel free to give any correction/ addition.

Publisher Subscriber Overview gives a good explanation on this:

When you create a publisher

ros::Publisher advertise(const std::string& topic, uint32_t queue_size, bool latch = false);

The queue_size there is the publisher/outgoing message queue (B) .. If you are publishing faster than roscpp can send the messages over the wire, roscpp will start dropping OLD messages.

When you create a subscriber

ros::Subscriber subscribe(const std::string& topic, uint32_t queue_size, <callback, which may involve multiple arguments>, const ros::TransportHints& transport_hints = ros::TransportHints());

The queue_size there is the incoming message/subscriber queue (C) size roscpp will use for your callback. If messages are arriving too fast and you are unable to keep up, up (e.g. you do not spin/ the rate of spin is slow ), roscpp will start throwing away OLD messages.

------------.

I believe that everything is FIFO. When queue is full, the oldest message will be thrown away.

------------.

From reading "publish() behavior and queueing" from the link that I put. What I understand is :

  • publish() is asynchronous.
  • When you publish, messages are pushed into a queue (A) for later processing. This queue is immediately pushed into the outgoing/publisher queue (B) . PS: If no one subscribes to the topic, the end is here.
  • When a subscriber subscribes to that topic. Messages will be sent/pushed from the corresponding outgoing/publisher queue (B) to the incoming/subscriber queue (C).--> this is done by internal thread
  • When you spin/ callback, the messages handled are from the incoming/subscriber queue (C).

-----------.

That is what I know, feel free to give any correction/ addition.