Gazebo's block laser plugin not printing out to a scan topic when gpu rays are used

asked 2021-06-15 03:35:36 -0500

kedus42 gravatar image

I am trying to get a point cloud from gazebo's block laser plugin but I also have to use gpu rays since I need the rays to be able to pass through "glass". I cannot remove the collision tags of the glass for my application. Removing the visual tag is fine so I have done this and attempted to switch to gpu rays. The gpu rays appear in gazebo but they do not output to a topic. I have also tried the non-block gpu laser plugin (libgazebo_ros_gpu_laser.so) but this flattens out all the detected points as a scan on two dimensions.

Here is the gpu plugin excerpt from the robot's urdf:

<sensor name="block_lidar" type="gpu_ray">
    <visualize>true</visualize>
    <pose>0.0 0.0 0.0 0.0 0.0 0.0</pose>
    <ray>
        <scan>
            <horizontal>
                <samples>30</samples>
                <resolution>1</resolution>
                <min_angle>-0.614356</min_angle>
                <max_angle>0.614356</max_angle>
            </horizontal>
            <vertical>
                <samples>30</samples>
                <resolution>1</resolution>
                <min_angle>-0.614356</min_angle>
                <max_angle>0.614356</max_angle>
            </vertical>
        </scan>
        <range>
            <min>0.05</min>
            <max>90.0</max>
        </range>
    </ray>
    <plugin name="lidar_plugin" filename="libgazebo_ros_gpu_block_laser.so">
        <gaussianNoise>0.00</gaussianNoise>
        <alwaysOn>true</alwaysOn>
        <updateRate>20</updateRate>
        <topicName>/daedalus/laser_scan_${prefix}</topicName>
        <frameName>anchor_${prefix}</frameName>
    </plugin>
    <always_on>true</always_on>
    <update_rate>10.0</update_rate>
  </sensor>

And here is the non-block plugin excerpt:

<sensor type="gpu_ray" name="hokuyo">
        <pose>0 0 0 0 0 1</pose>
        <visualize>true</visualize>
        <update_rate>10</update_rate>
        <ray>
            <scan>
                <horizontal>
                    <samples>30</samples>
                    <resolution>1</resolution>
                    <min_angle>-0.614356</min_angle>
                    <max_angle>0.614356</max_angle>
                </horizontal>
                <vertical>
                    <samples>30</samples>
                    <resolution>1</resolution>
                    <min_angle>-0.614356</min_angle>
                    <max_angle>0.614356</max_angle>
                </vertical>
            </scan>
            <range>
                <min>0.05</min>
                <max>90.0</max>
                <resolution>0.01</resolution>
            </range>
            <noise>
                <type>gaussian</type>
                <mean>0.0</mean>
                <stddev>0.01</stddev>
            </noise>
        </ray>
        <plugin name="gazebo_laser" filename="libgazebo_ros_gpu_laser.so">
            <topicName>/daedalus/laser/scan_${prefix}</topicName>
            <frameName>anchor_${prefix}</frameName>
        </plugin>
      </sensor>

I am using ros noetic, gazebo 11.3.0 running on Ubuntu 20.04 and my graphics card is an Nvidia Geforce 940mx with driver version 450.119.03. I would really appreciate any advice on how to get the gpu block laser printing to it's topic or how to get the expected 3D laser scan from the non-block laser plugin.

edit retag flag offensive close merge delete

Comments

Hi there, have you found the solution for this problem?

DangTran gravatar image DangTran  ( 2022-02-26 18:51:02 -0500 )edit

Hi, sorry I haven't logged in in a while.

No, I never managed to solve this. In the end I used a 2D laser and mounted it on a continuous joint, aggregating the scans after every full rotation. Similar enough to the results from a 3D scanner for my purposes.

kedus42 gravatar image kedus42  ( 2022-04-05 17:18:20 -0500 )edit

can u tell me how you did that? i am beginner and am trying to do the same thing virtually.

cskbala gravatar image cskbala  ( 2022-06-27 09:59:39 -0500 )edit

@cskbala I believe that both libgazebo_ros_gpu_laser and libgazebo_ros_laser.so only capture 2D scan information (although you can adjust <vertical> and <horizontal> tag), not 3D point cloud. You can capture 2D scans and store them in a stack while rotating the sensor, but this approach can be complex and not suitable for real-time application. I ended up using velodyne_gazebo_plugins instead for point cloud topic.

DangTran gravatar image DangTran  ( 2022-06-27 17:49:48 -0500 )edit

@cskbala I used the laser assembler package here: laser_assembler pkg. After every period of rotating the 2D lasers, I would call the assemble_scans service which would respond with a 3D point cloud aggregation of all 2D laser scans in that duration. @DangTran is right though, this approach is definitely not suitable for real-time applications.

kedus42 gravatar image kedus42  ( 2022-06-28 02:36:26 -0500 )edit