当前位置:网站首页>R2LIVE代码学习记录(3):对雷达特征提取
R2LIVE代码学习记录(3):对雷达特征提取
2022-07-27 05:36:00 【代码多少钱一两】
main读取配置参数声明订阅、发布话题
int main(int argc, char **argv)
{
ros::init(argc, argv, "feature_ext");
ros::NodeHandle n;
// 从launch读取配置参数
n.param<double>("feature_extraction/blind", blind, 0.01); // 距离最小值,用于剔除重复点,当当前点与后一个点距离的平方小于该阈值,则剔除
n.param<double>("feature_extraction/inf_bound", inf_bound, 10); // 无穷值阈值,超出该阈值则认为是无穷值
n.param<int>("feature_extraction/N_SCANS", N_SCANS, 1); // 扫描线数
n.param<int>("feature_extraction/group_size", group_size, 8); // 激光点云特征提取中,用于确实是否分组,点数大于该阈值则分组
n.param<double>("feature_extraction/disA", disA, 0.01); // 平面点判断算法中,用于增大点计算过程中的搜索范围,相乘的系数
n.param<double>("feature_extraction/disB", disB, 0.1); // 平面点判断算法中,用于增大点计算过程中的搜索范围,相加的稀疏
n.param<double>("feature_extraction/p2l_ratio", p2l_ratio, 400); // 用于判断是否为平面点的阈值,如果小于该阈值,则该点是待判断点
n.param<double>("feature_extraction/limit_maxmid", limit_maxmid, 9); // 检测平面点中的阈值
n.param<double>("feature_extraction/limit_midmin", limit_midmin, 16); // 检测平面点中的阈值
n.param<double>("feature_extraction/limit_maxmin", limit_maxmin, 3.24); // 检测平面点中的阈值
n.param<double>("feature_extraction/jump_up_limit", jump_up_limit, 175.0); // 角度上限
n.param<double>("feature_extraction/jump_down_limit", jump_down_limit, 5.0); // 角度下限
n.param<double>("feature_extraction/cos160", cos160, 160.0);
n.param<double>("feature_extraction/edgea", edgea, 3); // 有跨越的边判断算法中,距离阈值,相乘的系数
n.param<double>("feature_extraction/edgeb", edgeb, 0.05); // 有跨越的边判断算法中,距离阈值,相加的稀疏
n.param<double>("feature_extraction/smallp_intersect", smallp_intersect, 170.0);
n.param<double>("feature_extraction/smallp_ratio", smallp_ratio, 1.2);
n.param<int>("feature_extraction/point_filter_num", point_filter_num, 4);
n.param<int>("feature_extraction/point_step", g_point_step, 3);
n.param<int>("feature_extraction/using_raw_point", g_if_using_raw_point, 1);
jump_up_limit = cos(jump_up_limit / 180 * M_PI);
jump_down_limit = cos(jump_down_limit / 180 * M_PI);
cos160 = cos(cos160 / 180 * M_PI);
smallp_intersect = cos(smallp_intersect / 180 * M_PI);
ros::Subscriber sub_points = n.subscribe("/velodyne_points", 1000, velo16_handler, ros::TransportHints().tcpNoDelay());
pub_full = n.advertise<sensor_msgs::PointCloud2>("/laser_cloud", 100); // 所有激光点云
pub_surf = n.advertise<sensor_msgs::PointCloud2>("/laser_cloud_flat", 100); // 平坦的平面点
pub_corn = n.advertise<sensor_msgs::PointCloud2>("/laser_cloud_sharp", 100); // 锐利的边缘点
ros::spin();
return 0;
}
回调函数:
int orders[16] = {
0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 15};
void velo16_handler(const sensor_msgs::PointCloud2::ConstPtr &msg)
{
pcl::PointCloud<PointType> pl_orig;
pcl::fromROSMsg(*msg, pl_orig);
uint plsize = pl_orig.size();
vector<pcl::PointCloud<PointType>> pl_buff(N_SCANS);
vector<vector<orgtype>> typess(N_SCANS);
pcl::PointCloud<PointType> pl_corn, pl_surf, pl_full;
int scanID;
int last_stat = -1;
int idx = 0;
for (int i = 0; i < N_SCANS; i++)
{
pl_buff[i].resize(plsize);
typess[i].resize(plsize);
}
for (uint i = 0; i < plsize; i++)
{
PointType &ap = pl_orig[i];
double leng = sqrt(ap.x * ap.x + ap.y * ap.y);
if (leng < blind)
{
continue;
}
double ang = atan(ap.z / leng) * rad2deg;
scanID = int((ang + 15) / 2 + 0.5);
if (scanID >= N_SCANS || scanID < 0)
{
continue;
}
if (orders[scanID] <= last_stat)
{
idx++;
}
pl_buff[scanID][idx].x = ap.x;
pl_buff[scanID][idx].y = ap.y;
pl_buff[scanID][idx].z = ap.z;
pl_buff[scanID][idx].intensity = ap.intensity;
typess[scanID][idx].range = leng;
last_stat = orders[scanID];
}
idx++;
for (int j = 0; j < N_SCANS; j++)
{
pcl::PointCloud<PointType> &pl = pl_buff[j];
vector<orgtype> &types = typess[j];
pl.erase(pl.begin() + idx, pl.end());
types.erase(types.begin() + idx, types.end());
plsize = idx - 1;
for (uint i = 0; i < plsize; i++)
{
vx = pl[i].x - pl[i + 1].x;
vy = pl[i].y - pl[i + 1].y;
vz = pl[i].z - pl[i + 1].z;
types[i].dista = vx * vx + vy * vy + vz * vz;
}
types[plsize].range = sqrt(pl[plsize].x * pl[plsize].x + pl[plsize].y * pl[plsize].y);
give_feature(pl, types, pl_corn, pl_surf);
}
pub_func(pl_orig, pub_full, msg->header.stamp);
pub_func(pl_surf, pub_surf, msg->header.stamp);
pub_func(pl_corn, pub_corn, msg->header.stamp);
}
边栏推荐
- 客户案例 | 聚焦流程体验,助银行企业APP迭代
- Sunflower teaches you how to prevent denial of service attacks?
- Details of cross entropy loss function in pytorch
- Linux Installation and uninstallation of MySQL
- 工控用Web组态软件比组态软件更高效
- Ftx.us launched stock and ETF trading services to make trading more transparent
- Record of pychart running jupyter notebook in virtual environment
- PNA修饰多肽ARMS-PNA|PNA-DNA|suc-AAPF-pNA|Suc-(Ala)3-pNA
- Pymysql query result conversion JSON
- After adding a camera (camera) to the UAV in gazebo, the UAV cannot take off
猜你喜欢

