gz-sim
gz-sim copied to clipboard
Some ranges of lidar sensor return always 0.0
Environment
- OS Version:
- Source or binary build?: Binary, Ignition Fortress (Gazebo 6.8.0)
Description
I am spawning a model (teste_bot) containing a lidar sensor and echoing the lidar topic to check the ranges returned.
- Expected behavior: In the absence of any obstacle in the range of detection of the sensor, it is expected that all ranges return inf. In case of any detection, the range value should be a value between the minimum range and the maximum range.
- Actual behavior: All ranges return inf except the ones corresponding to the last (upper) horizontal layer and to the last ray in each horizontal layer, which return 0.0 invariably. It should be impossible even if any ray collision happened, since the values of ranges returned by the sensor should not be below the minimum range parameter, which is not zero in this case.
Steps to reproduce
- Add a sensor component to the xacro file of any model, using the plugin "ignition::gazebo::systems::Sensors":
<gazebo reference="base_lidar">
<sensor name="${name}" type='gpu_lidar'>
<pose>0 0 ${body_height*0.6} 0 0 0</pose>
<topic>${name}/lidar</topic>
<update_rate>10</update_rate>
<ray>
<scan>
<horizontal>
<samples>5</samples>
<min_angle>${-radians(20)}</min_angle>
<max_angle>${radians(20)}</max_angle>
</horizontal>
<vertical>
<samples>5</samples>
<min_angle>${-radians(10)}</min_angle>
<max_angle>${radians(10)}</max_angle>
</vertical>
</scan>
<range>
<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>
- Build the workspace:
colcon build
- Launch the simulator:
ign gazebo empty.sdf --render-engine ogre
- Spawn the robot:
ign service -s /world/empty/create --reqtype ignition.msgs.EntityFactory --reptype ignition.msgs.Boolean --timeout 300 --req 'sdf_filename: "/home/lucas/ros2_ntu_ws/src/ntu_gazebo/models/teste_bot/urdf/teste_bot.urdf" '
Output
A screenshot of the point cloud of the lidar sensor, which was configured to have 5 samples in the
Could someone help me clarify why is this happening?
Gratefully,
Lucas
I'm having issues trying to reproduce this, here is what I have so far
I created a static robot with a single link and the sensor much like yours (I went ahead and converted the xacro macros in this case):
<?xml version="1.0" ?>
<robot name="vehicle">
<gazebo>
<static>true</static>
</gazebo>
<link name="base_link">
<inertial>
<mass value="1"/>
<inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/>
</inertial>
</link>
<gazebo reference="base_link">
<sensor name="lidar" type='gpu_lidar'>
<pose>0 0 1.0 0 0 0</pose>
<topic>scan</topic>
<update_rate>10</update_rate>
<ray>
<scan>
<horizontal>
<samples>5</samples>
<min_angle>-0.349066</min_angle>
<max_angle>0.349066</max_angle>
</horizontal>
<vertical>
<samples>5</samples>
<min_angle>-0.174533</min_angle>
<max_angle>0.174533</max_angle>
</vertical>
</scan>
<range>
<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>
</robot>
I execute with:
ign gazebo empty.sdf --render-engine ogre
ign service -s /world/empty/create --reqtype ignition.msgs.EntityFactory --reptype ignition.msgs.Boolean --timeout 300 --req 'sdf_filename: "/home/mjcarroll/diff_drive.urdf" '
And I get the resulting screenshot:
All of my ranges are inf
.
The same happens with a basic SDF model.
Can you include more information? Maybe a link to your model so that I can execute exactly what you have? Or a minimally reproducable example so that I can try that?
@lucaslbmp friendly ping.
@lucaslbmp I'm going to close this as I haven't heard back from you. If you have any other problems, feel free to either re-open this issue or open a new issue.
For some reason this doesn't work when I am trying to run it via a ros node. The camera and other sensors work fine but the lidar ends up giving a 0 reading in range, no matter what. On a stand alone gazebo instance it works perfectly well. Any thoughts?