ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

How to ROS_*_THROTTLE inside objects?

asked 2015-10-07 13:33:33 -0500

thebyohazard gravatar image

I have a vector of objects of a custom class. In one function of my class, I am trying to include a ROS_*_THROTTLE macro. At some point, I iterate through the vector, calling my function. I would like for the message to get printed once for each object, but instead the message only gets called for the very first object, leading me to believe the throttle isn't based on the message content or the context, but rather the line number or something like that. Am I correct on this?

If so, is there any existing way to throttle messages per object or per message content? I tried using named loggers, too, but still I only get the one message.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-04-20 17:33:16 -0500

nckswt gravatar image

For anyone else trying to find the answer to this in the future: it doesn't appear to be possible, but there's a workaround.

The ROS_LOG_THROTTLE macro statically defines last_hit, so there's only one timer per invocation of that line (regardless of whether you try a ROS_*_THROTTLE_NAMED call as well).

My suggestion would be to manually throttle it using ROS_*_COND instead. It's unsatisfactory, but it seems to be the best solution.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-10-07 13:33:33 -0500

Seen: 316 times

Last updated: Apr 20 '18