From bbcad31e57f25c65c1da7c80d9204ab6135d2853 Mon Sep 17 00:00:00 2001 From: Tim Clephas Date: Mon, 12 Jul 2021 11:07:18 +0200 Subject: [PATCH 01/11] Single package.xml file for both ROS1 and ROS2 --- .gitignore | 1 - README.md | 70 +++++++++++++++++------------------------------- README_CN.md | 44 ++++++++---------------------- package.xml | 25 +++++++++++++++++ package_ros1.xml | 26 ------------------ package_ros2.xml | 25 ----------------- 6 files changed, 60 insertions(+), 131 deletions(-) create mode 100644 package.xml delete mode 100644 package_ros1.xml delete mode 100644 package_ros2.xml diff --git a/.gitignore b/.gitignore index 01b13ecd..581c6ddb 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,3 @@ cmake-build-debug/ version.h *.pb.cc *.pb.h -package.xml diff --git a/README.md b/README.md index abce8479..ca7c9c55 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # **rslidar_sdk** - [中文介绍](README_CN.md) + [中文介绍](README_CN.md) ## 1 Introduction @@ -8,13 +8,13 @@ ### **1.1 LiDAR Support** -- RS-LiDAR-16 -- RS-LiDAR-32 -- RS-Bpearl -- RS-Ruby -- RS-Ruby Lite -- RS-LiDAR-M1 -- RS-Helios +- RS16 +- RS32 +- RSBP +- RS128 +- RS80 +- RSM1-B3 +- RSHELIOS ### 1.2 Point type support @@ -23,7 +23,7 @@ ## 2 Download -### 2.1 Download via Git +### 2.1 Download via Git Since rslidar_sdk project includes a submodule --- rs_driver, user needs to run the following commands after git clone to download the submodule properly. @@ -44,7 +44,7 @@ Instead of using Git, user can also access [rslidar_sdk_release](https://github. ### 3.1 ROS -To run rslidar_sdk in ROS environment, ROS related libraries need to be installed. +To run rslidar_sdk in ROS environment, ROS related libraries need to be installed. **Ubuntu 16.04**: ros-kinetic-desktop-full @@ -58,12 +58,12 @@ If you install ros-kinetic-desktop-full/ros-melodic-desktop-full/ros-noetic-desk ### 3.2 ROS2 -If use rslidar_sdk in ROS2 environment, ROS2 related libraries need to be installed. +If use rslidar_sdk in ROS2 environment, ROS2 related libraries need to be installed. **Ubuntu 16.04**: Not supported **Ubuntu 18.04**: ROS2 eloquent desktop - + **Installation**: please refer to https://index.ros.org/doc/ros2/Installation/Eloquent/Linux-Install-Debians/ **Ubuntu 20.04**: ROS2 foxy desktop @@ -76,7 +76,7 @@ If use rslidar_sdk in ROS2 environment, ROS2 related libraries need to be instal **Note! Please avoid installing ROS and ROS2 on the same computer! This may cause conflict! Also you may need to install Yaml manually.** -### 3.3 Yaml(Essential) +### 3.3 Yaml(Essential) version: >= v0.5.2 @@ -89,7 +89,7 @@ sudo apt-get update sudo apt-get install -y libyaml-cpp-dev ``` -### 3.4 Pcap(Essential) +### 3.4 Pcap(Essential) version: >=v1.7.4 @@ -117,7 +117,7 @@ We offer three ways to compile and run the driver. ### 4.1 Compile directly - In this way, user can use ROS facilities(not ROS2) if ROS master node is launched in advance via ```roscore```. Also, rviz can be launched seperately for visualization. + In this way, user can use ROS facilities(not ROS2) if ROS master node is launched in advance via ```roscore```. Also, rviz can be launched seperately for visualization. ```sh cd rslidar_sdk @@ -130,20 +130,9 @@ cmake .. && make -j4 ### 4.2 Compile with ROS catkin tools -(1) Open the *CMakeLists.txt* in the project,modify the line on top of the file **set(COMPILE_METHOD ORIGINAL)** to **set(COMPILE_METHOD CATKIN)**. - -```cmake -#======================================= -# Compile setup (ORIGINAL,CATKIN,COLCON) -#======================================= -set(COMPILE_METHOD CATKIN) -``` - -(2) Rename the file *package_ros1.xml* in the rslidar_sdk to *package.xml* - -(3) Create a new workspace folder, and create a *src* folder in it. Then put the rslidar_sdk project into the *src* folder. +(1) Create a new workspace folder, and create a *src* folder in it. Then put the rslidar_sdk project into the *src* folder. -(4) Go back to the root of workspace, run the following commands to compile and run. (if using zsh, replace the 2nd command with *source devel/setup.zsh*). +(2) Go back to the root of workspace, run the following commands to compile and run. (if using zsh, replace the 2nd command with *source devel/setup.zsh*). ```sh catkin_make @@ -153,22 +142,11 @@ roslaunch rslidar_sdk start.launch ### 4.3 Compile with ROS2-colcon -(1) Open the *CMakeLists.txt* in the project,modify the line on top of the file **set(COMPILE_METHOD ORIGINAL)** to **set(COMPILE_METHOD COLCON)**. - -```cmake -#======================================= -# Compile setup (ORIGINAL,CATKIN,COLCON) -#======================================= -set(COMPILE_METHOD COLCON) -``` - -(2) Rename the file *package_ros2.xml* in the rslidar_sdk to *package.xml* - -(3) Create a new workspace folder, and create a *src* folder in it. Then put the rslidar_sdk project in the *src* folder. +(1) Create a new workspace folder, and create a *src* folder in it. Then put the rslidar_sdk project in the *src* folder. -(4) Download the packet definition project in ROS2 through [link](/~https://github.com/RoboSense-LiDAR/rslidar_msg), then put the project rslidar_msg in the *src* folder you just created. +(2) Download the packet definition project in ROS2 through [link](/~https://github.com/RoboSense-LiDAR/rslidar_msg), then put the project rslidar_msg in the *src* folder you just created. -(5) Go back to the root of workspace, run the following commands to compile and run. (if using zsh, replace the 2nd command with *source install/setup.zsh*). +(3) Go back to the root of workspace, run the following commands to compile and run. (if using zsh, replace the 2nd command with *source install/setup.zsh*). ```sh colcon build @@ -180,7 +158,7 @@ ros2 launch rslidar_sdk start.py ## 5 Introduction to parameters -This section is very important since all functions and features provided by rslidar_sdk is configured via parameter modification. So please read the following links carefully. +This section is very important since all functions and features provided by rslidar_sdk is configured via parameter modification. So please read the following links carefully. [Intro to parameters](doc/intro/parameter_intro.md) @@ -206,8 +184,8 @@ The following documents are some quick guides for using some of the most common [Multi-LiDARs](doc/howto/how_to_use_multi_lidars.md) -[Switch Point Type](doc/howto/how_to_switch_point_type.md) +[Switch Point Type](doc/howto/how_to_switch_point_type.md) -[Coordinate Transformation](doc/howto/how_to_use_coordinate_transformation.md) +[Coordinate Transformation](doc/howto/how_to_use_coordinate_transformation.md) -[Multi-Cast](doc/howto/how_to_use_multi_cast_function.md) +[Multi-Cast](doc/howto/how_to_use_multi_cast_function.md) diff --git a/README_CN.md b/README_CN.md index b188ab51..21ba4c68 100644 --- a/README_CN.md +++ b/README_CN.md @@ -41,11 +41,11 @@ git submodule update ## 3 依赖介绍 -### 3.1 ROS +### 3.1 ROS *若需在ROS环境下使用雷达驱动,则需安装ROS相关依赖库* -Ubuntu 16.04 - ROS kinetic desktop-full +Ubuntu 16.04 - ROS kinetic desktop-full Ubuntu 18.04 - ROS melodic desktop-full @@ -77,7 +77,7 @@ Ubuntu 20.04 - ROS2 Galactic desktop ### 3.3 Yaml (必需) -版本号: >= v0.5.2 +版本号: >= v0.5.2 *若已安装ROS desktop-full, 可跳过* @@ -127,20 +127,9 @@ cmake .. && make -j4 ### 4.2 依赖于ROS-catkin编译 -(1) 打开工程内的*CMakeLists.txt*文件,将文件顶部的**set(COMPILE_METHOD ORIGINAL)**改为**set(COMPILE_METHOD CATKIN)**。 +(1) 新建一个文件夹作为工作空间,然后再新建一个名为*src*的文件夹, 将rslidar_sdk工程放入*src*文件夹内。 -```cmake -#======================================= -# Compile setup (ORIGINAL,CATKIN,COLCON) -#======================================= -set(COMPILE_METHOD CATKIN) -``` - -(2) 将rslidar_sdk工程目录下的*package_ros1.xml*文件重命名为*package.xml*。 - -(3) 新建一个文件夹作为工作空间,然后再新建一个名为*src*的文件夹, 将rslidar_sdk工程放入*src*文件夹内。 - -(4) 返回工作空间目录,执行以下命令即可编译&运行(若使用.zsh,将第二句指令替换为 *source devel/setup.zsh*)。 +(2) 返回工作空间目录,执行以下命令即可编译&运行(若使用.zsh,将第二句指令替换为 *source devel/setup.zsh*)。 ```sh catkin_make @@ -150,22 +139,11 @@ roslaunch rslidar_sdk start.launch ### 4.3 依赖于ROS2-colcon编译 -(1) 打开工程内的*CMakeLists.txt*文件,将文件顶部的**set(COMPILE_METHOD ORIGINAL)**改为**set(COMPILE_METHOD COLCON)**。 - -```cmake -#======================================= -# Compile setup (ORIGINAL,CATKIN,COLCON) -#======================================= -set(COMPILE_METHOD COLCON) -``` - -(2) 将rslidar_sdk工程目录下的*package_ros2.xml*文件重命名为*package.xml*。 - -(3) 新建一个文件夹作为工作空间,然后再新建一个名为*src*的文件夹, 将rslidar_sdk工程放入*src*文件夹内。 +(1) 新建一个文件夹作为工作空间,然后再新建一个名为*src*的文件夹, 将rslidar_sdk工程放入*src*文件夹内。 -(4) 通过[链接](/~https://github.com/RoboSense-LiDAR/rslidar_msg)下载ROS2环境下的雷达packet消息定义, 将rslidar_msg工程也放在刚刚新建的*src*文件夹内,与rslidar_sdk并列。 +(2) 通过[链接](/~https://github.com/RoboSense-LiDAR/rslidar_msg)下载ROS2环境下的雷达packet消息定义, 将rslidar_msg工程也放在刚刚新建的*src*文件夹内,与rslidar_sdk并列。 -(5) 返回工作空间目录,执行以下命令即可编译&运行(若使用.zsh,将第二句指令替换为 *source install/setup.zsh*)。 +(3) 返回工作空间目录,执行以下命令即可编译&运行(若使用.zsh,将第二句指令替换为 *source install/setup.zsh*)。 ```sh colcon build @@ -203,8 +181,8 @@ ros2 launch rslidar_sdk start.py [多雷达](doc/howto/how_to_use_multi_lidars_cn.md) -[切换点的类型](doc/howto/how_to_switch_point_type_cn.md) +[切换点的类型](doc/howto/how_to_switch_point_type_cn.md) -[坐标变换功能](doc/howto/how_to_use_coordinate_transformation_cn.md) +[坐标变换功能](doc/howto/how_to_use_coordinate_transformation_cn.md) -[组播模式](doc/howto/how_to_use_multi_cast_function_cn.md) +[组播模式](doc/howto/how_to_use_multi_cast_function_cn.md) diff --git a/package.xml b/package.xml new file mode 100644 index 00000000..1719b3ff --- /dev/null +++ b/package.xml @@ -0,0 +1,25 @@ + + + rslidar_sdk + 1.3.0 + The rslidar_sdk package + robosense + BSD + + catkin + ament_cmake + + libpcap-dev + libpcl-dev + libyaml-cpp-dev + pcl_conversions + rclcpp + roscpp + rslidar_msg + sensor_msgs + std_msgs + + + ament_cmake + + diff --git a/package_ros1.xml b/package_ros1.xml deleted file mode 100644 index 28814d5e..00000000 --- a/package_ros1.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - rslidar_sdk - 1.3.0 - The rslidar_sdk package - robosense - BSD - - catkin - - roscpp - sensor_msgs - roslib - yaml-cpp - libpcap - pcl_ros - pcl_conversions - libpcl-all-dev - - roscpp - sensor_msgs - roslib - libpcap - pcl_conversions - - diff --git a/package_ros2.xml b/package_ros2.xml deleted file mode 100644 index e1bb89ae..00000000 --- a/package_ros2.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - rslidar_sdk - 1.3.0 - The rslidar_sdk package - robosense - BSD - - ament_cmake - - yaml-cpp - - rclcpp - std_msgs - sensor_msgs - rslidar_msg - libpcap - pcl_conversions - libpcl-all-dev - - - ament_cmake - - - From 6c6e27ae58649fcb396aa34b548e4683fc1a1f46 Mon Sep 17 00:00:00 2001 From: Tim Clephas Date: Mon, 12 Jul 2021 11:19:06 +0200 Subject: [PATCH 02/11] Adhere to rosdep definitions --- package.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.xml b/package.xml index 1719b3ff..b3ce814b 100644 --- a/package.xml +++ b/package.xml @@ -9,15 +9,15 @@ catkin ament_cmake - libpcap-dev - libpcl-dev - libyaml-cpp-dev + libpcap + libpcl-all-dev pcl_conversions rclcpp roscpp rslidar_msg sensor_msgs std_msgs + yaml-cpp ament_cmake From 9cc5af0219f6934c35448ef893d8a776b1ef0d5c Mon Sep 17 00:00:00 2001 From: Tim Clephas Date: Mon, 12 Jul 2021 11:34:23 +0200 Subject: [PATCH 03/11] pcl_ros is also a dependency --- package.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/package.xml b/package.xml index b3ce814b..2c58bd5b 100644 --- a/package.xml +++ b/package.xml @@ -12,6 +12,7 @@ libpcap libpcl-all-dev pcl_conversions + pcl_ros rclcpp roscpp rslidar_msg From abcb79953730ce1234f0986fc1dfa15f0e103d36 Mon Sep 17 00:00:00 2001 From: Tim Clephas Date: Mon, 12 Jul 2021 11:48:58 +0200 Subject: [PATCH 04/11] pcl dependencies only for ROS1 --- package.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.xml b/package.xml index 2c58bd5b..b69b2809 100644 --- a/package.xml +++ b/package.xml @@ -12,7 +12,7 @@ libpcap libpcl-all-dev pcl_conversions - pcl_ros + pcl_ros rclcpp roscpp rslidar_msg From 21e10d0ae1b0c8717e41296ebc4c1429e855a065 Mon Sep 17 00:00:00 2001 From: Tim Clephas Date: Fri, 11 Feb 2022 16:47:09 +0100 Subject: [PATCH 05/11] Fix rebase --- CMakeLists.txt | 2 -- package.xml | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 64f6accb..70a537b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,6 @@ if(roscpp_FOUND) message("-- ROS Found, Ros Support is turned On!") message(=============================================================) add_definitions(-DROS_FOUND) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/package_ros1.xml ${CMAKE_CURRENT_SOURCE_DIR}/package.xml COPYONLY) find_package(roslib QUIET) include_directories(${roscpp_INCLUDE_DIRS} ${roslib_INCLUDE_DIRS}) @@ -51,7 +50,6 @@ if(rclcpp_FOUND AND ${COMPILE_METHOD} STREQUAL "COLCON") message("-- ROS2 Found, Ros2 Support is turned On!") message(=============================================================) add_definitions(-DROS2_FOUND) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/package_ros2.xml ${CMAKE_CURRENT_SOURCE_DIR}/package.xml COPYONLY) set(CMAKE_CXX_STANDARD 14) find_package(ament_cmake REQUIRED) diff --git a/package.xml b/package.xml index b69b2809..029a336b 100644 --- a/package.xml +++ b/package.xml @@ -15,6 +15,7 @@ pcl_ros rclcpp roscpp + roslib rslidar_msg sensor_msgs std_msgs From a373e157fd41fe75dab70e995e409b748cdfe696 Mon Sep 17 00:00:00 2001 From: Tim Clephas Date: Fri, 18 Mar 2022 12:26:52 +0100 Subject: [PATCH 06/11] No need to set COMPILE_METHOD --- CMakeLists.txt | 47 ++++++++++++++++++++--------------------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 70a537b6..30d013df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,11 +2,6 @@ cmake_minimum_required(VERSION 3.5) cmake_policy(SET CMP0048 NEW) project(rslidar_sdk) -#======================================= -# Compile setup (ORIGINAL, CATKIN, COLCON) -#======================================= -set(COMPILE_METHOD CATKIN) - #======================================= # Custom Point Type (XYZI, XYZIRT) #======================================= @@ -45,7 +40,7 @@ endif(roscpp_FOUND) #ROS2# find_package(rclcpp QUIET) -if(rclcpp_FOUND AND ${COMPILE_METHOD} STREQUAL "COLCON") +if(rclcpp_FOUND) message(=============================================================) message("-- ROS2 Found, Ros2 Support is turned On!") message(=============================================================) @@ -59,11 +54,11 @@ if(rclcpp_FOUND AND ${COMPILE_METHOD} STREQUAL "COLCON") find_package(pcl_conversions REQUIRED) include_directories(${rclcpp_INCLUDE_DIRS}) -else(rclcpp_FOUND AND ${COMPILE_METHOD} STREQUAL "COLCON") +else(rclcpp_FOUND) message(=============================================================) message("-- ROS2 Not Found, Ros2 Support is turned Off!") message(=============================================================) -endif(rclcpp_FOUND AND ${COMPILE_METHOD} STREQUAL "COLCON") +endif(rclcpp_FOUND) #Protobuf# find_package(Protobuf QUIET) @@ -98,7 +93,7 @@ link_directories(${PCL_LIBRARY_DIRS}) add_definitions(${PCL_DEFINITIONS}) #Catkin# -if(${COMPILE_METHOD} STREQUAL "CATKIN") +if(roscpp_FOUND) add_definitions(-DRUN_IN_ROS_WORKSPACE) find_package(catkin REQUIRED COMPONENTS @@ -116,7 +111,7 @@ if(${COMPILE_METHOD} STREQUAL "CATKIN") roslib pcl_conversions ) -endif(${COMPILE_METHOD} STREQUAL "CATKIN") +endif(roscpp_FOUND) #Include directory# include_directories(${PROJECT_SOURCE_DIR}/src) @@ -171,25 +166,23 @@ endif(NOT PROTOC MATCHES "NOTFOUND" AND Protobuf_FOUND) #Ros# if(roscpp_FOUND) target_link_libraries(rslidar_sdk_node ${ROS_LIBS}) - if(${COMPILE_METHOD} STREQUAL "CATKIN") - install(TARGETS rslidar_sdk_node - RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} - LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} - ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}) - install(DIRECTORY launch/ - DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch - PATTERN ".svn" EXCLUDE) - install(DIRECTORY config/ - DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/config - PATTERN ".svn" EXCLUDE) - install(DIRECTORY rviz/ - DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/rviz - PATTERN ".svn" EXCLUDE) - endif() + install(TARGETS rslidar_sdk_node + RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}) + install(DIRECTORY launch/ + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch + PATTERN ".svn" EXCLUDE) + install(DIRECTORY config/ + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/config + PATTERN ".svn" EXCLUDE) + install(DIRECTORY rviz/ + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/rviz + PATTERN ".svn" EXCLUDE) endif(roscpp_FOUND) #Ros2# -if(rclcpp_FOUND AND ${COMPILE_METHOD} STREQUAL "COLCON") +if(rclcpp_FOUND) ament_target_dependencies(rslidar_sdk_node rclcpp sensor_msgs std_msgs rslidar_msg) install(TARGETS rslidar_sdk_node @@ -201,4 +194,4 @@ if(rclcpp_FOUND AND ${COMPILE_METHOD} STREQUAL "COLCON") DESTINATION share/${PROJECT_NAME} ) ament_package() -endif(rclcpp_FOUND AND ${COMPILE_METHOD} STREQUAL "COLCON") +endif(rclcpp_FOUND) From e4e509598015a57f776b024472be7df2909c8a8a Mon Sep 17 00:00:00 2001 From: Tim Clephas Date: Fri, 18 Mar 2022 12:33:24 +0100 Subject: [PATCH 07/11] Update steps in README --- README.md | 15 ++------------- README_CN.md | 15 ++------------- 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index bede7d20..01241cb7 100644 --- a/README.md +++ b/README.md @@ -130,9 +130,7 @@ cmake .. && make -j4 ### 4.2 Compile with ROS catkin tools -(1) Open the *CMakeLists.txt* in the project,modify the line on top of the file **set(COMPILE_METHOD ORIGINAL)** to **set(COMPILE_METHOD CATKIN)**. - -(2) Go back to the root of workspace, run the following commands to compile and run. (if using zsh, replace the 2nd command with *source devel/setup.zsh*). +(1) Run the following commands to compile and run. (if using zsh, replace the 2nd command with *source devel/setup.zsh*). ```sh catkin_make @@ -142,16 +140,7 @@ roslaunch rslidar_sdk start.launch ### 4.3 Compile with ROS2-colcon -(1) Open the *CMakeLists.txt* in the project,modify the line on top of the file **set(COMPILE_METHOD ORIGINAL)** to **set(COMPILE_METHOD COLCON)**. - -```cmake -#======================================= -# Compile setup (ORIGINAL,CATKIN,COLCON) -#======================================= -set(COMPILE_METHOD COLCON) -``` - -(3) Go back to the root of workspace, run the following commands to compile and run. (if using zsh, replace the 2nd command with *source install/setup.zsh*). +(1) Run the following commands to compile and run. (if using zsh, replace the 2nd command with *source install/setup.zsh*). ```sh colcon build diff --git a/README_CN.md b/README_CN.md index a6152242..6783c83a 100644 --- a/README_CN.md +++ b/README_CN.md @@ -127,9 +127,7 @@ cmake .. && make -j4 ### 4.2 依赖于ROS-catkin编译 -(1) 打开工程内的*CMakeLists.txt*文件,将文件顶部的**set(COMPILE_METHOD ORIGINAL)**改为**set(COMPILE_METHOD CATKIN)**。 - -(2) 返回工作空间目录,执行以下命令即可编译&运行(若使用.zsh,将第二句指令替换为 *source devel/setup.zsh*)。 +(1) 返回工作空间目录,执行以下命令即可编译&运行(若使用.zsh,将第二句指令替换为 *source devel/setup.zsh*)。 ```sh catkin_make @@ -139,16 +137,7 @@ roslaunch rslidar_sdk start.launch ### 4.3 依赖于ROS2-colcon编译 -(1) 打开工程内的*CMakeLists.txt*文件,将文件顶部的**set(COMPILE_METHOD ORIGINAL)**改为**set(COMPILE_METHOD COLCON)**。 - -```cmake -#======================================= -# Compile setup (ORIGINAL,CATKIN,COLCON) -#======================================= -set(COMPILE_METHOD COLCON) -``` - -(3) 返回工作空间目录,执行以下命令即可编译&运行(若使用.zsh,将第二句指令替换为 *source install/setup.zsh*)。 +(1) 返回工作空间目录,执行以下命令即可编译&运行(若使用.zsh,将第二句指令替换为 *source install/setup.zsh*)。 ```sh colcon build From e058d257e34a7a7a972eb737488ab86fc7c45cc2 Mon Sep 17 00:00:00 2001 From: Tim Clephas Date: Thu, 25 Jul 2024 15:03:35 +0200 Subject: [PATCH 08/11] roslib only for ROS1 --- package.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.xml b/package.xml index d951aefe..e6726d11 100644 --- a/package.xml +++ b/package.xml @@ -15,7 +15,7 @@ pcl_ros rclcpp roscpp - roslib + roslib rslidar_msg sensor_msgs std_msgs From f22e46720464c435fb499be9bf8bfec35a085e37 Mon Sep 17 00:00:00 2001 From: Tim Clephas Date: Fri, 26 Jul 2024 09:53:21 +0200 Subject: [PATCH 09/11] Restore libpcap as it's header is included --- package.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/package.xml b/package.xml index 415f1f74..e9a97908 100644 --- a/package.xml +++ b/package.xml @@ -9,6 +9,7 @@ catkin ament_cmake + libpcap pcl_ros rclcpp roscpp From d3f8cad4c81ccc37b2e103adcd6e488f1deefee1 Mon Sep 17 00:00:00 2001 From: Tim Clephas Date: Fri, 2 Aug 2024 22:48:46 +0200 Subject: [PATCH 10/11] Allow --config-path as argument for now as ROS2 nodes are inconsistent --- node/rslidar_sdk_node.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/node/rslidar_sdk_node.cpp b/node/rslidar_sdk_node.cpp index 546917e5..b2ba14e3 100644 --- a/node/rslidar_sdk_node.cpp +++ b/node/rslidar_sdk_node.cpp @@ -88,6 +88,15 @@ int main(int argc, char** argv) config_path += "/config/config.yaml"; +// Pick up --config-path argument from command line +for (int i = 1; i < argc; i++) { + std::string arg = argv[i]; + if (arg == "--config-path" && i + 1 < argc) { + config_path = argv[i + 1]; + break; + } +} + #ifdef ROS_FOUND ros::NodeHandle priv_hh("~"); std::string path; From 7198d6a4372c9bb96b0fea16694118947c0dc353 Mon Sep 17 00:00:00 2001 From: Tim Clephas Date: Mon, 26 Aug 2024 15:49:26 +0200 Subject: [PATCH 11/11] Drop manual argument parsing --- node/rslidar_sdk_node.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/node/rslidar_sdk_node.cpp b/node/rslidar_sdk_node.cpp index 90218275..49d543bb 100644 --- a/node/rslidar_sdk_node.cpp +++ b/node/rslidar_sdk_node.cpp @@ -88,15 +88,6 @@ int main(int argc, char** argv) config_path += "/config/config.yaml"; -// Pick up --config-path argument from command line -for (int i = 1; i < argc; i++) { - std::string arg = argv[i]; - if (arg == "--config-path" && i + 1 < argc) { - config_path = argv[i + 1]; - break; - } -} - #ifdef ROS_FOUND ros::NodeHandle priv_hh("~"); std::string path;