Problem with ydlidar and conversion LaserScan -> PointCloud
Hello, i'm new to ROS and i would like to have some help about this.
So i have the ydlidar F4 pro at the moment, i managed to visualize with rviz the laserScan topic etc it works fine.
Now i want to have (x,y,z) points so that my future robot will be able to move past objects and for this I would like to have points.
The thing is that i managed to convert LaserScan to PointCloud and visualize it in rviz (again) but 1/4 of the lidar seems to be not working in my cpp program but on rviz it works fine.
If you can help me i would be very grateful
Edit : link in google drive couldn't attach it here https://drive.google.com/open?id=1P3Z...
Edit 2 : i'm using ydlidat_test_v2.cpp this is the one i have problem with
Edit 3 : log file https://drive.google.com/open?id=1Ye_...
Edit : library https://github.com/YDLIDAR/ydlidar_ros lidar http://www.ydlidar.com/product/F4
https://drive.google.com/open?id=1USF...
Can you be more explicit about what isn't working ? You don't get anything printed ? The calculations are wrong ? You have 1/4 of the data missing ?
Yes so the calcul is wrong like for 1/4 the points given in the cpp are (0,0,0) for the all quarter but the rest is fine, but the rviz visualisation is normal for the topic that is repost (i take scan and change to PointCloud then publish it to cloud)
Can you edit your question to add the code that is producing your ouput ? We can't tell which file you are using (is it ydlidar_test_v2.cpp ?).
The common part between your files is that you print data under the condition that the range is under
0.5
meters, are all your obstacles closer than50 cm
from your lidar ?yes i'm using the v2, i wanted to focus on specific distance so it didn't spam the console
And if you check the data with
rostopic echo /scan
, are there some points at range0.0
?Yes i think there are some in the scan but in the cloud they aren't
Maybe the convert part is wrong i don't know, maybe the lidar as problems but that would be strange because on rviz i have 360°
Can you remove the range condition so that we can see all the laser scan data in your log file please ?
Also, what is your lidar resolution ? It seems odd that your variable
count
returns606
, it's generally360
or720
:Maybe there is an internal conversion that creates an issue here, or your variables are wrong. But then I would be surprised that
scan->ranges[i]
doesn't print an error if index is wrong. Can you also add the value oftime_increment
,scan_time
andangle_increment
in your question please ?