Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I remember some earlier discussion about this, but can't find (or link) it right now.

If I remember correctly, the rationale was that in ROS 1, you never really created subcribers, you already created subscriptions.

This is evidenced by the fact you cannot create any additional subscriptions using a ros::Subscriber instance in ROS 1, which would have made sense. You do that via your ros::NodeHandle.

The only things you can do with a ros::Subscriber are:

  • ask it which topic it's subscribed to
  • ask it how many publishers are publishing to that topic
  • compare it to other ros::Subscriber instances (which then compares the topic it's subscribed to, among other things) and copy it
  • shut it down (ie: unsubscribe)

that all sounds really more like things you'd do with a subscription.

The class' documentation also states this:

Manages an subscription callback on a specific topic.

Which again reinforces the idea that ros::Subscriber was really actually a ros::Subscription all along. The name of the class just didn't reflect that fact, so using the latter as the name of the class in ROS 2 just made more sense.

I remember some earlier discussion about this, but can't find (or link) it right now.

If I remember correctly, the rationale was that in ROS 1, you never really created subcribers, you already created subscriptions.

This is evidenced by the fact you cannot create any additional subscriptions using a ros::Subscriber instance in ROS 1, which would have made sense. You do that via your ros::NodeHandle.

The only things you can do with a ros::Subscriber are:are (from the C++ API):

  • ask it which topic it's subscribed to
  • ask it how many publishers are publishing to that topic
  • compare it to other ros::Subscriber instances (which then compares the topic it's subscribed to, among other things) and copy it
  • shut it down (ie: unsubscribe)

that all sounds really more like things you'd do with a subscription.

The class' documentation also states this:

Manages an subscription callback on a specific topic.

Which again reinforces the idea that ros::Subscriber was really actually a ros::Subscription all along. The name of the class just didn't reflect that fact, so using the latter as the name of the class in ROS 2 just made more sense.