rclcpp icon indicating copy to clipboard operation
rclcpp copied to clipboard

Add start-parameter-event-subcriber option

Open mauropasse opened this issue 5 years ago • 6 comments

In the efforts of reducing CPU usage for embedded platforms, this PR is created to give the option to start or not the parameter event subscriber.

Benchmarks on RPi1 (single core running at 700Mhz) shows that CPU is reduced about 2% when this parameter event subscriber is not created.

Given that currently we have the option to NOT start the parameter event publisher, makes sense to have also the option to not start the parameter event subscriber.

@alsora @dgoel

mauropasse avatar Mar 24 '20 13:03 mauropasse

Hello! Any updates on this?

mauropasse avatar Apr 28 '20 09:04 mauropasse

@wjwwood @hidmic for more feedback.

@mauropasse I think this will have to wait post-Foxy release.

ivanpauno avatar Apr 28 '20 13:04 ivanpauno

If we would have a "on parameter changed" callback, that could be used instead of a subscription (and it will be much cheaper).

My first reaction is to agree with @ivanpauno. That'd boost performance without introducing subtle issues with overall functionality.

I can understand that on resource constrained platforms one may want to drop unnecessary features (unnecessary for a given application), but I'm not convinced that's something you'd do in runtime.

hidmic avatar May 04 '20 12:05 hidmic

@mauropasse

Benchmarks on RPi1 (single core running at 700Mhz) shows that CPU is reduced about 2% when this parameter event subscriber is not created.

just out of curiosity, only not creating subscription for parameter events lead this? I think cpu consumption for parameter event subscription depends on parameter activity.

fujitatomoya avatar May 11 '20 08:05 fujitatomoya

@fujitatomoya I didn't do too much CPU profiling to get the exact reason, but my guess is that when IPC is used the subscription is implemented as a waitable, and the current StaticSingleThreadExecutor checks it's predicate at every iteration (IsReady?) Originally I did this to have a clean debug about the general system, setting ros params off, the subscription was still on and being checked.

mauropasse avatar May 11 '20 10:05 mauropasse

If use_sim_time is modified locally, it will be ignored.

Maybe https://github.com/ros2/rclcpp/pull/1947 solves this issue, in which case I think adding this option will be fine.

ivanpauno avatar Jun 16 '22 13:06 ivanpauno