cyberbotics / webots

Webots Robot Simulator
https://cyberbotics.com
Apache License 2.0
3.28k stars 1.71k forks source link

Wrong Lidar Point Height when Tilt Angle is Non-Zero. #37

Open DavidMansolino opened 5 years ago

DavidMansolino commented 5 years ago

Describe the Bug When the tilt angle of a lidar is not 0, it may happen that the lidar points are 'too high'.

Steps to Reproduce

  1. Can easily be reproduce with the Velodyne HLD64 and a flat ground.
  2. Or with this world: test0.zip

Expected behavior The lidar point should all be at the same height than the floor.

Screenshots lidar

System System: Windows 10 64-bit Processor: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz Number of cores: 4 OpenGL vendor: NVIDIA Corporation (0x10de) OpenGL renderer: GeForce GTX 970/PCIe/SSE2 (0x13c2) OpenGL version: 4.6.0 NVIDIA 416.94

DavidMansolino commented 5 years ago

Without tilt angle: lidar_2

With a title angle of -0.2: lidar_1

DavidMansolino commented 5 years ago

The bug is present only for spherical cameras.

DavidMansolino commented 5 years ago

I found the exact reason, the problem is at the merge_spherical shader level. Indeed because of the spherical deformation, the wrong vertical pixel is selected, in case of lidars we should perform the deformation only horizontally but not vertically.

DavidMansolino commented 5 years ago

Tilting the camera doesn't seem to be a good idea, in case of spherical camera, it is really a mess if the cameras are tilted (sub-cameras border don't coincide anymore). Instead of tilting the sub-cameras, it seems safer to create a bigger field of view and use only the interesting part (so that the orientation of all the sub-cameras is conserved), but this will require some re-factorization.