Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The trick I needed was to instantiate the clock outside of the macro call like this:

rclcpp::Clock clock;
RCLCPP_DEBUG_THROTTLE(node_->get_logger(), clock, 1, "EIPInterface::receiveLoop - Average Loop Time: %f (FPS: %.2f)", avg_period, 1 / avg_period);

The reason is that the macro just replaces [&clock] with the string you place in for the clock. So in my case after the preprocessor processes the logging macro it was generating code like this:

[&rclcpp::Clock()]

Which is invalid C++ syntax.