简体   繁体   English

在 c++ 中通过 tcp 发送 pcl 点云

[英]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.

相关问题 如何确定 C++ 代码中的 PCL(点云库)版本? - How to determine PCL (Point Cloud Library) version in C++ code? C ++中的点云库(PCL)等待/延迟/睡眠功能 - Point Cloud Library (PCL) wait/delay/sleep function in C++ 如何从 std::vector 创建 pcl::PointIndices<int> 在 c++ 中使用 `pcl`(点云库)?</int> - How to create pcl::PointIndices from std::vector<int> with `pcl`(Point Cloud Library) in c++? 我可以在 C++ 中使用 PCL 将无组织的点云数据转换为有组织的点云数据吗? - Can I convert unorganized point cloud data to organized point cloud data using PCL in C++? C++ 点云库 PCL。 尝试添加两点 - C++ Point Cloud Library PCL. Try to add two points VSCode C++ IntelliSense 工作正常,除了 PCL(点云库) - VSCode C++ IntelliSense works fine except for PCL (Point Cloud Library) 如何在保持其顺序的同时对点云进行下采样? (PCL C++) - How to downsample a point cloud while maintaining its order? (PCL C++) c ++ pcl_ros:如何使用最新的100条消息生成点云 - c++ pcl_ros: How to generate point cloud with latest 100 messages 检测导入点云是否出错,并在不关闭应用PCL和C++的情况下显示提示信息 - Detect if there is an error when importing a point cloud and display alert message without closing application PCL and C++ 如何在 C/C++ 中通过 TCP 发送.mp4 文件? - How to send .mp4 file over TCP in C/C++?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM