Main MRPT website > C++ reference for MRPT 1.5.7
rplidar_cmd.h
Go to the documentation of this file.
1 /*
2  * RPLIDAR SDK
3  *
4  * Copyright (c) 2009 - 2014 RoboPeak Team
5  * http://www.robopeak.com
6  * Copyright (c) 2014 - 2016 Shanghai Slamtec Co., Ltd.
7  * http://www.slamtec.com
8  *
9  */
10 /*
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions are met:
13  *
14  * 1. Redistributions of source code must retain the above copyright notice,
15  * this list of conditions and the following disclaimer.
16  *
17  * 2. Redistributions in binary form must reproduce the above copyright notice,
18  * this list of conditions and the following disclaimer in the documentation
19  * and/or other materials provided with the distribution.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
25  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  *
33  */
34 
35 #pragma once
36 
37 #include "rplidar_protocol.h"
38 
39 // Commands
40 //-----------------------------------------
41 
42 // Commands without payload and response
43 #define RPLIDAR_CMD_STOP 0x25
44 #define RPLIDAR_CMD_SCAN 0x20
45 #define RPLIDAR_CMD_FORCE_SCAN 0x21
46 #define RPLIDAR_CMD_RESET 0x40
47 
48 
49 // Commands without payload but have response
50 #define RPLIDAR_CMD_GET_DEVICE_INFO 0x50
51 #define RPLIDAR_CMD_GET_DEVICE_HEALTH 0x52
52 
53 #define RPLIDAR_CMD_GET_SAMPLERATE 0x59 //added in fw 1.17
54 
55 // Commands with payload and have response
56 #define RPLIDAR_CMD_EXPRESS_SCAN 0x82 //added in fw 1.17
57 
58 //add for A2 to set RPLIDAR motor pwm when using accessory board
59 #define RPLIDAR_CMD_SET_MOTOR_PWM 0xF0
60 #define RPLIDAR_CMD_GET_ACC_BOARD_FLAG 0xFF
61 
62 #if defined(_WIN32)
63 #pragma pack(1)
64 #endif
65 
66 
67 // Payloads
68 // ------------------------------------------
69 #define RPLIDAR_EXPRESS_SCAN_MODE_NORMAL 0
70 #define RPLIDAR_EXPRESS_SCAN_MODE_FIXANGLE 1
74 } __attribute__((packed)) rplidar_payload_express_scan_t;
75 
76 #define MAX_MOTOR_PWM 1023
77 #define DEFAULT_MOTOR_PWM 660
80 } __attribute__((packed)) rplidar_payload_motor_pwm_t;
81 
84 } __attribute__((packed)) rplidar_payload_acc_board_flag_t;
85 
86 // Response
87 // ------------------------------------------
88 #define RPLIDAR_ANS_TYPE_DEVINFO 0x4
89 #define RPLIDAR_ANS_TYPE_DEVHEALTH 0x6
90 
91 #define RPLIDAR_ANS_TYPE_MEASUREMENT 0x81
92 // Added in FW ver 1.17
93 #define RPLIDAR_ANS_TYPE_MEASUREMENT_CAPSULED 0x82
94 
95 // Added in FW ver 1.17
96 #define RPLIDAR_ANS_TYPE_SAMPLE_RATE 0x15
97 
98 #define RPLIDAR_ANS_TYPE_ACC_BOARD_FLAG 0xFF
99 
100 #define RPLIDAR_RESP_ACC_BOARD_FLAG_MOTOR_CTRL_SUPPORT_MASK (0x1)
103 } __attribute__((packed)) rplidar_response_acc_board_flag_t;
104 
105 
106 #define RPLIDAR_STATUS_OK 0x0
107 #define RPLIDAR_STATUS_WARNING 0x1
108 #define RPLIDAR_STATUS_ERROR 0x2
109 
110 #define RPLIDAR_RESP_MEASUREMENT_SYNCBIT (0x1<<0)
111 #define RPLIDAR_RESP_MEASUREMENT_QUALITY_SHIFT 2
112 #define RPLIDAR_RESP_MEASUREMENT_CHECKBIT (0x1<<0)
113 #define RPLIDAR_RESP_MEASUREMENT_ANGLE_SHIFT 1
114 
118 } __attribute__((packed)) rplidar_response_sample_rate_t;
119 
121  _u8 sync_quality; // syncbit:1;syncbit_inverse:1;quality:6;
122  _u16 angle_q6_checkbit; // check_bit:1;angle_q6:15;
124 } __attribute__((packed)) rplidar_response_measurement_node_t;
125 
126 //[distance_sync flags]
127 #define RPLIDAR_RESP_MEASUREMENT_EXP_ANGLE_MASK (0x3)
128 #define RPLIDAR_RESP_MEASUREMENT_EXP_DISTANCE_MASK (0xFC)
129 
131  _u16 distance_angle_1; // see [distance_sync flags]
132  _u16 distance_angle_2; // see [distance_sync flags]
134 } __attribute__((packed)) rplidar_response_cabin_nodes_t;
135 
136 
137 #define RPLIDAR_RESP_MEASUREMENT_EXP_SYNC_1 0xA
138 #define RPLIDAR_RESP_MEASUREMENT_EXP_SYNC_2 0x5
139 
140 #define RPLIDAR_RESP_MEASUREMENT_EXP_SYNCBIT (0x1<<15)
141 
143  _u8 s_checksum_1; // see [s_checksum_1]
144  _u8 s_checksum_2; // see [s_checksum_1]
146  rplidar_response_cabin_nodes_t cabins[16];
147 } __attribute__((packed)) rplidar_response_capsule_measurement_nodes_t;
148 
154 } __attribute__((packed)) rplidar_response_device_info_t;
155 
159 } __attribute__((packed)) rplidar_response_device_health_t;
160 
161 #if defined(_WIN32)
162 #pragma pack()
163 #endif
GLuint GLenum GLsizei GLsizei GLint GLint GLboolean packed
Definition: glext.h:5956
struct _rplidar_payload_express_scan_t __attribute__((packed)) rplidar_payload_express_scan_t
uint8_t _u8
Definition: rptypes.h:63
uint32_t _u32
Definition: rptypes.h:69
rplidar_response_cabin_nodes_t cabins[16]
Definition: rplidar_cmd.h:146
uint16_t _u16
Definition: rptypes.h:66



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019