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

It should not matter too much, because the RCLCPP logging macros (which replace the ROS_INFO calls from ROS 1) are implemented by using rcutils. See for instance RCLCPP_DEBUG:

  do { \
    static_assert( \
      ::std::is_same<typename std::remove_cv<typename std::remove_reference<decltype(logger)>::type>::type, \
      typename ::rclcpp::Logger>::value, \
      "First argument to logging macros must be an rclcpp::Logger"); \
 \
    RCUTILS_LOG_DEBUG_NAMED( \
      logger.get_name(), \
      rclcpp::get_c_string(RCLCPP_FIRST_ARG(__VA_ARGS__, "")), \
        RCLCPP_ALL_BUT_FIRST_ARGS(__VA_ARGS__,"")); \
  } while (0)

So decoding this, it basically just calls RCUTILS_LOG_DEBUG_NAMED, with a little bit of extra overhead to get the name of the logger you are using, which is negligible, and some magic to ensure the first argument is a C string that also should be very cheap, and some static type checks at the beginning that only affect compilation time.

So I'd just continue using the RCLCPP macros if you're working in C++, unless your profiling shows you have a bottleneck here :)

NB the snippet above is from Foxy, but for Dashing it is not different in a way that affects your question.