fsstudio-team / ZeroSimROSUnity

Robotic simulation in Unity with ROS integration.
https://roboticsimulationservices.com/
MIT License
171 stars 21 forks source link

3D lidar orientation issue #31

Open manikjslb opened 1 year ago

manikjslb commented 1 year ago

I have been trying to import a 2D and 3D lidar to turtlebot3_waffle using the provided sample turtlebot scene tutorial.

What I am trying to do is that, if I translate and rotate the turtlebot, then the 3D pointcloud as well as 2D scan data should also translate and rotate similar amount to that of robot base_foorprint.

I am successful in doing so for 2D lidar however, when I import the 3D lidar in scene; then depending upon selected parent transform id the 3D pointcloud ONLY either rotates or translates.

I have attached some screenshots of Unity editor to show you 3D Lidar's different configuration, screenshot of tf tree and screenshots of foxglove where I am visualizing the data.

P.S. Observe how 2D scan (white) and 3D pointcloud (green) is aligned or misaligned. If what I am trying to achieve is successful then the 2D scan and 3D pointcloud would never be misaligned no matter however I move the robot.

TF Tree

test 1 - parent transform id = base_footprint

observe how after applying pure rotation along vertical axis, the 2D and 3D points are misaligned.

Unity Settings Initial Pose after applying only rotation to base

in this test if I apply only translation then the 2D and 3D pointclouds remains aligned.

test 2 - parent transform id = odom

observe how after applying pure translation along x axis, the 2D and 3D points are misaligned.

Unity Settings Initial Pose after applying only translation to base

in this test if I apply only rotattion then the 2D and 3D pointclouds remains aligned.

Can someone help me find any bug in my understanding or help me find a solution?

micahpearlman commented 1 year ago

Thank you for reporting the issue, apologies we will not be able to look into it immediately until probably January.

manikjslb commented 1 year ago

@micahpearlman thanks you for response. could you guess where the problem might be coming from? I can try to solve the bug, can you suggest me a start point?

I am wondering if we need to change something in OTransformHits to account for rotation?

also it looks like the developer of ZOLIDAR3D.cs identified a potential bug at line 141. Could this be same bug that I am talking about?