Main MRPT website > C++ reference for 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
_u16
uint16_t _u16
Definition: rptypes.h:63
_rplidar_response_cabin_nodes_t::offset_angles_q3
_u8 offset_angles_q3
Definition: rplidar_cmd.h:136
_rplidar_payload_express_scan_t::reserved
_u32 reserved
Definition: rplidar_cmd.h:71
_rplidar_response_measurement_node_t::angle_q6_checkbit
_u16 angle_q6_checkbit
Definition: rplidar_cmd.h:124
_rplidar_response_measurement_node_t::sync_quality
_u8 sync_quality
Definition: rplidar_cmd.h:123
_rplidar_response_capsule_measurement_nodes_t::s_checksum_2
_u8 s_checksum_2
Definition: rplidar_cmd.h:147
_rplidar_response_measurement_node_t
Definition: rplidar_cmd.h:121
_rplidar_response_capsule_measurement_nodes_t::start_angle_sync_q6
_u16 start_angle_sync_q6
Definition: rplidar_cmd.h:148
_rplidar_response_sample_rate_t
Definition: rplidar_cmd.h:115
_rplidar_response_device_info_t::model
_u8 model
Definition: rplidar_cmd.h:154
_u8
uint8_t _u8
Definition: rptypes.h:60
_rplidar_response_capsule_measurement_nodes_t
Definition: rplidar_cmd.h:144
_rplidar_payload_express_scan_t::working_mode
_u8 working_mode
Definition: rplidar_cmd.h:70
_rplidar_response_device_info_t
Definition: rplidar_cmd.h:152
_rplidar_response_capsule_measurement_nodes_t::cabins
rplidar_response_cabin_nodes_t cabins[16]
Definition: rplidar_cmd.h:149
_rplidar_response_cabin_nodes_t
Definition: rplidar_cmd.h:132
_rplidar_response_sample_rate_t::express_sample_duration_us
_u16 express_sample_duration_us
Definition: rplidar_cmd.h:118
_rplidar_response_device_info_t::firmware_version
_u16 firmware_version
Definition: rplidar_cmd.h:155
_rplidar_response_capsule_measurement_nodes_t::s_checksum_1
_u8 s_checksum_1
Definition: rplidar_cmd.h:146
_rplidar_response_device_info_t::serialnum
_u8 serialnum[16]
Definition: rplidar_cmd.h:157
rplidar_protocol.h
_rplidar_response_device_health_t::error_code
_u16 error_code
Definition: rplidar_cmd.h:163
_rplidar_response_sample_rate_t::std_sample_duration_us
_u16 std_sample_duration_us
Definition: rplidar_cmd.h:117
_rplidar_response_measurement_node_t::distance_q2
_u16 distance_q2
Definition: rplidar_cmd.h:125
__attribute__
struct _rplidar_payload_express_scan_t __attribute__((packed)) rplidar_payload_express_scan_t
_rplidar_payload_motor_pwm_t::pwm_value
_u16 pwm_value
Definition: rplidar_cmd.h:78
_rplidar_payload_acc_board_flag_t
Definition: rplidar_cmd.h:81
_rplidar_payload_express_scan_t
Definition: rplidar_cmd.h:68
_rplidar_response_acc_board_flag_t::support_flag
_u32 support_flag
Definition: rplidar_cmd.h:103
packed
GLuint GLenum GLsizei GLsizei GLint GLint GLboolean packed
Definition: glext.h:6795
_rplidar_response_device_health_t
Definition: rplidar_cmd.h:160
_rplidar_payload_acc_board_flag_t::reserved
_u32 reserved
Definition: rplidar_cmd.h:83
_rplidar_response_cabin_nodes_t::distance_angle_2
_u16 distance_angle_2
Definition: rplidar_cmd.h:135
_rplidar_payload_motor_pwm_t
Definition: rplidar_cmd.h:76
_rplidar_response_acc_board_flag_t
Definition: rplidar_cmd.h:101
_rplidar_response_device_health_t::status
_u8 status
Definition: rplidar_cmd.h:162
_rplidar_response_cabin_nodes_t::distance_angle_1
_u16 distance_angle_1
Definition: rplidar_cmd.h:134
_u32
uint32_t _u32
Definition: rptypes.h:66
_rplidar_response_device_info_t::hardware_version
_u8 hardware_version
Definition: rplidar_cmd.h:156



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST