c++tcppoint-cloud-librarypoint-clouds

send pcl point cloud over tcp in c++


I am new to data serialization in c++, I searched for examples but I was not really successful. My goal is to be able to send and receive a pcl point cloud over tcp in c++. I am familiar with ROS, but now I cannot use it in the server. I have to send point cloud through ethernet to a client machine, where I am free to use ROS.

I tried Python with ZeroMQ configured to send the point cloud in numpy array. The message contained a json markdown with the array shape and then another message contained the array. If i am correct, in c++ I should serialize my pcl::PointCloud<pcl::PointXYZ> cloud object to be able to send it somehow. In case of c++ I cannot find it possible to send array shape as markdown. Is it possible in c++ to send this cloud object similar as in zmq? Or is there a more handy approach to this problem?

update: In cpp, I read the point cloud from camera, into pcl::PointCloud<pcl::PointXYZ> object. My goal is to send somehow this data through tcp and be able to reconstruct into a similar point cloud object preferably in cpp.


Solution

  • C++ does not provide a standard method to serialize and deserialize data.

    You can implement this yourself for simple cases.

    For more complex cases you can use a library, such as protocol buffers or Boost serialization.

    You can also use a text-based format "on the wire", such as XML or JSON.