Two rangefinders with hereflow not working

I recently got the Hereflow sensor to do GPS-less navigation. Since the lidar on the module is only good for 2m I added an LW20 as a secondary lidar. When I connected it and set the parameters as noted in the wiki, it didn’t work. I tried multiple combinations and it seems like you only can use one rangefinder with the optical flow, not both. I can, however, use both rangefinders at the same time without optical flow.

I’m using the pixhawk4. HereFlow uses the CAN1 bus and the LW20 is connected to the I2CA.

Params:
LW20:
RNGFND1_TYPE = 7
RNGFND1_ADDR = 102
RNGFND1_SCALING = 1
RNGFND1_MIN_CM = 5
RNGFND1_MAX_CM = 9500
RNGFND1_GNDCLEAR = 18

HereFlow:
FLOW_TYPE = 6
CAN_P1_DRIVER = 1
CAN_D1_PROTOCOL = 1
RNGFND1_TYPE = 24
RNGFND1_MAX_CM = 300

Can someone explain why this is as well as a fix?

@Idan_Fiksel, you’re using Copter-3.6 of course?

In Copter-3.6 the altitude control and optical flow will always use the first downward facing lidar which is the first lidar with RNGFNDx_ORIENT = 25.

I think it’s not worth even setting up the HereFlow rangefinder so don’t bother setting any RNGFNDx_TYPE parameters to “24”.

Thank you for the fast reply. We have been working in Copter-4.0.0-dev but we went back to Copter-3.6.11 to see if we have the same issue, which we did.

Since we found out we could only use one rangefinder, we implemented your solution and are just using the LW20 from altitude control.

Could we attach another LW20 on the I2C bus for slope detection or will that also break the optical flow?

@Idan_Fiksel,

I don’t think attached a second lidar should ever “break” optical flow. You’ll need to be careful when connecting two lidar to the same I2C bus that the addresses are somehow made to be different (I think it may be possible to change a lightware sensor’s I2C address using the Lightware Terminal program but I’m not sure).

It’s possible to configure two range finders to point in the same direction (i.e. both their _ORIENT parameters can be set to be the same direction) but this only helps if they have different ranges - the intention being that a short range and long range lidar could be used at the same time. This is only available in Copter-4.0.0, has only been tested by one developer (the one who wrote it) and hasn’t been documented. I don’t think there’s any advantage to attaching two identical lidar pointing in the same direction. The most likely outcome is that the lidar will become confused if they pickup the laser sent from the other lidar.