v1.0.0 release #5

Merged
Livox-SDK merged 1 commits from review_pr into master 2019-02-27 05:03:57 +01:00
7 changed files with 61 additions and 15 deletions
+3 -6
View File
@@ -1,7 +1,3 @@
# Official Q&A site
https://groups.google.com/forum/#!forum/livox-lidars
# 1 Introduction # 1 Introduction
Livox SDK is the software development kit designed for all Livox products. It is developed based on C/C++ following Livox SDK Communication Protocol, and provides easy-to-use C style API. With Livox SDK, users can quickly connect to Livox products and receive point cloud data. Livox SDK is the software development kit designed for all Livox products. It is developed based on C/C++ following Livox SDK Communication Protocol, and provides easy-to-use C style API. With Livox SDK, users can quickly connect to Livox products and receive point cloud data.
@@ -41,7 +37,8 @@ sudo apt install cmake libapr1-dev libboost-atomic-dev libboost-system-dev
#### Compile Livox SDK #### Compile Livox SDK
In the Livox SDK directory, run the following commands to compile the project: In the Livox SDK directory, run the following commands to compile the project:
``` ```
cd build git clone https://github.com/Livox-SDK/Livox-SDK.git
cd Livox-SDK/build
cmake .. cmake ..
make make
sudo make install sudo make install
@@ -97,4 +94,4 @@ After compiling the Livox SDK as shown in section 4.1.2, you can find `hub_sampl
# 5 Support # 5 Support
You can get support from Livox with the following methods: You can get support from Livox with the following methods:
* Send email to dev@livoxtech.com with a clear description of your problem and your setup * Send email to dev@livoxtech.com with a clear description of your problem and your setup
* Github Issues * Github Issues
+14 -1
View File
@@ -57,6 +57,10 @@ void GetLidarData(uint8_t handle, LivoxEthPacket *data, uint32_t data_num) {
++receive_packet_count; ++receive_packet_count;
if (0 == (receive_packet_count % 10000)) { if (0 == (receive_packet_count % 10000)) {
printf("receive packet count %d %d\n", data->id, receive_packet_count); printf("receive packet count %d %d\n", data->id, receive_packet_count);
/** Parsing the timestamp and the point cloud data. */
uint64_t cur_timestamp = *((uint64_t *)(data->timestamp));
LivoxRawPoint *p_point_data = (LivoxRawPoint *)data->data;
} }
printf("receive packet from %d \n", (uint16_t) HubGetLidarHandle(data->slot, data->id)); printf("receive packet from %d \n", (uint16_t) HubGetLidarHandle(data->slot, data->id));
} }
@@ -191,15 +195,24 @@ void OnDeviceBroadcast(const BroadcastDeviceInfo *info) {
} }
int main(int argc, const char *argv[]) { int main(int argc, const char *argv[]) {
printf("Livox SDK initializing.\n");
/** Initialize Livox-SDK. */
if (!Init()) { if (!Init()) {
return -1; return -1;
} }
printf("Livox SDK has been initialized.\n");
LivoxSdkVersion _sdkversion;
GetLivoxSdkVersion(&_sdkversion);
printf("Livox SDK version %d.%d.%d .\n", _sdkversion.major, _sdkversion.minor, _sdkversion.patch);
memset(devices, 0, sizeof(devices)); memset(devices, 0, sizeof(devices));
SetBroadcastCallback(OnDeviceBroadcast); SetBroadcastCallback(OnDeviceBroadcast);
SetDeviceStateUpdateCallback(OnDeviceChange); SetDeviceStateUpdateCallback(OnDeviceChange);
if (Start()) { if (Start()) {
printf("Start discovering device.\n");
#ifdef WIN32 #ifdef WIN32
Sleep(20000); Sleep(20000);
#else #else
+17 -5
View File
@@ -47,19 +47,24 @@ typedef struct {
DeviceItem devices[kMaxLidarCount]; DeviceItem devices[kMaxLidarCount];
uint32_t data_recveive_count[kMaxLidarCount]; uint32_t data_recveive_count[kMaxLidarCount];
#define BROADCAST_CODE_LIST_SIZE 3 char *broadcast_code_list[] = {
char *broadcast_code_list[BROADCAST_CODE_LIST_SIZE] = { "000000000000002",
"000000000000002", "000000000000003",
"000000000000003", "000000000000004"
"000000000000004"
}; };
#define BROADCAST_CODE_LIST_SIZE (sizeof(broadcast_code_list) / sizeof(intptr_t))
/** Receiving point cloud data from Livox LiDAR. */ /** Receiving point cloud data from Livox LiDAR. */
void GetLidarData(uint8_t handle, LivoxEthPacket *data, uint32_t data_num) { void GetLidarData(uint8_t handle, LivoxEthPacket *data, uint32_t data_num) {
if (data) { if (data) {
data_recveive_count[handle] += data_num; data_recveive_count[handle] += data_num;
if (data_recveive_count[handle] % 10000 == 0) { if (data_recveive_count[handle] % 10000 == 0) {
printf("receive packet count %d %d\n", handle, data_recveive_count[handle]); printf("receive packet count %d %d\n", handle, data_recveive_count[handle]);
/** Parsing the timestamp and the point cloud data. */
uint64_t cur_timestamp = *((uint64_t *)(data->timestamp));
LivoxRawPoint *p_point_data = (LivoxRawPoint *)data->data;
} }
} }
} }
@@ -165,10 +170,16 @@ void OnDeviceBroadcast(const BroadcastDeviceInfo *info) {
} }
int main(int argc, const char *argv[]) { int main(int argc, const char *argv[]) {
printf("Livox SDK initializing.\n");
/** Initialize Livox-SDK. */ /** Initialize Livox-SDK. */
if (!Init()) { if (!Init()) {
return -1; return -1;
} }
printf("Livox SDK has been initialized.\n");
LivoxSdkVersion _sdkversion;
GetLivoxSdkVersion(&_sdkversion);
printf("Livox SDK version %d.%d.%d .\n", _sdkversion.major, _sdkversion.minor, _sdkversion.patch);
memset(devices, 0, sizeof(devices)); memset(devices, 0, sizeof(devices));
memset(data_recveive_count, 0, sizeof(data_recveive_count)); memset(data_recveive_count, 0, sizeof(data_recveive_count));
@@ -186,6 +197,7 @@ int main(int argc, const char *argv[]) {
Uninit(); Uninit();
return -1; return -1;
} }
printf("Start discovering device.\n");
#ifdef WIN32 #ifdef WIN32
Sleep(30000); Sleep(30000);
+12 -1
View File
@@ -89,8 +89,19 @@ typedef enum {
#pragma pack(1) #pragma pack(1)
#define LIVOX_SDK_MAJOR_VERSION 1
#define LIVOX_SDK_MINOR_VERSION 0
#define LIVOX_SDK_PATCH_VERSION 0
#define kBroadcastCodeSize 16 #define kBroadcastCodeSize 16
/** The numeric version information struct. */
typedef struct {
int major; /**< major number */
int minor; /**< minor number */
int patch; /**< patch number */
} LivoxSdkVersion;
/** Cartesian coordinate format. */ /** Cartesian coordinate format. */
typedef struct { typedef struct {
int32_t x; /**< X axis, Unit:mm */ int32_t x; /**< X axis, Unit:mm */
@@ -99,7 +110,7 @@ typedef struct {
uint8_t reflectivity; /**< Reflectivity */ uint8_t reflectivity; /**< Reflectivity */
} LivoxRawPoint; } LivoxRawPoint;
/** standard point cloud format */ /** Standard point cloud format */
typedef struct { typedef struct {
float x; /**< X axis, Unit:m */ float x; /**< X axis, Unit:m */
float y; /**< X axis, Unit:m */ float y; /**< X axis, Unit:m */
+6
View File
@@ -33,6 +33,12 @@ extern "C" {
#include <stdint.h> #include <stdint.h>
#include "livox_def.h" #include "livox_def.h"
/**
* Return SDK's version information in a numeric form.
* @param version Pointer to a version structure for returning the version information.
*/
void GetLivoxSdkVersion(LivoxSdkVersion *version);
/** /**
* Initialize the SDK. * Initialize the SDK.
* @return true if successfully initialized, otherwise false. * @return true if successfully initialized, otherwise false.
+1 -1
View File
@@ -78,7 +78,7 @@ bool FindLocalIP(const struct sockaddr_in &client_addr, uint32_t &local_ip) {
IP_ADAPTER_INFO *pAdapter = reinterpret_cast<IP_ADAPTER_INFO *>(pAdapterInfo.get()); IP_ADAPTER_INFO *pAdapter = reinterpret_cast<IP_ADAPTER_INFO *>(pAdapterInfo.get());
if (NO_ERROR == dlRetVal && pAdapter != NULL) { if (NO_ERROR == dlRetVal && pAdapter != NULL) {
while (pAdapterInfo) { while (pAdapter) {
std::string str_ip = pAdapter->IpAddressList.IpAddress.String; std::string str_ip = pAdapter->IpAddressList.IpAddress.String;
std::string str_mask = pAdapter->IpAddressList.IpMask.String; std::string str_mask = pAdapter->IpAddressList.IpMask.String;
ULONG host_ip = inet_addr(const_cast<char *>(str_ip.c_str())); ULONG host_ip = inet_addr(const_cast<char *>(str_ip.c_str()));
+8 -1
View File
@@ -30,6 +30,14 @@
using namespace livox; using namespace livox;
IOThread *g_thread = NULL; IOThread *g_thread = NULL;
void GetLivoxSdkVersion(LivoxSdkVersion *version) {
if (version != NULL) {
version->major = LIVOX_SDK_MAJOR_VERSION;
version->minor = LIVOX_SDK_MINOR_VERSION;
version->patch = LIVOX_SDK_PATCH_VERSION;
}
}
bool Init() { bool Init() {
bool result = false; bool result = false;
do { do {
@@ -59,7 +67,6 @@ bool Init() {
result = false; result = false;
break; break;
} }
result = true; result = true;
} while (0); } while (0);