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
  1. yes

  2. for each message someone else publishes on the same topic, the callback is called.

  3. Once you are in the callback function, you are running your code. If you want to skip certain messages, or react to your own code, you can just return from the callback. There is also the possibility to unsubscribe() the subscriber and then the callback will not be called anymore.

  1. yesIn general, yes.

  2. for each message someone else publishes on the same topic, the callback is called.

  3. Once you are in the callback function, you are running your code. If you want to skip certain messages, or react to your own code, you can just return from the callback. There is also the possibility to unsubscribe() the subscriber and then the callback will not be called anymore.

  1. In general, yes.

  2. for each message someone else publishes on the same topic, the callback is called.

  3. Once you are in the callback function, you are running your code. If you want to skip certain messages, or react to your own code, you can just return from the callback. There is also the possibility to unsubscribe() the subscriber and then the callback will not be called anymore.

  4. The answer to this is: use boost::bind.

  5. Usually the callback would be preferred for structure. If you want to handle something in your main loop, you could either set some global variable currentMessage in you handler and use that or pass a reference to the (local) current message using boost::bind that is updated by the handler.

  6. You should read up on shared pointers to understand that meaning. In short: You can pass the pointer around as you like without this taking time, but you don't need to care about memory management.

  1. In general, yes.

  2. for each message someone else publishes on the same topic, the callback is called.

  3. Once you are in the callback function, you are running your code. If you want to skip certain messages, or react to your own code, you can just return from the callback. There is also the possibility to unsubscribe() the subscriber and then the callback will not be called anymore.

  4. The answer to this is: use boost::bind.boost::bind. For your example this probably looks like this (unchecked):

    boost::bind(chatterCallback(_1, boost::ref(i), c));

  5. Usually the callback would be preferred for structure. If you want to handle something in your main loop, you could either set some global variable currentMessage in you handler and use that or pass a reference to the (local) current message using boost::bind that is updated by the handler.

  6. You should read up on shared pointers to understand that meaning. In short: You can pass the pointer around as you like without this taking time, but you don't need to care about memory management.

  1. In general, yes.yes. Regarding 4) technically it is subscribed once and the callback is called as often as new messages arrive.

  2. for each message someone else publishes on the same topic, the callback is called.

  3. Once you are in the callback function, you are running your code. If you want to skip certain messages, or react to your own code, you can just return from the callback. There is also the possibility to unsubscribe() the subscriber and then the callback will not be called anymore.

  4. The answer to this is: use boost::bind. For your example this probably looks like this (unchecked):

    boost::bind(chatterCallback(_1, boost::ref(i), c));

  5. Usually the callback would be preferred for structure. If you want to handle something in your main loop, you could either set some global variable currentMessage in you handler and use that or pass a reference to the (local) current message using boost::bind that is updated by the handler.

  6. You should read up on shared pointers to understand that meaning. In short: You can pass the pointer around as you like without this taking time, but you don't need to care about memory management.

  1. In general, yes. Regarding 4) technically it is subscribed once and the callback is called as often as new messages arrive.

  2. for each message someone else publishes on the same topic, the callback is called.

  3. Once you are in the callback function, you are running your code. If you want to skip certain messages, or react to your own code, you can just return from the callback. There is also the possibility to unsubscribe() the subscriber and then the callback will not be called anymore.

  4. The answer to this is: use boost::bind. For your example this probably looks like this (unchecked):

    boost::bind(chatterCallback(_1, boost::bind(&chatterCallback, _1, boost::ref(i), c));c);

  5. Usually the callback would be preferred for structure. If you want to handle something in your main loop, you could either set some global variable currentMessage in you handler and use that or pass a reference to the (local) current message using boost::bind that is updated by the handler.

  6. You should read up on shared pointers to understand that meaning. In short: You can pass the pointer around as you like without this taking time, but you don't need to care about memory management.