v2

Dependencies:   BEAR_Protocol_Edited BufferedSerial Debug MaxSonar PID Process QEI UI iSerial mbed

Fork of clean_V1 by Betago

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers rplidar_protocol.h Source File

rplidar_protocol.h

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