Code Monkey home page Code Monkey logo

livox-sdk's 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 consists of Livox SDK communication protocol, Livox SDK core, Livox SDK API, Linux sample, and ROS demo.

Prerequisites

  • Ubuntu 14.04/Ubuntu 16.04/Ubuntu 18.04, both x86 and ARM (Nvidia TX2)
  • Windows 7/10, Visual Studio 2015 Update3/2017/2019
  • C++11 compiler

2 Livox SDK Communication Protocol

Livox SDK communication protocol opens to all users. It is the communication protocol between user programs and Livox products. The protocol consists of control commands and data format. Please refer to the Livox SDK Communication Protocol for detailed information.

3 Livox SDK Core

Livox SDK provides the implementation of control commands and point cloud data transmission, as well as the C/C++ API. The basic structure of Livox SDK core is shown as below:

Livox SDK Architecture

User Datagram Protocol (UDP) is used for communication between Livox SDK and LiDAR sensors. Please refer to the Livox SDK Communication Protocol for further information. Point cloud data handler supports point cloud data transmission, while command handler receives and sends control commands. And the C/C++ API is based on command handler and point cloud data handler.

The Livox LiDAR sensors can be connected to host directly or through the Livox Hub. Livox SDK supports both connection methods. When LiDAR units are connected to host directly, the host will establish communication with each LiDAR unit individually. And if the LiDAR units connect to host through Hub, then the host only communicates with the Livox Hub while the Hub communicates with each LiDAR unit.

4 Livox SDK API

Livox SDK API provides a set of C style functions which can be conveniently integrated in C/C++ programs. Please refer to the Livox SDK API Reference for further information.

4.1 Installation

The installation procedures in Ubuntu 18.04/16.04/14.04 LTS and Windows 7/10 are shown here as examples. For Ubuntu 18.04/16.04/14.04 32-bit LTS and Mac, you can get it in Livox-SDK wiki.

4.1.1 Ubuntu 18.04/16.04/14.04 LTS

Dependencies

Livox SDK requires CMake 3.0.0+ as dependencies. You can install these packages using apt:

sudo apt install cmake

Compile Livox SDK

In the Livox SDK directory, run the following commands to compile the project:

git clone https://github.com/Livox-SDK/Livox-SDK.git
cd Livox-SDK
cd build && cmake ..
make
sudo make install

4.1.2 Windows 7/10

Dependencies

Livox SDK supports Visual Studio 2015 Update3/2017/2019 and requires install CMake 3.0.0+ as dependencies.

In the Livox SDK directory, run the following commands to create the Visual Studio solution file. Generate the 32-bit project:

cd Livox-SDK/build

For Viusal Studio 2015 Update3/2017:

cmake ..

For Viusal Studio 2019:

cmake .. -G "Visual Studio 16 2019" -A Win32

Generate the 64-bit project:

cd Livox-SDK/build 

For Viusal Studio 2015 Update3:

cmake .. -G "Visual Studio 14 2015 Win64"

For Viusal Studio 2017:

cmake .. -G "Visual Studio 15 2017 Win64"

For Viusal Studio 2019:

cmake .. -G "Visual Studio 16 2019" -A x64

Compile Livox SDK

You can now compile the Livox SDK in Visual Studio.

4.1.3 ARM-Linux Cross Compile

The procedure of cross compile Livox-SDK in ARM-Linux are shown below.

Dependencies

Host machine requires install cmake. You can install these packages using apt:

sudo apt install cmake

Cross Compile Toolchain

If your ARM board vendor provides a cross compile toolchain, you can skip the following step of installing the toolchain and use the vendor-supplied cross compile toolchain instead.

The following commands will install C and C++ cross compiler toolchains for 32bit and 64bit ARM board. You need to install the correct toolchain for your ARM board. For 64bit SoC ARM board, only install 64bit toolchain, and for 32bit SoC ARM board, only install 32bit toolchain.

Install ARM 32 bits cross compile toolchain

 sudo apt-get install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi

Install ARM 64 bits cross compile toolchain

sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu

Cross Compile Livox-SDK

For ARM 32 bits toolchain,In the Livox SDK directory,run the following commands to cross compile the project:

cd Livox-SDK
cd build && \
cmake .. -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_C_COMPILER=arm-linux-gnueabi-gcc -DCMAKE_CXX_COMPILER=arm-linux-gnueabi-g++
make

For ARM 64 bits toolchain,In the Livox SDK directory,run the following commands to cross compile the project:

cd Livox-SDK
cd build && \
cmake .. -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++
make

Note:

  • gcc cross compiler need to support C ++11 standard

4.2 Run Livox SDK Sample

Two samples are provided in Sample/Lidar and Sample/Hub, which demonstrate how to configure Livox LiDAR units and receive the point cloud data when directly connecting Livox SDK to LiDAR units or by using a Livox Hub, respectively. The sequence diagram is shown as below:

4.2.1 Ubuntu 18.04/16.04 /14.04 LTS

For Ubuntun 18.04/16.04/14.04 LTS, run the lidar_sample if connect with the LiDAR unit(s):

cd sample/lidar && ./lidar_sample

or run the hub_sample if connect with the hub unit(s):

cd sample/hub && ./hub_sample

4.2.2 Windows 7/10

After compiling the Livox SDK as shown in section 4.1.2, you can find hub_sample.exe or lidar_sample.exe in the {Livox-SDK}\build\sample\hub\Debug or {Livox-SDK}\build\sample\lidar\Debug folder, respectively, which can be run directly.

Then you can see the information as below:

4.3 Connect to the specific LiDAR units

