ros-navigation / navigation2

ROS 2 Navigation Framework and System
https://nav2.org/
Other
2.6k stars 1.3k forks source link

Nav2 modules reach 100% usage of the CPU #4086

Closed jesusramondovale closed 9 months ago

jesusramondovale commented 9 months ago

Bug report

Required Info:

Expected behavior

I'm using a SBC Debix Model A with an quad-core ARM Cortex-A53 processor : NXP i.MX 8M Plus (2.3TOPS NPU) (aarch64) and using htop I can see that all 4 cores reach a 100% usage only by launching the nav2 modules with

IncludeLaunchDescription(
            PythonLaunchDescriptionSource([os.path.join(
            get_package_share_directory('nav2_bringup'), 'launch'),'/bringup_launch.py']),
            launch_arguments={'map': map_file_path,
                              'autostart': 'True'}.items()

        ),

image

What's the "component_container_isolated" process and why is it taking more than 1 core? What's the "accounts-daemon" process and why starts to use so much CPU when I launch Nav2?

Actual behavior

Navigation works but when I increase the maximum speed values (it's a basic 2-wheeled differential robot) it starts going very bad

SteveMacenski commented 9 months ago

Nav2 is not a single threaded application. I'd have to review the stack, but I think its ~10-20 threads, depending on what you have running. 120% of a core seems about right and inline with our published metrics. Frankly, its amazing we only use 1.2 of those weak, low power ARM cores to run all of autonomous navigation!

That is not "only" running Nav2, I see some accounts daemon, microros, rosbridge themselves summing up to 1.6 cores (more than Nav2!). The other lidar/base drivers/teleop nodes also add up, but seem more or less inline with what I'd think (though, 8% for a teleop/odom publisher node seems excessive - what are these, python?)

This is not a safe configuration. You're thrashing the CPU and memory, I would not attempt to operate a robot under these compute conditions unless it was a small toy robot that if it had problems in an R&D lab would be no big deal. You need more compute.

jesusramondovale commented 9 months ago

Thank you for your quick response! It's true that I must remove a lot of garbage apart from Nav2, but.. could you tell me how can I launch the nav2_bringup in "release mode" or something that doesn't make the component container run in log-level info? I'm so lost over here sorry

SteveMacenski commented 9 months ago

I don't understand what you mean or what behavior you're trying to remove.

jesusramondovale commented 9 months ago

I'd like to know how would you try to reduce at maximum the CPU usage (talking only about Nav2 modules)

My only goal is to navigate on the ground with a 2-wheeled differential robot at speeds about 1m/s