Repository: ros/ros_comm

Issue:
Mismatch between ROS wiki and code for ROS_[INFO/...]_..._THROTTLE C++ macros
The wiki entry (http://wiki.ros.org/roscpp/Overview/Logging) for the various THROTTLE rosconsole C++ macros does not match the code itself. The wiki states (correctly) that you provide a period, however the macros themselves use "rate".
```C++
...
#define ROS_INFO_THROTTLE(rate, ...) ROS_LOG_THROTTLE(rate, ::ros::console::levels::Info, ROSCONSOLE_DEFAULT_NAME, __VA_ARGS__)
#define ROS_INFO_STREAM_THROTTLE(rate, args) ROS_LOG_STREAM_THROTTLE(rate, ::ros::console::levels::Info, ROSCONSOLE_DEFAULT_NAME, args)
#define ROS_INFO_THROTTLE_NAMED(rate, name, ...) ROS_LOG_THROTTLE(rate, ::ros::console::levels::Info, std::string(ROSCONSOLE_NAME_PREFIX) + "." + name, __VA_ARGS__)
...
```
This has the potential for confusion if one uses the macro definition as a way of looking up what the macros do instead of going to the wiki.

This is obviously a low priority issue but if someone happens to be working in the area anyway, this could be cleaned up at the same time.


Discussion:

Resolving patch:
diff --git a/tools/rosconsole/scripts/generate_macros.py b/tools/rosconsole/scripts/generate_macros.py
--- a/tools/rosconsole/scripts/generate_macros.py
+++ b/tools/rosconsole/scripts/generate_macros.py
@@ -49,14 +49,14 @@ def add_macro(f, caps_name, enum_name):
     f.write('#define ROS_%s_STREAM_ONCE(args)\n' %(caps_name))
     f.write('#define ROS_%s_ONCE_NAMED(name, ...)\n' %(caps_name))
     f.write('#define ROS_%s_STREAM_ONCE_NAMED(name, args)\n' %(caps_name))
-    f.write('#define ROS_%s_THROTTLE(rate, ...)\n' %(caps_name))
-    f.write('#define ROS_%s_STREAM_THROTTLE(rate, args)\n' %(caps_name))
-    f.write('#define ROS_%s_THROTTLE_NAMED(rate, name, ...)\n' %(caps_name))
-    f.write('#define ROS_%s_STREAM_THROTTLE_NAMED(rate, name, args)\n' %(caps_name))
-    f.write('#define ROS_%s_DELAYED_THROTTLE(rate, ...)\n' %(caps_name))
-    f.write('#define ROS_%s_STREAM_DELAYED_THROTTLE(rate, args)\n' %(caps_name))
-    f.write('#define ROS_%s_DELAYED_THROTTLE_NAMED(rate, name, ...)\n' %(caps_name))
-    f.write('#define ROS_%s_STREAM_DELAYED_THROTTLE_NAMED(rate, name, args)\n' %(caps_name))
+    f.write('#define ROS_%s_THROTTLE(period, ...)\n' %(caps_name))
+    f.write('#define ROS_%s_STREAM_THROTTLE(period, args)\n' %(caps_name))
+    f.write('#define ROS_%s_THROTTLE_NAMED(period, name, ...)\n' %(caps_name))
+    f.write('#define ROS_%s_STREAM_THROTTLE_NAMED(period, name, args)\n' %(caps_name))
+    f.write('#define ROS_%s_DELAYED_THROTTLE(period, ...)\n' %(caps_name))
+    f.write('#define ROS_%s_STREAM_DELAYED_THROTTLE(period, args)\n' %(caps_name))
+    f.write('#define ROS_%s_DELAYED_THROTTLE_NAMED(period, name, ...)\n' %(caps_name))
+    f.write('#define ROS_%s_STREAM_DELAYED_THROTTLE_NAMED(period, name, args)\n' %(caps_name))
 
     f.write('#define ROS_%s_FILTER(filter, ...)\n' %(caps_name))
     f.write('#define ROS_%s_STREAM_FILTER(filter, args)\n' %(caps_name))
@@ -77,15 +77,15 @@ def add_macro(f, caps_name, enum_name):
     f.write('#define ROS_%s_ONCE_NAMED(name, ...) ROS_LOG_ONCE(::ros::console::levels::%s, std::string(ROSCONSOLE_NAME_PREFIX) + "." + name, __VA_ARGS__)\n' %(caps_name, enum_name))
     f.write('#define ROS_%s_STREAM_ONCE_NAMED(name, args) ROS_LOG_STREAM_ONCE(::ros::console::levels::%s, std::string(ROSCONSOLE_NAME_PREFIX) + "." + name, args)\n' %(caps_name, enum_name))
 
-    f.write('#define ROS_%s_THROTTLE(rate, ...) ROS_LOG_THROTTLE(rate, ::ros::console::levels::%s, ROSCONSOLE_DEFAULT_NAME, __VA_ARGS__)\n' %(caps_name, enum_name))
-    f.write('#define ROS_%s_STREAM_THROTTLE(rate, args) ROS_LOG_STREAM_THROTTLE(rate, ::ros::console::levels::%s, ROSCONSOLE_DEFAULT_NAME, args)\n' %(caps_name, enum_name))
-    f.write('#define ROS_%s_THROTTLE_NAMED(rate, name, ...) ROS_LOG_THROTTLE(rate, ::ros::console::levels::%s, std::string(ROSCONSOLE_NAME_PREFIX) + "." + name, __VA_ARGS__)\n' %(caps_name, enum_name))
-    f.write('#define ROS_%s_STREAM_THROTTLE_NAMED(rate, name, args) ROS_LOG_STREAM_THROTTLE(rate, ::ros::console::levels::%s, std::string(ROSCONSOLE_NAME_PREFIX) + "." + name, args)\n' %(caps_name, enum_name))
+    f.write('#define ROS_%s_THROTTLE(period, ...) ROS_LOG_THROTTLE(period, ::ros::console::levels::%s, ROSCONSOLE_DEFAULT_NAME, __VA_ARGS__)\n' %(caps_name, enum_name))
+    f.write('#define ROS_%s_STREAM_THROTTLE(period, args) ROS_LOG_STREAM_THROTTLE(period, ::ros::console::levels::%s, ROSCONSOLE_DEFAULT_NAME, args)\n' %(caps_name, enum_name))
+    f.write('#define ROS_%s_THROTTLE_NAMED(period, name, ...) ROS_LOG_THROTTLE(period, ::ros::console::levels::%s, std::string(ROSCONSOLE_NAME_PREFIX) + "." + name, __VA_ARGS__)\n' %(caps_name, enum_name))
+    f.write('#define ROS_%s_STREAM_THROTTLE_NAMED(period, name, args) ROS_LOG_STREAM_THROTTLE(period, ::ros::console::levels::%s, std::string(ROSCONSOLE_NAME_PREFIX) + "." + name, args)\n' %(caps_name, enum_name))
 
-    f.write('#define ROS_%s_DELAYED_THROTTLE(rate, ...) ROS_LOG_DELAYED_THROTTLE(rate, ::ros::console::levels::%s, ROSCONSOLE_DEFAULT_NAME, __VA_ARGS__)\n' %(caps_name, enum_name))
-    f.write('#define ROS_%s_STREAM_DELAYED_THROTTLE(rate, args) ROS_LOG_STREAM_DELAYED_THROTTLE(rate, ::ros::console::levels::%s, ROSCONSOLE_DEFAULT_NAME, args)\n' %(caps_name, enum_name))
-    f.write('#define ROS_%s_DELAYED_THROTTLE_NAMED(rate, name, ...) ROS_LOG_DELAYED_THROTTLE(rate, ::ros::console::levels::%s, std::string(ROSCONSOLE_NAME_PREFIX) + "." + name, __VA_ARGS__)\n' %(caps_name, enum_name))
-    f.write('#define ROS_%s_STREAM_DELAYED_THROTTLE_NAMED(rate, name, args) ROS_LOG_STREAM_DELAYED_THROTTLE(rate, ::ros::console::levels::%s, std::string(ROSCONSOLE_NAME_PREFIX) + "." + name, args)\n' %(caps_name, enum_name))
+    f.write('#define ROS_%s_DELAYED_THROTTLE(period, ...) ROS_LOG_DELAYED_THROTTLE(period, ::ros::console::levels::%s, ROSCONSOLE_DEFAULT_NAME, __VA_ARGS__)\n' %(caps_name, enum_name))
+    f.write('#define ROS_%s_STREAM_DELAYED_THROTTLE(period, args) ROS_LOG_STREAM_DELAYED_THROTTLE(period, ::ros::console::levels::%s, ROSCONSOLE_DEFAULT_NAME, args)\n' %(caps_name, enum_name))
+    f.write('#define ROS_%s_DELAYED_THROTTLE_NAMED(period, name, ...) ROS_LOG_DELAYED_THROTTLE(period, ::ros::console::levels::%s, std::string(ROSCONSOLE_NAME_PREFIX) + "." + name, __VA_ARGS__)\n' %(caps_name, enum_name))
+    f.write('#define ROS_%s_STREAM_DELAYED_THROTTLE_NAMED(period, name, args) ROS_LOG_STREAM_DELAYED_THROTTLE(period, ::ros::console::levels::%s, std::string(ROSCONSOLE_NAME_PREFIX) + "." + name, args)\n' %(caps_name, enum_name))
 
     f.write('#define ROS_%s_FILTER(filter, ...) ROS_LOG_FILTER(filter, ::ros::console::levels::%s, ROSCONSOLE_DEFAULT_NAME, __VA_ARGS__)\n' %(caps_name, enum_name))
     f.write('#define ROS_%s_STREAM_FILTER(filter, args) ROS_LOG_STREAM_FILTER(filter, ::ros::console::levels::%s, ROSCONSOLE_DEFAULT_NAME, args)\n' %(caps_name, enum_name))


Test patch: