How to render raw Lidar scan data to PointCloud2?
I am very new to ROS. I am running ROS in MacOS with the ROS (version 1.5) inside the conda environment. I have tried reading raw data from lidar with hex code output via the serial port using Python (version 3.9). Later, I tried publishing parsed data from lidar to PointCloud2.data with this format:
[convertedhex1,convertedhex2,convertedhex3....convertedhexN]
*generated with looping and reading each 2 hex to integer data with PointCloud2.fields:
name:"x",offset:0,count:1,datatype:7
name:"y",offset:1,count:1,datatype:7
name:"z",offset:2,count:1,datatype:7
Assuming every offset in iteration reading XYZ points.
The PointCloud2 data is not rendering in RViz with the same topic and frame id, but the "messages received" field is incrementing. Rendering the scan to LaserScan is successful, but drawing using circles is looking like this.
I am using solid-state Lidar CygLidar D1 with 120° horizontal FOV and 65° vertical FOV (not rotating Lidar). I think LaserScan is showing wrong, or I parsed error data? Based on the user Manual with a 3D response sample, the data show like on the screenshot with LaserScan.
Is PointCloud2.data support a 3-dimensional array? Or can someone maybe help me? I am literally stuck here.