[英]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.我是 c++ 数据序列化的新手,我搜索了示例,但并没有真正成功。 My goal is to be able to send and receive a pcl point cloud over tcp in c++.
我的目标是能够在 c++ 中的 tcp 上发送和接收 pcl 点云。 I am familiar with ROS, but now I cannot use it in the server.
我对ROS很熟悉,但现在我不能在服务器上使用它。 I have to send point cloud through ethernet to a client machine, where I am free to use ROS.
我必须通过以太网将点云发送到客户端机器,在那里我可以自由使用 ROS。
I tried Python with ZeroMQ configured to send the point cloud in numpy array.我尝试了 Python,ZeroMQ 配置为在 numpy 阵列中发送点云。 The message contained a json markdown with the array shape and then another message contained the array.
该消息包含带有数组形状的 json markdown,然后另一条消息包含该数组。 If i am correct, in c++ I should serialize my
pcl::PointCloud<pcl::PointXYZ> cloud
object to be able to send it somehow.如果我是正确的,在 c++ 我应该序列化我的
pcl::PointCloud<pcl::PointXYZ> cloud
object 以便能够以某种方式发送它。 In case of c++ I cannot find it possible to send array shape as markdown.在 c++ 的情况下,我找不到将数组形状发送为 markdown 的可能性。 Is it possible in c++ to send this cloud object similar as in zmq?
在 c++ 中是否可以像在 zmq 中一样发送此云object? 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.更新:在 cpp 中,我从相机读取点云到
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.我的目标是通过 tcp以某种方式发送这些数据,并能够最好在 cpp 中重建为类似的点云 object。
C++ does not provide a standard method to serialize and deserialize data. C++ 不提供序列化和反序列化数据的标准方法。
You can implement this yourself for simple cases.对于简单的情况,您可以自己实现。
For more complex cases you can use a library, such as protocol buffers or Boost serialization .对于更复杂的情况,您可以使用库,例如协议缓冲区或Boost 序列化。
You can also use a text-based format "on the wire", such as XML or JSON.您还可以“在线”使用基于文本的格式,例如 XML 或 JSON。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.