Using Two Lidar with mavlink (DISTANCE_SENSOR ( #132 ))

Hi, I am trying to use 2 lidars with Mavlink protocol now. One is to be used as an anti-collision, the other in the front.
Two LW20 Lidars are installed in the serial port of my MCU,
MCU is connected with FC.

If only one Lidar is equipped, Lidar will come out normally. Rangefinder1 and Sonarrange also work normally in Mission Planner.
However, if you turn on RangeFinder2 after attaching two Lidars, the same value as RangeFinder1 continues to appear. These RangeFinder values ​​come from Lidar1 and Lidar2 alternately.

I want to use RangeFiner1 as Lidar 1 and RangeFinder2 as Lidar2, but I don’t know which part is wrong.


  • command_long
    Lidar1(20hz): id=1, type=0, time_boot_ms=0, min_distance=10cm, max_distance=10000, orientation=25, covariance=0

Lidar2(20hz): id=2, type=0, time_boot_ms=0, min_distance=10cm, max_distance=100cm, orientation=0, covariance=0.

Mission Planner
Serial2_Protocol: 1 (mavlink1)
Serial2_Baudrate: 115200
rngfnd1_type: 10 (mavlink)
rngfnd1_orient : 25 (Down)
rngfnd1_addr: 1
rngfnd2_type: 10 (mavlink)
rngfnd2_orient: 0 (forward)
rngfnd2_addr: 2

This is a bug that was solved just recently in the latest Copter 4.2 dev branch. I think we might include it in 4.1 release, but I am not sure