简体   繁体   English

如何将 Gazebo 世界转换为点云?

[英]How to convert a Gazebo world to a point cloud?

I am using the PX4 toolchain to build an autonomous UAV.我正在使用 PX4 工具链来构建自主无人机。 I am using it through the Gazebo simulator, using ROS and MAVROS.我通过 Gazebo 模拟器使用它,使用 ROS 和 MAVROS。 For now, I need to work on path finding algorithms, not sensors, so I would like a "ground truth" map of a Gazebo simulation.现在,我需要研究寻路算法,而不是传感器,所以我想要 Gazebo 模拟的“基本事实”map。 If possible it would be great to be able to use it through the Octomap node of ROS.如果可能的话,能够通过 ROS 的 Octomap 节点使用它会很棒。

All I have been able to do, is to connect a depth camera point cloud to the ROS octomap node, and look at it with RViz, like explained in this tutorial .我所能做的就是将深度相机点云连接到 ROS octomap 节点,并使用 RViz 进行查看,如本教程中所述。 I thought about putting depth camera sensor all around my world, in order to approximate the ground truth world with the octomap representation, but it looks complicated to do and no very efficient.我曾考虑在我的世界各处放置深度相机传感器,以便用八图表示近似地面真实世界,但它看起来很复杂而且效率不高。

So is there a way to generate a point cloud representation of the current Gazebo world simulation, and connect it to an Octomap?那么有没有办法生成当前 Gazebo 世界模拟的点云表示,并将其连接到 Octomap?

Thank you very much for your help: :)非常感谢您的帮助: :)

I am posting my solution since it might happen to someone else.我发布我的解决方案,因为它可能会发生在其他人身上。

In the end, I made a script to convert a Gazebo world to an octomap.bt file.最后,我编写了一个脚本来将 Gazebo 世界转换为 octomap.bt 文件。 It mainly uses this reference .它主要使用这个参考 First, I convert the.world, .sdf and.dae files into a.dae file.首先,我将.world、.sdf 和.dae 文件转换为.dae 文件。 This is done in python script, by parsing the XML of.world and.sdf files and by using the pycollada library to parse.dae files.这是在 python 脚本中完成的,通过解析 XML of.world 和 .sdf 文件并使用 pycollada 库解析.dae 文件。 Then, I use Blender to convert the.dae scene in a.obj.然后,我使用 Blender 将 a.obj 中的 .dae 场景转换。 Then, using the program in the link, I convert the.obj in a voxel representation.binvox, and finally to an octomap.bt file.然后,使用链接中的程序,我将.obj 转换为体素表示.binvox,最后转换为 octomap.bt 文件。

My code: https://github.com/rhidra/autopilot/tree/master/world_to_octomap我的代码: https://github.com/rhidra/autopilot/tree/master/world_to_octomap

My code, especially the python script for.world and.sdf parsing, is very rudimentary.我的代码,尤其是用于.world 和.sdf 解析的python 脚本,非常简陋。 It is probably too simple for a complex problem.对于一个复杂的问题来说,这可能太简单了。

I hope it will help someone !我希望它会帮助别人!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM