Livox SDK API  V2.1.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 {
38 } DeviceType;
39 
41 typedef enum {
48 } LidarState;
49 
51 typedef enum {
55 } LidarMode;
56 
58 typedef enum {
61 } LidarFeature;
62 
64 typedef enum {
67 } LidarIpMode;
68 
70 typedef enum {
81 } LivoxStatus;
82 
84 typedef int32_t livox_status;
85 
87 typedef enum {
92 } DeviceEvent;
93 
95 typedef enum {
102 } TimestampType;
103 
105 typedef enum {
114 } PointDataType;
115 
117 typedef enum {
122 
124 typedef enum {
127 } ImuFreq;
128 
129 #pragma pack(1)
130 
131 #define LIVOX_SDK_MAJOR_VERSION 2
132 #define LIVOX_SDK_MINOR_VERSION 1
133 #define LIVOX_SDK_PATCH_VERSION 0
134 
135 #define kBroadcastCodeSize 16
136 
138 typedef struct {
139  int major;
140  int minor;
141  int patch;
143 
145 typedef struct {
146  int32_t x;
147  int32_t y;
148  int32_t z;
149  uint8_t reflectivity;
150 } LivoxRawPoint;
151 
153 typedef struct {
154  uint32_t depth;
155  uint16_t theta;
156  uint16_t phi;
157  uint8_t reflectivity;
159 
161 typedef struct {
162  float x;
163  float y;
164  float z;
165  uint8_t reflectivity;
166 } LivoxPoint;
167 
169 typedef struct {
170  int32_t x;
171  int32_t y;
172  int32_t z;
173  uint8_t reflectivity;
174  uint8_t tag;
176 
178 typedef struct {
179  uint32_t depth;
180  uint16_t theta;
181  uint16_t phi;
182  uint8_t reflectivity;
183  uint8_t tag;
185 
187 typedef struct {
188  int32_t x1;
189  int32_t y1;
190  int32_t z1;
191  uint8_t reflectivity1;
192  uint8_t tag1;
193  int32_t x2;
194  int32_t y2;
195  int32_t z2;
196  uint8_t reflectivity2;
197  uint8_t tag2;
199 
201 typedef struct {
202  uint16_t theta;
203  uint16_t phi;
204  uint32_t depth1;
205  uint8_t reflectivity1;
206  uint8_t tag1;
207  uint32_t depth2;
208  uint8_t reflectivity2;
209  uint8_t tag2;
211 
213 typedef struct {
214  float gyro_x;
215  float gyro_y;
216  float gyro_z;
217  float acc_x;
218  float acc_y;
219  float acc_z;
220 } LivoxImuPoint;
221 
223 typedef struct {
224  uint32_t temp_status : 2;
225  uint32_t volt_status : 2;
226  uint32_t motor_status : 2;
227  uint32_t dirty_warn : 2;
228  uint32_t firmware_err : 1;
229  uint32_t pps_status : 1;
230  uint32_t device_status : 1;
231  uint32_t fan_status : 1;
232  uint32_t self_heating : 1;
233  uint32_t ptp_status : 1;
240  uint32_t time_sync_status : 3;
241  uint32_t rsvd : 13;
242  uint32_t system_status : 2;
244 
246 typedef struct {
252  uint32_t sync_status : 2;
253  uint32_t temp_status : 2;
254  uint32_t lidar_status : 1;
255  uint32_t lidar_link_status : 1;
256  uint32_t firmware_err : 1;
257  uint32_t rsvd : 23;
258  uint32_t system_status : 2;
259 } HubErrorCode;
260 
264 typedef union {
265  uint32_t error_code;
268 } ErrorMessage;
269 
271 typedef struct {
272  uint8_t version;
273  uint8_t slot;
274  uint8_t id;
275  uint8_t rsvd;
276  uint32_t err_code;
277  uint8_t timestamp_type;
279  uint8_t data_type;
280  uint8_t timestamp[8];
281  uint8_t data[1];
283 
285 typedef union {
286  uint32_t progress;
288 } StatusUnion;
289 
291 typedef struct {
292  char broadcast_code[kBroadcastCodeSize];
293  uint8_t handle;
294  uint8_t slot;
295  uint8_t id;
296  uint8_t type;
297  uint16_t data_port;
298  uint16_t cmd_port;
299  uint16_t sensor_port;
300  char ip[16];
304  uint8_t firmware_version[4];
305 } DeviceInfo;
306 
308 typedef struct {
309  char broadcast_code[kBroadcastCodeSize];
310  uint8_t dev_type;
311  uint16_t reserved;
312  char ip[16];
314 
316 typedef struct {
317  char broadcast_code[kBroadcastCodeSize];
318  uint8_t dev_type;
319  uint8_t version[4];
320  uint8_t slot;
321  uint8_t id;
323 
325 typedef struct {
326  char broadcast_code[kBroadcastCodeSize];
327  uint8_t state;
329 
330 typedef struct {
331  uint8_t ret_code;
332  char broadcast_code[kBroadcastCodeSize];
333 } ReturnCode;
334 
335 typedef struct {
336  char broadcast_code[kBroadcastCodeSize];
338 
339 typedef struct {
340  char broadcast_code[kBroadcastCodeSize];
341  uint8_t feature;
343 
344 typedef struct {
345  char broadcast_code[kBroadcastCodeSize];
346  uint8_t state;
348 
349 typedef struct {
350  char broadcast_code[kBroadcastCodeSize];
352 
353 typedef struct {
354  uint8_t ret_code;
355  char broadcast_code[kBroadcastCodeSize];
356  uint8_t state;
358 
359 typedef struct {
360  char broadcast_code[kBroadcastCodeSize];
361  uint8_t mode;
363 
364 typedef struct {
365  char broadcast_code[kBroadcastCodeSize];
367 
368 typedef struct {
369  uint8_t ret_code;
370  char broadcast_code[kBroadcastCodeSize];
371  uint8_t mode;
373 
374 typedef struct {
375  char broadcast_code[kBroadcastCodeSize];
376  uint8_t freq;
378 
379 
380 typedef struct {
381  char broadcast_code[kBroadcastCodeSize];
383 
384 typedef struct {
385  uint8_t ret_code;
386  char broadcast_code[kBroadcastCodeSize];
387  uint8_t freq;
389 
391 typedef struct {
392  char broadcast_code[kBroadcastCodeSize];
393  float roll;
394  float pitch;
395  float yaw;
396  int32_t x;
397  int32_t y;
398  int32_t z;
400 
402 typedef struct {
403  uint8_t ret_code;
404  char broadcast_code[kBroadcastCodeSize];
405  float roll;
406  float pitch;
407  float yaw;
408  int32_t x;
409  int32_t y;
410  int32_t z;
412 
413 typedef struct {
414  char broadcast_code[kBroadcastCodeSize];
415  uint8_t state;
416  uint8_t feature;
419 
423 typedef struct {
424  uint32_t ip_addr;
425  uint16_t data_port;
426  uint16_t cmd_port;
427  uint16_t sensor_port;
429 
433 typedef struct {
434  uint8_t ret_code;
435  uint8_t firmware_version[4];
437 
441 typedef struct {
442  uint8_t ip_mode;
443  uint32_t ip_addr;
445 
449 typedef struct {
450  uint8_t ret_code;
451  uint8_t ip_mode;
452  uint32_t ip_addr;
453  uint32_t net_mask;
454  uint32_t gw_addr;
456 
460 typedef struct {
461  uint32_t ip_addr;
462  uint32_t net_mask;
463  uint32_t gw_addr;
465 
469 typedef struct {
470  uint8_t ret_code;
471  uint8_t state;
472  uint8_t feature;
475 
479 typedef struct {
480  float roll;
481  float pitch;
482  float yaw;
483  int32_t x;
484  int32_t y;
485  int32_t z;
487 
491 typedef struct {
492  uint8_t ret_code;
493  float roll;
494  float pitch;
495  float yaw;
496  int32_t x;
497  int32_t y;
498  int32_t z;
500 
504 typedef struct {
505  uint8_t ret_code;
506  uint8_t state;
508 
512 typedef struct {
513  uint8_t ret_code;
514  uint8_t mode;
516 
517 
521 typedef struct {
522  uint8_t ret_code;
523  uint8_t freq;
525 
529 typedef struct {
530  uint8_t year;
531  uint8_t month;
532  uint8_t day;
533  uint8_t hour;
534  uint32_t mircrosecond;
536 
540 typedef struct {
541  uint8_t ret_code;
542  uint8_t count;
543  ConnectedLidarInfo device_info_list[1];
545 
549 typedef struct {
550  uint8_t count;
551  LidarModeRequestItem config_list[1];
553 
557 typedef struct {
558  uint8_t ret_code;
559  uint8_t count;
560  ReturnCode ret_state_list[1];
562 
566 typedef struct {
567  uint8_t slot;
568  uint8_t state;
570 
574 typedef struct {
575  uint8_t count;
576  ExtrinsicParameterRequestItem parameter_list[1];
578 
582 typedef struct {
583  uint8_t ret_code;
584  uint8_t count;
585  ReturnCode ret_code_list[1];
587 
591 typedef struct {
592  uint8_t count;
593  DeviceBroadcastCode code_list[1];
595 
599 typedef struct {
600  uint8_t ret_code;
601  uint8_t count;
602  ExtrinsicParameterResponseItem parameter_list[1];
604 
608 typedef struct {
609  uint8_t ret_code;
610  uint8_t count;
611  LidarStateItem state_list[1];
613 
617 typedef struct {
618  uint8_t count;
619  RainFogSuppressRequestItem lidar_cfg_list[1];
621 
625 typedef struct {
626  uint8_t ret_code;
627  uint8_t count;
628  ReturnCode ret_state_list[1];
630 
634 typedef struct {
635  uint8_t ret_code;
636  uint16_t slot_power_state;
638 
642 typedef struct {
643  uint8_t count;
644  FanControlRequestItem lidar_cfg_list[1];
646 
650 typedef struct {
651  uint8_t ret_code;
652  uint8_t count;
653  ReturnCode return_list[1];
655 
659 typedef struct {
660  uint8_t count;
661  GetFanStateRequestItem lidar_cfg_list[1];
663 
667 typedef struct {
668  uint8_t ret_code;
669  uint8_t count;
670  GetFanStateResponseItem return_list[1];
672 
676 typedef struct {
677  uint8_t count;
680 
684 typedef struct {
685  uint8_t ret_code;
686  uint8_t count;
687  ReturnCode return_list[1];
689 
693 typedef struct {
694  uint8_t count;
697 
701 typedef struct {
702  uint8_t ret_code;
703  uint8_t count;
706 
710 typedef struct {
711  uint8_t count;
712  SetImuPushFrequencyRequestItem lidar_cfg_list[1];
714 
718 typedef struct {
719  uint8_t ret_code;
720  uint8_t count;
721  ReturnCode return_list[1];
723 
727 typedef struct {
728  uint8_t count;
729  GetImuPushFrequencyRequestItem lidar_cfg_list[1];
731 
735 typedef struct {
736  uint8_t ret_code;
737  uint8_t count;
740 
741 #pragma pack()
742 
743 #endif // LIVOX_DEF_H_
LidarIpMode
Definition: livox_def.h:64
uint8_t reflectivity
Definition: livox_def.h:165
uint8_t feature
Definition: livox_def.h:416
uint8_t type
Definition: livox_def.h:296
LidarFeature feature
Definition: livox_def.h:302
uint8_t reflectivity
Definition: livox_def.h:149
DeviceEvent
Definition: livox_def.h:87
uint8_t slot
Definition: livox_def.h:273
LidarState
Definition: livox_def.h:41
uint16_t data_port
Definition: livox_def.h:425
PointDataType
Definition: livox_def.h:105
uint8_t rsvd
Definition: livox_def.h:275
uint16_t cmd_port
Definition: livox_def.h:298
uint8_t state
Definition: livox_def.h:415
int32_t z
Definition: livox_def.h:148
uint8_t timestamp_type
Definition: livox_def.h:277
LidarFeature
Definition: livox_def.h:58
float gyro_z
Definition: livox_def.h:216
HubErrorCode hub_error_code
Definition: livox_def.h:267
TimestampType
Definition: livox_def.h:95
uint8_t reflectivity
Definition: livox_def.h:157
uint16_t phi
Definition: livox_def.h:156
StatusUnion error_union
Definition: livox_def.h:473
uint16_t sensor_port
Definition: livox_def.h:427
LidarErrorCode lidar_error_code
Definition: livox_def.h:266
uint16_t sensor_port
Definition: livox_def.h:299
uint8_t slot
Definition: livox_def.h:294
uint8_t handle
Definition: livox_def.h:293
int32_t livox_status
Definition: livox_def.h:84
StatusUnion status
Definition: livox_def.h:303
basic_data data
Definition: format.h:764
DeviceType
Definition: livox_def.h:33
float y
Definition: livox_def.h:163
ErrorMessage status_code
Definition: livox_def.h:287
PointCloudReturnMode
Definition: livox_def.h:117
int32_t y
Definition: livox_def.h:147
uint32_t depth
Definition: livox_def.h:154
uint8_t reflectivity
Definition: livox_def.h:173
uint8_t ret_code
Definition: livox_def.h:470
StatusUnion error_union
Definition: livox_def.h:417
#define kBroadcastCodeSize
Definition: livox_def.h:135
float gyro_x
Definition: livox_def.h:214
uint32_t progress
Definition: livox_def.h:286
uint32_t error_code
Definition: livox_def.h:265
ImuFreq
Definition: livox_def.h:124
LidarMode
Definition: livox_def.h:51
LivoxStatus
Definition: livox_def.h:70
LidarState state
Definition: livox_def.h:301
int32_t x
Definition: livox_def.h:146
float z
Definition: livox_def.h:164
uint8_t data_type
Definition: livox_def.h:279
uint8_t version
Definition: livox_def.h:272
float gyro_y
Definition: livox_def.h:215
uint16_t theta
Definition: livox_def.h:155
uint32_t err_code
Definition: livox_def.h:276
uint8_t id
Definition: livox_def.h:274
uint8_t ret_code
Definition: livox_def.h:331
uint16_t data_port
Definition: livox_def.h:297
uint32_t ip_addr
Definition: livox_def.h:424
uint16_t cmd_port
Definition: livox_def.h:426
uint8_t id
Definition: livox_def.h:295
float x
Definition: livox_def.h:162