Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High CPU load due to joint state broadcaster #1409

Open
firesurfer opened this issue Dec 5, 2024 · 2 comments
Open

High CPU load due to joint state broadcaster #1409

firesurfer opened this issue Dec 5, 2024 · 2 comments
Labels

Comments

@firesurfer
Copy link
Contributor

Describe the bug

I am currently looking into the issue why our ros2control node is consuming 100% cpu load.
For testing purposes I disabled all loaded controllers one by one. As expected the cpu drops a bit for each controller. But for the joint state broadcaster this was rather extreme. I see a change in cpu load for node of ~15-20%.
This is not the case for other controllers that publish messages at the same rate of 500Hz.

We have a rather large amount of joints in our system: 34.

Expected behavior

I would expect that such a simple controller shouldn't consume that much cpu power.

Environment (please complete the following information):

  • OS: ubuntu 24.04
  • Version Jazzy - 4.16.0

Additional context

When taking a look at the code I would guess at the moment three places that could result in a higher cpu load:

  1. there are rather many operations on the map_interface_to_joint_state_ -> but unordered_map should be fast enough
  2. mutex operation in the RT publisher
  3. Reading the values from the state interfaces -> Not sure if there is any synchronization happening ?
@firesurfer firesurfer added the bug label Dec 5, 2024
@christophfroehlich
Copy link
Contributor

Strange. To narrow that down, I'd comment the different publishers in the update() method and see if the publishers or the state_interface.get_value() is causing this behavior..

@saikishor
Copy link
Member

I highly doubt that it is caused due to the handles. In a synchronous system, mutexes shouldn't do anything. So, as @christophfroehlich suggested try to check with the publishers and see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants