TFMini Plus for simple object avoidance


I want to use my TFMini Plus for simple front facing object avoidance like heading toward a wall or tree and have it stop say at 3 meters.

I did this first and realized it was for terrain following:

I have it hooked up to my Hex Cube black carrier board on Telemetry 2 using serial. I looked at the sonarrange in MP and it is showing a number from the lidar which seems correct. I do not want to use it for terrain follow though, so now should I disable those settings as I want to use front facing for object avoidance?

I found this:

I am not sure exactly what I should do now as I have it setup facing down and reading terrain height? I am only going to be using this with Loiter mode to start and I still want to be able to use geofence as well. Do I leave everything the way I have it and set:

avoid_margin=3 (is that meters?)

Thank you, David


RangeFinder can be used for proximity control.

On the graph, Blue line is when I’m walking in front of my Hexa. As I’m too close it move backward.

Red is TFMini+ reading (facing front)
Green is TF02-Pro reading (altitude control)

In the RNGFND settings, orientation is set to Forward,

PRX_TYPE set to 4 (use range finder)

AVOID_ENABLE set to 2 (use proximity sensor)

Capture d’écran 2020-07-01 à 07.43.02

RNGFND2 settings (RNGFND1 is TF02-Pro)

Capture d’écran 2020-07-01 à 07.44.10

Thank you @mlebret.

I am still confused on what I need to turnoff or change from setting it up as a downward facing camera for a rangefinder or terrain following? You have the object avoidance setup as rngfnd2 and not rngfind1. Is object avoidance setup on rngfnd2? I will only have one camera. Also, you have avoid_enable=2. I read maybe it should be on avoid_enable=7 to still be able to all including geo fence? Sorry, just confused.

My TFMini S is looking forward (for objet avoidance) and set as RNGFND2

My TF02-Pro is looking down for terrain following (height control) and set as RNGFND1

AVOID_ENABLE: I chose 2 (use proximity sensor) and my Fence is not enabled

I just have one lidar looking forward. Do I set it as rngfnd1 or rngfnd2? Does object avoidance have to be on rngfnd2?

Rngfnd1 is fine. There is no link between numbering and use.


Thank you so much for helping me out. I tested today and all went pretty well. With the max distance recommended of 6m outdoors for this lidar, I have set the avoid_margin to 5 meters and if going over 11 mph it has a hard time coming to a stop before it hits the object. Any recommendations besides maybe getting a longer range lidar?

Again, thank you.

You can try to work the LOIT_BRK_ACCEL and LOIT_BRK_DELAY

Even if recommended outdoor performance is 6m, you can experiment with a larger range RNGFND_MAX (9m)

Ok, thank you. I will try some things today or tomorrow and post a video.

Played around with it more today. I tried the rngfnd_max to 900 cm and the avoid_margin to 800 cm and it will read it, but only below 10 mph. If I go above 10 mph it will come very close or hit the trees or wall. I also tried playing with the loit_brk_accel and loit_brk_delay, but did not seem to change much. I ordered a TF-02 Pro today and will try that next week. Over 10 mph it does not pick the object up and react fast enough. It works, just has some limitations. Video below is at @6 mph and @10 mph. Being a bigger drone it obviously is a lot harder to stop quickly. Will keep working and trying things. Thank you @mlebret