#pragma once #include #include #include #include #include #include "error_code/error_code.hpp" #include "tool/pathcreator.h" namespace ZX { /************************************ 定义 **********************************/ const size_t PACKET_HEAD_SIZE = 12; const size_t PACKET_END_SIZE = 4; /************************************ 枚举 **********************************/ enum LidarMessageType { UNKNOW_TYPE = 0, // 未知类型 PointXYZ_TYPE, // 三维点:x、y、z点 PointXYZI_TYPE, // 三维点(含置信度i):x、y、z、i PointXYZPYR_TYPE, // 三维点(含三个角度):x、y、z、pitch、yaw、roll PointRYR_TYPE, // 三维极坐标:roll、yaw、r LIDAR_RS_HELIOS_16P, // 速腾聚创雷达,基于PointRYR,但r的精度是0.25cm PointTYPE_MAX // 最后一个,检测用 }; static void shut_down_logging(const char *data, size_t size) { time_t tt; time(&tt); tt = tt + 8 * 3600; // transform the time zone tm *t = gmtime(&tt); char buf[255] = {0}; sprintf(buf, "./%d%02d%02d-%02d%02d%02d-dump.txt", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); FILE *tp_file = fopen(buf, "w"); fprintf(tp_file, data, strlen(data)); fclose(tp_file); } // 例子: ZX::InitGlog("MeasureNode", ETC_PATH"MeasureNode/MeasureNodeLog/"); static void InitGlog(const char * project_name, const char *logPath) { PathCreator pc; pc.Mkdir(logPath); google::InitGoogleLogging(project_name); google::SetStderrLogging(google::INFO); google::SetLogDestination(google::INFO, logPath); google::SetLogFilenameExtension(".txt"); google::InstallFailureSignalHandler(); google::InstallFailureWriter(&ZX::shut_down_logging); FLAGS_colorlogtostderr = true; // Set log color FLAGS_logbufsecs = 0; // Set log output speed(s) FLAGS_max_log_size = 24; // Set max log file size(GB) FLAGS_stop_logging_if_full_disk = true; } } // pcl 拓展点云类型 namespace pcl { /************************************ 结构体 **********************************/ struct EIGEN_ALIGN16 PointALL // 强制SSE填充以获得正确的内存对齐 { PCL_ADD_POINT4D; // 添加XYZ+填充类型的首选方式 float intensity; float pitch; float roll; float yaw; float r; PCL_MAKE_ALIGNED_OPERATOR_NEW // 确保新的分配器内存是对齐的 }; struct EIGEN_ALIGN16 PointRPRY // 强制SSE填充以获得正确的内存对齐 { float r; float pitch; float roll; float yaw; PCL_MAKE_ALIGNED_OPERATOR_NEW // 确保新的分配器内存是对齐的 }; struct EIGEN_ALIGN16 PointRYR // 强制SSE填充以获得正确的内存对齐 { float r; float yaw; float roll; PCL_MAKE_ALIGNED_OPERATOR_NEW // 确保新的分配器内存是对齐的 }; }