/home/lsc/catkin_Runbased_segment/src/Run_based_segmentation-master/nodes/clustering/scanlinerun.cpp:26:10: fatal error: velodyne_pointcloud/point_types.h: 没有那个文件或目录
26 | #include <velodyne_pointcloud/point_types.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [Run_based_segmentation-master/CMakeFiles/scanlinerun.dir/build.make:63:Run_based_segmentation-master/CMakeFiles/scanlinerun.dir/nodes/clustering/scanlinerun.cpp.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:326:Run_based_segmentation-master/CMakeFiles/scanlinerun.dir/all] 错误 2
make[1]: *** 正在等待未完成的任务…
/home/lsc/catkin_Runbased_segment/src/Run_based_segmentation-master/nodes/ground_filter/groundplanfit.cpp:28:10: fatal error: velodyne_pointcloud/point_types.h: 没有那个文件或目录
28 | #include <velodyne_pointcloud/point_types.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [Run_based_segmentation-master/CMakeFiles/groundplanfit.dir/build.make:63:Run_based_segmentation-master/CMakeFiles/groundplanfit.dir/nodes/ground_filter/groundplanfit.cpp.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:1865:Run_based_segmentation-master/CMakeFiles/groundplanfit.dir/all] 错误 2
make: *** [Makefile:141:all] 错误 2
Invoking “make -j8 -l8” failed
遇到错误
这是我的cmakelist文件
cmake_minimum_required(VERSION 2.8.3)
project(points_preprocessor_usi)
find_package(catkin REQUIRED COMPONENTS
roscpp
velodyne_pointcloud
std_msgs
pcl_ros
pcl_conversions
)
catkin_package(CATKIN_DEPENDS
sensor_msgs
CATKIN_DEPENDS
velodyne_pointcloud
pcl_ros
pcl_conversions
)
###########
Build
###########
include_directories(
${catkin_INCLUDE_DIRS}
)
find_package(Eigen3 REQUIRED)
find_package(catkin REQUIRED COMPONENTS velodyne_pointcloud)
#SET(CMAKE_CXX_FLAGS “-std=c++11 -O2 -g -Wall ${CMAKE_CXX_FLAGS}”)
SET(CMAKE_CXX_FLAGS “-std=c++14 -O2 -g -Wall ${CMAKE_CXX_FLAGS}”)
link_directories(${PCL_LIBRARY_DIRS})
#Ground Plane Fitter
find_package(PCL 1.10 REQUIRED)
add_definitions(${PCL_DEFINITIONS})
find_package(velodyne_pointcloud REQUIRED)
include_directories(
include
${catkin_INCLUDE_DIRS}
)
add_executable(groundplanfit
nodes/ground_filter/groundplanfit.cpp
)
target_include_directories(groundplanfit PRIVATE
${PCL_INCLUDE_DIRS}
)
target_include_directories(groundplanfit PRIVATE
${velodyne_pointcloud_INCLUDE_DIRS}
)
target_link_libraries(groundplanfit
${catkin_LIBRARIES}
${PCL_LIBRARIES}
${velodyne_pointcloud_INCLUDE_LIBRARIES}
)
#Scan Line Run
add_executable(scanlinerun
nodes/clustering/scanlinerun.cpp
)
target_include_directories(scanlinerun PRIVATE
${PCL_INCLUDE_DIRS}
)
target_include_directories(scanlinerun PRIVATE
${velodyne_pointcloud_INCLUDE_DIRS}
)
target_link_libraries(scanlinerun
${catkin_LIBRARIES}
${PCL_LIBRARIES}
${velodyne_pointcloud_INCLUDE_LIBRARIES}
)
解决方案:
set(VELODYNE_POINTCLOUD_INCLUDE_DIRS “/opt/ros/melodic/share/velodyne_pointcloud/include/”)
include_directories(${VELODYNE_POINTCLOUD_INCLUDE_DIRS})
cmake_minimum_required(VERSION 2.8.3)
project(points_preprocessor_usi)
find_package(catkin REQUIRED COMPONENTS
roscpp
velodyne_pointcloud
std_msgs
pcl_ros
pcl_conversions
)
catkin_package(CATKIN_DEPENDS
sensor_msgs
CATKIN_DEPENDS
velodyne_pointcloud
pcl_ros
pcl_conversions
)
###########
Build
###########
include_directories(
${catkin_INCLUDE_DIRS}
)
find_package(Eigen3 REQUIRED)
find_package(catkin REQUIRED COMPONENTS velodyne_pointcloud)
#SET(CMAKE_CXX_FLAGS “-std=c++11 -O2 -g -Wall ${CMAKE_CXX_FLAGS}”)
SET(CMAKE_CXX_FLAGS “-std=c++14 -O2 -g -Wall ${CMAKE_CXX_FLAGS}”)
link_directories(${PCL_LIBRARY_DIRS})
#Ground Plane Fitter
find_package(PCL 1.10 REQUIRED)
add_definitions(${PCL_DEFINITIONS})
find_package(velodyne_pointcloud REQUIRED)
include_directories(
include
c
a
t
k
i
n
I
N
C
L
U
D
E
D
I
R
S
)
s
e
t
(
V
E
L
O
D
Y
N
E
P
O
I
N
T
C
L
O
U
D
I
N
C
L
U
D
E
D
I
R
S
"
/
o
p
t
/
r
o
s
/
n
o
e
t
i
c
/
s
h
a
r
e
/
v
e
l
o
d
y
n
e
p
o
i
n
t
c
l
o
u
d
"
)
i
n
c
l
u
d
e
d
i
r
e
c
t
o
r
i
e
s
(
{catkin_INCLUDE_DIRS} ) set(VELODYNE_POINTCLOUD_INCLUDE_DIRS "/opt/ros/noetic/share/velodyne_pointcloud") include_directories(
catkinINCLUDEDIRS)set(VELODYNEPOINTCLOUDINCLUDEDIRS"/opt/ros/noetic/share/velodynepointcloud")includedirectories({VELODYNE_POINTCLOUD_INCLUDE_DIRS})
add_executable(groundplanfit
nodes/ground_filter/groundplanfit.cpp
)
target_include_directories(groundplanfit PRIVATE
${PCL_INCLUDE_DIRS}
)
target_include_directories(groundplanfit PRIVATE
${velodyne_pointcloud_INCLUDE_DIRS}
)
target_link_libraries(groundplanfit
${catkin_LIBRARIES}
${PCL_LIBRARIES}
${velodyne_pointcloud_INCLUDE_LIBRARIES}
)
#Scan Line Run
add_executable(scanlinerun
nodes/clustering/scanlinerun.cpp
)
target_include_directories(scanlinerun PRIVATE
${PCL_INCLUDE_DIRS}
)
target_include_directories(scanlinerun PRIVATE
${velodyne_pointcloud_INCLUDE_DIRS}
)
target_link_libraries(scanlinerun
${catkin_LIBRARIES}
${PCL_LIBRARIES}
${velodyne_pointcloud_INCLUDE_LIBRARIES}
)
显示结果:
libpcl-dev: /usr/include/pcl-1.10/pcl/impl/point_types.hpp
libpcl-dev: /usr/include/pcl-1.10/pcl/point_types.h
libpcl-dev: /usr/include/pcl-1.10/pcl/recognition/point_types.h
libpdal-dev: /usr/include/pdal/io/point_types.hpp
PCL
find_package(PCL REQUIRED COMPONENTS common io visualization)
include_directories(
P
C
L
I
N
C
L
U
D
E
D
I
R
S
)
l
i
n
k
d
i
r
e
c
t
o
r
i
e
s
(
{PCL_INCLUDE_DIRS}) link_directories(
PCLINCLUDEDIRS)linkdirectories({PCL_LIBRARY_DIRS})
add_definitions(
P
C
L
D
E
F
I
N
I
T
I
O
N
S
)
l
i
n
k
d
i
r
e
c
t
o
r
i
e
s
(
{PCL_DEFINITIONS}) link_directories(
PCLDEFINITIONS)linkdirectories({PCL_LIBRARY_DIRS} ${velodyne_pointcloud_LIBRARY_DIRS})
cmake_minimum_required(VERSION 2.8.3)
project(points_preprocessor_usi)
find_package(catkin REQUIRED COMPONENTS
roscpp
std_msgs
pcl_ros
pcl_conversions
velodyne_pointcloud
)
catkin_package(CATKIN_DEPENDS
sensor_msgs
velodyne_pointcloud
)
###########
Build
###########
include_directories(
${catkin_INCLUDE_DIRS}
)
find_package(Eigen3 REQUIRED)
#SET(CMAKE_CXX_FLAGS “-std=c++11 -O2 -g -Wall ${CMAKE_CXX_FLAGS}”)
SET(CMAKE_CXX_FLAGS “-std=c++14 -O2 -g -Wall ${CMAKE_CXX_FLAGS}”)
link_directories(${PCL_LIBRARY_DIRS})
#Ground Plane Fitter
find_package(PCL 1.10 REQUIRED)
add_definitions(${PCL_DEFINITIONS})
add_executable(groundplanfit
nodes/ground_filter/groundplanfit.cpp
)
target_include_directories(groundplanfit PRIVATE
${PCL_INCLUDE_DIRS}
)
target_link_libraries(groundplanfit
${catkin_LIBRARIES}
${PCL_LIBRARIES}
)
#Scan Line Run
add_executable(scanlinerun
nodes/clustering/scanlinerun.cpp
)
target_include_directories(scanlinerun PRIVATE
${PCL_INCLUDE_DIRS}
)
target_link_libraries(scanlinerun
${catkin_LIBRARIES}
${PCL_LIBRARIES}
)
这个问题出现的原因可能是在不同的ROS版本中,包的依赖关系发生了变化,从而导致了构建问题。特别是在ROS的较新版本中,一些常见的依赖包可能会被分成更小的子包,需要在CMakeLists.txt文件中手动添加这些子包。
find_package(catkin REQUIRED COMPONENTS
velodyne_pointcloud
)
include_directories(
${catkin_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
)
最后,如果这些更改不起作用,您可能需要手动添加依赖项,类似于以下内容
catkin_package(
CATKIN_DEPENDS
pcl_ros
velodyne_pointcloud
)
4月10号遇到问题:
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-oo0myjc4/python-lzf/setup.py’“'”‘; file=’“'”‘/tmp/pip-install-oo0myjc4/python-lzf/setup.py’“'”‘;f=getattr(tokenize, ‘"’“‘open’”’“‘, open)(file);code=f.read().replace(’”‘"’\r\n’“'”‘, ‘"’"’\n’“'”‘);f.close();exec(compile(code, file, ‘"’“‘exec’”’"‘))’ bdist_wheel -d /tmp/pip-wheel-s451643f
cwd: /tmp/pip-install-oo0myjc4/python-lzf/
Complete output (16 lines):
running bdist_wheel
running build
running build_ext
building ‘lzf’ extension
creating build
creating build/temp.linux-x86_64-cpython-38
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I. -I/usr/include/python3.8 -c lzf_c.c -o build/temp.linux-x86_64-cpython-38/lzf_c.o -Wall
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I. -I/usr/include/python3.8 -c lzf_d.c -o build/temp.linux-x86_64-cpython-38/lzf_d.o -Wall
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I. -I/usr/include/python3.8 -c lzf_module.c -o build/temp.linux-x86_64-cpython-38/lzf_module.o -Wall
In file included from /usr/include/python3.8/Python.h:8,
from lzf_module.c:3:
/usr/include/python3.8/pyconfig.h:3:12: fatal error: /usr/include/x86_64-linux-gnu/x86_64-linux-gnu/python3.8/pyconfig.h: 符号连接的层数过多
3 | # include <x86_64-linux-gnu/python3.8/pyconfig.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command ‘/usr/bin/x86_64-linux-gnu-gcc’ failed with exit code 1
ERROR: Failed building wheel for python-lzf
执行命令:
sudo apt-get update
sudo apt-get install python3-pip
sudo pip3 install pypcd
import pypcd
遇到错误:
[alaserPGO-5] process has died [pid 11088, exit code -11, cmd /home/lsc/A-LOAM/devel/lib/aloam_velodyne/alaserPGO /velodyne_points:=/velodyne_points __name:=alaserPGO __log:=/home/lsc/.ros/log/20c48b3e-2a8c-11ee-aef2-7c2a318553ea/alaserPGO-5.log].
log file: /home/lsc/.ros/log/20c48b3e-2a8c-11ee-aef2-7c2a318553ea/alaserPGO-5*.log