Problems when using lidar and camera on the same robot on Ignition

asked 2022-05-04 13:42:53 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hi, I am trying to create a simple two-wheeled robot in Ignition using a xacro description file. I intend to spawn this robot with a lidar and a camera sensor and for both of each I use the plugin named "ignition::gazebo::systems::Sensors". The sensors are added to the robot xacro via macros, which contain the following snipets of code:

<gazebo reference="cam_front">
        <sensor name='${name}' type='camera'>
            <pose>${body_dim_x/2} 0 ${body_dim_z/2} 0 0 0</pose>
            <visualize>true</visualize>
            <update_rate>5</update_rate>
            <topic>${name}/camera_image</topic>
            <camera>
                <!-- <horizontal_fov>1.047</horizontal_fov> -->
                <image>
                    <!-- <width>320</width>
                    <height>240</height> -->
                    <width>640</width>
                    <height>420</height>
                    <!-- <format>B8G8R8</format> -->
                </image>
                <!-- <clip>
                    <near>0.1</near>
                    <far>100</far>
                </clip> -->
            </camera>


            <plugin filename="libignition-gazebo-camera-video-recorder-system.so" name="ignition::gazebo::systems::CameraVideoRecorder">
            </plugin>
        </sensor>
    </gazebo>

<gazebo reference="base_lidar">
        <sensor name="${name}" type='gpu_lidar'>
            <pose>0 0 ${body_height*0.6} 0 0 0</pose>
            <!-- <pose>0 0 1.0 0 0 0</pose> -->
            <topic>${name}/lidar</topic>
            <update_rate>10</update_rate>
            <ray>
                <scan>
                    <horizontal>
                        <!-- <samples>90</samples> -->
                        <samples>10</samples>
                        <resolution>1</resolution>
                        <min_angle>${-radians(20)}</min_angle>
                        <max_angle>${radians(20)}</max_angle>
                    </horizontal>
                    <vertical>
                        <samples>10</samples>
                        <resolution>1</resolution>
                        <min_angle>${-radians(10)}</min_angle>
                        <max_angle>${radians(10)}</max_angle>
                    </vertical>
                </scan>
                <range>
                    <!-- <min>0.08</min> -->
                    <min>0.1</min>
                    <max>2.0</max>
                    <resolution>0.01</resolution>
                </range>
            </ray>
            <always_on>1</always_on>
            <visualize>true</visualize>

            <plugin filename="libignition-gazebo-sensors-system.so" name="ignition::gazebo::systems::Sensors">
                <render_engine>ogre</render_engine>
            </plugin>
        </sensor>
    </gazebo>

When I try to spawn the robot with each sensor separately, they work correctly, as it can be seen in the image below.

image description

However when both of the sensors are included in the xacro, the simulator crashes and displays the following error:

image description

Could someone help me find what is causing this issue?

Gratefully, Lucas

edit retag flag offensive close merge delete