Multimodal database | star ring technology multimode database argodb "one database for multiple purposes", building a high-performance Lake warehouse integrated platform

Add virtual network card and configure OP route in win10

如何删除或替换EasyPlayer流媒体播放器的loading样式?

Derivative, partial derivative and gradient

事件捕获方式和冒泡方式—它们的区别是什么?

Redis operation of Linux Installation

Many of the world's top 500 enterprises gathered at the second digital Expo, and the digital industry curtain is about to open!

关于卡尔曼滤波的协方差如何影响deepsort的跟踪效果的考虑

DNA(脱氧核糖核酸)供应|碳纳米管载核酸-DNA/RNA材料|DNA/RNA核酸修饰磁性纳米颗粒

CASS11.0.0.4 for AutoCAD2010-2023免狗使用方法
随机推荐
What is special about the rehabilitation orthopedic branch of 3D printing brand?
Reasoning speed of model
MySql数据库
DNA research experiment application | cyclodextrin modified nucleic acid cd-rna/dna | cyclodextrin nucleic acid probe / quantum dot nucleic acid probe
齐岳:巯基修饰寡聚DNA|DNA修饰CdTe/CdS核壳量子点|DNA偶联砷化铟InAs量子点InAs-DNA QDs
ES6 new features (getting started)
Recommended by the world's most technologically competent smart contract security audit company in 2022
关于ES6的新特性
Shell编程的规范和变量
PSI | CSI and ROC | AUC and KS - memorandum
Code random notes_ Hash_ 242 effective letter heterotopic words
Do it yourself container
GoLand writes Go program
How to manage a large number of scheduled tasks
After adding a camera (camera) to the UAV in gazebo, the UAV cannot take off
Tips - completely delete the files on the USB flash drive
聊聊大火的多模态
Brief introduction of chip, memory and its key indicators I
Li Hongyi 2020 deep learning and human language processing dlhlp core resolution-p21
Pymysql query result conversion JSON