Using Ligar TF-mini S as sensor for indoor positioning on pixhawk with mission planner

Hi! Im trying to use TF-mini S as the main source of altitude data for pixhawk. The rangefinder (sonarrange) shows the values correctly, but altitude always shows unstable values in the range from -2 to 2 - and these values do not coincide at all with the lidar values. I perfomed all the actions from the topic - it didn’t work. Please tell me what can be done with this

Update to ArduCopter 4.3.2 and retest

Updated, rebooted, no result(

Have you followed all the instructions on: Benewake TFmini / TFmini Plus lidar — Copter documentation ?

Yes, according to the documentation, I was able to connect the lidar to SERIAL 4 and was able to get the data (sonarrange). I set the parameters as in the instructions, and after reading this site -
I also set the values of the specified parameters so that the pilot controller understands that the lidar is directed downward and should be used to determine the altitude (instead of GPS and barometer)

however, the altitude values do not match the lidar values and it seems to me that the controller does not use lidar at all to determine the altitude

I tried to use i2c connection instead of SERIAL. through i2c I don’t even get the sonarrange value

In the documentation you posted, it requires loiter mode to work, so I guess with GPS fix not in indoor environment. Here you can see a working TF lidar but in loiter (with gps fix)

Thanks, but I need indoor alg (without GPS and baro). The optical flow sensor works for me according to the description, but I can’t figure out how to make the lidar work for measuring the height in the room, it seems that all the parameters are set, but there is no result. However, for obstacle detection (lidar in horizontal position), I was able to set

If your flight controller has 2MB of Flash memory (or custom FW) and sonar range updates correctly it should work. Indeed, as regards the gps fix, I confused with obstacle avoidance where the gps fix is needed. For the simple altimeter, the ALT HOLD mode is enough. Did you follow this part of the wiki?
I also used an auxiliary switch (RCx option 10)

Yes, I followed
I tried to launch, the drone just flew into the ceiling (when set alt hold mode)

Have you also checked the vibrations of the copter?

Please share parameters or logs(much preferred) for this flight