Fix unilidar_sdk2 for jazzy colcon build
This commit is contained in:
@@ -61,7 +61,6 @@ RUN cd src/upstream/livox_sdk && \
|
|||||||
# Build the workspace with symlink install
|
# Build the workspace with symlink install
|
||||||
RUN . /opt/ros/jazzy/setup.sh && \
|
RUN . /opt/ros/jazzy/setup.sh && \
|
||||||
colcon build --symlink-install \
|
colcon build --symlink-install \
|
||||||
--packages-ignore unitree_lidar_ros2 unitree_lidar_ros unitree_lidar_sdk \
|
|
||||||
--cmake-args -DROS_EDITION=ROS2 -DDISTRO_ROS=jazzy
|
--cmake-args -DROS_EDITION=ROS2 -DDISTRO_ROS=jazzy
|
||||||
|
|
||||||
# Source the overlay on container startup
|
# Source the overlay on container startup
|
||||||
|
|||||||
@@ -26,3 +26,4 @@ apply_patch_once() {
|
|||||||
apply_patch_once "$ROOT_DIR/src/upstream/livox_sdk" "$PATCH_DIR/livox_sdk.patch"
|
apply_patch_once "$ROOT_DIR/src/upstream/livox_sdk" "$PATCH_DIR/livox_sdk.patch"
|
||||||
apply_patch_once "$ROOT_DIR/src/upstream/slam_gmapping" "$PATCH_DIR/slam_gmapping.patch"
|
apply_patch_once "$ROOT_DIR/src/upstream/slam_gmapping" "$PATCH_DIR/slam_gmapping.patch"
|
||||||
apply_patch_once "$ROOT_DIR/src/upstream/FAST_LIO" "$PATCH_DIR/fast_lio.patch"
|
apply_patch_once "$ROOT_DIR/src/upstream/FAST_LIO" "$PATCH_DIR/fast_lio.patch"
|
||||||
|
apply_patch_once "$ROOT_DIR/src/upstream/unilidar_sdk2" "$PATCH_DIR/unilidar_sdk2.patch"
|
||||||
|
|||||||
@@ -0,0 +1,105 @@
|
|||||||
|
diff --git a/unitree_lidar_ros2/src/unitree_lidar_ros2/CMakeLists.txt b/unitree_lidar_ros2/src/unitree_lidar_ros2/CMakeLists.txt
|
||||||
|
index 041ef0d..dd57d47 100644
|
||||||
|
--- a/unitree_lidar_ros2/src/unitree_lidar_ros2/CMakeLists.txt
|
||||||
|
+++ b/unitree_lidar_ros2/src/unitree_lidar_ros2/CMakeLists.txt
|
||||||
|
@@ -23,16 +23,15 @@ find_package(pcl_conversions REQUIRED)
|
||||||
|
find_package(PCL REQUIRED)
|
||||||
|
find_package(tf2_ros REQUIRED)
|
||||||
|
find_package(sensor_msgs REQUIRED)
|
||||||
|
+find_package(unitree_lidar_sdk REQUIRED)
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
${PCL_INCLUDE_DIRS}
|
||||||
|
include
|
||||||
|
- ../../../unitree_lidar_sdk/include
|
||||||
|
)
|
||||||
|
|
||||||
|
link_directories(
|
||||||
|
${PCL_LIBRARY_DIRS}
|
||||||
|
- ../../../unitree_lidar_sdk/lib/${CMAKE_SYSTEM_PROCESSOR}
|
||||||
|
)
|
||||||
|
|
||||||
|
add_definitions(${PCL_DEFINITIONS})
|
||||||
|
@@ -42,7 +41,6 @@ add_executable(unitree_lidar_ros2_node src/unitree_lidar_ros2_node.cpp)
|
||||||
|
target_link_libraries( unitree_lidar_ros2_node
|
||||||
|
${Boost_SYSTEM_LIBRARY}
|
||||||
|
${PCL_LIBRARIES}
|
||||||
|
- libunilidar_sdk2.a
|
||||||
|
)
|
||||||
|
|
||||||
|
ament_target_dependencies(
|
||||||
|
@@ -52,6 +50,7 @@ ament_target_dependencies(
|
||||||
|
geometry_msgs
|
||||||
|
tf2_ros
|
||||||
|
pcl_conversions
|
||||||
|
+ unitree_lidar_sdk
|
||||||
|
)
|
||||||
|
|
||||||
|
install(TARGETS
|
||||||
|
diff --git a/unitree_lidar_ros2/src/unitree_lidar_ros2/package.xml b/unitree_lidar_ros2/src/unitree_lidar_ros2/package.xml
|
||||||
|
index 74539aa..b5febb2 100644
|
||||||
|
--- a/unitree_lidar_ros2/src/unitree_lidar_ros2/package.xml
|
||||||
|
+++ b/unitree_lidar_ros2/src/unitree_lidar_ros2/package.xml
|
||||||
|
@@ -21,6 +21,7 @@
|
||||||
|
|
||||||
|
<depend>geometry_msgs</depend>
|
||||||
|
<depend>tf2_ros</depend>
|
||||||
|
+ <depend>unitree_lidar_sdk</depend>
|
||||||
|
|
||||||
|
<export>
|
||||||
|
<build_type>ament_cmake</build_type>
|
||||||
|
diff --git a/unitree_lidar_sdk/CMakeLists.txt b/unitree_lidar_sdk/CMakeLists.txt
|
||||||
|
index 80af9c9..0d9a334 100644
|
||||||
|
--- a/unitree_lidar_sdk/CMakeLists.txt
|
||||||
|
+++ b/unitree_lidar_sdk/CMakeLists.txt
|
||||||
|
@@ -1,39 +1,14 @@
|
||||||
|
-cmake_minimum_required(VERSION 3.0)
|
||||||
|
+cmake_minimum_required(VERSION 3.5)
|
||||||
|
project(unitree_lidar_sdk)
|
||||||
|
|
||||||
|
-set(CMAKE_BUILD_TYPE "Release")
|
||||||
|
-set(CMAKE_CXX_FLAGS "-std=c++17")
|
||||||
|
-set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb")
|
||||||
|
-set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall -DNDEBUG")
|
||||||
|
+find_package(ament_cmake REQUIRED)
|
||||||
|
|
||||||
|
-include_directories(include)
|
||||||
|
+# Install the SDK headers and the architecture-specific prebuilt static library.
|
||||||
|
+install(DIRECTORY include/ DESTINATION include/${PROJECT_NAME})
|
||||||
|
+install(FILES lib/${CMAKE_SYSTEM_PROCESSOR}/libunilidar_sdk2.a DESTINATION lib)
|
||||||
|
|
||||||
|
-link_directories(lib/${CMAKE_SYSTEM_PROCESSOR})
|
||||||
|
+# Export them so ament packages can consume the SDK via find_package().
|
||||||
|
+ament_export_include_directories(include/${PROJECT_NAME})
|
||||||
|
+ament_export_libraries(unilidar_sdk2)
|
||||||
|
|
||||||
|
-SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
|
||||||
|
-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib/${CMAKE_SYSTEM_PROCESSOR})
|
||||||
|
-
|
||||||
|
-add_executable(example_lidar_udp
|
||||||
|
- examples/example_lidar_udp.cpp
|
||||||
|
-)
|
||||||
|
-target_link_libraries(example_lidar_udp libunilidar_sdk2.a )
|
||||||
|
-
|
||||||
|
-add_executable(example_lidar_serial
|
||||||
|
- examples/example_lidar_serial.cpp
|
||||||
|
-)
|
||||||
|
-target_link_libraries(example_lidar_serial libunilidar_sdk2.a )
|
||||||
|
-
|
||||||
|
-add_executable(set_ip_address
|
||||||
|
- examples/set_ip_address.cpp
|
||||||
|
-)
|
||||||
|
-target_link_libraries(set_ip_address libunilidar_sdk2.a )
|
||||||
|
-
|
||||||
|
-add_executable(set_to_serial_mode
|
||||||
|
- examples/set_to_serial_mode.cpp
|
||||||
|
-)
|
||||||
|
-target_link_libraries(set_to_serial_mode libunilidar_sdk2.a )
|
||||||
|
-
|
||||||
|
-add_executable(set_to_udp_mode
|
||||||
|
- examples/set_to_udp_mode.cpp
|
||||||
|
-)
|
||||||
|
-target_link_libraries(set_to_udp_mode libunilidar_sdk2.a )
|
||||||
|
\ No newline at end of file
|
||||||
|
+ament_package()
|
||||||
|
\ No newline at end of file
|
||||||
Reference in New Issue
Block a user