build: vendor the Slamtec rplidar SDK in third_party
The repo is now self-contained: driver_rplidar compiles the SDK from third_party/rplidar_sdk (Linux sources only, teardown delete[] bug fixed in place), so a plain cmake configure needs no SDK path and no probing — the XLIDAR_RPLIDAR_SDK_DIR option and external references are gone. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,35 +1,12 @@
|
||||
# The rplidar plugin compiles the vendor SDK straight into the plugin .so.
|
||||
# XLIDAR_RPLIDAR_SDK_DIR must point at a directory holding include/ + src/;
|
||||
# when unset, common local layouts are probed. Without an SDK the plugin is
|
||||
# skipped (the rest of the build is unaffected).
|
||||
|
||||
if(NOT XLIDAR_RPLIDAR_SDK_DIR)
|
||||
foreach(candidate
|
||||
${CMAKE_SOURCE_DIR}/third_party/rplidar_sdk
|
||||
${CMAKE_SOURCE_DIR}/../rplidar_sdk/sdk
|
||||
${CMAKE_SOURCE_DIR}/../xloc-monorepo/xlocd/deps/rplidar_sdk)
|
||||
if(EXISTS ${candidate}/include/sl_lidar.h)
|
||||
set(XLIDAR_RPLIDAR_SDK_DIR ${candidate})
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(NOT XLIDAR_RPLIDAR_SDK_DIR OR NOT EXISTS ${XLIDAR_RPLIDAR_SDK_DIR}/include/sl_lidar.h)
|
||||
message(WARNING "driver_rplidar: Slamtec SDK not found "
|
||||
"(set -DXLIDAR_RPLIDAR_SDK_DIR=...) — plugin skipped")
|
||||
return()
|
||||
endif()
|
||||
|
||||
message(STATUS "driver_rplidar: using SDK at ${XLIDAR_RPLIDAR_SDK_DIR}")
|
||||
# Compiles the vendored Slamtec SDK (third_party/rplidar_sdk) straight into
|
||||
# the plugin .so — no external dependency.
|
||||
set(RPLIDAR_SDK_DIR ${CMAKE_SOURCE_DIR}/third_party/rplidar_sdk)
|
||||
|
||||
file(GLOB_RECURSE RPLIDAR_SDK_SOURCES CONFIGURE_DEPENDS
|
||||
${XLIDAR_RPLIDAR_SDK_DIR}/src/*.cpp)
|
||||
# The SDK ships win32/macOS arch files; keep Linux only.
|
||||
list(FILTER RPLIDAR_SDK_SOURCES EXCLUDE REGEX "arch/(win32|macOS)/")
|
||||
${RPLIDAR_SDK_DIR}/src/*.cpp)
|
||||
|
||||
xlidar_add_plugin(driver_rplidar rplidar_driver.cpp ${RPLIDAR_SDK_SOURCES})
|
||||
target_include_directories(driver_rplidar SYSTEM PRIVATE
|
||||
${XLIDAR_RPLIDAR_SDK_DIR}/include
|
||||
${XLIDAR_RPLIDAR_SDK_DIR}/src
|
||||
${RPLIDAR_SDK_DIR}/include
|
||||
${RPLIDAR_SDK_DIR}/src
|
||||
)
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
// Slamtec RPLIDAR over serial (C1 defaults), built on the vendor SDK
|
||||
// (sl_lidar.h). Ported from xlocd's embedded rplidar driver — the scan math
|
||||
// (angle/distance decoding, inversion, FOV window, NaN invalid points) is
|
||||
// kept identical.
|
||||
// Slamtec RPLIDAR over serial (C1 defaults), built on the vendored SDK
|
||||
// (third_party/rplidar_sdk, sl_lidar.h). Scan math: angle/distance decoding,
|
||||
// inversion, FOV window, invalid points as NaN.
|
||||
//
|
||||
// Unlike the network drivers, angles are reported in the DEVICE frame
|
||||
// [0, 2π), 0 = ahead, ascending — exactly what the SDK's ascendScanData
|
||||
// yields (and what xlocd's engine expects).
|
||||
// yields.
|
||||
#include "lidar_interface.hpp"
|
||||
#include "plugin_helpers.hpp"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user