diff --git a/.gitignore b/.gitignore index 5555f3e..918269d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .vs *.sdf +sdk/obj +**/ipch diff --git a/README.md b/README.md index f89bee2..111043e 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ The demo applications are licensed under GPLv3 license. Release Notes ------------- +* [v1.10.0](https://github.com/slamtec/rplidar_sdk/blob/master/docs/ReleaseNote.v1.10.0.md) * [v1.9.1](https://github.com/slamtec/rplidar_sdk/blob/master/docs/ReleaseNote.v1.9.1.md) * [v1.9.0](https://github.com/slamtec/rplidar_sdk/blob/master/docs/ReleaseNote.v1.9.0.md) * [v1.8.1](https://github.com/slamtec/rplidar_sdk/blob/master/docs/ReleaseNote.v1.8.1.md) diff --git a/docs/ReleaseNote.v1.10.0.md b/docs/ReleaseNote.v1.10.0.md new file mode 100644 index 0000000..8791b85 --- /dev/null +++ b/docs/ReleaseNote.v1.10.0.md @@ -0,0 +1,3 @@ +RPLIDAR Public SDK v1.10.0 Release Note +====================================== +- [new feature] support Rplidar S1 diff --git a/sdk/app/frame_grabber/AboutDlg.cpp b/sdk/app/frame_grabber/AboutDlg.cpp index 1f54424..12faa01 100644 --- a/sdk/app/frame_grabber/AboutDlg.cpp +++ b/sdk/app/frame_grabber/AboutDlg.cpp @@ -4,7 +4,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/app/frame_grabber/AboutDlg.h b/sdk/app/frame_grabber/AboutDlg.h index c1f6b1a..78f8e82 100644 --- a/sdk/app/frame_grabber/AboutDlg.h +++ b/sdk/app/frame_grabber/AboutDlg.h @@ -4,7 +4,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/app/frame_grabber/MainFrm.cpp b/sdk/app/frame_grabber/MainFrm.cpp index 541bd67..fb49389 100644 --- a/sdk/app/frame_grabber/MainFrm.cpp +++ b/sdk/app/frame_grabber/MainFrm.cpp @@ -4,7 +4,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/app/frame_grabber/MainFrm.h b/sdk/app/frame_grabber/MainFrm.h index 48c190e..05d12f8 100644 --- a/sdk/app/frame_grabber/MainFrm.h +++ b/sdk/app/frame_grabber/MainFrm.h @@ -4,7 +4,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/app/frame_grabber/SerialSelDlg.cpp b/sdk/app/frame_grabber/SerialSelDlg.cpp index 5ad3d56..b747772 100644 --- a/sdk/app/frame_grabber/SerialSelDlg.cpp +++ b/sdk/app/frame_grabber/SerialSelDlg.cpp @@ -4,7 +4,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/app/frame_grabber/SerialSelDlg.h b/sdk/app/frame_grabber/SerialSelDlg.h index 1dabde5..c37e8b5 100644 --- a/sdk/app/frame_grabber/SerialSelDlg.h +++ b/sdk/app/frame_grabber/SerialSelDlg.h @@ -4,7 +4,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/app/frame_grabber/drvlogic/common.h b/sdk/app/frame_grabber/drvlogic/common.h index 6370139..45368a1 100644 --- a/sdk/app/frame_grabber/drvlogic/common.h +++ b/sdk/app/frame_grabber/drvlogic/common.h @@ -4,7 +4,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/app/frame_grabber/drvlogic/lidarmgr.cpp b/sdk/app/frame_grabber/drvlogic/lidarmgr.cpp index 1e6b6e0..b4dff4c 100644 --- a/sdk/app/frame_grabber/drvlogic/lidarmgr.cpp +++ b/sdk/app/frame_grabber/drvlogic/lidarmgr.cpp @@ -4,7 +4,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/app/frame_grabber/drvlogic/lidarmgr.h b/sdk/app/frame_grabber/drvlogic/lidarmgr.h index fd2c161..c8c01f7 100644 --- a/sdk/app/frame_grabber/drvlogic/lidarmgr.h +++ b/sdk/app/frame_grabber/drvlogic/lidarmgr.h @@ -4,7 +4,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/app/frame_grabber/framegrabber.cpp b/sdk/app/frame_grabber/framegrabber.cpp index 6563bef..e7c2ae9 100644 --- a/sdk/app/frame_grabber/framegrabber.cpp +++ b/sdk/app/frame_grabber/framegrabber.cpp @@ -4,7 +4,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/app/frame_grabber/framegrabber.rc b/sdk/app/frame_grabber/framegrabber.rc index 12cfb2f..c54cf40 100644 --- a/sdk/app/frame_grabber/framegrabber.rc +++ b/sdk/app/frame_grabber/framegrabber.rc @@ -131,7 +131,7 @@ CAPTION "About" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN DEFPUSHBUTTON "OK",IDOK,176,73,50,14 - LTEXT "RPLIDAR(R) System Win32 Demo Application\n\nVersion: 1.9.0\n\nCopyright(C) 2009 - 2013 RoboPeak Team\nCopyright(C) 2013 - 2018 Shanghai Slamtec Co. Ltd.\nhttp://www.slamtec.com",IDC_STATIC,45,14,172,57 + LTEXT "RPLIDAR(R) System Win32 Demo Application\n\nVersion: 1.10.0\n\nCopyright(C) 2009 - 2013 RoboPeak Team\nCopyright(C) 2013 - 2019 Shanghai Slamtec Co. Ltd.\nhttp://www.slamtec.com",IDC_STATIC,45,14,172,57 ICON IDR_MAINFRAME,IDC_STATIC,17,15,20,20 END @@ -284,8 +284,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,9,0,0 - PRODUCTVERSION 1,9,0,0 + FILEVERSION 1,10,0,0 + PRODUCTVERSION 1,10,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -301,12 +301,12 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "FileDescription", "framegrabber Module" - VALUE "FileVersion", "1.9.0.0" + VALUE "FileVersion", "1.10.0.0" VALUE "InternalName", "framegrabber" VALUE "LegalCopyright", "Copyright 2012" VALUE "OriginalFilename", "framegrabber.exe" VALUE "ProductName", "framegrabber Module" - VALUE "ProductVersion", "1.9.0.0" + VALUE "ProductVersion", "1.10.0.0" END END BLOCK "VarFileInfo" diff --git a/sdk/app/frame_grabber/scanView.cpp b/sdk/app/frame_grabber/scanView.cpp index 06dcc9b..9c6e2e7 100644 --- a/sdk/app/frame_grabber/scanView.cpp +++ b/sdk/app/frame_grabber/scanView.cpp @@ -4,7 +4,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/app/frame_grabber/scanView.h b/sdk/app/frame_grabber/scanView.h index 3e5dd6b..e439013 100644 --- a/sdk/app/frame_grabber/scanView.h +++ b/sdk/app/frame_grabber/scanView.h @@ -4,7 +4,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/app/frame_grabber/stdafx.cpp b/sdk/app/frame_grabber/stdafx.cpp index 44e9e25..6fc6930 100644 --- a/sdk/app/frame_grabber/stdafx.cpp +++ b/sdk/app/frame_grabber/stdafx.cpp @@ -4,7 +4,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/app/frame_grabber/stdafx.h b/sdk/app/frame_grabber/stdafx.h index 2854920..8950c40 100644 --- a/sdk/app/frame_grabber/stdafx.h +++ b/sdk/app/frame_grabber/stdafx.h @@ -4,7 +4,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/app/simple_grabber/main.cpp b/sdk/app/simple_grabber/main.cpp index fbf34a9..1be2e99 100644 --- a/sdk/app/simple_grabber/main.cpp +++ b/sdk/app/simple_grabber/main.cpp @@ -4,7 +4,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/app/ultra_simple/main.cpp b/sdk/app/ultra_simple/main.cpp index b6f2df7..ee62bb8 100644 --- a/sdk/app/ultra_simple/main.cpp +++ b/sdk/app/ultra_simple/main.cpp @@ -4,7 +4,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/sdk/Makefile b/sdk/sdk/Makefile index bb3ec55..dab98ad 100644 --- a/sdk/sdk/Makefile +++ b/sdk/sdk/Makefile @@ -1,19 +1,34 @@ #/* -# * Copyright (C) 2014 RoboPeak -# * Copyright (C) 2014 - 2018 Shanghai Slamtec Co., Ltd. +# * RPLIDAR SDK # * -# * This program is free software: you can redistribute it and/or modify -# * it under the terms of the GNU General Public License as published by -# * the Free Software Foundation, either version 3 of the License, or -# * (at your option) any later version. +# * Copyright (c) 2009 - 2014 RoboPeak Team +# * http://www.robopeak.com +# * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. +# * http://www.slamtec.com # * -# * This program is distributed in the hope that it will be useful, -# * but WITHOUT ANY WARRANTY; without even the implied warranty of -# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# * GNU General Public License for more details. +# */ +#/* +# * Redistribution and use in source and binary forms, with or without +# * modification, are permitted provided that the following conditions are met: +# * +# * 1. Redistributions of source code must retain the above copyright notice, +# * this list of conditions and the following disclaimer. +# * +# * 2. Redistributions in binary form must reproduce the above copyright notice, +# * this list of conditions and the following disclaimer in the documentation +# * and/or other materials provided with the distribution. # * -# * You should have received a copy of the GNU General Public License -# * along with this program. If not, see . +# * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +# * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # * # */ # diff --git a/sdk/sdk/include/rplidar.h b/sdk/sdk/include/rplidar.h index 660a5e1..4e14aa0 100644 --- a/sdk/sdk/include/rplidar.h +++ b/sdk/sdk/include/rplidar.h @@ -3,7 +3,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ @@ -41,4 +41,4 @@ #include "rplidar_driver.h" -#define RPLIDAR_SDK_VERSION "1.9.0" +#define RPLIDAR_SDK_VERSION "1.10.0" diff --git a/sdk/sdk/include/rplidar_cmd.h b/sdk/sdk/include/rplidar_cmd.h index 2aadfbb..cfe0760 100644 --- a/sdk/sdk/include/rplidar_cmd.h +++ b/sdk/sdk/include/rplidar_cmd.h @@ -3,7 +3,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ @@ -127,7 +127,7 @@ typedef struct _rplidar_payload_acc_board_flag_t { //added in FW ver 1.24 #define RPLIDAR_ANS_TYPE_GET_LIDAR_CONF 0x20 #define RPLIDAR_ANS_TYPE_SET_LIDAR_CONF 0x21 - +#define RPLIDAR_ANS_TYPE_MEASUREMENT_DENSE_CAPSULED 0x85 #define RPLIDAR_ANS_TYPE_ACC_BOARD_FLAG 0xFF #define RPLIDAR_RESP_ACC_BOARD_FLAG_MOTOR_CTRL_SUPPORT_MASK (0x1) @@ -183,6 +183,18 @@ typedef struct _rplidar_response_capsule_measurement_nodes_t { _u16 start_angle_sync_q6; rplidar_response_cabin_nodes_t cabins[16]; } __attribute__((packed)) rplidar_response_capsule_measurement_nodes_t; + +typedef struct _rplidar_response_dense_cabin_nodes_t { + _u16 distance; +} __attribute__((packed)) rplidar_response_dense_cabin_nodes_t; + +typedef struct _rplidar_response_dense_capsule_measurement_nodes_t { + _u8 s_checksum_1; // see [s_checksum_1] + _u8 s_checksum_2; // see [s_checksum_1] + _u16 start_angle_sync_q6; + rplidar_response_dense_cabin_nodes_t cabins[40]; +} __attribute__((packed)) rplidar_response_dense_capsule_measurement_nodes_t; + // ext1 : x2 boost mode #define RPLIDAR_RESP_MEASUREMENT_EXP_ULTRA_MAJOR_BITS 12 diff --git a/sdk/sdk/include/rplidar_driver.h b/sdk/sdk/include/rplidar_driver.h index 8db3228..b73b845 100644 --- a/sdk/sdk/include/rplidar_driver.h +++ b/sdk/sdk/include/rplidar_driver.h @@ -3,7 +3,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ @@ -132,6 +132,7 @@ class RPlidarDriver { /// \param timeout The operation timeout value (in millisecond) for the serial port communication virtual u_result reset(_u32 timeout = DEFAULT_TIMEOUT) = 0; + virtual u_result clearNetSerialRxCache() = 0; // FW1.24 /// Get all scan modes that supported by lidar virtual u_result getAllSupportedScanModes(std::vector& outModes, _u32 timeoutInMs = DEFAULT_TIMEOUT) = 0; diff --git a/sdk/sdk/include/rplidar_protocol.h b/sdk/sdk/include/rplidar_protocol.h index be2dba3..2f8231b 100644 --- a/sdk/sdk/include/rplidar_protocol.h +++ b/sdk/sdk/include/rplidar_protocol.h @@ -3,7 +3,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/sdk/include/rptypes.h b/sdk/sdk/include/rptypes.h index 5036eef..34d8ecb 100644 --- a/sdk/sdk/include/rptypes.h +++ b/sdk/sdk/include/rptypes.h @@ -3,7 +3,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/sdk/src/arch/linux/net_socket.cpp b/sdk/sdk/src/arch/linux/net_socket.cpp index 4b17671..0124a13 100644 --- a/sdk/sdk/src/arch/linux/net_socket.cpp +++ b/sdk/sdk/src/arch/linux/net_socket.cpp @@ -1,35 +1,9 @@ /* - * RPLIDAR SDK - * - * Copyright (c) 2009 - 2014 RoboPeak Team - * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. - * http://www.slamtec.com - * - */ -/* - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * RoboPeak Project + * HAL Layer - Socket Interface + * Copyright 2009 - 2013 RoboPeak Project * + * POXIS Implementation */ diff --git a/sdk/sdk/src/arch/win32/arch_win32.h b/sdk/sdk/src/arch/win32/arch_win32.h index d17b0b4..10852f3 100644 --- a/sdk/sdk/src/arch/win32/arch_win32.h +++ b/sdk/sdk/src/arch/win32/arch_win32.h @@ -3,7 +3,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/sdk/src/arch/win32/net_serial.cpp b/sdk/sdk/src/arch/win32/net_serial.cpp index a0a6824..7a35a17 100644 --- a/sdk/sdk/src/arch/win32/net_serial.cpp +++ b/sdk/sdk/src/arch/win32/net_serial.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/sdk/src/arch/win32/net_serial.h b/sdk/sdk/src/arch/win32/net_serial.h index ffa4265..a390f94 100644 --- a/sdk/sdk/src/arch/win32/net_serial.h +++ b/sdk/sdk/src/arch/win32/net_serial.h @@ -3,7 +3,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/sdk/src/arch/win32/net_socket.cpp b/sdk/sdk/src/arch/win32/net_socket.cpp index 1826c0e..c2968b6 100644 --- a/sdk/sdk/src/arch/win32/net_socket.cpp +++ b/sdk/sdk/src/arch/win32/net_socket.cpp @@ -1,35 +1,9 @@ /* - * RPLIDAR SDK - * - * Copyright (c) 2009 - 2014 RoboPeak Team - * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. - * http://www.slamtec.com - * - */ -/* - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * RoboPeak Project + * HAL Layer - Socket Interface + * Copyright 2009 - 2013 RoboPeak Project * + * Win32 Implementation */ #define _WINSOCKAPI_ diff --git a/sdk/sdk/src/arch/win32/timer.cpp b/sdk/sdk/src/arch/win32/timer.cpp index f85a15b..b95c054 100644 --- a/sdk/sdk/src/arch/win32/timer.cpp +++ b/sdk/sdk/src/arch/win32/timer.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/sdk/src/arch/win32/timer.h b/sdk/sdk/src/arch/win32/timer.h index 11bba61..59b3982 100644 --- a/sdk/sdk/src/arch/win32/timer.h +++ b/sdk/sdk/src/arch/win32/timer.h @@ -3,7 +3,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/sdk/src/arch/win32/winthread.hpp b/sdk/sdk/src/arch/win32/winthread.hpp index 673eeaf..604f1d3 100644 --- a/sdk/sdk/src/arch/win32/winthread.hpp +++ b/sdk/sdk/src/arch/win32/winthread.hpp @@ -3,7 +3,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/sdk/src/hal/abs_rxtx.h b/sdk/sdk/src/hal/abs_rxtx.h index 4cb7832..3c0e837 100644 --- a/sdk/sdk/src/hal/abs_rxtx.h +++ b/sdk/sdk/src/hal/abs_rxtx.h @@ -3,7 +3,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/sdk/src/hal/event.h b/sdk/sdk/src/hal/event.h index 27362ee..5e05234 100644 --- a/sdk/sdk/src/hal/event.h +++ b/sdk/sdk/src/hal/event.h @@ -3,7 +3,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/sdk/src/hal/locker.h b/sdk/sdk/src/hal/locker.h index ce8d98f..d7a13fb 100644 --- a/sdk/sdk/src/hal/locker.h +++ b/sdk/sdk/src/hal/locker.h @@ -3,7 +3,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/sdk/src/hal/thread.cpp b/sdk/sdk/src/hal/thread.cpp index 28064af..16ccb90 100644 --- a/sdk/sdk/src/hal/thread.cpp +++ b/sdk/sdk/src/hal/thread.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/sdk/src/hal/thread.h b/sdk/sdk/src/hal/thread.h index 167c5a4..94074b8 100644 --- a/sdk/sdk/src/hal/thread.h +++ b/sdk/sdk/src/hal/thread.h @@ -3,7 +3,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/sdk/src/hal/util.h b/sdk/sdk/src/hal/util.h index 72700aa..2882b1d 100644 --- a/sdk/sdk/src/hal/util.h +++ b/sdk/sdk/src/hal/util.h @@ -3,7 +3,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/sdk/src/rplidar_driver.cpp b/sdk/sdk/src/rplidar_driver.cpp index c8a08b8..1cc6774 100644 --- a/sdk/sdk/src/rplidar_driver.cpp +++ b/sdk/sdk/src/rplidar_driver.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ @@ -132,6 +132,16 @@ u_result RPlidarDriverImplCommon::reset(_u32 timeout) return RESULT_OK; } + +u_result RPlidarDriverImplCommon::clearNetSerialRxCache() +{ + if (!isConnected()) return RESULT_OPERATION_FAIL; + + _chanDev->flush(); + + return RESULT_OK; +} + u_result RPlidarDriverImplCommon::_waitResponseHeader(rplidar_ans_header_t * header, _u32 timeout) { int recvPos = 0; @@ -671,9 +681,17 @@ u_result RPlidarDriverImplCommon::_cacheCapsuledScanData() continue; } } + switch (_cached_express_flag) + { + case 0: + _capsuleToNormal(capsule_node, local_buf, count); + break; + case 1: + _dense_capsuleToNormal(capsule_node, local_buf, count); + break; + } + // - _capsuleToNormal(capsule_node, local_buf, count); - for (size_t pos = 0; pos < count; ++pos) { if (local_buf[pos].flag & RPLIDAR_RESP_MEASUREMENT_SYNCBIT) @@ -821,7 +839,55 @@ void RPlidarDriverImplCommon::_capsuleToNormal(const rplidar_response_capsul _is_previous_capsuledataRdy = true; } -//*******************************************HQ support******************************** +void RPlidarDriverImplCommon::_dense_capsuleToNormal(const rplidar_response_capsule_measurement_nodes_t & capsule, rplidar_response_measurement_node_hq_t *nodebuffer, size_t &nodeCount) +{ + const rplidar_response_dense_capsule_measurement_nodes_t *dense_capsule = reinterpret_cast(&capsule); + nodeCount = 0; + if (_is_previous_capsuledataRdy) { + int diffAngle_q8; + int currentStartAngle_q8 = ((dense_capsule->start_angle_sync_q6 & 0x7FFF) << 2); + int prevStartAngle_q8 = ((_cached_previous_dense_capsuledata.start_angle_sync_q6 & 0x7FFF) << 2); + + diffAngle_q8 = (currentStartAngle_q8)-(prevStartAngle_q8); + if (prevStartAngle_q8 > currentStartAngle_q8) { + diffAngle_q8 += (360 << 8); + } + + int angleInc_q16 = (diffAngle_q8 << 8)/40; + int currentAngle_raw_q16 = (prevStartAngle_q8 << 8); + for (size_t pos = 0; pos < _countof(_cached_previous_dense_capsuledata.cabins); ++pos) + { + int dist_q2; + int angle_q6; + int syncBit; + const int dist = static_cast(_cached_previous_dense_capsuledata.cabins[pos].distance); + dist_q2 = dist << 2; + angle_q6 = (currentAngle_raw_q16 >> 10); + syncBit = (((currentAngle_raw_q16 + angleInc_q16) % (360 << 16)) < angleInc_q16) ? 1 : 0; + currentAngle_raw_q16 += angleInc_q16; + + if (angle_q6 < 0) angle_q6 += (360 << 6); + if (angle_q6 >= (360 << 6)) angle_q6 -= (360 << 6); + + + + rplidar_response_measurement_node_hq_t node; + + node.angle_z_q14 = _u16((angle_q6 << 8) / 90); + node.flag = (syncBit | ((!syncBit) << 1)); + node.quality = dist_q2 ? (0x2f << RPLIDAR_RESP_MEASUREMENT_QUALITY_SHIFT) : 0; + node.dist_mm_q2 = dist_q2; + + nodebuffer[nodeCount++] = node; + + + } + } + + _cached_previous_dense_capsuledata = *dense_capsule; + _is_previous_capsuledataRdy = true; +} + u_result RPlidarDriverImplCommon::_cacheHqScanData() { rplidar_response_hq_capsule_measurement_nodes_t hq_node; @@ -1601,6 +1667,8 @@ u_result RPlidarDriverImplCommon::startScanExpress(bool force, _u16 scanMode, _u { return RESULT_INVALID_DATA; } + + } else { @@ -1618,9 +1686,13 @@ u_result RPlidarDriverImplCommon::startScanExpress(bool force, _u16 scanMode, _u //get scan answer type to specify how to wait data _u8 scanAnsType; if (ifSupportLidarConf) + { getScanModeAnsType(scanAnsType, scanMode); + } else + { scanAnsType = RPLIDAR_ANS_TYPE_MEASUREMENT_CAPSULED; + } { rp::hal::AutoLocker l(_lock); @@ -1630,7 +1702,7 @@ u_result RPlidarDriverImplCommon::startScanExpress(bool force, _u16 scanMode, _u if (scanMode != RPLIDAR_CONF_SCAN_COMMAND_STD && scanMode != RPLIDAR_CONF_SCAN_COMMAND_EXPRESS) scanReq.working_mode = _u8(scanMode); scanReq.working_flags = options; - + if (IS_FAIL(ans = _sendCommand(RPLIDAR_CMD_EXPRESS_SCAN, &scanReq, sizeof(scanReq)))) { return ans; } @@ -1647,22 +1719,32 @@ u_result RPlidarDriverImplCommon::startScanExpress(bool force, _u16 scanMode, _u } _u32 header_size = (response_header.size_q30_subtype & RPLIDAR_ANS_HEADER_SIZE_MASK); - + if (scanAnsType == RPLIDAR_ANS_TYPE_MEASUREMENT_CAPSULED) { if (header_size < sizeof(rplidar_response_capsule_measurement_nodes_t)) { return RESULT_INVALID_DATA; } + _cached_express_flag = 0; + _isScanning = true; + _cachethread = CLASS_THREAD(RPlidarDriverImplCommon, _cacheCapsuledScanData); + } + else if (scanAnsType == RPLIDAR_ANS_TYPE_MEASUREMENT_DENSE_CAPSULED) + { + if (header_size < sizeof(rplidar_response_capsule_measurement_nodes_t)) { + return RESULT_INVALID_DATA; + } + _cached_express_flag = 1; _isScanning = true; _cachethread = CLASS_THREAD(RPlidarDriverImplCommon, _cacheCapsuledScanData); - }else if(scanAnsType ==RPLIDAR_ANS_TYPE_MEASUREMENT_HQ ){ - if (header_size < sizeof(rplidar_response_hq_capsule_measurement_nodes_t)) { + } + else if (scanAnsType == RPLIDAR_ANS_TYPE_MEASUREMENT_HQ) { + if (header_size < sizeof(rplidar_response_hq_capsule_measurement_nodes_t)) { return RESULT_INVALID_DATA; } - _isScanning = true; - _cachethread = CLASS_THREAD(RPlidarDriverImplCommon, _cacheHqScanData); - - } + _isScanning = true; + _cachethread = CLASS_THREAD(RPlidarDriverImplCommon, _cacheHqScanData); + } else { if (header_size < sizeof(rplidar_response_ultra_capsule_measurement_nodes_t)) { diff --git a/sdk/sdk/src/rplidar_driver_TCP.h b/sdk/sdk/src/rplidar_driver_TCP.h index 8de2343..0bd7ffd 100644 --- a/sdk/sdk/src/rplidar_driver_TCP.h +++ b/sdk/sdk/src/rplidar_driver_TCP.h @@ -3,7 +3,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/sdk/src/rplidar_driver_impl.h b/sdk/sdk/src/rplidar_driver_impl.h index b25cf3f..a8db47d 100644 --- a/sdk/sdk/src/rplidar_driver_impl.h +++ b/sdk/sdk/src/rplidar_driver_impl.h @@ -3,7 +3,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ @@ -41,7 +41,7 @@ namespace rp { namespace standalone{ namespace rplidar { virtual bool isConnected(); virtual u_result reset(_u32 timeout = DEFAULT_TIMEOUT); - + virtual u_result clearNetSerialRxCache(); virtual u_result getAllSupportedScanModes(std::vector& outModes, _u32 timeoutInMs = DEFAULT_TIMEOUT); virtual u_result getTypicalScanMode(_u16& outMode, _u32 timeoutInMs = DEFAULT_TIMEOUT); virtual u_result checkSupportConfigCommands(bool& outSupport, _u32 timeoutInMs = DEFAULT_TIMEOUT); @@ -56,6 +56,7 @@ namespace rp { namespace standalone{ namespace rplidar { virtual u_result startScan(bool force, bool useTypicalScan, _u32 options = 0, RplidarScanMode* outUsedScanMode = NULL); virtual u_result startScanExpress(bool force, _u16 scanMode, _u32 options = 0, RplidarScanMode* outUsedScanMode = NULL, _u32 timeout = DEFAULT_TIMEOUT); + virtual u_result getHealth(rplidar_response_device_health_t & health, _u32 timeout = DEFAULT_TIMEOUT); virtual u_result getDeviceInfo(rplidar_response_device_info_t & info, _u32 timeout = DEFAULT_TIMEOUT); virtual u_result getSampleDuration_uS(rplidar_response_sample_rate_t & rateInfo, _u32 timeout = DEFAULT_TIMEOUT); @@ -87,6 +88,7 @@ namespace rp { namespace standalone{ namespace rplidar { virtual u_result _cacheCapsuledScanData(); virtual u_result _waitCapsuledNode(rplidar_response_capsule_measurement_nodes_t & node, _u32 timeout = DEFAULT_TIMEOUT); virtual void _capsuleToNormal(const rplidar_response_capsule_measurement_nodes_t & capsule, rplidar_response_measurement_node_hq_t *nodebuffer, size_t &nodeCount); + virtual void _dense_capsuleToNormal(const rplidar_response_capsule_measurement_nodes_t & capsule, rplidar_response_measurement_node_hq_t *nodebuffer, size_t &nodeCount); //FW1.23 virtual u_result _cacheUltraCapsuledScanData(); @@ -109,12 +111,15 @@ namespace rp { namespace standalone{ namespace rplidar { _u16 _cached_sampleduration_std; _u16 _cached_sampleduration_express; + _u8 _cached_express_flag; rplidar_response_capsule_measurement_nodes_t _cached_previous_capsuledata; + rplidar_response_dense_capsule_measurement_nodes_t _cached_previous_dense_capsuledata; rplidar_response_ultra_capsule_measurement_nodes_t _cached_previous_ultracapsuledata; rplidar_response_hq_capsule_measurement_nodes_t _cached_previous_Hqdata; bool _is_previous_capsuledataRdy; bool _is_previous_HqdataRdy; + rp::hal::Locker _lock; diff --git a/sdk/sdk/src/rplidar_driver_serial.h b/sdk/sdk/src/rplidar_driver_serial.h index 5ec017e..abc1468 100644 --- a/sdk/sdk/src/rplidar_driver_serial.h +++ b/sdk/sdk/src/rplidar_driver_serial.h @@ -3,7 +3,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */ diff --git a/sdk/sdk/src/sdkcommon.h b/sdk/sdk/src/sdkcommon.h index afb5373..d025dfb 100644 --- a/sdk/sdk/src/sdkcommon.h +++ b/sdk/sdk/src/sdkcommon.h @@ -3,7 +3,7 @@ * * Copyright (c) 2009 - 2014 RoboPeak Team * http://www.robopeak.com - * Copyright (c) 2014 - 2018 Shanghai Slamtec Co., Ltd. + * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. * http://www.slamtec.com * */