I connected the SF11/C via IC2 to a pixhawk 2.1. Before we used the LW20, which worked always fine.
The problem here is, when I switch to Loiter or Althold, it does not hold the height, it goes always up around 40-50cm, goes back down, than up again and so on. I included a logfile, which shows this. When using only the barometer, everything is fine.
The lidar reading seems to lag behind your barometer and GPS reading by ~500 log lines (~1.5 seconds). I think this may be confusing the altitude controller and causing it to overshoot the altitude target. The oscillation looks unstable and may eventually fly out of control if you don’t land it or switch to Stabilize or another non-altitude controlled mode, so be careful when testing.
I am not sure what might cause your lidar to be slow. I checked the following parameters:
RNGFND_TYPE = 7
RNGFND_MAX_CM = 12000
RNGFND_MIN_CM = 5
RNGFND_GNDCLEAR = 15
RNGFND_ADDR = 102
EK2_ALT_SOURCE = 0
EK2_RNG_USE_HGT = 70
They all look fine, except I am not sure about RNGFND_ADDR. I’m not sure what it’s supposed to be in your case, and if you switched LightWare devices without changing this parameter, maybe it would cause communication errors with the device.
EDIT: Can you please post a log from a good flight with the LW20?
Also, your lidar reads 0 meters before your copter takes off. Is this normal? I thought it is supposed to read a non-zero value (you set RNGFND_GNDCLEAR to this value).
Oscillations of this type can be caused by instability in the control loop. This generally implies that there is too much damping or filtering causing a lag in the data. The SF11/C does have filter settings and if these have been set to give a very smooth result then this might cause the effect seen. In comparison, the LW20 runs quite a bit faster with a low data lag.
The filtering parameters are easily changed through the USB connection on the SF11/C via the LightWare Terminal application. I suggest that you disconnect the SF11/C from the system and check the settings and response rate “stand-alone” to make sure that everything is working as expected. Hopefully this will then work correctly in your system.