首页 > 编程知识 正文

profile超级平台,sla立体光固化成型

时间:2023-05-06 20:16:20 阅读:147756 作者:3432

最近在学习SLAM和ROS,首先接触的是github上的开源项目BLAM,是berkely的一个哥哥写的,有关于油管的视频。 本教程面向的是SLAM和ROS的初学者,如果有问题请指出。

事先贴上github附带的效果图

系统简介BLAM使用PointCloudXYZ类型的点云数据作为输入,视频中使用velodyneVLP16激光雷达作为传感器,逐步绘制整个点云地图。

BLAM系统框架很简单:

Created with Raphal 2.2.0 PCL点云数据处理定位非线性优化环? 调整地图制作地图的yes no代码主要分为以下大部分

- point_cloud_filter:处理输入的点云数据,获得滤波后的点云数据

3358www.Sina.com/:基于gicp算法的3358www.Sina.com/点云数据姿态转换(初始计算) ) ) ) ) ) ) ) ) ) ) ) ) ) )。

- point_cloud_odometry:通过最初计算的姿势变换获得与3358www.Sina.com/对应的地图中的两帧,再次执行GICP以获得正确的姿势变换(例如

- point_cloud_localization:将当前帧的点云数据与历史点云数据进行比较以确定是否发生环回,并发布姿态数据

当前帧:构建点云地图并公开地图数据

BLAM的整个点云数据处理从blam_slam.cc开始

# include ROS/ROS.h # include blam _ slam/blam slam.hint main (int argv,char**argv(ROS3360:init ) argv,argc //专用名称空间定义详情请参阅另一篇博文BlamSlam bs; if (! bs.Initialize(n,false /* online processing */) )调用initialize函数,以调用脱机模式ROS _ error (% s : failedtoinitialion } ros:spin (; return EXIT_SUCCESS; }现在定义了句柄n,执行了初始化函数,请转至BlamSlam:Initialize

boolblamslam :3360 initialize (constros : nodehandlen,bool from_log ) name _=ROS 3: names 336033: Ames filter_.initialize(n ) ) /内部的主要工作是. yaml文件参数ROS _ error (' % s : failedtoinitializepointcloudfilter.',name_ (if (! odometry_.initialize(n ) ) /参数为NodeHandle,表示同一命名空间ROS _ error (' % s : failedtoinitializepointcloudometry.' ) (if (! LOOP_closure_.initialize(n ) ) ROS _ error (' % s : failedtoinitializelaserloopclosure.',name _.c _ str rer (if (! localization_.initialize(n ) ) ROS _ error (' % s : failedtoinitializelocalization.',name_.c_str ) ) 返回假; (if (! mapper_.initialize(n ) ) ROS _ error (' % s : failedtoinitializemapper.',name_ ) u

.c_str()); return false; } if (!LoadParameters(n)) { ROS_ERROR("%s: Failed to load parameters.", name_.c_str()); return false; } if (!RegisterCallbacks(n, from_log)) { ROS_ERROR("%s: Failed to register callbacks.", name_.c_str()); return false; } return true;}

这里各个模块的Initialize()函数主要作用是提取.yaml文件里的参数。不太重要,有兴趣的可以自行看一下
看到最后一个**RegisterCallbacks(n, from_log)**是初始化函数的重点,具体内容是

bool BlamSlam::RegisterCallbacks(const ros::NodeHandle& n, bool from_log) { // Create a local nodehandle to manage callback subscriptions. ros::NodeHandle nl(n); //以n为父节点 visualization_update_timer_ = nl.createTimer( visualization_update_rate_, &BlamSlam::VisualizationTimerCallback, this); //创建一个timer定时调用VisualizationTimerCallback,其内容是发布**地图**话题 if (from_log) //这里是false 所以进入online return RegisterLogCallbacks(n); else return RegisterOnlineCallbacks(n); //进入这个 }

下面我们继续进入**RegisterOnlineCallbacks(n)**函数

bool BlamSlam::RegisterOnlineCallbacks(const ros::NodeHandle& n) { ROS_INFO("%s: Registering online callbacks.", name_.c_str()); // Create a local nodehandle to manage callback subscriptions. ros::NodeHandle nl(n); estimate_update_timer_ = nl.createTimer( estimate_update_rate_, &BlamSlam::EstimateTimerCallback, this); //定时器 pcld_sub_ = nl.subscribe("pcld", 100, &BlamSlam::PointCloudCallback, this); //消息订阅 return CreatePublishers(n);}

首先先看到订阅者,订阅了一个名为pcld的相对话题名称,在launch文件里这个话题名被重映射到了/PointCloudXYZ,所以这里订阅的是PointCloudXYZ的点云数据

另外是一个以**estimate_update_rate_为调用间隔的EstimateTimerCallback()**函数,我们继续进入

void BlamSlam::EstimateTimerCallback(const ros::TimerEvent& ev) { // Sort all messages accumulated since the last estimate update. synchronizer_.SortMessages();    //对点云数据根据时间排序,并得到index数组 // Iterate through sensor messages, passing to update functions. MeasurementSynchronizer::sensor_type type; unsigned int index = 0; while (synchronizer_.GetNextMessage(&type, &index)) { //找到下一个点云数据的index switch(type) { // Point cloud messages. case MeasurementSynchronizer::PCL_POINTCLOUD: {    //根据类型进入这个分支 const MeasurementSynchronizer::Message<PointCloud>::ConstPtr& m = synchronizer_.GetPCLPointCloudMessage(index); //通过index得到pointcloud数据 ProcessPointCloudMessage(m->msg); //执行数据处理 ********* break; } // Unhandled sensor messages. default: { ROS_WARN("%s: Unhandled measurement type (%s).", name_.c_str(), MeasurementSynchronizer::GetTypeString(type).c_str()); break; } } } // Remove processed messages from the synchronizer. synchronizer_.ClearMessages();}

这个函数主要工作是,根据timestamp对暂存的点云数据进行排序,根据排序结果依次对点云数据进行处理(调用**ProcessPointCloudMessage(m->msg)**函数)

所有数据处理工作都在**ProcessPointCloudMessage(m->msg)**函数中完成,这一章主要介绍了整个程序的的入口,下一章里会介绍点云处理过程

                                        转载请注明出处                                        欢迎讨论交流

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。