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_ADDR = 49

RNGFND2_MAX_CM = 1500 (TeraRanger15m)

RNGFND2_MIN_CM = 50 (TeraRanger15m)

RNGFND2_ORIENT = 0

RNGFND2_TYPE = 14

PRX_TYPE = 4

AVOID_ENABLE = 2

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?
https://ardupilot.org/copter/docs/common-teraranger-one-rangefinder.html

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.

@Alvin

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?