high CPU usage when using ros_ign_bridge

asked 2022-05-05 19:11:04 -0500

raefsel gravatar image

I am looking into using gazebo ignition on a new ROS2 project and am building up an example that is a basic differential drive robot with a lidar on top. The lidar is putting out a laserscan message with only 100 samples. Because this is a ROS2 project, I need to get that data over to my (currently non-existent) ROS2 nodes so I am using ros_ign_bridge to transfer the data. This seems to work fine with cmd_vel messages coming from ROS2 but the lidarscan messages are causing my computer to go nuts with all 16 cores using about 80% of their available CPU cycles if I have a bridge for that topic.

Here is how I am setting up the node in my launch file:

Node(
        package='ros_ign_bridge',
        executable='parameter_bridge',
        arguments=['/lidar@sensor_msgs/msg/LaserScan@ignition.msgs.LaserScan']
    )

Here is my 'lidar', which is located within my chassis link. It is basically a copy-paste from something I found on the web:

<sensor name='gpu_lidar' type='gpu_lidar'>"
                <pose relative_to='lidar_frame'>0 0 0 0 0 0</pose>
                <topic>lidar</topic>
                <update_rate>10</update_rate>
                <ray>
                    <scan>
                        <horizontal>
                            <samples>100</samples>
                            <resolution>1</resolution>
                            <min_angle>-1.396263</min_angle>
                            <max_angle>1.396263</max_angle>
                        </horizontal>
                        <vertical>
                            <samples>1</samples>
                            <resolution>0.01</resolution>
                            <min_angle>0</min_angle>
                            <max_angle>0</max_angle>
                        </vertical>
                    </scan>
                    <range>
                        <min>0.08</min>
                        <max>10.0</max>
                        <resolution>0.01</resolution>
                    </range>
                </ray>
                <always_on>1</always_on>
                <visualize>true</visualize>
            </sensor>

If I just comment out the ros_ign_bridge node in my launch file then the CPU usage is maybe 10%. Is there anything that I can do to make it not consume almost everything my computer has to offer?

I'm pretty sure that I am using the Fortress version of ignition. I'm not sure how to check. Gazebo is saying ignition gazebo 6.9.0

edit retag flag offensive close merge delete