From 6148cd3c33ae39adbd7e12faf82567fa8f8e7b0d Mon Sep 17 00:00:00 2001 From: David Hu Date: Sun, 12 Mar 2023 02:57:06 +0800 Subject: [PATCH] =?UTF-8?q?[update]=E4=BF=AE=E5=A4=8D=E4=B8=8A=E6=AC=A1?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=8F=91=E7=8E=B0=E7=9A=84bug=EF=BC=8C?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=B0=E5=9E=8B=E5=8F=B7=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=96=87=E6=A1=A3=EF=BC=8C=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=AD=90=E9=A1=B9=E7=9B=AECMake=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=96=B9=E4=BE=BF=E5=BC=80=E5=8F=91=E8=80=85=E5=BC=95?= =?UTF-8?q?=E7=94=A8(=E7=89=88=E6=9C=AC=E5=8F=B7v3.3.1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 47 +++++++++++++++++++++++ README.md | 1 + include/ldlidar_driver/ldlidar_datatype.h | 2 +- sample/linux/CMakeLists.txt | 2 +- sample/linux/README.md | 2 + sample/linux/README_CN.md | 2 + sample/linux/demo.cpp | 4 +- sample/windows/windemo.cpp | 5 ++- test/test.cpp | 4 +- 9 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..10402d4 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,47 @@ +# sub project +message(STATUS "operation system is ${CMAKE_SYSTEM}") + +if(CMAKE_SYSTEM_NAME MATCHES "Linux") +message(STATUS "current platform: Linux ") + +set(LDLIDAR_DRIVER_SOURCE_LINUX + ${CMAKE_CURRENT_SOURCE_DIR}/src/ldlidar_driver.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/ldlidar_driver_linux.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/ldlidar_dataprocess.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/ldlidar_protocol.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/log_module.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/network_socket_interface_linux.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/serial_interface_linux.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/sl_transform.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/slbf.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/tofbf.cpp +) + +add_library(ldlidar_driver STATIC + ${LDLIDAR_DRIVER_SOURCE_LINUX} +) + +elseif(CMAKE_SYSTEM_NAME MATCHES "Windows") +message(STATUS "current platform: Windows") + +set(LDLIDAR_DRIVER_SOURCE_WIN + ${CMAKE_CURRENT_SOURCE_DIR}/src/ldlidar_driver.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/ldlidar_driver_win.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/ldlidar_dataprocess.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/ldlidar_protocol.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/log_module.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/serial_interface_win.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/sl_transform.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/slbf.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/tofbf.cpp +) + +add_library(ldlidar_driver STATIC + ${LDLIDAR_DRIVER_SOURCE_WIN} +) + +else() + message(STATUS "other platform: ${CMAKE_SYSTEM_NAME}") +endif (CMAKE_SYSTEM_NAME MATCHES "Linux") + + diff --git a/README.md b/README.md index 0ac9c85..c2e62df 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ This SDK is only applicable to the LiDAR products sold by Shenzhen LDROBOT Co., | LDROBOT LiDAR LD06 | 2D DTOF | | LDROBOT LiDAR LD19 | 2D DTOF | | LDROBOT LiDAR LD14 | 2D Triangle| +| LDROBOT LiDAR LD14P | 2D Triangle| --- ## Get SDK diff --git a/include/ldlidar_driver/ldlidar_datatype.h b/include/ldlidar_driver/ldlidar_datatype.h index 6bee73a..1def671 100644 --- a/include/ldlidar_driver/ldlidar_datatype.h +++ b/include/ldlidar_driver/ldlidar_datatype.h @@ -27,7 +27,7 @@ #include #include -#define LDLiDAR_SDK_VERSION_NUMBER "3.3.0" +#define LDLiDAR_SDK_VERSION_NUMBER "3.3.1" #define ANGLE_TO_RADIAN(angle) ((angle)*3141.59 / 180000) diff --git a/sample/linux/CMakeLists.txt b/sample/linux/CMakeLists.txt index 04b72f3..452385b 100644 --- a/sample/linux/CMakeLists.txt +++ b/sample/linux/CMakeLists.txt @@ -29,7 +29,7 @@ include_directories( set(LDLIDAR_DRIVER_SOURCE_LINUX ${CMAKE_CURRENT_SOURCE_DIR}/../../src/ldlidar_driver.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../../src/ldlidar_driver_linux.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/../../src/lipkg.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../../src/ldlidar_dataprocess.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../../src/ldlidar_protocol.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../../src/log_module.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../../src/network_socket_interface_linux.cpp diff --git a/sample/linux/README.md b/sample/linux/README.md index 9b1c70f..30a0d94 100644 --- a/sample/linux/README.md +++ b/sample/linux/README.md @@ -23,6 +23,8 @@ $ ./build/ldlidar # example: # LDLiDAR LD14 $ ./build/ldlidar LD14 /dev/ttyUSB0 +# LDLiDAR LD14P +$ ./build/ldlidar LD14P /dev/ttyUSB0 # LDLiDAR LD06 $ ./build/ldlidar LD06 /dev/ttyUSB0 # LDLiDAR LD19 diff --git a/sample/linux/README_CN.md b/sample/linux/README_CN.md index 9368ed6..2399d76 100644 --- a/sample/linux/README_CN.md +++ b/sample/linux/README_CN.md @@ -23,6 +23,8 @@ $ ./build/ldlidar # example: # LDLiDAR LD14 $ ./build/ldlidar LD14 /dev/ttyUSB0 +# LDLiDAR LD14P +$ ./build/ldlidar LD14P /dev/ttyUSB0 # LDLiDAR LD06 $ ./build/ldlidar LD06 /dev/ttyUSB0 # LDLiDAR LD19 diff --git a/sample/linux/demo.cpp b/sample/linux/demo.cpp index e92eb0b..2b6ed20 100644 --- a/sample/linux/demo.cpp +++ b/sample/linux/demo.cpp @@ -44,8 +44,9 @@ struct LdsInfoStruct { uint32_t baudrate; }; -LdsInfoStruct LdsInfoArrary[3] = { +LdsInfoStruct LdsInfoArrary[4] = { {"LD14", ldlidar::LDType::LD_14, 115200}, + {"LD14P", ldlidar::LDType::LD_14P, 230400}, {"LD06", ldlidar::LDType::LD_06, 230400}, {"LD19", ldlidar::LDType::LD_19, 230400}, }; @@ -75,6 +76,7 @@ int main(int argc, char **argv) { LOG_INFO("please input: ./ldlidar ",""); LOG_INFO("example:",""); LOG_INFO("./ldlidar LD14 /dev/ttyUSB0",""); + LOG_INFO("./ldlidar LD14P /dev/ttyUSB0",""); LOG_INFO("./ldlidar LD06 /dev/ttyUSB0",""); LOG_INFO("./ldlidar LD19 /dev/ttyUSB0",""); exit(EXIT_FAILURE); diff --git a/sample/windows/windemo.cpp b/sample/windows/windemo.cpp index 26ed575..1c35ff0 100644 --- a/sample/windows/windemo.cpp +++ b/sample/windows/windemo.cpp @@ -37,11 +37,12 @@ int main(int argc, char** argv) { uint32_t baudrate; }; - const int inf_array_size = 3; + const int inf_array_size = 4; lidar_inf_struct inf_array[inf_array_size] = { {0, "LDLiDAR LD06", ldlidar::LDType::LD_06, 230400}, {1, "LDLiDAR LD14", ldlidar::LDType::LD_14, 115200}, - {2, "LDLiDAR LD19", ldlidar::LDType::LD_19, 230400}}; + {2, "LDLiDAR LD14P", ldlidar::LDType::LD_14P, 230400}, + {3, "LDLiDAR LD19", ldlidar::LDType::LD_19, 230400}}; printf("The SDK support ldlidar product:\n"); for (auto inf_base : inf_array) { diff --git a/test/test.cpp b/test/test.cpp index 2fa4e45..df0f126 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -68,8 +68,9 @@ struct LdsInfoStruct { uint32_t baudrate; }; -LdsInfoStruct LdsInfoArrary[3] = { +LdsInfoStruct LdsInfoArrary[4] = { {"LD14", ldlidar::LDType::LD_14, 115200}, + {"LD14P", ldlidar::LDType::LD_14P, 230400}, {"LD06", ldlidar::LDType::LD_06, 230400}, {"LD19", ldlidar::LDType::LD_19, 230400}, }; @@ -99,6 +100,7 @@ int test(int argc, char **argv) { LOG_INFO("please input: ./test_node ",""); LOG_INFO("example:",""); LOG_INFO("./test_node LD14 /dev/ttyUSB0",""); + LOG_INFO("./test_node LD14P /dev/ttyUSB0",""); LOG_INFO("./test_node LD06 /dev/ttyUSB0",""); LOG_INFO("./test_node LD19 /dev/ttyUSB0",""); exit(EXIT_FAILURE);