1
$\begingroup$

Can someone explain to me the difference between the rclcpp::Qos class and the rclcpp::rmw_qos_profile_t class?

To me, it seems that the first is just an encapsulation of the latter. And if, so, why do some constructors (see rclcpp::Publisher) use rclcpp::Qos and some other (see rclcpp::message_filter::Subscriber) use rclcpp::rmw_qos_profile_t?

$\endgroup$

1 Answer 1

2
$\begingroup$

The rclcpp::QoS class was introduced here. As the main reason is mentioned: 'Adds an rclcpp version of QoS, which requires the history depth to be specified if using "keep last"'.

why do some constructors use rclcpp::Qos and some other use rclcpp::rmw_qos_profile_t

A quick look through the rclcpp PR's reveals e.g.:

  • This one, introducing rclcpp::QoS for create_client and
  • This one for create_service.

Note that these PR's are a lot more recent than the initial PR introducing rclcpp::QoS.

So I think the reason some constructors still take a rmw_qos_profile_t is probably just because nobody had the time to change those yet.

Side note on the question:

My best-practice to find this kind of knowledge is to:

  • Go to the code in Github,
  • Find a relevant line (e.g. a class definition or a specific method),
  • Click on the line number,
  • Choose 'View git blame' and
  • Read through the pull requests that influenced that part of the code.

This generally leads to design info and discussions about design choices.

Final remark: rmw_qos_profile_t is not part of rclcpp but of rmw. It is defined here.

$\endgroup$
1
  • $\begingroup$ Thank you very much! I often get stuck on little details like this and your tips will definitely help me in the future :) $\endgroup$ Commented Oct 26, 2023 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.