Samples we provided will connect all the broadcast device in you LAN in default.There are two ways to connect the specific units:

  • run sample with input options

  • edit the Broadcast Code list in source code

NOTE:

Each Livox LiDAR unit owns a unique Broadcast Code . The broadcast code consists of its serial number and an additional number (1,2, or 3). The serial number can be found on the body of the LiDAR unit (below the QR code).The Broadcast Code may be used when you want to connect to the specific LiDAR unit(s). The detailed format is shown as below:

Broadcast Code

4.3.1 Program Options

We provide the following program options for connecting the specific units and saving log file:

[-c]:Register LiDAR units by Broadcast Code. Connect the registered units ONLY. 
[-l]:Save the log file(In the executable file's directory).
[-h]:Show help.

Here is the example:

./lidar_sample_cc -c "00000000000002&00000000000003&00000000000004" -l
./hub_sample_cc -c "00000000000001" -l

4.3.2 Edit Broadcast Code List

Comment the following code section:

/** Connect all the broadcast device. */
int lidar_count = 0;
char broadcast_code_list[kMaxLidarCount][kBroadcastCodeSize];

Remove the comment of the following code section, set the BROADCAST_CODE_LIST_SIZE and replace the broadcast code lists in the main.c for both LiDAR sample ({Livox-SDK}/sample/lidar/main.c) and Hub sample ({Livox-SDK}/sample/hub/main.c) with the broadcast code of your devices before building.

/** Connect the broadcast device in list, please input the broadcast code and modify the BROADCAST_CODE_LIST_SIZE. */
/*#define BROADCAST_CODE_LIST_SIZE  3
int lidar_count = BROADCAST_CODE_LIST_SIZE;
char broadcast_code_list[kMaxLidarCount][kBroadcastCodeSize] = {
  "000000000000002",
  "000000000000003",
  "000000000000004"
};*/

4.4 Generate the lvx file

We provide the C++ sample to generate the lvx file for hub and LiDAR unit(s). You can use the same way in 4.2.1 and 4.2.2 to run them.

4.4.1 Program Options

You can alse use the program options in 4.3.1 to connect specific device and generate the log file, and we provide two new options for lvx file:

[-t] Time to save point cloud to the lvx file.(unit: s)
[-p] Get the extrinsic parameter from standard extrinsic.xml file(The same as viewer) in the executable file's directory.(Especially for LiDAR unit(s) as the hub will calculate the extrinsic parameter by itself)

Here is the example:

./lidar_lvx_sample -c "00000000000002&00000000000003&00000000000004" -l -t 10 -p
./hub_lvx_sample -c "00000000000001" -l -t 10

5 Support

You can get support from Livox with the following methods:

  • Send email to [email protected] with a clear description of your problem and your setup
  • Github Issues

livox-sdk's People

Contributors

gworkman avatar jingweiz2017 avatar kamiccolo avatar karolmajek avatar livox-sdk avatar sirdifferential avatar unanancyowen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

livox-sdk's Issues

False depth values on Object edges

I found that on object edges the depth values are extrapolated over the background. This happens where the background behind the edge lies in a shadowed region (the intensity here is zero), however, there, depth values are still given but falsely given by the object contour and not the background.

Why does this happen? And how can I fix this? It seems to me that this is due to the different position of the emitter and detector of the lidar. But why are the intensity values correct but not the depth values?

Build failed: could not find PkgConfig

I am trying to build the SDK from the latest release. When I run cmake .. the output is the following:

-- main project dir: /home/ubuntu/Livox-SDK
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- system
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ubuntu/Livox-SDK/build

If I try to continue and run make, the build fails with

fatal error: apr_general.h: No such file or directory
  #include "apr_general.h"

However, I checked and the correct libraries are installed and the apr_general.h file exists in /usr/include/apr-1.0/

Interferences between multiple sensors

I use 2 livox mid-40 sensors that scan at the same time. When I get the scanned output I see there are a lot of wrong measurements, e.g. very far values etc. When the sensors scan the environment one after another and not at the same time everything works fine. So I assume some reflections from one sensor go into into the other sensor leading to wrong measurements.

Am I doing something wrong? Is there a way to filter out these wrong measurement?

This is really a big issue. The sensors are supposed to work together...

Heartbeat Packet Format

Hello,

I am a graduate student in geomatics at the University of Florida and I have just begun development of a Python3 driver for the Mid-40 sensor. I am using a Mac computer and hence don't have the ability to run the binaries that Livox provided and therefore I can not thoroughly packet sniff the valid UDP communications. I have been able to follow the SDK documentation and acquire and parse the broadcast message (coming in on port 55000). I have tested the CRC16 and CRC32 checks using the initial values stated in the SDK and everything in my code agrees with all the broadcast messages coming in over all 255 frame sequences.

This is the command (hex) that I send to the sensor as a connection/handshaking request, which sets my IP to 192.168.33.1 and the point cloud port to 1981 and command port to 65000:
AA 01 17 00 00 00 00 64 39 00 01 C0 A8 21 01 BD 07 E8 FD 1E 25 F9 12

Upon sending the connection request, I receive the following response message (coming in now on port 65000, as excepted):
AA 01 10 00 01 00 00 64 53 00 01 00 F1 34 3C 29

The content of this message is as expected and the 5th last hex char (00) indicates to me that the connection request was successful, as per the SDK. At this point in time I send a heartbeat request command. The following command is what I send:
AA 01 0F 00 00 00 00 04 D7 00 03 38 BA 8D 0C

I am under the assumption that the hex chars in this command will always remain the same every time a heartbeat request is sent? Unfortunately, after sending this heartbeat request command, I do not receive a response message. After the heartbeat timeout occurs I once again receive the broadcast message over port 55000.

My question is, are you certain that your documentation is correct for the heartbeat command format? I am hoping that you could examine my command messages and ensure that my understanding is correct and that they conform to your standards.

Thanks,

Ryan

P.S. You have a mistake in your SDK documentation in section 2.1, Frame Format. You state that the Size (bytes) of the crc_32 Whole Frame Checksum is 2 bytes when it should be 4 bytes (i.e., 32 bits).

树莓派平台编译错误

/home/ubuntu/Livox-SDK/third_party/apr/include/apr-1/apr.h:359:10: error: unknown type name ‘off64_t’
359 | typedef off64_t apr_off_t;
| ^~~~~~~

SDK release V2.0.0 not well suport for Mid40's UTC synchronization

It will be fixed in next release.
If you want to use the lidar_utc_sync sample with the Mid-40, a temporary solution is :

  1. Update Mid40's firmware to v03.07.0000 or above (through the Livox Viewer).
  2. Modify line 738 of command_impl.cpp from
if (device_manager().device_mode() != kDeviceModeLidar
      || device_manager().IsLidarMid40(handle)) {
    return kStatusNotSupported;
  }

to

 if (device_manager().device_mode() != kDeviceModeLidar)  {
    return kStatusNotSupported;
  }

and then rebuild Livox-SDK, it will be worked with Mid-40 to use the lidar_utc_sync sample.

Livox SDK on Win10

Hi,

I have followed instructions to compile the Livox SDK on Win10. After connecting my Mid-40 successfully, I run lidar_sample.exe following Step 4.2.2, and it shows the following figures. Is it normal? I dont know why the programme automatically stops.

image

Question: how to integrate the Livox-SDK into a OOP structure?.

Hi. I am trying to integrate the drivers into my own software and I am having some problems.

The use of global objects for the callbacks (i.e. SetDeviceStateUpdateCallback SetBroadcastCallback LidarStartSampling ...) is not viable in my case. I have to put all the global objects as non static members of a class. I have seen that some of the callbacks use a void pointer to pass generic data structures to the callbacks, however some of the others don't. I have tried std::bind (which would be perfect for this case) .
For instance:

void OnDeviceInfoChangeCustom(MyCustomClass* a, const DeviceInfo *info, DeviceEvent type) {
//...
}
//And then

SetDeviceStateUpdateCallback(std::function<...> (std::bind(OnDeviceInfoChangeCustom, this, _1, _2)

However this is not working either. Partially because SetDeviceStateUpdateCallback expects the type DeviceStateUpdateCallback only to cast it later into a more flexible std::function (just since today)/boost::function).

Do you have any recommendation for this situation?.
Thank you very much.

Multiple livox devices connect compute

Two livox through two network connect one compute, only receive one livox's data.Livox and compute in the same network segment.
Multiple mode how to work?

livox horizon和imu时间同步

您好,我在用livox horizon和xsens的imu录数据,请问我怎么样才能得到同步的时间戳呢,我想知道硬件上需要怎么连接,我用的驱动是livox_ros_driver.谢谢!

SDK 中关于whitelist的含义

在阅读SDK代码时,频繁遇到很多变量或者注释里面含有 whitelist,请问 whitelist有什么特殊含义吗?

关于Livox点云的覆盖范围和精度问题

    看官网上的宣传说基本能在1秒内接近100%的覆盖率,不知道这个覆盖率是如何定义的?个人感觉应该和视场范围、深度等因素都有联系。
    我目前遇到的问题是这样的,采用Mid-40、Horizon对一个固定的静态的场景进行扫描,如果按照官方标定的1秒左右就可以完成100%覆盖的话,那么我收集5秒的数据后,应该就可以完成背景初始化了,然后再接收实时点云数据,利用深度信息与原始背景进行比较,检测出遗落的其它物体或通过的运动物体。但实际情况是:背景初始化完成后,在实时点云数据与背景进行对比时却发现存在很多深度信息与背景不同的点(但实际情况是完全相同的场景),起初我猜测是不是我背景收集的数据还不够多,于是我把背景初始化的时长增大到30秒(收集30秒的数据,建立不同位置(x,y)的初始深度信息),然而实时对比时仍然存在很多深度信息有明显差异的点。
    我的程序逻辑是对监测区域初始化为一张网格,每个格子的大小是如果是5cm,深度信息对比就是拿实时与背景相对应的网格的深度进行对比。即使如此,对于相同的静态场景(室内),积累30秒背景,实时对比时也仍然有很多深度差异较大的格子。
    请问,这是什么原因?或者我应该如何调整我的程序逻辑?

mac环境下,执行make命令的时候发生以下错误

mac环境下,执行make命令的时候发生以下错误,只能ubuntu环境吗,不支持mac编译吗

[ 72%] Linking CXX executable lidar_lvx_sample
[ 72%] Built target lidar_lvx_sample
Scanning dependencies of target hub_sample_cc
[ 74%] Building CXX object sample_cc/hub/CMakeFiles/hub_sample_cc.dir/lds_hub.cpp.o
[ 76%] Building CXX object sample_cc/hub/CMakeFiles/hub_sample_cc.dir/main.cpp.o
[ 79%] Linking CXX executable hub_sample_cc
[ 79%] Built target hub_sample_cc
Scanning dependencies of target lidar_sample_cc
[ 81%] Building CXX object sample_cc/lidar/CMakeFiles/lidar_sample_cc.dir/main.cpp.o
[ 83%] Building CXX object sample_cc/lidar/CMakeFiles/lidar_sample_cc.dir/lds_lidar.cpp.o
[ 86%] Linking CXX executable lidar_sample_cc
[ 86%] Built target lidar_sample_cc
Scanning dependencies of target trouble_shooting
[ 88%] Building CXX object sample_cc/trouble_shooting/CMakeFiles/trouble_shooting.dir/main.cpp.o
[ 90%] Linking CXX executable trouble_shooting
[ 90%] Built target trouble_shooting
Scanning dependencies of target lidar_utc_sync
[ 93%] Building CXX object sample_cc/lidar_utc_sync/CMakeFiles/lidar_utc_sync.dir/main.cpp.o
[ 95%] Building CXX object sample_cc/lidar_utc_sync/CMakeFiles/lidar_utc_sync.dir/lds_lidar.cpp.o
[ 97%] Building CXX object sample_cc/lidar_utc_sync/CMakeFiles/lidar_utc_sync.dir/synchro.cpp.o
/Users/nyis/jemoo/Livox-SDK/sample_cc/lidar_utc_sync/synchro.cpp:273:36: error: use of undeclared identifier 'B460800'; did you mean 'BR460800'?
B460800, B500000, B576000,B921600,B1152000, B1500000, B2000000,
^~~~~~~
BR460800
/Users/nyis/jemoo/Livox-SDK/sample_cc/lidar_utc_sync/synchro.h:59:3: note: 'BR460800' declared here
BR460800,
^
/Users/nyis/jemoo/Livox-SDK/sample_cc/lidar_utc_sync/synchro.cpp:273:45: error: use of undeclared identifier 'B500000'; did you mean 'BR500000'?
B460800, B500000, B576000,B921600,B1152000, B1500000, B2000000,
^~~~~~~
BR500000
/Users/nyis/jemoo/Livox-SDK/sample_cc/lidar_utc_sync/synchro.h:60:3: note: 'BR500000' declared here
BR500000,
^
/Users/nyis/jemoo/Livox-SDK/sample_cc/lidar_utc_sync/synchro.cpp:273:54: error: use of undeclared identifier 'B576000'; did you mean 'BR576000'?
B460800, B500000, B576000,B921600,B1152000, B1500000, B2000000,
^~~~~~~
BR576000
/Users/nyis/jemoo/Livox-SDK/sample_cc/lidar_utc_sync/synchro.h:61:3: note: 'BR576000' declared here
BR576000,
^
/Users/nyis/jemoo/Livox-SDK/sample_cc/lidar_utc_sync/synchro.cpp:273:62: error: use of undeclared identifier 'B921600'; did you mean 'BR921600'?
B460800, B500000, B576000,B921600,B1152000, B1500000, B2000000,
^~~~~~~
BR921600
/Users/nyis/jemoo/Livox-SDK/sample_cc/lidar_utc_sync/synchro.h:62:3: note: 'BR921600' declared here
BR921600,
^
/Users/nyis/jemoo/Livox-SDK/sample_cc/lidar_utc_sync/synchro.cpp:273:70: error: use of undeclared identifier 'B1152000'; did you mean 'BR1152000'?
B460800, B500000, B576000,B921600,B1152000, B1500000, B2000000,
^~~~~~~~
BR1152000
/Users/nyis/jemoo/Livox-SDK/sample_cc/lidar_utc_sync/synchro.h:63:3: note: 'BR1152000' declared here
BR1152000,
^
/Users/nyis/jemoo/Livox-SDK/sample_cc/lidar_utc_sync/synchro.cpp:273:80: error: use of undeclared identifier 'B1500000'
B460800, B500000, B576000,B921600,B1152000, B1500000, B2000000,
^
/Users/nyis/jemoo/Livox-SDK/sample_cc/lidar_utc_sync/synchro.cpp:273:90: error: use of undeclared identifier 'B2000000'; did you mean 'BR2000000'?
B460800, B500000, B576000,B921600,B1152000, B1500000, B2000000,
^~~~~~~~
BR2000000
/Users/nyis/jemoo/Livox-SDK/sample_cc/lidar_utc_sync/synchro.h:65:3: note: 'BR2000000' declared here
BR2000000,
^
/Users/nyis/jemoo/Livox-SDK/sample_cc/lidar_utc_sync/synchro.cpp:274:36: error: use of undeclared identifier 'B2500000'
B2500000, B3000000, B3500000, B4000000
^
/Users/nyis/jemoo/Livox-SDK/sample_cc/lidar_utc_sync/synchro.cpp:274:46: error: use of undeclared identifier 'B3000000'; did you mean 'BR3000000'?
B2500000, B3000000, B3500000, B4000000
^~~~~~~~
BR3000000
/Users/nyis/jemoo/Livox-SDK/sample_cc/lidar_utc_sync/synchro.h:67:3: note: 'BR3000000' declared here
BR3000000,
^
/Users/nyis/jemoo/Livox-SDK/sample_cc/lidar_utc_sync/synchro.cpp:274:56: error: use of undeclared identifier 'B3500000'
B2500000, B3000000, B3500000, B4000000
^
/Users/nyis/jemoo/Livox-SDK/sample_cc/lidar_utc_sync/synchro.cpp:274:66: error: use of undeclared identifier 'B4000000'; did you mean 'BR4000000'?
B2500000, B3000000, B3500000, B4000000
^~~~~~~~
BR4000000
/Users/nyis/jemoo/Livox-SDK/sample_cc/lidar_utc_sync/synchro.h:69:3: note: 'BR4000000' declared here
BR4000000,
^
/Users/nyis/jemoo/Livox-SDK/sample_cc/lidar_utc_sync/synchro.cpp:296:23: error: use of undeclared identifier 'CBAUD'
options.c_cflag &= ~CBAUD;
^
/Users/nyis/jemoo/Livox-SDK/sample_cc/lidar_utc_sync/synchro.cpp:299:41: warning: format specifies type 'int' but the argument has type 'tcflag_t' (aka 'unsigned long') [-Wformat]
printf("[Baudrate]: %d %d\r\n", baud, baudrate);
~~ ^~~~~~~~
%lu
1 warning and 12 errors generated.
make[2]: *** [sample_cc/lidar_utc_sync/CMakeFiles/lidar_utc_sync.dir/synchro.cpp.o] Error 1
make[1]: *** [sample_cc/lidar_utc_sync/CMakeFiles/lidar_utc_sync.dir/all] Error 2
make: *** [all] Error 2

I can't remove from SDK a device connected before on runtime

Hi all.

I have a library for my own projects to works with livox lidars based on your Livox-SDK. Now I am using Livox Horizon.

I am develop for connect and disconnect Lidars on runtime, and In my network I have 2 o 3 PCs that can connect to Lidars devices. Actually only one Lidar send data to one PC. This is OK, but I want in runtime (Without reset my software or Livox-SDK) connect and disconnect to any lidar.

The problem is the next:

  • In my software when I send code broadcast to connect to one device calls to Livox-SDK function of "AddLidarToConnect(...)". And the software make all the operations and it have the Lidar sampling perfectly.
  • When I send a command to my software I want to stop sampling device "LidarStopSampling(...)", disconnect device "DisconnectDevice(...)" and with this, I want to free the Lidar to connect from other PC, but the the SDK automatically connects to the device and the SDK doesn't free the Lidar to connect from other PC.

I thinks it is because I have the function "AddLidarToConnect(...)" to add the Lidar in a list on SDK but I don't call other function to remove from this list on SDK. I read the documentation and I don't see it in the documentation this type of function, Can you tell me what function I need to use to free the Lidar to connect to other PC without closing the SDK on runtime??.

If you don't understand or you need more information tell to me.

Best Regards.

如何获取正确的时间戳?

我用的是mid-40,我自己写了个脚本,抓取雷达数据,但是抓到的时间戳转换为日期格式是1970年的时间,请问如何获取正确的时间?

sample

您好,我想问一下sample和sample_cc有什么区别啊

cannot open file extrinsic.xml

when i excute command "./lidar_lvx_sample -l -t 10 -p" on ubuntu 16.04,the error information showed...
jsc@CQJSC1:/publish/livox/livox-sdk/build/sample/lidar_lvx_file$ ./lidar_lvx_sample -l -t 10 -p
Save the log file.
Time to save point cloud to the lvx file:10.
Get the extrinsic parameter from extrinsic.xml file.
Livox SDK initializing.
Livox SDK has been initialized.
Livox SDK version 2.0.0 .
Start discovering device.
[2020-01-15 10:27:08.022] [console] [info] Broadcast broadcast code: 1HDDGC500103091 [device_discovery.cpp] [OnBroadcast] [163]
Receive Broadcast Code 1HDDGC500103091
[2020-01-15 10:27:08.022] [console] [info] Broadcast code : 1HDDGC500103091 not add to connect [device_discovery.cpp] [OnBroadcast] [180]
[2020-01-15 10:27:09.030] [console] [info] Broadcast broadcast code: 1HDDGC500103091 [device_discovery.cpp] [OnBroadcast] [163]
Receive Broadcast Code 1HDDGC500103091
[2020-01-15 10:27:09.030] [console] [info] Broadcast code : 1HDDGC500103091 not add to connect [device_discovery.cpp] [OnBroadcast] [180]
[2020-01-15 10:27:10.038] [console] [info] Broadcast broadcast code: 1HDDGC500103091 [device_discovery.cpp] [OnBroadcast] [163]
Receive Broadcast Code 1HDDGC500103091
[2020-01-15 10:27:10.039] [console] [info] LocalIP: 192.168.31.101 [device_discovery.cpp] [OnBroadcast] [226]
[2020-01-15 10:27:10.039] [console] [info] Command Port: 55501 [device_discovery.cpp] [OnBroadcast] [227]
[2020-01-15 10:27:10.039] [console] [info] Data Port: 56001 [device_discovery.cpp] [OnBroadcast] [228]
[2020-01-15 10:27:10.062] [console] [info] New Device [device_discovery.cpp] [OnData] [110]
[2020-01-15 10:27:10.062] [console] [info] Handle: 0 [device_discovery.cpp] [OnData] [111]
[2020-01-15 10:27:10.062] [console] [info] Broadcast Code: 1HDDGC500103091 [device_discovery.cpp] [OnData] [112]
[2020-01-15 10:27:10.062] [console] [info] Type: 3 [device_discovery.cpp] [OnData] [113]
[2020-01-15 10:27:10.062] [console] [info] IP: 192.168.31.109 [device_discovery.cpp] [OnData] [114]
[2020-01-15 10:27:10.062] [console] [info] Command Port: 55501 [device_discovery.cpp] [OnData] [115]
[2020-01-15 10:27:10.062] [console] [info] Data Port: 56001 [device_discovery.cpp] [OnData] [116]
OnDeviceChange broadcast code 1HDDGC500103091 update type 0
[WARNING] Lidar sn: [1HDDGC500103091] Connect!!!
Device Working State 5
Device State Error Code 0X00000000
Device feature 0
[2020-01-15 10:27:10.062] [console] [info] Send Command: Set 0 Id 2 Seq 3 [command_channel.cpp] [Send] [241]
[2020-01-15 10:27:10.086] [console] [info] Recieve Ack: Set 0 Id 2 Seq 3 [command_handler.cpp] [OnCommand] [130]
firm ver: 6.7.0.0
[2020-01-15 10:27:10.110] [console] [info] Update State to 1, device connect true [device_manager.cpp] [UpdateDeviceState] [237]
OnDeviceChange broadcast code 1HDDGC500103091 update type 2
[WARNING] Lidar sn: [1HDDGC500103091] StateChange!!!
Device Working State 1
Device State Error Code 0X00000000
Device feature 0
terminate called after throwing an instance of 'std::runtime_error'
what(): cannot open file extrinsic.xml
Aborted (core dumped)
jsc@CQJSC1:
/publish/livox/livox-sdk/build/sample/lidar_lvx_file$

"hour" missing in timestamp type 3 on MID 40

Hey LIVOX,
We are currently using the MID-40 and needed a UTC timestamp. After resolving the issue (Issue #31) regarding UTC on the mid40 including firmware upgrade we ran into further problems.

The main issue was that we couldn’t get anything else than 0 reading the byte 3 “hour” in the timestamp. Everything else looked fine including the microseconds. After looking through some of the source code we noticed that the {utc_time_req->hour} in {ParseRmcTime} was never set to anything (found in the command_impl.cpp).
We fixed the issue by adding the code underneath between line 213 and 214 in command_impl.cpp.

utc_time_reg->hour = hour;

How often can I get a single UDP data package?

Hi,

I checked the Point Cloud {#data_type} of the Livox SDK Communication Protocol.
I'm using a Mid-40 and the Data Type is 0.
So I found out that single UDP data package contains 100 samples.

Also, from the documentation and tables
「Taking Mid-40 as an example, the sampling frequency is 100 KHz , and the interval of each point is 10μs」

Point Num Timestamp
1 T1
2 T1 + 10 μs
3 T1 + 20 μs
... ...
100 T1 + 990 μs

I found the following:
It was found that single UDP data package contains 1000μs (0.001s) worth of data (100 points).
I believe that the Data Frequency, 100,000 points/s, is achieved by collecting 1,000 UDP data packages.

How often can I get a single UDP data package?
I'm thinking data package/0.001s, is this correct?

Thanks!

Horizon的点云数据格式与Mid系统不一样??

Horizon与Mid系列的点云数据格式不一样么?我采用SDK中lidar_lvx_sample这个例子,将接受到的点云数据(x,y,z,r)保存到文本文件中(代码如下),采用其他工具打开该文本文件,可以收集并展示出更多更密集的点云视图。但是用相同的方法接受并保存Horizon的数据就不行,得到的图是个立方体(到处都是反射点,感觉乱掉了)如下图所示。请问,Horizon的点云数据格式是不是与Mid不同,该如何保存x、y、z、r 四个值呢?谢谢。
void LvxFileHandle::SaveTxtFile(std::list &point_list)
{
std::unique_ptr<char[]> buffer(new char[WRITE_BUFFER_LEN]);
uint64_t curpos = 0;
for (std::list::iterator iter = point_list.begin(); iter != point_list.end(); iter++)
{
for (size_t i = 0; i < 100; i++)
{
int x = ((LivoxRawPoint*)iter->raw_point)[i].x;
int y = ((LivoxRawPoint*)iter->raw_point)[i].y;
int z = ((LivoxRawPoint*)iter->raw_point)[i].z;
int r = ((LivoxRawPoint*)iter->raw_point)[i].reflectivity;
sprintf_s(line, "%d %d %d %d\r\n", x, y, z, r);
int len = std::strlen(line);
if (curpos + len >= WRITE_BUFFER_LEN)
{
txt_file.write(buffer.get(), curpos);
curpos = 0;
}
memcpy(buffer.get() + curpos, line, len);
curpos += len;
}
}
}
Horizon点云

Adjusting the spin rate of the Livox Mid 40

Hi, I am interested in achieving a higher total coverage of the scan area in a given time while trading off against a lower resolution along the scan lines of the pattern.

Is it possible to adjust the spinning rate of the turning mirrors / prisms of the Livox Mid 40 as a parameter using the Livox-SDK ?

关于雨雪雾的抗干扰能力

在Mid40的手册中看到有抗雨雾的功能,而Horizon中没有看到。请问下,Mid系列和Horizon哪个抗雨雪雾的抗干扰能力更好一些?

你好,请问下使用sample_cc的程序,如何实现程序启动和停止自由切换,谢谢!

你好,我使用的是MID-100,使用示例代码sample_cc的源码,我想通过一个按钮来控制lidar的采样和停止采样,代码流程修改如下:1、点击“开始”按钮,调用 int ret = read_lidar.InitLdsLidar(cmdline_broadcast_code); 2、将LivoxEthPacket *data中的数据拷贝出;3、调用 read_lidar.DeInitLdsLidar();关闭本次采集数据;4、点击“关闭”按钮,结束本次采集;5、再次执行1操作,发现cloud_ch[0]->points.size() = 0,没有采集到数据。请问我的操作是有什么问题?我该如何实现我自由控制采集数据开关的功能,谢谢!

How to read .lvx file

Hello, I have some .lvx files created by Mid-40, and I want to get its data in my code, so I wonder if there is any tools or SDK or some other methods that can do this, thanks!

How do I get the target reflectivity on the Mid-40?

Hi,

The reflectivity of 0~150 based on the Lambertian reflection model can be obtained.

However, I don't see any values from 151~255 based on the reflectivity of target objects.

Why is this? How do I do this?

Thanks!

设备接入后频繁打印出StateChange告警信息,何故?

在SDK-demo的基础上开发了个小功能,能够接受点云数据,但控制台上会频繁打印StateChange的告警信息,不知道为什么会出现这个告警?我需不需要处理,该如何处理?
连接的设备是Horizon,打印信息是:
[WARNING] Lidar sn: ... StateChange!!!
OnDeviceChange broadcast code ... update type 2

livox mid-40 failed to start sampling

Hi, I just received the livox mid-40 lidar. I followed the instructions to connect the lidar and my laptop to the same router via ethernet. The lidar is powered by a power supply and the sync wire is not plugged in. However, there is no pointcloud data.

I tried both linux 16.04 and windows livox viewer, and they both failed. Screenshots are attached. How can I diagnose this issue?

img_8181
img_8182

Thanks.

Error when run livox_ros_driver on 18.04

Hi, I am using MID-100, and I runing the livox_ros_driver on ubuntu 18.04, there is an error on Livox-SDK:
[console] [error] Receive Failed Socket operation on non-socket [device_discovery.cpp] [OnData] [87]
Any advice?
The pointcloud in rviz is just like below shape, is that OK? if not, is that related to above error?
image

How to cut point cloud data

Is the coordinates obtained in "getlidardata" based on the radar itself? How to cut point cloud data by region. In the "getlidardata" example of "lidar_lvx_ sample", I filter the point cloud data through coordinates, and open it in the livox viewer, The resulting area is not the area I want to filter.

if (p_point_data->x < 2500 || p_point_data->x > 2700 || p_point_data->y < -400 || p_point_data->y > 400 || p_point_data->z < -600 || p_point_data->z > 600) return;

Pi Builds failing

Compiling when outside the 64bit shell yields errors relating to apr1.h and off_64_t mentioned in the first post

Is it possible to compile 32bit version of the livox-sdk? Reason being that Pi3 camera is inaccessible in the ds64 shell

follow the guide for installation on ubuntu on my raspberry pi, but running the make command gives med the following error about unknown type name 'off64_t'

pi@raspberrypi:~/livox/Livox-SDK/build $ make
[ 84%] Built target livox_sdk_static
[ 88%] Building C object sample/hub/CMakeFiles/hub_sample.dir/main.c.o
In file included from /usr/include/apr-1.0/apr_general.h:28,
from /home/pi/livox/Livox-SDK/sample/hub/main.c:33:
/usr/include/apr-1.0/apr.h:358:10: error: unknown type name ‘off64_t’
typedef off64_t apr_off_t;
^~~~~~~
sample/hub/CMakeFiles/hub_sample.dir/build.make:62: recipe for target 'sample/hub/CMakeFiles/hub_sample.dir/main.c.o' failed
make[2]: *** [sample/hub/CMakeFiles/hub_sample.dir/main.c.o] Error 1
CMakeFiles/Makefile2:140: recipe for target 'sample/hub/CMakeFiles/hub_sample.dir/all' failed
make[1]: *** [sample/hub/CMakeFiles/hub_sample.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Is there a specific way for installation on a raspberry pi or what to do?

rviz pointcloud 2

我在rviz中查看点云的显示情况,不知为何,livox反馈回来的点云每隔几秒会消失一次,请问这个问题是需要设置解决吗

如何解决传输数据量过大的问题?

   我们的环境中部署了多个mid-100,使用了一个SDK去接收数据,因为传输过来的数据量很大,所以导致服务器负载压力很重,针对这个问题,我有两个方案:

1.减少数据量
2.将设备串行化,轮流接收数据
暂不考虑扩展服务器规模
针对第一个方案,我想要知道可以配置数据量的api
针对第二个方案,我想要知道有没有可以使设备轮流发送数据的api,还是说只能通过start,stop等api自行实现?

Setting Static IP

Hi Livox team,
I'm one of Chief specialists in JSC NIIAS. There was a need to change the default IP address for the Mid-40 and Horizon.
Relying on 4.1 General CMD Set 0x08 Configure Static/Dynamic IP can change only 4th block of IP such as: 192.168.150.. But we need to set up 192.168..***. How can I change it? Had tried to change in Livox Viewer but there is no such option. Sending the command package did not bring the desired results.
Ask for help in resolving this issue.

PTP Sync

I can't get the Mid-40 to achieve a PTP sync. Is there any way to introspect what could be the problem? The device is on the same subnet as a PTP master. A pc on the same subnet is able to PTP sync using ptp4l (linuxptp) successfully. Do I need to do anything else to trigger the sync? All I ever get is no-sync timestamps (ns since power-on).

[request] Add export config.cmake file

Currently, Livox SDK doesn't export config.cmake files.
In general, libraries build with CMake provide config.cmake to find it.
It will be able to find the Livox SDK using find_package(livox_sdk) in CMakeLists.txt of user project.
It provides good experience for many developers.
Please consider to export config.cmake. Thanks,

raspberry

您好,在树莓派下cmake,有错误,请问需要改哪里

pi@raspberrypi:~/Livox-SDK $ cd build && cmake ..
CMake Error at /usr/share/cmake-3.13/Modules/CMakeDetermineSystem.cmake:174 (file):
file failed to open for writing (No such file or directory):

/home/pi/Livox-SDK/build/CMakeFiles/CMakeOutput.log

Call Stack (most recent call first):
CMakeLists.txt:3 (project)

CMake Error: Could not open file for write in copy operation /home/pi/Livox-SDK/build/CMakeFiles/3.13.4/CMakeSystem.cmake.tmp
CMake Error: : System Error: No such file or directory
CMake Error at /usr/share/cmake-3.13/Modules/CMakeDetermineSystem.cmake:186 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMakeLists.txt:3 (project)

关于Livox设备点云数据的坐标零点 ?

请问收到的Livox设备点云数据的坐标零点在什么位置?这个零点可以通过配置设置么?
另外,如何将收到的点云转化为用户的自定义坐标系中坐标点?谢谢

Compile error in release build type

Hi Livox team,
I'm one of members in Seoul Robotics.
I'm facing a compile error while building Livox-SDK with my script.
Below is error message.

Livox-SDK/sdk_core/src/base/io_loop.cpp:85:19: error: unused variable ‘thread_id’ [-Werror=unused-variable]
   apr_os_thread_t thread_id = apr_os_thread_current();

I'm thinking the problem occures because I'm using "cmake .. -DCMAKE_BUILD_TYPE=Release" in my script. This makes the compiler ignore assert() syntax.
Could you simply add (void)thread_id in IOLoop::RemoveDelegateSync to avoid compile error in case someone using Release build?

Get information and Data from SDK with no static callbacks C functions

Hi.

I am developing a system with your Lidars. I have my applications in C++ and all code have Objects with their respective Classes.

I want a class for controlling the Lidar, but the SDK all the information has the Callbacks for Get information and data of Lidar and on C++ in a Class with not static functions I can't configure Callbacks.

I don't see any methods on SDK to connect lidar, get information or get data without Callbacks, It is correct??.

Do you have any plan for have a C++ Class of methods or methods to get information directly from a function returning the structures requested from a specific Lidar??

My system have one defined Lidar for device and have the specfied broadcast_code for connect and Static IP, and I want to connect directly without broadcasting and waiting packets for connect.

In a first approach my class looks like this and fails compiling on "SetDeviceStateUpdateCallback":

Lidar.h:


#include "livox_sdk.h"

typedef enum {
	kDeviceStateDisconnect = 0,
	kDeviceStateConnect = 1,
	kDeviceStateSampling = 2,
} DeviceState;

class Lidar
{
private: //Properties
	string sTAG = "Lidar";

	string sCode = "XXXXXX7006003XX";

	uint8_t uiHandle = 0;
	uint8_t uiDeviceState = kDeviceStateDisconnect;
	DeviceInfo xDeviceInfo;
public: //Properties

private: //Method
	void vOnDeviceChange(const DeviceInfo *info, DeviceEvent type);

public: //Method
	Lidar();
	~Lidar();
};

Lidar.cpp:

#include "Lidar.h"

void Lidar::vOnDeviceChange(const DeviceInfo * xDeviceInfo, DeviceEvent xDeviceEventType)
{
	try {
		if (xDeviceInfo != NULL) {
			if (uiHandle == xDeviceInfo->handle) {
				if (xDeviceEventType == kEventConnect) {
					//QueryDeviceInformation(this->uiHandle, Lidar::vOnDeviceInformation, NULL);
					this->uiDeviceState = kDeviceStateConnect;
					this->xDeviceInfo = *xDeviceInfo;
				}
				else if (xDeviceEventType == kEventDisconnect) {
					this->uiDeviceState = kDeviceStateDisconnect;
				}
				else if (xDeviceEventType == kEventStateChange) {
					this->xDeviceInfo = *xDeviceInfo;
				}

				if (this->uiDeviceState == kDeviceStateConnect) {
					if (this->xDeviceInfo.state == kLidarStateNormal) {
						this->uiDeviceState = kDeviceStateSampling;
					}
				}
			}
			else {
				
			}
		}else{
			
		}
	}
	catch (std::exception& e) {
		std::cout << e.what() << '\n' << std::endl;
	}
}

Lidar::Lidar()
{
	try {
		/** Initialize Livox-SDK. */
		if (Init()) {
			Constants::vShowLog(this->sTAG, "Livox SDK has been initialized.");
			LivoxSdkVersion xSDKVersion;
			GetLivoxSdkVersion(&xSDKVersion);

			//Constants::vShowLog(this->sTAG, "Livox SDK Version" + std::to_string(xSDKVersion.major) + "." + std::to_string(xSDKVersion.minor) + "." + std::to_string(xSDKVersion.patch));

			/** Set the callback function called when device state change,
			* which means connection/disconnection and changing of LiDAR state.
			*/
			//SetDeviceStateUpdateCallback(&Lidar::vOnDeviceChange);

			//SetDeviceStateUpdateCallback([this](const DeviceInfo * xDeviceInfo, DeviceEvent xDeviceEventType) {vOnDeviceChange(xDeviceInfo, xDeviceEventType); });

			auto vCallbackOnDeviceChange = std::bind(&Lidar::vOnDeviceChange, this);
			SetDeviceStateUpdateCallback(vCallbackOnDeviceChange);

			/** Start the device discovering routine. */
			if (!Start()) {
				Uninit();
			}
			else {
				usleep(1000000);

				bool bRes = false;
				bRes = AddLidarToConnect(sCode.c_str(), &uiHandle);
				if (bRes == kStatusSuccess) {
					/** Set the point cloud data for a specific Livox LiDAR. */
					//SetDataCallback(uiHandle, Lidar::vGetLidarData);
					this->uiHandle = uiHandle;
					this->uiDeviceState = kDeviceStateDisconnect;
				}
			}
		}
		else {

		}
	}
	catch (std::exception& e) {
		std::cout << e.what() << '\n' << std::endl;
	}
}

Lidar::~Lidar()
{
}

Best Regards.

Erratum in Start/Stop Sampling SDK communication protocol command

Hello,

In section 4.1 of the General CMD Set section of your SDK documentation, you state that the Start/Stop Sampling command (0x04) uses the values of 0x00 to Start Sampling and 0x01 to Stop Sampling. After working (and ultimately wasting) over half a day on trying to simply get my Mid-40 to begin transmitting point cloud data packets, it turns out that your documentation is incorrect and these two commands are in fact reversed!!

I sure hope this helps someone else out and saves them the time and headaches.

Ryan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.