MRPT  1.9.9
rplidar_cmd.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 /*
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions are met:
12  *
13  * 1. Redistributions of source code must retain the above copyright notice,
14  * this list of conditions and the following disclaimer.
15  *
16  * 2. Redistributions in binary form must reproduce the above copyright notice,
17  * this list of conditions and the following disclaimer in the documentation
18  * and/or other materials provided with the distribution.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  */
33 
34 #pragma once
35 
36 #include "rplidar_protocol.h"
37 
38 // Commands
39 //-----------------------------------------
40 
41 // Commands without payload and response
42 #define RPLIDAR_CMD_STOP 0x25
43 #define RPLIDAR_CMD_SCAN 0x20
44 #define RPLIDAR_CMD_FORCE_SCAN 0x21
45 #define RPLIDAR_CMD_RESET 0x40
46 
47 // Commands without payload but have response
48 #define RPLIDAR_CMD_GET_DEVICE_INFO 0x50
49 #define RPLIDAR_CMD_GET_DEVICE_HEALTH 0x52
50 
51 #define RPLIDAR_CMD_GET_SAMPLERATE 0x59 // added in fw 1.17
52 
53 // Commands with payload and have response
54 #define RPLIDAR_CMD_EXPRESS_SCAN 0x82 // added in fw 1.17
55 
56 // add for A2 to set RPLIDAR motor pwm when using accessory board
57 #define RPLIDAR_CMD_SET_MOTOR_PWM 0xF0
58 #define RPLIDAR_CMD_GET_ACC_BOARD_FLAG 0xFF
59 
60 #if defined(_WIN32)
61 #pragma pack(1)
62 #endif
63 
64 // Payloads
65 // ------------------------------------------
66 #define RPLIDAR_EXPRESS_SCAN_MODE_NORMAL 0
67 #define RPLIDAR_EXPRESS_SCAN_MODE_FIXANGLE 1
69 {
72 } __attribute__((packed)) rplidar_payload_express_scan_t;
73 
74 #define MAX_MOTOR_PWM 1023
75 #define DEFAULT_MOTOR_PWM 660
77 {
79 } __attribute__((packed)) rplidar_payload_motor_pwm_t;
80 
82 {
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)
102 {
104 } __attribute__((packed)) rplidar_response_acc_board_flag_t;
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 
116 {
119 } __attribute__((packed)) rplidar_response_sample_rate_t;
120 
122 {
123  _u8 sync_quality; // syncbit:1;syncbit_inverse:1;quality:6;
124  _u16 angle_q6_checkbit; // check_bit:1;angle_q6:15;
126 } __attribute__((packed)) rplidar_response_measurement_node_t;
127 
128 //[distance_sync flags]
129 #define RPLIDAR_RESP_MEASUREMENT_EXP_ANGLE_MASK (0x3)
130 #define RPLIDAR_RESP_MEASUREMENT_EXP_DISTANCE_MASK (0xFC)
131 
133 {
134  _u16 distance_angle_1; // see [distance_sync flags]
135  _u16 distance_angle_2; // see [distance_sync flags]
137 } __attribute__((packed)) rplidar_response_cabin_nodes_t;
138 
139 #define RPLIDAR_RESP_MEASUREMENT_EXP_SYNC_1 0xA
140 #define RPLIDAR_RESP_MEASUREMENT_EXP_SYNC_2 0x5
141 
142 #define RPLIDAR_RESP_MEASUREMENT_EXP_SYNCBIT (0x1 << 15)
143 
145 {
146  _u8 s_checksum_1; // see [s_checksum_1]
147  _u8 s_checksum_2; // see [s_checksum_1]
149  rplidar_response_cabin_nodes_t cabins[16];
150 } __attribute__((packed)) rplidar_response_capsule_measurement_nodes_t;
151 
153 {
158 } __attribute__((packed)) rplidar_response_device_info_t;
159 
161 {
164 } __attribute__((packed)) rplidar_response_device_health_t;
165 
166 #if defined(_WIN32)
167 #pragma pack()
168 #endif
GLuint GLenum GLsizei GLsizei GLint GLint GLboolean packed
Definition: glext.h:6794
struct _rplidar_payload_express_scan_t __attribute__((packed)) rplidar_payload_express_scan_t
uint8_t _u8
Definition: rptypes.h:60
uint32_t _u32
Definition: rptypes.h:66
rplidar_response_cabin_nodes_t cabins[16]
Definition: rplidar_cmd.h:149
uint16_t _u16
Definition: rptypes.h:63



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020