Front Avoidance Sensor Issues

I am trying to get my Terabee Teraranger 15m sensor to work for forward facing collision avoidance. I have it connected through I2C. I also have a downward facing lidar for altitude accurac. It is connected through PWM (and is set as rangefinder 1). I have set the following parameters set for the Teraranger (rangefinder 2):


RNGFND2_MAX_CM = 1500 (TeraRanger15m)

RNGFND2_MIN_CM = 50 (TeraRanger15m)





AVOID_MARGIN = 5 (controls how many meters from the barrier the vehicle will attempt to stop or try to slide along it)

AVOID_DIST_MAX = 5 (Distance from object at which obstacle avoidance will begin in non-GPS modes)

AVOID_BEHAVE = slide (allows setting whether the vehicle should simply Stop in front of the barrier or Slide around it)

AVOID_ANGLE_MAX = 2000 (Max lean angle used to avoid obstacles while in non-GPS modes)

If I have the PRX_TYPE set, it gives bad proximity and will deny the arm command. The Teraranger, does work when I view the proximity map while on the ground.

If I set PRX_TYPE to zero, it will not use the sensor for avoidance, but will allow me to arm.

Does anyone have any experience with these? I am not sure why it is giving a bad proximity error.

What is the exact message when it denies arming?

“Bad Proximity”

Are you following the instruction on ardupilot wiki?

Did you power it with external power?
Can you try to swap rangefinder 1 and 2 and see if any of them would work?

Yes, I used the wiki for the parameter setup, but for some reason it wasn’t used as avoidance during testing.

I will try swapping the rangefinder 1&2.

On terabee’s website, they said not to use external power if that was the only peripheral on the I2C bus. I can definitely try to power externally though.

I will let you know what I find. Thanks for your help.


I tried to swap rangefinders 1 and 2. I also tried to disable rangefinder 2 (downward facing lidar). None of this seemed to help.

External power did seem to help the issue. I still have the same parameters set. Funny thing I figured out is that “bad proximity” shows when an object is NOT detected. If I stand in front of my UAV I am allowed to arm and takeoff, and the sensor works as planned.

Any thoughts on this? It seems a little backwards from what it should be.

Does it show the correct range in Mission Planner?


Sorry for the late reply. The sonarrange status is referring to the downward facing lidar and not the front facing rangefinder.

The rangefinder does, however, display the correct range in the proximity map

Are you able to arm now?

Looks like Mission Planner don’t support showing individual rangefinder values

So I guess getting a 2D proximity map and value of downward rangefinder is what you can get.

For the sensor behaviour being inversed, do you have any way to verify its setting or hardware? Like a tester from other than autopilot

I have tested the avoidance out myself, it works like a charm. I think the downward facing lidar is also being used as avoidance. I will test this out ASAP.

I do not have another way to test the sensors settings on hand. I know the sensors work. I could connect to an arduino if needed, but thats about it.

I really wish there was a way to choose the sensors used for rangefinding vs avoidance…

Also, a “quick fix” for me is to disable the rangefinder for the arming check, but I would like to monitor the health of my sensors, so I really don’t want to do it this way…

I am open to any more advice, though.

In this case this is more like lack of feature than hardware issue.
You may want to suggest adding this to ardupilot by raising a topic in ardupilot forum.

I had not realized that this had been seen and a patch has been issued. Thanks for all your help alvin