Can two TFmini Lidars be conected?

Hi Ardupilot community,

Is it possible to connect two TFmini lidars on ArduRover through uart?

My end goal is to have obstacle avoidance with my rover. I have two TFmini’s mounted on the front of the rover, and have connected them both into Serial 4 & 5 (the 1 port) on my pixhawk 2.4.8. They are both powered up, i can see the red led light inside them. These are being powered over two ports. Can’t seem to make them work.

I have configured them in the Lidar manufacturer software, can’t think of the name off the cuff.

I haven’t connected into telem2, as i want to connect a computer into that port.

Can some confirm if this is possible with the setup i have described? If it can be, can you please articulate what settings i need to adjust. If not, can you suggest a different method?

I have search on the net and discourse but no joy, not even sure if i can do it yet or whether i need to attach these to a computer and have them communicate commands to Pixhawk.

Any information would be great.
Regards
Ben

My configuration:
Ardurover Firmware 3.4.2
MP 1.3.58.1 build 1.3.6841.9548
Pixhawk 2.4.8

Settings configured:
Serial 4 & 5 Protocol = 9
Serial 4 & 5 = 115
RGFND_ORIENT = 1
RGFND_FUNCTION = 0
RGFND_TYPE = 20
RGFND2_ORIENT = 7
RGFND2_FUNCTION = 0
RGFND2_TYPE = 20

1 Like

Patrick discusses the use of the TF Mini in the way your after.
Its a good place to start

3 Likes

Hi,

did you try to make one TFmini work?
I use one TFmini on my rover at the moment and I only get it to work, if I set the rangefinder type to lightware serial, with the TFmini set to pix mode.

2 Likes

Hello,

I’m on copter 3.6/Chibios/mRo X2.1, not on rover. But this should not make a difference.
I also could not make the TFmini to work in binay mode (RGFND_TYPE = 20).
TFmini works fine in Pix-Mode (ASCII) and “RGFND_TYPE = 8”.

I got my TFmini about 2 month ago from Sparkfun. They are loaded with firmware “160”, which have some changes compared to “15X” firmware, e.g. additional Distance Mode 3.

I have another TFmini working im binary mode with an Arduino serial-I2C converter (similar to the one mentioned above) which uses an own Arduino sketch based on https://github.com/opensensinglab/tfmini.

Maybe it is a bug, if RGFND_TYPE = 20 is not working?

2 Likes

I checked this setup this morning , and there is something wrong. Seems that the driver (type 20) is not working properly , it is spitting wrong distances intermittently.
And other problem is related to have same type of sensors on 2 serial ports, looks like the mapping is not working correctly.
@rmackay9 ,I will report to my investigation here, and probably open an Issue.

2 Likes

Please note that you can experiment with the TFMINI in emulation mode:
Send the command for pix format output is 42 57 02 00 00 00 04 06
And set the rangefinder as [RNGFND_TYPE] = 8 (LightWareSerial)

To enable proximity http://ardupilot.org/copter/docs/parameters.html#prx-type
you set to 4 RangeFinder

And to enable RADAR yo do CRTL-F
http://ardupilot.org/dev/docs/code-overview-object-avoidance.html#reporting-to-the-ground-station

Here is the result:

2 Likes

Thanks RickyG! I have read this article. I just wanted to see if i can achieve setting two lidars through UART first. I appreciate your post.

1 Like

Hi Sebastian,

Yes, i have got 1 TFmini working, using lightwave serial settings as suggested. The issue with a second one running is a cannot find a feedback mechanism to indicate the second one is working. On the MP home screen there needs to be a value output field, like sonarrange2 or equivalent in the status field.

Thanks for your response Sebastion.

1 Like

Yes,

This afternoon I have connected two TF mini to a Pixhawk 2.1. Copter 3.6 with Chibios.

The first one, as a rangefinder in serial port 4 (GPS2)
I have changed the TF mini to pix mode with the code 42 57 02 00 00 00 04 06.
PRX_TYPE = 4 Rangefinder.
SERIAL4_PROTOCOL = 9 (Lidar)
SERIAL4_BAUD = 115
RNGFND_TYPE = 8 (LightWareSerial)
RNGFND_SCALING = 1
RNGFND_GAIN=0.8
RNGFND_ORIENF=0
RNGFND_MIN_CM = 30
RNGFND_MAX_CM = 600
PRX_TYPE=4
PRX_YAW_CORE=0
In the radar I can see the distance. Distances shown are consistent.

The second TF mini in serial port 5 as a sonar
I have used the TF mini as I received it, with the standard output.
RNGFND_TYPE = 20 TF Mini.
SERIAL5_PROTOCOL = 9 (Lidar)
SERIAL5_BAUD = 115
RNGFND_SCALING = 1
RNGFND_MIN_CM = 30
RNGFND_MAX_CM = 600
RNGFND_GNDCLEAR = 20
RNGFND_ORIENF=25

Both TF mini are powered from a 5V BEC.
I have not tested in air, but on ground I was having consistent distances.

Special thanks to ppoirier. I couldn’t have done it without your help.

3 Likes

Hi Rainfly,

I am not sure what TFmini firmware i am running. Will check on the GUI this week.

I have found if i follow manufacture instructions with pixhawk it works, well a single unit will.

I found changing the settings to TFmini (20) in MP configuration and TFmini in Sonar via the optional settings in initial setup, the TFmini is clunky and doesn’t work properly, if at all. Depending on the setting configuration you use.

