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);