Lidar sensor cannot be used from urdf file

Hello, I am trying to display a model using a urdf file. I was able to display the model, but the lidar sensing data is not displayed. I have confirmed that libgazebo_ros_ray_sensor.so is in /opt/ros/humble/lib. Please tell me how to solve this.

urdf file

<gazebo reference="lidar_link">
        <sensor name="gazebo_lidar" type="ray">
            <always_on>true</always_on>
            <visualize>true</visualize>
            <update_rate>60</update_rate>
            <plugin filename="libgazebo_ros_ray_sensor.so" name="gazebo_lidar">
                <ros>
                    <remapping>~/out:=scan</remapping>
                </ros>
                <output_type>sensor_msgs/LaserScan</output_type>
                <frame_name>lidar_link</frame_name>
            </plugin>
            <ray>
                <scan>
                    <horizontal>
                        <samples>360</samples>
                        <resolution>1.000000</resolution>
                        <min_angle>0.000000</min_angle>
                        <max_angle>3.140000</max_angle>
                    </horizontal>
                </scan>
                <range>
                    <min>0.150</min>
                    <max>6.0</max>
                    <resolution>0.015</resolution>
                </range>
                <noise>
                    <type>gaussian</type>
                    <mean>0.0</mean>
                    <stddev>0.01</stddev>
                </noise>
            </ray>
        </sensor>
        <material>Gazebo/DarkGrey</material>
    </gazebo>

launch file

    # set gazebo resource path
    gz_sim_resource_path_candidates = [os.path.join("/opt/ros/humble", "share"),
                                      ":" + 
                                    os.path.join(urdf_defalut_path)]

    set_gz_sim_resource_path_env = SetEnvironmentVariable(
        "GZ_SIM_RESOURCE_PATH",
        gz_sim_resource_path_candidates,
    )

    # start gazebo
    gazebo_share_path = get_package_share_directory("ros_gz_sim")

    gazebo_launch = IncludeLaunchDescription(
        launch_description_source=PathJoinSubstitution(
            [gazebo_share_path, "launch", "gz_sim.launch.py"]
        ),
        launch_arguments={
            "gz_args": [
                "-r ",
                PathJoinSubstitution([package_dir, "worlds", world]),
            ]
        }.items(),
    )

    ros_gz_bridge_node = Node(
        package="ros_gz_bridge",
        executable="parameter_bridge",
        parameters=[
            {
                "config_file": PathJoinSubstitution(
                    [
                        package_dir,
                        "config",
                        "ros_gz_bridge.yaml",
                    ]
                ),
            }
        ],
        output="screen",
    )

    gazebo_model_spawner_node = Node(
        package="ros_gz_sim",
        executable="create",
        name="gazebo_robot_model_spawner",
        output="screen",
        arguments=[
            "-name", model_name,
            "-topic", "/robot_description",
        ],
    )

Error message
Library [/opt/ros/humble/lib/libgazebo_ros_ray_sensor.so] does not export any plugins. The symbol [IgnitionPluginHook] is missing, or it is not externally visible.

Hello,

Thanks for posting on Gazebo Community. However, this type of question is best asked on https://robotics.stackexchange.com/. When creating the question, please make sure to include the gazebo tag and describe your problem in detail.

1 Like