Search code examples
androidusblidar

What are the steps to use a livox lidar with an android phone


We are trying to connect a livox mid 360 lidar to an android phone. But we don't know the steps to do so. The lidar can be powered by an external 12 V battery, so power is not a problem. The lidar provides the ethernet port which can be connected to the type-C port on a computer with a cable and it works there. Can we connect the lidar to the type-C port of an android phone and make it work? My concern is about the driver which is only provided in C++. Do we need to convert the driver to java or kotlin?

If we would like to accomplish this goal, what are the steps we need to take?


Solution

  • The steps to connect the mid360 lidar and the android phone follows naturally from careful reasoning.

    1. connect the ethernet cable of the lidar to a USB adapter with a type-C connector which is then connected to the android phone.
    2. enable the ethernet sharing on the android phone in its settings. I did not find this option on Honor V10, but it is available on Redmi K40 Pro.
    3. connect the android phone and the computer running Android studio to the same wireless network for debugging.
    4. enable the wireless debugging for the android phone.
    5. find out the android phone's ethernet network subnet, e.g., 192.168.47.xx, by ifconfig in adb shell.
    6. set the subnet for mid360 in livox viewer's config panel. Now the UDP packets from the lidar can be received on the socket 54301. To parse these packets,
    7. use NDK to compile the livox SDK2, and use jni to call the socket connection and parsing functions.
    8. if you want to publish these messages on ROS1, then you should use roscpp android to compile the livox ros driver2, and call these functions in jni. Here is the setup. The computer is showing the livox point clouds in rviz published by the roscore on the Android phone. The setup.

    We are completing our project following the above steps. I will enrich this answer when I get the project done.