问题描述
我试图在Windows中安装ROS-Velodyne驱动程序(https://github.com/ros-drivers/velodyne),以从velodyne LiDAR捕获点云,但是在运行catkin_make时出错。
由于这些驱动程序需要pcap库,因此我在系统中安装了WinPcap并更新了velodyne驱动程序cmake以查找所需的标头并链接该库。 但是在运行cmake时,“ target_link_libraries”出现错误(如图所示)
无法为目标“ velodyne_driver”指定链接库 由该项目建造
以下是velodyne_driver软件包的cmake文件:
cmake_minimum_required(VERSION 2.8.3)
project(velodyne_driver)
# Set minimum C++ standard to C++11
if (NOT "${CMAKE_CXX_STANDARD_COmpuTED_DEFAULT}")
message(STATUS "Changing CXX_STANDARD from C++98 to C++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif ("${CMAKE_CXX_STANDARD_COmpuTED_DEFAULT}" STREQUAL "98")
message(STATUS "Changing CXX_STANDARD from C++98 to C++11")
set(CMAKE_CXX_STANDARD 11)
endif()
set(${PROJECT_NAME}_CATKIN_DEPS
diagnostic_updater
dynamic_reconfigure
nodelet
roscpp
tf
velodyne_msgs)
find_package(catkin required COMPONENTS ${${PROJECT_NAME}_CATKIN_DEPS} roslint)
# This driver uses Boost threads
find_package(Boost required COMPONENTS thread)
# kinger: libpcap provides no pkg-config or find_package module:
#message (STATUS "****** Starting PCAP Search in folder: ********")
set( PCAP_DIR "C:/workspace/WpdPack" )
#message (STATUS ${PCAP_DIR})
#kinger: Include file FindPCAP.cmake
include(FindPCAP.cmake)
#find_package( PCAP required )
message (STATUS "******* FIND PCAP TASK FINISHED **********")
message (STATUS ${PCAP_FOUND})
message (STATUS ${PCAP_INCLUDE_Dirs})
message (STATUS ${PCAP_LIBRARY_Dirs})
message (STATUS ${PCAP_LIBRARIES})
#set(libpcap_LIBRARIES -lpcap)
if(PCAP_FOUND)
# Include Directories
include_directories( ${PCAP_INCLUDE_Dirs} )
# Library Directories (Option)
link_directories( ${PCAP_LIBRARY_Dirs} )
# Dependencies
target_link_libraries( ${PROJECT_NAME} ${PCAP_LIBRARIES} )
endif()
include_directories(include ${Boost_INCLUDE_DIR} ${catkin_INCLUDE_Dirs})
# Generate dynamic_reconfigure server
generate_dynamic_reconfigure_options(cfg/VelodyneNode.cfg)
# objects needed by other ROS packages that depend on this one
catkin_package(CATKIN_DEPENDS ${${PROJECT_NAME}_CATKIN_DEPS}
INCLUDE_Dirs include
LIBRARIES velodyne_input)
# compile the driver and input library
add_subdirectory(src/lib)
add_subdirectory(src/driver)
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})
install(FILES nodelet_velodyne.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(DIRECTORY launch/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch)
install(PROGRAMS src/vdump
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
roslint_cpp()
if (CATKIN_ENABLE_TESTING)
# these dependencies are only needed for unit testing
find_package(roslaunch required)
find_package(rostest required)
# Download packet capture (PCAP) files containing test data.
# Store them in devel-space,so rostest can easily find them.
catkin_download_test_data(
${PROJECT_NAME}_tests_class.pcap
http://download.ros.org/data/velodyne/class.pcap
DESTINATION ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/tests
MD5 65808d25772101358a3719b451b3d015)
catkin_download_test_data(
${PROJECT_NAME}_tests_32e.pcap
http://download.ros.org/data/velodyne/32e.pcap
DESTINATION ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/tests
MD5 e41d02aac34f0967c03a5597e1d554a9)
catkin_download_test_data(
${PROJECT_NAME}_tests_vlp16.pcap
http://download.ros.org/data/velodyne/vlp16.pcap
DESTINATION ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/tests
MD5 f45c2bb1d7ee358274e423ea3b66fd73)
# unit tests
add_rostest(tests/pcap_node_hertz.test)
add_rostest(tests/pcap_nodelet_hertz.test)
add_rostest(tests/pcap_32e_node_hertz.test)
add_rostest(tests/pcap_32e_nodelet_hertz.test)
add_rostest(tests/pcap_vlp16_node_hertz.test)
add_rostest(tests/pcap_vlp16_nodelet_hertz.test)
# parse check all the launch/*.launch files
roslaunch_add_file_check(launch)
# unit test
catkin_add_gtest(time_test tests/timeconversiontest.cpp)
target_link_libraries(time_test
${catkin_LIBRARIES}
${Boost_LIBRARIES}
${PCAP_LIBRARIES})
endif (CATKIN_ENABLE_TESTING)
更新:解决了上述问题。它与target_link_libraries有关,我们需要提供“ target”而不是“ project”。我通过添加以下行来更新了cmake:
set(libpcap_LIBRARIES ${PCAP_LIBRARIES})
现在,构建失败,发生以下错误:59%
C:\opt\ros\noetic\x64\include\diagnostic_updater/update_functions.h(188): error C2589: 'constant': illegal token on right side of '::'
看起来这是一个未解决的问题:https://github.com/ms-iot/ROSOnWindows/issues/280
解决方法
很高兴看到您在Windows上使用ROS!我想知道更多关于您的项目。 我们(Azure Edge Robotics,在Windows上维护ROS)目前没有Velodyne激光雷达,因此没有尝试移植它。
似乎Windows上尚未启用Velodyne Lidar ROS节点。看起来cmake文件中有几个特定于Linux的命令需要Windows等效项。
我们在此处提供了Windows移植指南-https://ms-iot.github.io/ROSOnWindows/GettingStarted/PortingANode.html
有一个winpcap vcpkg可在端口中使用: https://github.com/microsoft/vcpkg/tree/master/ports/winpcap
我已经在ROSonWindows github上创建了它来跟踪: Catkin_make on the velodyne drivers fails in the windows 10 environemnt