SICKAG / sick_scan_xd

Based on the sick_scan drivers for ROS1, sick_scan_xd merges sick_scan, sick_scan2 and sick_scan_base repositories. The driver supports both Linux (native, ROS1, ROS2) and Windows (native and ROS2).
Apache License 2.0
107 stars 87 forks source link

Continuous point cloud retrieval #185

Closed bazzou-mohammed closed 1 year ago

bazzou-mohammed commented 1 year ago

Hi, Working with the LMS511-10100 scanner, I managed to get the "sick_scan_xd_api_test" tool to work successfully. I was able to retrieve a CSV file containing the data, but I noticed that it only contains data from the first frame, i.e. a single measurement of the scanned object. At the moment, I want to perform continuous acquisitions and I wonder if anyone has an idea for solving this problem. Thank you for your help.

rostest commented 1 year ago

Every time the callback apiTestCartesianPointCloudMsgCallback in "sick_scan_xd_api_test" is executed, you will receive a message with new scan data. You can see this e.g. in your screenshot https://user-images.githubusercontent.com/103991360/249077637-049f184f-93b0-4837-8a11-dc575ab45e26.png : Each message provides a new scan. If you convert each message into csv, you should continously retrieve the scans from your lidar. Remember to append the data, default file operation might be to overwrite.

bazzou-mohammed commented 1 year ago

Hi, you mean I have to put the coordinate printing part here inside : image Thank you for your help.

rostest commented 1 year ago

Hi, you are right. Use callback apiTestCartesianPointCloudMsgCallback to convert and append the scan data to a csv file. You can replace or modify function plotPointcloudToJpeg to plot the scan data to csv instead of jpg.

bazzou-mohammed commented 1 year ago

Hi, good morning; Thank you for your feedback. I have understood and carried what you advised, but unfortunately I can't see any difference. here are the changes made : printPointcloudToCSV.txt here the call to the printPointcloudToCSV function : image Thank you for your help.

rostest commented 1 year ago

Hi,

line 24 opens the csv-file in write modus, i.e. the csv-file will be cleared and overwritten for each call:

FILE* foutCsv = fopen(csvFileNameTmp.c_str(), "w"); // open csv file

Open the csv-file in append mode instead:

FILE* foutCsv = fopen(csvFileNameTmp.c_str(), "a"); // open csv file to append scan data

Alternatively, you can create a csv-file with a different filename for each scan.

bazzou-mohammed commented 1 year ago

Hi, that's great, thank you very much. have a nice day

rostest commented 1 year ago

Thanks, same to you!