Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
inc/rplidar_protocol.h@2:faef6636d456, 2021-05-05 (annotated)
- Committer:
- yaaqobhpt
- Date:
- Wed May 05 14:14:28 2021 +0000
- Revision:
- 2:faef6636d456
- Parent:
- 0:c25c4b67b6a1
dada
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yaaqobhpt | 0:c25c4b67b6a1 | 1 | /* |
yaaqobhpt | 0:c25c4b67b6a1 | 2 | * Copyright (c) 2014, RoboPeak |
yaaqobhpt | 0:c25c4b67b6a1 | 3 | * All rights reserved. |
yaaqobhpt | 0:c25c4b67b6a1 | 4 | * |
yaaqobhpt | 0:c25c4b67b6a1 | 5 | * Redistribution and use in source and binary forms, with or without |
yaaqobhpt | 0:c25c4b67b6a1 | 6 | * modification, are permitted provided that the following conditions are met: |
yaaqobhpt | 0:c25c4b67b6a1 | 7 | * |
yaaqobhpt | 0:c25c4b67b6a1 | 8 | * 1. Redistributions of source code must retain the above copyright notice, |
yaaqobhpt | 0:c25c4b67b6a1 | 9 | * this list of conditions and the following disclaimer. |
yaaqobhpt | 0:c25c4b67b6a1 | 10 | * |
yaaqobhpt | 0:c25c4b67b6a1 | 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
yaaqobhpt | 0:c25c4b67b6a1 | 12 | * this list of conditions and the following disclaimer in the documentation |
yaaqobhpt | 0:c25c4b67b6a1 | 13 | * and/or other materials provided with the distribution. |
yaaqobhpt | 0:c25c4b67b6a1 | 14 | * |
yaaqobhpt | 0:c25c4b67b6a1 | 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
yaaqobhpt | 0:c25c4b67b6a1 | 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
yaaqobhpt | 0:c25c4b67b6a1 | 17 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
yaaqobhpt | 0:c25c4b67b6a1 | 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
yaaqobhpt | 0:c25c4b67b6a1 | 19 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
yaaqobhpt | 0:c25c4b67b6a1 | 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
yaaqobhpt | 0:c25c4b67b6a1 | 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
yaaqobhpt | 0:c25c4b67b6a1 | 22 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
yaaqobhpt | 0:c25c4b67b6a1 | 23 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
yaaqobhpt | 0:c25c4b67b6a1 | 24 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
yaaqobhpt | 0:c25c4b67b6a1 | 25 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
yaaqobhpt | 0:c25c4b67b6a1 | 26 | * |
yaaqobhpt | 0:c25c4b67b6a1 | 27 | */ |
yaaqobhpt | 0:c25c4b67b6a1 | 28 | /* |
yaaqobhpt | 0:c25c4b67b6a1 | 29 | * RoboPeak LIDAR System |
yaaqobhpt | 0:c25c4b67b6a1 | 30 | * Data Packet IO protocol definition for RP-LIDAR |
yaaqobhpt | 0:c25c4b67b6a1 | 31 | * |
yaaqobhpt | 0:c25c4b67b6a1 | 32 | * Copyright 2009 - 2014 RoboPeak Team |
yaaqobhpt | 0:c25c4b67b6a1 | 33 | * http://www.robopeak.com |
yaaqobhpt | 0:c25c4b67b6a1 | 34 | * |
yaaqobhpt | 0:c25c4b67b6a1 | 35 | */ |
yaaqobhpt | 0:c25c4b67b6a1 | 36 | //#ifndef RPLIDAR_PROTOCOL_H |
yaaqobhpt | 0:c25c4b67b6a1 | 37 | //#define RPLIDAR_PROTOCOL_H |
yaaqobhpt | 0:c25c4b67b6a1 | 38 | |
yaaqobhpt | 0:c25c4b67b6a1 | 39 | #pragma once |
yaaqobhpt | 0:c25c4b67b6a1 | 40 | |
yaaqobhpt | 0:c25c4b67b6a1 | 41 | // RP-Lidar Input Packets |
yaaqobhpt | 0:c25c4b67b6a1 | 42 | |
yaaqobhpt | 0:c25c4b67b6a1 | 43 | #define RPLIDAR_CMD_SYNC_BYTE 0xA5 |
yaaqobhpt | 0:c25c4b67b6a1 | 44 | #define RPLIDAR_CMDFLAG_HAS_PAYLOAD 0x80 |
yaaqobhpt | 0:c25c4b67b6a1 | 45 | |
yaaqobhpt | 0:c25c4b67b6a1 | 46 | |
yaaqobhpt | 0:c25c4b67b6a1 | 47 | #define RPLIDAR_ANS_SYNC_BYTE1 0xA5 |
yaaqobhpt | 0:c25c4b67b6a1 | 48 | #define RPLIDAR_ANS_SYNC_BYTE2 0x5A |
yaaqobhpt | 0:c25c4b67b6a1 | 49 | |
yaaqobhpt | 0:c25c4b67b6a1 | 50 | #define RPLIDAR_ANS_PKTFLAG_LOOP 0x1 |
yaaqobhpt | 0:c25c4b67b6a1 | 51 | |
yaaqobhpt | 0:c25c4b67b6a1 | 52 | |
yaaqobhpt | 0:c25c4b67b6a1 | 53 | #if defined(_WIN32) |
yaaqobhpt | 0:c25c4b67b6a1 | 54 | #pragma pack(1) |
yaaqobhpt | 0:c25c4b67b6a1 | 55 | #endif |
yaaqobhpt | 0:c25c4b67b6a1 | 56 | |
yaaqobhpt | 0:c25c4b67b6a1 | 57 | typedef struct _rplidar_cmd_packet_t { |
yaaqobhpt | 0:c25c4b67b6a1 | 58 | _u8 syncByte; //must be RPLIDAR_CMD_SYNC_BYTE |
yaaqobhpt | 0:c25c4b67b6a1 | 59 | _u8 cmd_flag; |
yaaqobhpt | 0:c25c4b67b6a1 | 60 | _u8 size; |
yaaqobhpt | 0:c25c4b67b6a1 | 61 | _u8 data[0]; |
yaaqobhpt | 0:c25c4b67b6a1 | 62 | } __attribute__((packed)) rplidar_cmd_packet_t; |
yaaqobhpt | 0:c25c4b67b6a1 | 63 | |
yaaqobhpt | 0:c25c4b67b6a1 | 64 | |
yaaqobhpt | 0:c25c4b67b6a1 | 65 | typedef struct _rplidar_ans_header_t { |
yaaqobhpt | 0:c25c4b67b6a1 | 66 | _u8 syncByte1; // must be RPLIDAR_ANS_SYNC_BYTE1 |
yaaqobhpt | 0:c25c4b67b6a1 | 67 | _u8 syncByte2; // must be RPLIDAR_ANS_SYNC_BYTE2 |
yaaqobhpt | 0:c25c4b67b6a1 | 68 | _u32 size:30; |
yaaqobhpt | 0:c25c4b67b6a1 | 69 | _u32 subType:2; |
yaaqobhpt | 0:c25c4b67b6a1 | 70 | _u8 type; |
yaaqobhpt | 0:c25c4b67b6a1 | 71 | } __attribute__((packed)) rplidar_ans_header_t; |
yaaqobhpt | 0:c25c4b67b6a1 | 72 | |
yaaqobhpt | 0:c25c4b67b6a1 | 73 | #if defined(_WIN32) |
yaaqobhpt | 0:c25c4b67b6a1 | 74 | #pragma pack() |
yaaqobhpt | 0:c25c4b67b6a1 | 75 | #endif |
yaaqobhpt | 0:c25c4b67b6a1 | 76 | |
yaaqobhpt | 0:c25c4b67b6a1 | 77 |