Using lightwave serial as per manufactures instructions make it work properly in MP. However, i can’t get two devices working. Perhaps both are working but i can’t work out how to see the second lidar data in real time.

1 Like

Your most welcome
Patrick is awesome and has done a number of things with the tfMini. It’s worth a read

2 Likes

Hi ppoirer,

Thank you for your response. I read the links you posted. Reading the second link, it indicates that there can be a PRX2 setting. My rover firmware is not showing this setting. Do you know if this is available with Ardurover 3.4.2?

How do you see if the second TFmini is feeding data? When one is connected you can see the data in sonarrange, If there another field we can view it from?

Are you able to suggest a way to have the two lidars working with serial?

Ppoirer, I appreciate the information you have provided, am very greatful.

I have attached an image of the radar screen and my settings below:

image

RNGFND_ADDR,0
RNGFND_DEBOUNCE,2
RNGFND_FUNCTION,0
RNGFND_GNDCLEAR,10
RNGFND_MAX_CM,600
RNGFND_MIN_CM,30
RNGFND_OFFSET,0
RNGFND_ORIENT,7
RNGFND_PIN,-1
RNGFND_POS_X,0
RNGFND_POS_Y,0
RNGFND_POS_Z,0
RNGFND_PWRRNG,0
RNGFND_RMETRIC,1
RNGFND_SCALING,1
RNGFND_SETTLE,0
RNGFND_STOP_PIN,-1
RNGFND_TRIGGR_CM,100
RNGFND_TURN_ANGL,45
RNGFND_TURN_TIME,1
RNGFND_TYPE,8
RNGFND2_ADDR,0
RNGFND2_FUNCTION,0
RNGFND2_GNDCLEAR,10
RNGFND2_MAX_CM,600
RNGFND2_MIN_CM,30
RNGFND2_OFFSET,0
RNGFND2_ORIENT,1
RNGFND2_PIN,-1
RNGFND2_POS_X,0
RNGFND2_POS_Y,0
RNGFND2_POS_Z,0
RNGFND2_RMETRIC,1
RNGFND2_SCALING,3
RNGFND2_SETTLE,0
RNGFND2_STOP_PIN,-1
RNGFND2_TYPE,20

1 Like

Hi Andresrc,

Thank you for your post! I have copied your settings but it doesn’t persuade the lidars to work together. I can get one working but not both of them.

Just to confirm, you have two lidars operating with these settings?

When i look at your RNGFND settings, it appears to come from one lot of settings.

I appreciate your response andresrc!

Regards
Ben

1 Like

@Bender there is a probleme with the TFMIN (Type 20) native driver not allowig multiple instances of RNGFND. The lightware (Type 8) can have 2 instances running simultaneously (as showned in my example)

2 Likes

First I configured the front tf Mini, as a rangefinder. TF Mini was in pix mode and in the Pixhawk as a LightWareSerial. In Sonarrange distance and in the optional hardware rangefinder page of the MP I had 0 m. but pressing Ctrl+f, in the proximity radar I could see the right distance.

Then I configured the other TF Mini as a Sonar. In the previous post, for everything related to the second TF Mini, was RNGFND2_TYPE and so on…
I Forgot to change RNGFND with RNGFND2. In this second TF Mini, I did not change the code for pix output. I left it in standard output and RNGFND2_TYPE was 20 (TF Mini).

Now in MP in the status tab I have sonarrange: the distance indicated by the second TF Mini and in the Ctrl-F Radar the distance indicated by the first TF Mini.

I think that everything is ok, but I didn´t fly it after the TF Mini installation. I also don’t have the drone with me, so I can’t show you any other image or log, but I will try as soon as possible.

Regards

2 Likes

@ppoirer Your advice and assistance was fantastic! Changed the settings to Type 8: Lightware serial and boom, it worked.

ppoirier, you have made my week! I really appreciate your assistance.

I have attached a screen dump of my proximity radar for posterity

image

2 Likes

Patricks the MAN, the hero of our nation

2 Likes

Hi andresrc,

Thank you for your detailed explanation. I didn’t end up using your process but it looks like we can achieve the same outcome using a different process.

I followed @ppoirier advice to achieve the outcome. If it didn’t work i was going to try your method. The main difference between our methods is i used Type 8: Lightware Serial for both RNGFND_TYPE and RNGFND2_TYPE, set RNGFND_ORIENT to Type7: Forward_Left and RNGFND2_ORIENT to Type1: Forward-Right. Opening the proximity radar using Ctrl F and “proximity” i can see both radar measurements that respond and display fairly accurate readings.

I really appreciate your assistance! Hope i can return the favour some day.

Regards
Ben

See image attached:
image

1 Like

@rmackay9 Push an update for the TFMINI driver, yestedray https://github.com/ArduPilot/ardupilot/pull/9697
I tested it on my BeagleBone but the results are not conclusive, will continue to dig in it

2 Likes

I’m happy you have the TF Mini working.

Yes, we have slightly different approach, as far as I want one TF Mini to keep distance to the front and another one to check or mantain terrain altitude.

Probably in the future I will make an update. Maybe a kind of POC as ppoiter did, or maybe a higher range laser to act as a sonar, and the two TF Mini for obstacle avoidance as you did.

I am just thinking loud, but I think that 6 m. for obstacle avoidance is Ok, but 6 m. as a sonar is maybe a bit short, as far as I fly most of the time at higher altitude. Do you have some experience in this way? Really could be interesting to have a longer range sonar? Other rangefinder are yet pretty expensive.

Regards.

1 Like