RP lidar data plotting

22 views (last 30 days)
Kavish Ram
Kavish Ram on 26 Sep 2020
Commented: Kavish Ram on 8 Oct 2020
I'm currently working on a project where I want to plot a 3d diagram (sort of like terrain mapping) with the data obtain by Rp lidar.
I am able to get x,y,z axis in .csv format but I am not sure how I can display these values accurately so that it represents a terrain map.
I have tried scatter2, mesh and pcshow but those graphs have not been accurate and just shows me noise.
Any help will be highly apperciated.
Thank you.
Kavish Ram
Kavish Ram on 6 Oct 2020
The equation used was found in a question/answer blog site. After doing mulitple reserach, I wasn't able to work out the equation which displays what I am after. Please to let me know if you have further insite as to which equation will be most suitable in this case.
The Distance X is the distance measured by the lidar (mm) and the Angle X is the angle value which the distance was measured in (Same for angle y and z). I know it seems a little bit confusing, but that is what the lidar is outputting. The values are given to me by the lidar software, which i have just transfered to the csv. format. No equations were used during this process.
Currently the rp lidar rotates 360 degrees to obtain the data angle and distance in 2d. By using an external stepper motor, and rotating the lidar, I am trying to aquire the y values. By rotating both external stepper motors, I am also trying to aquire Z axis. So that i can get data values which makes a 3d plot or Point cloud.
I am still in the learning stages of my project, so still trying to work out equations and the best way to get 3d out of a 2d lidar.

Sign in to comment.

Accepted Answer

Amrtanshu Raj
Amrtanshu Raj on 6 Oct 2020
The problem is not in the plotting/visualisation part. We advise implementing the equations first to get proper values and then look into the visualisation part. If the values are recorded correct, then pcshow will be enough to visualise the plot.
My advice to get the desired values will be first to understand how a Lidar works and then try to record the Lidar range and theta (given by the lidar sensor) along with the time step. Then rotate the Lidar using the stepper along Y-axis( you should not need the Z stepper as the entire 3D area will be swept) and also record the angles(phi) along with the timestamp. Then you can try to sync both the set of readings(range and theta from RPLidar and phi from the stepper) with the help of the timestamp.
Then you can use sph2cart(theta will be the azimuth and phi will be elevation) to get the xyz values for each Lidar reading, after that use the PointCloud to store them as a point cloud. The use the pcshow function to get the desired Visualisation.
  1 Comment
Kavish Ram
Kavish Ram on 8 Oct 2020
Thank you so much for that advice, appreciate it. I have noticed a few mistakes in the equation and will be looking further into that and try and work out a new equation.
Question. If I take out the Z stepper, how will I be able to obtain the Z axis values than? Will this be obtained by an equation? As pcshow and scatter3 require all xyz to display.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!