Livox SDK API  V2.2.0
livox_def.h
Go to the documentation of this file.
1 //
2 // The MIT License (MIT)
3 //
4 // Copyright (c) 2019 Livox. All rights reserved.
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to deal
8 // in the Software without restriction, including without limitation the rights
9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 // copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in
14 // all copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 // SOFTWARE.
23 //
24 
25 #ifndef LIVOX_DEF_H_
26 #define LIVOX_DEF_H_
27 
28 #include <stdint.h>
29 
30 #define kMaxLidarCount 32
31 
33 typedef enum {
40 } DeviceType;
41 
43 typedef enum {
50 } LidarState;
51 
53 typedef enum {
57 } LidarMode;
58 
60 typedef enum {
63 } LidarFeature;
64 
66 typedef enum {
69 } LidarIpMode;
70 
72 typedef enum {
76 
78 typedef enum {
89 } LivoxStatus;
90 
92 typedef int32_t livox_status;
93 
95 typedef enum {
100 } DeviceEvent;
101 
103 typedef enum {
110 } TimestampType;
111 
113 typedef enum {
124 } PointDataType;
125 
127 typedef enum {
133 
135 typedef enum {
138 } ImuFreq;
139 
140 #pragma pack(1)
141 
142 #define LIVOX_SDK_MAJOR_VERSION 2
143 #define LIVOX_SDK_MINOR_VERSION 2
144 #define LIVOX_SDK_PATCH_VERSION 0
145 
146 #define kBroadcastCodeSize 16
147 
149 typedef struct {
150  int major;
151  int minor;
152  int patch;
154 
156 typedef struct {
157  int32_t x;
158  int32_t y;
159  int32_t z;
160  uint8_t reflectivity;
161 } LivoxRawPoint;
162 
164 typedef struct {
165  uint32_t depth;
166  uint16_t theta;
167  uint16_t phi;
168  uint8_t reflectivity;
170 
172 typedef struct {
173  float x;
174  float y;
175  float z;
176  uint8_t reflectivity;
177 } LivoxPoint;
178 
180 typedef struct {
181  int32_t x;
182  int32_t y;
183  int32_t z;
184  uint8_t reflectivity;
185  uint8_t tag;
187 
189 typedef struct {
190  uint32_t depth;
191  uint16_t theta;
192  uint16_t phi;
193  uint8_t reflectivity;
194  uint8_t tag;
196 
198 typedef struct {
199  int32_t x1;
200  int32_t y1;
201  int32_t z1;
202  uint8_t reflectivity1;
203  uint8_t tag1;
204  int32_t x2;
205  int32_t y2;
206  int32_t z2;
207  uint8_t reflectivity2;
208  uint8_t tag2;
210 
212 typedef struct {
213  uint16_t theta;
214  uint16_t phi;
215  uint32_t depth1;
216  uint8_t reflectivity1;
217  uint8_t tag1;
218  uint32_t depth2;
219  uint8_t reflectivity2;
220  uint8_t tag2;
222 
224 typedef struct {
225  int32_t x1;
226  int32_t y1;
227  int32_t z1;
228  uint8_t reflectivity1;
229  uint8_t tag1;
230  int32_t x2;
231  int32_t y2;
232  int32_t z2;
233  uint8_t reflectivity2;
234  uint8_t tag2;
235  int32_t x3;
236  int32_t y3;
237  int32_t z3;
238  uint8_t reflectivity3;
239  uint8_t tag3;
241 
243 typedef struct {
244  uint16_t theta;
245  uint16_t phi;
246  uint32_t depth1;
247  uint8_t reflectivity1;
248  uint8_t tag1;
249  uint32_t depth2;
250  uint8_t reflectivity2;
251  uint8_t tag2;
252  uint32_t depth3;
253  uint8_t reflectivity3;
254  uint8_t tag3;
256 
258 typedef struct {
259  float gyro_x;
260  float gyro_y;
261  float gyro_z;
262  float acc_x;
263  float acc_y;
264  float acc_z;
265 } LivoxImuPoint;
266 
268 typedef struct {
269  uint32_t temp_status : 2;
270  uint32_t volt_status : 2;
271  uint32_t motor_status : 2;
272  uint32_t dirty_warn : 2;
273  uint32_t firmware_err : 1;
274  uint32_t pps_status : 1;
275  uint32_t device_status : 1;
276  uint32_t fan_status : 1;
277  uint32_t self_heating : 1;
278  uint32_t ptp_status : 1;
285  uint32_t time_sync_status : 3;
286  uint32_t rsvd : 13;
287  uint32_t system_status : 2;
289 
291 typedef struct {
297  uint32_t sync_status : 2;
298  uint32_t temp_status : 2;
299  uint32_t lidar_status : 1;
300  uint32_t lidar_link_status : 1;
301  uint32_t firmware_err : 1;
302  uint32_t rsvd : 23;
303  uint32_t system_status : 2;
304 } HubErrorCode;
305 
309 typedef union {
310  uint32_t error_code;
313 } ErrorMessage;
314 
316 typedef struct {
317  uint8_t version;
318  uint8_t slot;
319  uint8_t id;
320  uint8_t rsvd;
321  uint32_t err_code;
322  uint8_t timestamp_type;
324  uint8_t data_type;
325  uint8_t timestamp[8];
326  uint8_t data[1];
328 
330 typedef union {
331  uint32_t progress;
333 } StatusUnion;
334 
336 typedef struct {
337  char broadcast_code[kBroadcastCodeSize];
338  uint8_t handle;
339  uint8_t slot;
340  uint8_t id;
341  uint8_t type;
342  uint16_t data_port;
343  uint16_t cmd_port;
344  uint16_t sensor_port;
345  char ip[16];
349  uint8_t firmware_version[4];
350 } DeviceInfo;
351 
353 typedef struct {
354  char broadcast_code[kBroadcastCodeSize];
355  uint8_t dev_type;
356  uint16_t reserved;
357  char ip[16];
359 
361 typedef struct {
362  char broadcast_code[kBroadcastCodeSize];
363  uint8_t dev_type;
364  uint8_t version[4];
365  uint8_t slot;
366  uint8_t id;
368 
370 typedef struct {
371  char broadcast_code[kBroadcastCodeSize];
372  uint8_t state;
374 
375 typedef struct {
376  uint8_t ret_code;
377  char broadcast_code[kBroadcastCodeSize];
378 } ReturnCode;
379 
380 typedef struct {
381  char broadcast_code[kBroadcastCodeSize];
383 
384 typedef struct {
385  char broadcast_code[kBroadcastCodeSize];
386  uint8_t feature;
388 
389 typedef struct {
390  char broadcast_code[kBroadcastCodeSize];
391  uint8_t state;
393 
394 typedef struct {
395  char broadcast_code[kBroadcastCodeSize];
397 
398 typedef struct {
399  uint8_t ret_code;
400  char broadcast_code[kBroadcastCodeSize];
401  uint8_t state;
403 
404 typedef struct {
405  char broadcast_code[kBroadcastCodeSize];
406  uint8_t mode;
408 
409 typedef struct {
410  char broadcast_code[kBroadcastCodeSize];
412 
413 typedef struct {
414  uint8_t ret_code;
415  char broadcast_code[kBroadcastCodeSize];
416  uint8_t mode;
418 
419 typedef struct {
420  char broadcast_code[kBroadcastCodeSize];
421  uint8_t freq;
423 
424 
425 typedef struct {
426  char broadcast_code[kBroadcastCodeSize];
428 
429 typedef struct {
430  uint8_t ret_code;
431  char broadcast_code[kBroadcastCodeSize];
432  uint8_t freq;
434 
436 typedef struct {
437  char broadcast_code[kBroadcastCodeSize];
438  float roll;
439  float pitch;
440  float yaw;
441  int32_t x;
442  int32_t y;
443  int32_t z;
445 
447 typedef struct {
448  uint8_t ret_code;
449  char broadcast_code[kBroadcastCodeSize];
450  float roll;
451  float pitch;
452  float yaw;
453  int32_t x;
454  int32_t y;
455  int32_t z;
457 
458 typedef struct {
459  char broadcast_code[kBroadcastCodeSize];
460  uint8_t state;
461  uint8_t feature;
464 
468 typedef struct {
469  uint32_t ip_addr;
470  uint16_t data_port;
471  uint16_t cmd_port;
472  uint16_t sensor_port;
474 
478 typedef struct {
479  uint8_t ret_code;
480  uint8_t firmware_version[4];
482 
486 typedef struct {
487  uint8_t ip_mode;
488  uint32_t ip_addr;
490 
494 typedef struct {
495  uint8_t ret_code;
496  uint8_t ip_mode;
497  uint32_t ip_addr;
498  uint32_t net_mask;
499  uint32_t gw_addr;
501 
505 typedef struct {
506  uint32_t ip_addr;
507  uint32_t net_mask;
508  uint32_t gw_addr;
510 
514 typedef struct {
515  uint8_t ret_code;
516  uint8_t state;
517  uint8_t feature;
520 
524 typedef enum {
533 } KeyErrorCode;
534 
538 typedef struct {
539  uint8_t ret_code;
540  uint16_t error_param_key;
541  uint8_t error_code;
543 
547 typedef enum {
553 
557 typedef struct {
558  uint16_t key; /*< Key, refer to \ref DeviceParamKeyName. */
559  uint16_t length; /*< Length of value */
560  uint8_t value[1]; /*< Value */
561 } KeyValueParam;
562 
566 typedef struct {
567  DeviceParameterResponse rsp; /*< Return code. */
568  KeyValueParam kv; /*< Key and value of device's parameters. */
570 
574 typedef struct {
575  uint8_t param_num; /*< Number of key. */
576  uint16_t key[1]; /*< Key, refer to \ref DeviceParamKeyName. */
578 
582 typedef struct {
583  uint8_t flag; /*< 0: for resetting all keys, 1: for resetting part of keys. */
584  uint8_t key_num; /*< number of keys to reset. */
585  uint16_t key[1]; /*< Keys to reset, refer to \ref DeviceParamKeyName. */
587 
591 typedef struct {
592  float roll;
593  float pitch;
594  float yaw;
595  int32_t x;
596  int32_t y;
597  int32_t z;
599 
603 typedef struct {
604  uint8_t ret_code;
605  float roll;
606  float pitch;
607  float yaw;
608  int32_t x;
609  int32_t y;
610  int32_t z;
612 
616 typedef struct {
617  uint8_t ret_code;
618  uint8_t state;
620 
624 typedef struct {
625  uint8_t ret_code;
626  uint8_t mode;
628 
629 
633 typedef struct {
634  uint8_t ret_code;
635  uint8_t freq;
637 
641 typedef struct {
642  uint8_t year;
643  uint8_t month;
644  uint8_t day;
645  uint8_t hour;
646  uint32_t mircrosecond;
648 
652 typedef struct {
653  uint8_t ret_code;
654  uint8_t count;
655  ConnectedLidarInfo device_info_list[1];
657 
661 typedef struct {
662  uint8_t count;
663  LidarModeRequestItem config_list[1];
665 
669 typedef struct {
670  uint8_t ret_code;
671  uint8_t count;
672  ReturnCode ret_state_list[1];
674 
678 typedef struct {
679  uint8_t slot;
680  uint8_t state;
682 
686 typedef struct {
687  uint8_t count;
688  ExtrinsicParameterRequestItem parameter_list[1];
690 
694 typedef struct {
695  uint8_t ret_code;
696  uint8_t count;
697  ReturnCode ret_code_list[1];
699 
703 typedef struct {
704  uint8_t count;
705  DeviceBroadcastCode code_list[1];
707 
711 typedef struct {
712  uint8_t ret_code;
713  uint8_t count;
714  ExtrinsicParameterResponseItem parameter_list[1];
716 
720 typedef struct {
721  uint8_t ret_code;
722  uint8_t count;
723  LidarStateItem state_list[1];
725 
729 typedef struct {
730  uint8_t count;
731  RainFogSuppressRequestItem lidar_cfg_list[1];
733 
737 typedef struct {
738  uint8_t ret_code;
739  uint8_t count;
740  ReturnCode ret_state_list[1];
742 
746 typedef struct {
747  uint8_t ret_code;
748  uint16_t slot_power_state;
750 
754 typedef struct {
755  uint8_t count;
756  FanControlRequestItem lidar_cfg_list[1];
758 
762 typedef struct {
763  uint8_t ret_code;
764  uint8_t count;
765  ReturnCode return_list[1];
767 
771 typedef struct {
772  uint8_t count;
773  GetFanStateRequestItem lidar_cfg_list[1];
775 
779 typedef struct {
780  uint8_t ret_code;
781  uint8_t count;
782  GetFanStateResponseItem return_list[1];
784 
788 typedef struct {
789  uint8_t count;
792 
796 typedef struct {
797  uint8_t ret_code;
798  uint8_t count;
799  ReturnCode return_list[1];
801 
805 typedef struct {
806  uint8_t count;
809 
813 typedef struct {
814  uint8_t ret_code;
815  uint8_t count;
818 
822 typedef struct {
823  uint8_t count;
824  SetImuPushFrequencyRequestItem lidar_cfg_list[1];
826 
830 typedef struct {
831  uint8_t ret_code;
832  uint8_t count;
833  ReturnCode return_list[1];
835 
839 typedef struct {
840  uint8_t count;
841  GetImuPushFrequencyRequestItem lidar_cfg_list[1];
843 
847 typedef struct {
848  uint8_t ret_code;
849  uint8_t count;
852 
853 #pragma pack()
854 
855 #endif // LIVOX_DEF_H_
LidarIpMode
Definition: livox_def.h:66
uint8_t reflectivity
Definition: livox_def.h:176
uint8_t feature
Definition: livox_def.h:461
uint8_t type
Definition: livox_def.h:341
LidarFeature feature
Definition: livox_def.h:347
uint8_t reflectivity
Definition: livox_def.h:160
DeviceEvent
Definition: livox_def.h:95
uint8_t slot
Definition: livox_def.h:318
LidarState
Definition: livox_def.h:43
uint16_t data_port
Definition: livox_def.h:470
PointDataType
Definition: livox_def.h:113
uint8_t rsvd
Definition: livox_def.h:320
uint16_t cmd_port
Definition: livox_def.h:343
uint8_t state
Definition: livox_def.h:460
int32_t z
Definition: livox_def.h:159
uint8_t timestamp_type
Definition: livox_def.h:322
LidarFeature
Definition: livox_def.h:60
float gyro_z
Definition: livox_def.h:261
HubErrorCode hub_error_code
Definition: livox_def.h:312
TimestampType
Definition: livox_def.h:103
DeviceParamKeyName
Definition: livox_def.h:547
uint8_t reflectivity
Definition: livox_def.h:168
uint16_t phi
Definition: livox_def.h:167
StatusUnion error_union
Definition: livox_def.h:518
LidarScanPattern
Definition: livox_def.h:72
uint16_t sensor_port
Definition: livox_def.h:472
LidarErrorCode lidar_error_code
Definition: livox_def.h:311
uint16_t sensor_port
Definition: livox_def.h:344
uint8_t slot
Definition: livox_def.h:339
uint8_t handle
Definition: livox_def.h:338
int32_t livox_status
Definition: livox_def.h:92
StatusUnion status
Definition: livox_def.h:348
basic_data data
Definition: format.h:764
DeviceType
Definition: livox_def.h:33
DeviceParameterResponse rsp
Definition: livox_def.h:567
float y
Definition: livox_def.h:174
uint16_t key
Definition: livox_def.h:558
ErrorMessage status_code
Definition: livox_def.h:332
PointCloudReturnMode
Definition: livox_def.h:127
uint16_t length
Definition: livox_def.h:559
int32_t y
Definition: livox_def.h:158
uint32_t depth
Definition: livox_def.h:165
uint8_t reflectivity
Definition: livox_def.h:184
uint8_t ret_code
Definition: livox_def.h:515
StatusUnion error_union
Definition: livox_def.h:462
#define kBroadcastCodeSize
Definition: livox_def.h:146
float gyro_x
Definition: livox_def.h:259
uint32_t progress
Definition: livox_def.h:331
uint32_t error_code
Definition: livox_def.h:310
ImuFreq
Definition: livox_def.h:135
LidarMode
Definition: livox_def.h:53
LivoxStatus
Definition: livox_def.h:78
LidarState state
Definition: livox_def.h:346
int32_t x
Definition: livox_def.h:157
float z
Definition: livox_def.h:175
uint8_t data_type
Definition: livox_def.h:324
uint8_t version
Definition: livox_def.h:317
float gyro_y
Definition: livox_def.h:260
uint16_t theta
Definition: livox_def.h:166
uint32_t err_code
Definition: livox_def.h:321
uint8_t id
Definition: livox_def.h:319
uint8_t ret_code
Definition: livox_def.h:376
KeyErrorCode
Definition: livox_def.h:524
uint16_t data_port
Definition: livox_def.h:342
uint32_t ip_addr
Definition: livox_def.h:469
uint16_t cmd_port
Definition: livox_def.h:471
uint8_t id
Definition: livox_def.h:340
float x
Definition: livox_def.h:173