按照Ti官方的指南编译他们提供的ROS Driver,出现了如下错误
In file included from /usr/include/pcl-1.10/pcl/io/file_io.h:41, from /usr/include/pcl-1.10/pcl/io/pcd_io.h:44, from /opt/ros/noetic/include/pcl_conversions/pcl_conversions.h:70, from /opt/ros/noetic/include/pcl_ros/point_cloud.h:9, from /home/psy/mmwave_ti_ros/ros_driver/src/ti_mmwave_rospkg/include/DataHandlerClass.h:14, from /home/psy/mmwave_ti_ros/ros_driver/src/ti_mmwave_rospkg/src/DataHandlerClass.cpp:1: /usr/include/pcl-1.10/pcl/common/io.h:65:9: note: candidate: ‘pcl::getFieldIndex(const pcl::PCLPointCloud2&, const string&)::<lambda(int)>’ 65 | [&field_name](const auto field) { return field.name == field_name; }); | ^ /usr/include/pcl-1.10/pcl/common/io.h:65:9: note: no known conversion for argument 1 from ‘const pcl::PCLPointField’ to ‘int’ make[2]: *** [ti_mmwave_rospkg/CMakeFiles/mmwave.dir/build.make:63:ti_mmwave_rospkg/CMakeFiles/mmwave.dir/src/mmWaveDataHdl.cpp.o] 错误 1 make[2]: *** 正在等待未完成的任务.... make[2]: *** [ti_mmwave_rospkg/CMakeFiles/mmwave.dir/build.make:89:ti_mmwave_rospkg/CMakeFiles/mmwave.dir/src/DataHandlerClass.cpp.o] 错误 1 make[1]: *** [CMakeFiles/Makefile2:2243:ti_mmwave_rospkg/CMakeFiles/mmwave.dir/all] 错误 2
在RoboSence的ros_rsLiDar的issue中找到了类似的问题
问题
Point Cloud Library-1.10 需要用C++14标准进行编译
解决方法
修改ti_mmwave_rospkg中的CMakeList.txt
add_definitions(-std=c++11)
修改为
add_definitions(-std=c++14)