Gazebo | Ignition | Community
Ask Your Question
0

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

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

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

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-05-04 06:15:54 -0600

Torben gravatar image

have you tried moving the plugin out of the sensors xacro files in to the Robot xacro files for me this is working fine. Cleaner and future proof would be to call the plugin from the world file like https://github.com/gazebosim/gz-sim/b... but I'm also currently strugeling on this step but as long as you have only one robot in the simulation this will work.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2022-05-04 13:42:53 -0600

Seen: 378 times

Last updated: May 04 '23