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.
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.
@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)
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.
@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 ?
I also would suggest to comment out or remove the special mode 2 handling.
This is what you already did, if you changed 2 --> 3 and the device sends mode 2 measurements.
None of the Arduino libs I looked at have a special handling like this.
Also in the data sheet I canāt find any information, that tfmini sends different units for different modes. Just a global setting for mm and cm.
Maybe I find time tonight to check my tfmini with Realterm.
Txs for testing. So you found that the distances were reported accurately and reliably as far as you could tell? How about a distances below 1m? Also do you know if your lidar has firmware version 15 or 16? Sorry for the questions, thanks for the feedback in any case.
Re other orientations not working, I suspect itās a setup issue with the Avoidance and/or Proximity parameters. If youāve got a dataflash log I can have a look
Thanks very much for all this detailed analysis. Itās really helpful.
OK, Iāll push out a 3.6.2-rc4 (hopefully tomorrow) that has the mode-2 scaling thing removed. Iāve looked at the datasheets as well and Iām not quite sure why we thought this was necessary.
It really should perform just like @ppoirier found I thinkā¦ if anyone would like to double check then that would be greatly appreciated. sincere apologies for the number of attempts this is taking.
Hello Randy,
Yes this mod works OK.
I will test the TF02 as well and report after a test flight with both sensor.
Thanks again for you availability and dedication (thanks to @OXINARF too)