No PRX distance values for a few seconds and crash (with video!) - rover 4.1.0

Hello all,
I am trying to build a rover with obstacle avoidance, using rover 4.1.0 stable. So far I have tried three different sensors, all of them seem to work when tested individually, but the rover the rover does not notice BIG obstacles (like a wall, a full size car or my legs…), all of them have the same problem!

I have noticed that the “radar” screen in Mission Planner shows a reasonable distance, but there is a lag of about three seconds when I put my hand before the sensor and the change in the radar screen, no lag when I remove my hand from the line of sight.
I thought of the PRX_FILT value, but there is no difference with a zero value or 20Hz. The thing is, I see the same problem with a teraranger evo 60m rangefinder (PRX_TYPE=4) , with a RPLIDAR A2 (PRX_TYPE=5) even with a Realsense D435i camera in a RPI4 companion computer and a python script to send DISTANCE Mavlink messages.
I believe that I have something not correctly configured, these are my PRX_ and RNGFND1_ params values:

PRX_FILT,0
PRX_IGN_ANG1,0
PRX_IGN_ANG2,0
PRX_IGN_ANG3,0
PRX_IGN_ANG4,0
PRX_IGN_ANG5,0
PRX_IGN_ANG6,0
PRX_IGN_WID1,0
PRX_IGN_WID2,0
PRX_IGN_WID3,0
PRX_IGN_WID4,0
PRX_IGN_WID5,0
PRX_IGN_WID6,0
PRX_LOG_RAW,0
PRX_ORIENT,0
PRX_TYPE,4
PRX_YAW_CORR,0
RNGFND1_ADDR,49
RNGFND1_FUNCTION,0
RNGFND1_GNDCLEAR,25
RNGFND1_MAX_CM,800
RNGFND1_MIN_CM,25
RNGFND1_OFFSET,0
RNGFND1_ORIENT,0
RNGFND1_PIN,-1
RNGFND1_POS_X,0
RNGFND1_POS_Y,0
RNGFND1_POS_Z,0
RNGFND1_PWRRNG,0
RNGFND1_RMETRIC,1
RNGFND1_SCALING,3
RNGFND1_STOP_PIN,-1
RNGFND1_TYPE,14
RNGFND2_TYPE,0
RNGFND3_TYPE,0
RNGFND4_TYPE,0
RNGFND5_TYPE,0
RNGFND6_TYPE,0
RNGFND7_TYPE,0
RNGFND8_TYPE,0
RNGFND9_TYPE,0
RNGFNDA_TYPE,0

You can see in the following screenshot that the proximity radar shows a distance (using teraranger evo lidar) but, interestingly, the rangefinder1 distance (received by MP) is always zero meters.

In the attached flash log file, the PRX distance follows the rangefinder distance when the change in distance is slow (it is me moving from or towards the rover) , but with more sudden changes, it seems that there is no PRX values for a few seconds, then recover. Is that the expected behavior?

Any help with this issue will be much appreciated. I’m having a hard time configuring the obstacle avoidance, so far, it seems more like an obstacle destroyer :slight_smile:

Thankyou!
Adolfo.

dataflash log: Sign in to your account

Hello again,
I have been doing some test trying to fix this issue. I have recorded a “real” mission and found the same problem as before: there is (sometimes) a lag between the distance of the rangefinder, and the proximity distance used for obstacle avoidance, it seems that the proximity values arte not available for a few seconds. Please have a look at this screenshot of the dataflash log plotting RNFGND.distance and PRX.d0 values:

PRX follows RNGFND, but sometimes there is a lack of PRX values for a few seconds. In the highlighted moment, the rover wrongly turned to the right (I don’t know why, yet, the next waypoint was straight ahead), then crashed against a parked car’s wheel, the RNGFND distance goes sharply to zero but there are not any proximity distances for a while.

This a very thrilling video of the MP screen and the onboard camera, the crash is at the end: Sign in to your account

I can’t figure it out what could be the problem.
Any help will be much appreciated.
thankyou!

Dataflash log: Sign in to your account (crash at 15:57:04)
telemetry log: Sign in to your account (crash at 72%)

HI @Adolfo_Cobo. Sorry to hear you are having trouble. I am currently the maintainer of Obstacle Avoidance features at ArduPilot. All the features are well tested by me on Copter… but I only do simulation tests for Rover (I don’t have one at the moment). Would it be possible for you to come on a call with me (preferably on ArduPilot Discord server), and we can try and figure out what the problem is? There may be a small bug that we might discover…

Thankyou @rishabsingh3003 for your help! My discord user is Adolfo#8715. I am doing more test right now. I have recorded another mission with the teraranger rangefinder and this is a screenshot of the log: the proximity values of distance are missing from time to time and for a good half a minute in one ocasion, while the rangefinder has apparently good distance values.
I have a rplidar-a2 and will try it in a moment. Will post the results.
Thankyou!

Hi again,
I have connected a RPlidarA2 as a proximity sensor, left the teraranger evo 60m as a rangefinder. In this case, there are no missing samples of the proximity distances in the logs. The rplidarA2 have a lot of glitches (that is the reason I am testing the teraranger instead, and sometimes the rplidar A2 os not detected at boot, even with a boot delay of 6 seconds). Anyway, if there is a bug in the proximity sensor code, it seems to appear only when the source of distances is a range finder. I think I have a maxbotix sonar somewhere, I will try.
Thankyou!

Hi Again,
I have connected a GY-US42v2 sonar in I2C mode (address 112) as a rangefinder. This time, it seems that proximity distances are ok but in the log I can see two brief periods of time without distance updates, marked in the screenshot below. So, I don’t know, may be it is an issue with rangefinder as proximity sensors or just with I2C rangefinders.
Best regards,
Adolfo.

Hello again,
I am still struggling with this issue. I have changed everything: a new pixhawk cube black, new version Rover 4.1.1, default parameters, and a new TFmini plus lidar as a rangefinder.
The result is the same: from time to time, there is no proximity distance values. I have noticed that the problem appears mostly when the distance drops suddenly. This is a screenshot of the dataflash log of rangefinder and proximity distances:

dataflash log file: Sign in to your account

In this other test, it seems clear that the proximity distance does not update until the rangefinder distance increase again. First test was with PRX_FILT=0, the second one with PRX_FILT=0.3Hz, just to check if this is related to the filter, it makes no difference.

dataflash log file: Sign in to your account

@rishabsingh3003 I will appreciate if you could have a look to the screenshots or the attached logs, I believe that there could be a bug somewhere. So far, this is happening with three different sensors (RPlidarA2, Teraranger evo 60, TFMiniplus), two pixhawk boards, and default parameters.
Thanks in advance, regards!
Adolfo.