ensenso/ros_driver

ROS2: High CPU load of python scripts

Closed this issue · 10 comments

Getting the following error:
[ERROR] [ensenso_camera_node-10]: process has died [pid 17673, exit code -9
when running the ensenso_camera_node with a virtual camera and virtual objects. It crashes after around ~300-350 seconds.

Is looks like it is a memory problem. The memory of the ensenso_camera_node always increases until it crashes with the error code. The virtual camera also disappears from NxView after the crash, and I have to restart machine to get it back.

Investigating further I see that I have another node running of type image_stream in the ensenso_camera package. This node's CPU usage increases (up to 100 % 😲 ) as the nodes run.

Any ideas what might cause this @benthie? I believe it has to do with the requested data from the image_stream node...

I will have a look at it.

  • Are you using ROS1 or ROS2?
  • Are you using the virtual camera directly or as a file camera?

Let me summarize what you are doing: you have an ensenso_camera_node running and besides that only the image_stream script?

I will have a look at it.

* Are you using ROS1 or ROS2?

ROS2

* Are you using the virtual camera directly or as a file camera?

Virtual camera directly

Let me summarize what you are doing: you have an ensenso_camera_node running and besides that only the image_stream script?

Yes, I start them both from a launch file. I also have some other nodes running TF, robot state publishers, but I do not think they cause any problems here.

Thank you for the details. I will get back to you if I have found something .

Which Ensenso SDK version do you use?

Which Ensenso SDK version do you use?

3.3.1417

I think I found a solution for the high CPU load of the python scripts. The fix is to use a MultiThreadedExecutor in combination with a ReentrantCallbackGroup. I am currently testing it on my machine and it looks good with regard to the CPU usage. For the memory leak I created a separate issue. I will keep you posted as soon as I have a working fix that also passes all tests.

FYI, the fixes for both this issue and #107 are part of the currently released v2.1.0.