TF-mini Lidar sensor does not work properly on pixhawk

@SpaceGCT, Any chance you can provide a log from 3.6.2-rc2? It won’t show the strings being sent from the lidar but it will show us some other stuff.

Ok, I’ll send you that logs.

Sincerely

2018년 11월 15일 (목) 오후 7:20에 rmackay9 noreply@ardupilot.org님이 작성:

1 Like

@rmackay9 , there is still a problem with the driver, seems it is(skipping_ shifting) a bit… I cannot read some distances like in the forties ( from 39 - 50 cm) take a look to the pattern on both proximity & rngfinder signals

I can send the log but this images explain it , I think

2 Likes

just been out flying with the TF mini i have the rangefinder on a switch set type to 8 and pixhawk was ticked in the GUI it flew the best alt yet at 2 mtrs not sure if this helps

1 Like

@ppoirier,

Thanks for testing the changes. I’m not sure I’m able to reproduce the issue but I was wondering if you could try testing this binary (built for pixhawk/cube on ChibiOS). This includes a change to avoid further char-to-uint8t conversion issues by holding the buffer in uint8_t which is what @OXINARF has suggested we do. The link to the code is here.

Below is a graph of what I see when I tested 3.6.2-rc2.

and here’s what I see with a similar test with the new version. It does seem more reliable actually and I suspect the issue is this line which was missing a cast to uint8_t when calculating the distance.

1 Like

Patrick,

I’ve push out -rc3 which includes the fix above. I’m pretty sure this is going to fix the problems you’ve found so if you could give -rc3 a try that’s be great. Txs for all your help in getting to the bottom of this.

1 Like

Hi Randy

I’ve just tested it that TF-mini Lidar sensor on pixhawk with 3.6.2rc3 beta

It was more reliable

but, It was not accurate within 1m

here is the log

2018년 11월 19일 (월) 오후 1:39, rmackay9 noreply@ardupilot.org님이 작성:

55 1980-01-01 오전 9-00-00.bin.log (1.71 MB)

55 1980-01-01 오전 9-00-00.bin (728 KB)

@SpaceGCT,

Thanks for testing!

Hard to say if that’s a sensor issue or a driver issue though right? Certainly with the number of driver issues we’ve had it would be fair to think it’s a driver software issue… but is there any other reason to think this? For example do alternative drivers (i.e. @ppoirier’s method) or the lightware-serial driver produce better results?

It looks like with firmware version 16x they replaced mode 02, 07 by mode 00, 03, 07.

Sparkfun delivered a Tfmini with 160 firmware recently.
It works fine with an Arduino serial-i2c converter based on https://github.com/opensensinglab/tfmini . From what I have seen in this Arduino-lib they do no distance scaling according to the mode at all. Returns always cm.

In contrary AP_RangeFinder_Benewake.cpp scales distance by factor 0.1 in mode 2.
But mode 2 does not exist with firmware 16x devices anyway.

1 Like

@RainFly,

Thanks for looking into this. So I guess during the test the sonar was much more than the 9cm to 12cm shown in the log? … and presumably we think the issue is that the mode is coming out of the sensor as “2” and is being made 10x smaller than it should be? If true this is a bit of an issue because I’d say this would be a “breaking change” by benewake. In that it’s not backwards compatible.

I made a short bench test with a spare Tfmini (160 firmware) with a spare X2.1.

mRoX21 00570033 3236510B 36363331
ChibiOS: ff603d11
ArduCopter V3.6.2-rc3 (0e61bbe6)

Short and longrange measurement are correct!

Maybe mode 2 works as before. They just don’t use it any more with 16x firmware.

@rmackay9 ok will test tonight

Rainer, looking at opensensinglab link , it seems to be a serial-to-serial conversion , no I2C ( include <Wire.h) driver involved…?

@ppoirier
Right, this is just the lib to read TFmini device. I didn’t want to fight with the TFmini protocol in my sketch. I took one of the example Sketches and merged it, I think it was your Sketch, to run on a Arduino Pro Mini 8MHz 3,3V.
TFmini is connected via softserial Pin 10/11 @57600 baud. (8 MHz Pro Mini can’t handle 115200 baud softserial)

I don’t know, if it is the right place, but anyway … here is the sketch I’m currently using with an Omnibus F4 Nano.
TFMINI-I2C-RW.zip (2.0 KB)

Cool , you could upload on github and make a link on my blog as an ‘‘alternative code’’ :slight_smile:

Patrick
After all this can you translate. As you know I am a TF Mini owner…but not sure what if anything I need to do to ensure I am successful in my use of it.

cheers

1 Like

Ricky, We are still testin the new driver. It might be workin ok now but I have not tested it yet. I’ll let you know when fully ready :slight_smile:

1 Like

You da man.
thank you sir…I am in no hurry. My machine is down with a gps issue so there is time, just thought i would ask.

1 Like

@rmackay9 here is the result , looking good …BUT I had to disable the short distance mode in order to make good readings.

Then I upgraded both TFMINI (from Version 1156 to latest: 2156) and according to @RainFly note:
…with firmware version 16x they replaced mode 02, 07 by mode 00, 03, 07.

I had to change line 125 to
if (linebuf[6] == 0x03 ) {
and it worked.

May I suggest that we just remove this distance compensation (lines 123-126) check ?

Hummm it seems it is still 02-07 mode