#ifndef LIVOX_LIDAR_DEF_H_
#define LIVOX_LIDAR_DEF_H_
#include <stdint.h>
#define kMaxLidarCount 32
#pragma pack(1)
#define LIVOX_LIDAR_SDK_MAJOR_VERSION 1
#define LIVOX_LIDAR_SDK_MINOR_VERSION 2
#define LIVOX_LIDAR_SDK_PATCH_VERSION 5
#define kBroadcastCodeSize 16
typedef int32_t livox_status;
typedef struct {
int major;
int minor;
int patch;
} LivoxLidarSdkVer;
typedef struct {
uint8_t dev_type;
char sn[16];
char lidar_ip[16];
} LivoxLidarInfo;
typedef enum {
kLivoxLidarTypeHub = 0,
kLivoxLidarTypeMid40 = 1,
kLivoxLidarTypeTele = 2,
kLivoxLidarTypeHorizon = 3,
kLivoxLidarTypeMid70 = 6,
kLivoxLidarTypeAvia = 7,
kLivoxLidarTypeMid360 = 9,
kLivoxLidarTypeIndustrialHAP = 10,
kLivoxLidarTypeHAP = 15,
kLivoxLidarTypePA = 16,
} LivoxLidarDeviceType;
typedef enum {
kKeyPclDataType = 0x0000,
kKeyPatternMode = 0x0001,
kKeyDualEmitEn = 0x0002,
kKeyPointSendEn = 0x0003,
kKeyLidarIpCfg = 0x0004,
kKeyStateInfoHostIpCfg = 0x0005,
kKeyLidarPointDataHostIpCfg = 0x0006,
kKeyLidarImuHostIpCfg = 0x0007,
kKeyCtlHostIpCfg = 0x0008,
kKeyLogHostIpCfg = 0x0009,
kKeyVehicleSpeed = 0x0010,
kKeyEnvironmentTemp = 0x0011,
kKeyInstallAttitude = 0x0012,
kKeyBlindSpotSet = 0x0013,
kKeyFrameRate = 0x0014,
kKeyFovCfg0 = 0x0015,
kKeyFovCfg1 = 0x0016,
kKeyFovCfgEn = 0x0017,
kKeyDetectMode = 0x0018,
kKeyFuncIoCfg = 0x0019,
kKeyWorkModeAfterBoot = 0x0020,
kKeyWorkMode = 0x001A,
kKeyGlassHeat = 0x001B,
kKeyImuDataEn = 0x001C,
kKeyFusaEn = 0x001D,
kKeyForceHeatEn = 0x001E,
kKeyLogParamSet = 0x7FFF,
kKeySn = 0x8000,
kKeyProductInfo = 0x8001,
kKeyVersionApp = 0x8002,
kKeyVersionLoader = 0x8003,
kKeyVersionHardware = 0x8004,
kKeyMac = 0x8005,
kKeyCurWorkState = 0x8006,
kKeyCoreTemp = 0x8007,
kKeyPowerUpCnt = 0x8008,
kKeyLocalTimeNow = 0x8009,
kKeyLastSyncTime = 0x800A,
kKeyTimeOffset = 0x800B,
kKeyTimeSyncType = 0x800C,
kKeyStatusCode = 0x800D,
kKeyLidarDiagStatus = 0x800E,
kKeyLidarFlashStatus = 0x800F,
kKeyFwType = 0x8010,
kKeyHmsCode = 0x8011,
kKeyCurGlassHeatState = 0x8012,
kKeyRoiMode = 0xFFFE,
kKeyLidarDiagInfoQuery = 0xFFFF
} ParamKeyName;
typedef struct {
uint8_t version;
uint16_t length;
uint16_t time_interval;
uint16_t dot_num;
uint16_t udp_cnt;
uint8_t frame_cnt;
uint8_t data_type;
uint8_t time_type;
uint8_t rsvd[12];
uint32_t crc32;
uint8_t timestamp[8];
uint8_t data[1];
} LivoxLidarEthernetPacket;
typedef struct {
uint8_t sof;
uint8_t version;
uint16_t length;
uint32_t seq_num;
uint16_t cmd_id;
uint8_t cmd_type;
uint8_t sender_type;
char rsvd[6];
uint16_t crc16_h;
uint32_t crc32_d;
uint8_t data[1];
} LivoxLidarCmdPacket;
typedef struct {
float gyro_x;
float gyro_y;
float gyro_z;
float acc_x;
float acc_y;
float acc_z;
} LivoxLidarImuRawPoint;
typedef struct {
int32_t x;
int32_t y;
int32_t z;
uint8_t reflectivity;
uint8_t tag;
} LivoxLidarCartesianHighRawPoint;
typedef struct {
int16_t x;
int16_t y;
int16_t z;
uint8_t reflectivity;
uint8_t tag;
} LivoxLidarCartesianLowRawPoint;
typedef struct {
uint32_t depth;
uint16_t theta;
uint16_t phi;
uint8_t reflectivity;
uint8_t tag;
} LivoxLidarSpherPoint;
typedef enum {
kLivoxLidarImuData = 0,
kLivoxLidarCartesianCoordinateHighData = 0x01,
kLivoxLidarCartesianCoordinateLowData = 0x02,
kLivoxLidarSphericalCoordinateData = 0x03
} LivoxLidarPointDataType;
typedef enum {
kLivoxLidarRealTimeLog = 0,
kLivoxLidarExceptionLog = 0x01
} LivoxLidarLogType;
typedef enum {
kLivoxLidarStatusSendFailed = -9,
kLivoxLidarStatusHandlerImplNotExist = -8,
kLivoxLidarStatusInvalidHandle = -7,
kLivoxLidarStatusChannelNotExist = -6,
kLivoxLidarStatusNotEnoughMemory = -5,
kLivoxLidarStatusTimeout = -4,
kLivoxLidarStatusNotSupported = -3,
kLivoxLidarStatusNotConnected = -2,
kLivoxLidarStatusFailure = -1,
kLivoxLidarStatusSuccess = 0
} LivoxLidarStatus;
typedef struct {
uint16_t key;
uint16_t length;
uint8_t value[1];
} LivoxLidarKeyValueParam;
typedef struct {
uint8_t ret_code;
uint16_t error_key;
} LivoxLidarAsyncControlResponse;
typedef struct {
uint8_t ret_code;
const char* lidar_info;
} LivoxLidarInfoResponse;
typedef struct {
uint8_t ret_code;
uint16_t param_num;
uint8_t data[1];
} LivoxLidarDiagInternalInfoResponse;
typedef enum {
kLivoxLidarScanPatternNoneRepetive = 0x00,
kLivoxLidarScanPatternRepetive = 0x01,
kLivoxLidarScanPatternRepetiveLowFrameRate = 0x02
} LivoxLidarScanPattern;
typedef enum {
kLivoxLidarFrameRate10Hz = 0x00,
kLivoxLidarFrameRate15Hz = 0x01,
kLivoxLidarFrameRate20Hz = 0x02,
kLivoxLidarFrameRate25Hz = 0x03,
} LivoxLidarPointFrameRate;
typedef enum {
kLivoxLidarNormal = 0x01,
kLivoxLidarWakeUp = 0x02,
kLivoxLidarSleep = 0x03,
kLivoxLidarError = 0x04,
kLivoxLidarPowerOnSelfTest = 0x05,
kLivoxLidarMotorStarting = 0x06,
kLivoxLidarMotorStoping = 0x07,
kLivoxLidarUpgrade = 0x08
} LivoxLidarWorkMode;
typedef enum {
kLivoxLidarWorkModeAfterBootDefault = 0x00,
kLivoxLidarWorkModeAfterBootNormal = 0x01,
kLivoxLidarWorkModeAfterBootWakeUp = 0x02
} LivoxLidarWorkModeAfterBoot;
typedef struct {
float roll_deg;
float pitch_deg;
float yaw_deg;
int32_t x; int32_t y; int32_t z; } LivoxLidarInstallAttitude;
typedef struct {
int32_t yaw_start;
int32_t yaw_stop;
int32_t pitch_start;
int32_t pitch_stop;
uint32_t rsvd;
} FovCfg;
typedef enum {
kLivoxLidarDetectNormal = 0x00,
kLivoxLidarDetectSensitive = 0x01
} LivoxLidarDetectMode;
typedef struct {
uint8_t in0;
uint8_t int1;
uint8_t out0;
uint8_t out1;
} FuncIOCfg;
typedef struct {
bool lidar_log_enable;
uint32_t lidar_log_cache_size;
char lidar_log_path[1024];
} LivoxLidarLoggerCfgInfo;
typedef struct {
char ip_addr[16];
char net_mask[16];
char gw_addr[16];
} LivoxLidarIpInfo;
typedef struct {
char host_ip_addr[16];
uint16_t host_state_info_port;
uint16_t lidar_state_info_port;
} HostStateInfoIpInfo;
typedef struct {
char host_ip_addr[16];
uint16_t host_point_data_port;
uint16_t lidar_point_data_port;
} HostPointIPInfo;
typedef struct {
char host_ip_addr[16];
uint16_t host_imu_data_port; uint16_t lidar_imu_data_port; } HostImuDataIPInfo;
typedef struct {
char ip_addr[16];
uint16_t dst_port;
uint16_t src_port;
} LivoxIpCfg;
typedef struct {
uint8_t pcl_data_type;
uint8_t pattern_mode;
uint8_t dual_emit_en;
uint8_t point_send_en;
LivoxLidarIpInfo lidar_ip_info;
HostPointIPInfo host_point_ip_info;
HostImuDataIPInfo host_imu_ip_info;
LivoxLidarInstallAttitude install_attitude;
uint32_t blind_spot_set;
uint8_t work_mode;
uint8_t glass_heat;
uint8_t imu_data_en;
uint8_t fusa_en;
char sn[16];
char product_info[64];
uint8_t version_app[4];
uint8_t version_load[4];
uint8_t version_hardware[4];
uint8_t mac[6];
uint8_t cur_work_state;
uint64_t status_code;
} LivoxLidarStateInfo;
typedef struct {
uint8_t pcl_data_type; uint8_t pattern_mode; uint8_t dual_emit_en; uint8_t point_send_en; LivoxLidarIpInfo lidar_ipcfg; HostStateInfoIpInfo host_state_info; HostPointIPInfo pointcloud_host_ipcfg; HostImuDataIPInfo imu_host_ipcfg; LivoxIpCfg ctl_host_ipcfg; LivoxIpCfg log_host_ipcfg;
int32_t vehicle_speed; int32_t environment_temp; LivoxLidarInstallAttitude install_attitude; uint32_t blind_spot_set; uint8_t frame_rate; FovCfg fov_cfg0; FovCfg fov_cfg1; uint8_t fov_cfg_en; uint8_t detect_mode; uint8_t func_io_cfg[4]; uint8_t work_tgt_mode; uint8_t glass_heat; uint8_t imu_data_en; uint8_t fusa_en;
char sn[16]; char product_info[64]; uint8_t version_app[4]; uint8_t version_loader[4]; uint8_t version_hardware[4]; uint8_t mac[6]; uint8_t cur_work_state; int32_t core_temp; uint32_t powerup_cnt; uint64_t local_time_now; uint64_t last_sync_time; int64_t time_offset; uint8_t time_sync_type; uint8_t status_code[32]; uint16_t lidar_diag_status; uint8_t lidar_flash_status; uint8_t fw_type; uint32_t hms_code[8]; uint8_t ROI_Mode; } DirectLidarStateInfo;
typedef struct {
uint8_t ret_code;
LivoxLidarStateInfo livox_lidar_state_info;
} LivoxLidarQueryInternalInfoResponse;
typedef enum {
kLivoxLidarStopPowerOnHeatingOrDiagnosticHeating = 0x00,
kLivoxLidarTurnOnHeating = 0x01,
kLivoxLidarDiagnosticHeating = 0x02,
kLivoxLidarStopSelfHeating = 0x03
} LivoxLidarGlassHeat;
typedef struct {
uint8_t log_send_method;
uint16_t log_id;
uint16_t log_frequency;
uint8_t is_save_setting;
uint8_t check_code;
} LivoxLidarLogParam;
typedef struct {
uint8_t ret_code;
} LivoxLidarLoggerResponse;
typedef struct {
uint16_t timeout;
} LivoxLidarRebootRequest;
typedef struct {
uint8_t ret_code;
} LivoxLidarRebootResponse;
typedef struct {
uint8_t data[16];
} LivoxLidarResetRequest;
typedef struct {
uint8_t ret_code;
} LivoxLidarResetResponse;
typedef enum {
kLivoxLidarUpgradeIdle = 0,
kLivoxLidarUpgradeRequest = 1,
kLivoxLidarUpgradeXferFirmware = 2,
kLivoxLidarUpgradeCompleteXferFirmware = 3,
kLivoxLidarUpgradeGetUpgradeProgress = 4,
kLivoxLidarUpgradeComplete = 5,
kLivoxLidarUpgradeTimeout = 6,
kLivoxLidarUpgradeErr = 7,
kLivoxLidarUpgradeUndef = 8
} LivoxLidarFsmState;
typedef enum {
kLivoxLidarEventRequestUpgrade = 0,
kLivoxLidarEventXferFirmware = 1,
kLivoxLidarEventCompleteXferFirmware = 2,
kLivoxLidarEventGetUpgradeProgress = 3,
kLivoxLidarEventComplete = 4,
kLivoxLidarEventReinit = 5,
kLivoxLidarEventTimeout = 6,
kLivoxLidarEventErr = 7,
kLivoxLidarEventUndef = 8
} LivoxLidarFsmEvent;
typedef struct {
LivoxLidarFsmEvent state;
uint8_t progress;
} LivoxLidarUpgradeState;
typedef struct {
uint8_t ret; } LivoxLidarRmcSyncTimeResponse;
#pragma pack()
typedef void (*LivoxLidarPointCloudCallBack)(const uint32_t handle, const uint8_t dev_type, LivoxLidarEthernetPacket* data, void* client_data);
typedef void (*LivoxLidarCmdObserverCallBack)(const uint32_t handle, const LivoxLidarCmdPacket* data, void* client_data);
typedef void (*LivoxLidarPointCloudObserver) (uint32_t handle, const uint8_t dev_type, LivoxLidarEthernetPacket *data, void *client_data);
typedef void (*LivoxLidarImuDataCallback)(const uint32_t handle, const uint8_t dev_type, LivoxLidarEthernetPacket* data, void* client_data);
typedef void(*LivoxLidarInfoCallback)(const uint32_t handle, const uint8_t dev_type, const char* info, void* client_data);
typedef void(*LivoxLidarInfoChangeCallback)(const uint32_t handle, const LivoxLidarInfo* info, void* client_data);
typedef void (*QueryLivoxLidarInternalInfoCallback)(livox_status status, uint32_t handle,
LivoxLidarDiagInternalInfoResponse* response, void* client_data);
typedef void (*LivoxLidarAsyncControlCallback)(livox_status status, uint32_t handle,
LivoxLidarAsyncControlResponse *response, void *client_data);
typedef void (*LivoxLidarResetCallback)(livox_status status, uint32_t handle, LivoxLidarResetResponse* response, void* client_data);
typedef void (*LivoxLidarLoggerCallback)(livox_status status, uint32_t handle,
LivoxLidarLoggerResponse* response, void* client_data);
typedef void (*LivoxLidarRebootCallback)(livox_status status, uint32_t handle, LivoxLidarRebootResponse* response, void* client_data);
typedef void (*OnLivoxLidarUpgradeProgressCallback)(uint32_t handle, LivoxLidarUpgradeState state, void *client_data);
typedef void (*LivoxLidarRmcSyncTimeCallBack)(livox_status status, uint32_t handle, LivoxLidarRmcSyncTimeResponse* data, void* client_data);
#endif