1 C++函数结构:
pcl::PointCloud<PointType>::Ptr transformPointCloud(pcl::PointCloud<PointType>::Ptr cloudIn,
PointTypePose *transformIn)
{
......
return CloudOut;
}
函数返回类型——pcl::PointCloud<PointType>::Ptr
函数名——transformPointCloud
(形参1类型——pcl::PointCloud<PointType>::Ptr 形参1变量名——cloudIn,
形参2类型——PointTypePose 形参变量2名——*transformIn)
return必须是函数类型,即 CloudOut 是 pcl::PointCloud<PointType>::Ptr 类型
2 函数形参类型:
指针/引用/常量const/数组/普通类型:int,float.double...
3 class或struct后冒号:的含义(继承与派生)
class或struct后面的冒号是用来 定义类的继承
class FeatureExtraction : public ParamServer
{...};
class 派生类名 : 继承方式 基类名
继承方式:public ,private和protected
FeatureExtraction这个新的类为派生类,通过公有方式继承ParamServer这个基类。
FeatureExtraction又称为子类(派生类),ParamServer称为父类(基类)。
Lio-sam中ParamServer基类定义在Utility.h文件中,其他.cpp文件中的类都公开继承这个类
如:
imageProjection.cpp文件中imageProjection类继承了ParamServer
class ImageProjection : public ParamServer
注:
子类只能继承父类中的public
子类中的{ }内都是新的成员变量和成员函数,也就是在父类的基础上新加了一些东西
SLAM学习笔记(二十)LIO-SAM流程及代码详解(最全)_zkk9527的博客-CSDN博客_lio-sam
tf 四元数:
tf::Quaternion quat;
tf::quaternionMsgToTF(amcl_pose.pose.pose.orientation,quat);
double roll,pitch,yaw;
tf::Matrix3x3(quat).getRPY(roll,pitch,yaw);
//获取偏航角
tf::getYaw(msg->pose.pose.orientation);