0%

.deb 是 Debian、Ubuntu 及其衍生发行版(如 Linux Mint)使用的软件包格式。当无法从官方软件源获取软件时,我们常常需要手动下载并安装 .deb 文件。


方法一:使用 apt 命令

apt 是 Ubuntu 等系统的高级包管理工具。它最大的优点是能够自动处理复杂的依赖关系,是安装本地 .deb 文件的首选方法。

阅读全文 »

在 RViz 里显示已经转换到世界坐标系的点云

假设相机一直向外发送点云(PointCloud2)消息,点云数据是相机坐标系下的。已知相机的外参(即相机坐标系到世界坐标系的变换),想在 RViz 里显示已经转换到世界坐标系的点云。


方案概述

RViz 显示点云时,会根据消息的 header.frame_id 和 TF 树中的坐标变换,把点云变换到 RViz 选定的固定坐标系(通常是 world_frame )下显示。

阅读全文 »

ROS 中使用 sensor_msgs::msg::PointCloud2 传输点云数据。开发中会需要对它和其他类型的点云数据进行转换,大部分由 pcl_conversions 提供。

pcl::PCLPointCloud2

ros msg -> pcl::PCLPointCloud2

1
2
3
4
5
6
7
8
9
10
11
#include <pcl/PCLPointCloud2.h>
#include <sensor_msgs/msg/point_cloud2.hpp>
#include <pcl_conversions/pcl_conversions.h>

pcl::PCLPointCloud2 pcl_pc2;

sensor_msgs::msg::PointCloud2 ros_cloud;
pcl_conversions::toPCL(ros_cloud, pcl_pc2);

sensor_msgs::msg::PointCloud2::SharedPtr pc_msg;
pcl_conversions::toPCL(*pc_msg.get(), pcl_pc2);
阅读全文 »

使用 cmake-format 工具

安装运行

安装

1
pip install cmake-format

运行格式化

1
cmake-format -i CMakeLists.txt

VSCode中安装对应的 cmake-format 插件

1

安装后检查或设置一下 cmake-foramt 的路径

2

使用自定义配置文件

cmake-format 支持自定义配置文件,支持.cmake-format.py.cmake-format.yaml

阅读全文 »

std::enable_ifC++ 中的一种 SFINAE(Substitution Failure Is Not An Error)工具,用于在模板中启用或禁用某些函数或类的特化。它通常用于条件编译,允许我们根据模板参数的某些特性(如类型是否满足某些条件)来选择性地启用或禁用某些代码。

基本语法

阅读全文 »

第一次使用Open3D 0.18.0,发现pcd点云显示有问题

1
2
3
4
5
import open3d as o3d

path = "xxxxxxxxxxxxx.pcd"
pcd = o3d.io.read_point_cloud(path)
o3d.visualization.draw_geometries([pcd])
1
2
3
Jupyter environment detected. Enabling Open3D WebVisualizer.  
[Open3D INFO] WebRTC GUI backend enabled.
[Open3D INFO] WebRTCWindowSystem: HTTP handshake server disabled.

弹出来的窗口一片空白,也没有任何报错
image-1

阅读全文 »

流编辑器 Sed

sed 是一种流编辑器,它是文本处理中非常重要的工具,能够完美的配合正则表达式使用,功能不同凡响。处理时,把当前处理的行存储在临时缓冲区中,称为“模式空间”(pattern space),接着用 sed 命令处理缓冲区中的内容,处理完成后,把缓冲区的内容送往屏幕。接着处理下一行,这样不断重复,直到文件末尾。文件内容并没有 改变,除非你使用重定向存储输出。Sed 主要用来自动编辑一个或多个文件;简化对文件的反复操作;编写转换程序等。

阅读全文 »

PCL 中有两种表示点云的数据结构,分别为 PointCloud<PointT>PCLPointCloud2。官方注释中常称为 a pcl::PointCloud<T> object 以及 a PCLPointCloud2 binary data blob

两者的最大区别是储存数据的方式

  • PointCloud<PointT> 为模板类,其中指定了每个点的数据类型 PointT独立储存每个点的数据。这种存储方式使得数据非常清晰,可以很方便地对某一个点或是某个点的某一字段进行访问,但无法选择存储或删除某一字段。

    1
    2
    3
    4
    5
    6
    template <typename PointT>
    class PointCloud {
    public:
    std::vector<PointT, Eigen::aligned_allocator<PointT>> points;
    ...
    };
  • PCLPointCloud2 则没有指定点的数据类型,而是在 fields 里记录每个点中有哪些字段(比如 rgba , x , normal_x 等),并以 std::uint8_t 将它们按顺序连续存储。这种存储方式理论上更通用,能够存储各种类型的点云数据,而不仅是 PCL中定义好的常见格式;可以灵活地对数据进行直接处理,选择存储或删除某一字段;当然也使得数据变得不太直观。

    1
    2
    3
    4
    5
    6
    struct PCLPointCloud2{
    std::vector<::pcl::PCLPointField> fields;
    uindex_t point_step = 0;
    std::vector<std::uint8_t> data;
    ...
    };
阅读全文 »

在调用 StatisticalOutlierRemoval 时遇到 double free or corruption

我在 PCL 源代码中加入了一些log,具体如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2: [INFO]1712543988.313661216: filter - CropBox
2: --- FilterIndices h - filter indices - start ---
2: --- PCLBase - initCompute - indices size:1228800 ---
2: --- FilterIndices h - call applyFilter(indices)
2: ----- CropBox hpp - applyFilter indices - start -------
2: ----- CropBox hpp - applyFilter indices - finish -------
2: --- FilterIndices h - call deinitCompute()
2: --- PCLBase hpp - deinitCompute ---
2: --- FilterIndices h - filter indices - finish ---

2: [INFO]1712543988.372619178: filter - StatisticalOutlierRemoval
2: --- FilterIndices h - filter indices - start ---
2: --- PCLBase - initCompute - indices size:2568 ---
2: --- FilterIndices h - call applyFilter(indices)
2: --- StatisticalOutlierRemoval h - applyFilter indices ---
2: ----- StatisticalOutlierRemoval hpp - applyFilterIndices - start -------
2: ----- StatisticalOutlierRemoval hpp - applyFilterIndices - finish -------
2: --- FilterIndices h - call deinitCompute()
2: double free or corruption (out)
阅读全文 »