00001 /* 00002 * RPLIDAR SDK 00003 * 00004 * Copyright (c) 2009 - 2014 RoboPeak Team 00005 * http://www.robopeak.com 00006 * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd. 00007 * http://www.slamtec.com 00008 * 00009 */ 00010 /* 00011 * Redistribution and use in source and binary forms, with or without 00012 * modification, are permitted provided that the following conditions are met: 00013 * 00014 * 1. Redistributions of source code must retain the above copyright notice, 00015 * this list of conditions and the following disclaimer. 00016 * 00017 * 2. Redistributions in binary form must reproduce the above copyright notice, 00018 * this list of conditions and the following disclaimer in the documentation 00019 * and/or other materials provided with the distribution. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00022 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 00023 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00024 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 00025 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00026 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00027 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 00028 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 00029 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 00030 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 00031 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00032 * 00033 */ 00034 00035 #pragma once 00036 00037 // RP-Lidar Input Packets 00038 00039 #define RPLIDAR_CMD_SYNC_BYTE 0xA5 00040 #define RPLIDAR_CMDFLAG_HAS_PAYLOAD 0x80 00041 00042 00043 #define RPLIDAR_ANS_SYNC_BYTE1 0xA5 00044 #define RPLIDAR_ANS_SYNC_BYTE2 0x5A 00045 00046 #define RPLIDAR_ANS_PKTFLAG_LOOP 0x1 00047 00048 #define RPLIDAR_ANS_HEADER_SIZE_MASK 0x3FFFFFFF 00049 #define RPLIDAR_ANS_HEADER_SUBTYPE_SHIFT (30) 00050 00051 #if defined(_WIN32) 00052 #pragma pack(1) 00053 #endif 00054 00055 typedef struct _rplidar_cmd_packet_t { 00056 _u8 syncByte; //must be RPLIDAR_CMD_SYNC_BYTE 00057 _u8 cmd_flag; 00058 _u8 size; 00059 _u8 data[0]; 00060 } __attribute__((packed)) rplidar_cmd_packet_t; 00061 00062 00063 typedef struct _rplidar_ans_header_t { 00064 _u8 syncByte1; // must be RPLIDAR_ANS_SYNC_BYTE1 00065 _u8 syncByte2; // must be RPLIDAR_ANS_SYNC_BYTE2 00066 _u32 size_q30_subtype; // see _u32 size:30; _u32 subType:2; 00067 _u8 type; 00068 } __attribute__((packed)) rplidar_ans_header_t; 00069 00070 #if defined(_WIN32) 00071 #pragma pack() 00072 #endif