I can’t fine this version of firmware as the bata5 doesn’t work with the LD19 changes.
I have FC MicoAir H743
Thanks
Dennis
Hi @Dennis_Bowman,
Thanks for the report. It’s difficult to go back but perhaps instead we should focus on resolving any issues you’re seeing with the LD19.
Can you provide more details on what is not working?
This is the PR that modified the LD06/LD19 driver
FYI @peterbarker
The problem i have is my LD19 worked fine in sun light before this change and now it’s very sensitive to sun light. Here is screen shot of PRX Dis and RFND (ALT) 1.4m of ALT to enable PRX. This is with 4.6 Beta5.
Before change only got real PRX Dis triggers.
Looking to go back to 4.6 Beta2 to make sure it works well. Can’t go back to 4.5.7 because my FC (MicoAir H743) is not in 4.5.7.
Thanks
Dennis
Hi @Dennis_Bowman,
ok, here’s a Copter-4.6.0-beta2 binary for the MicoAir743 for testing.
AP’s driver doesn’t configure the lidar itself so I suspect the sensitivity to light is caused by a change in the environment but at least you’ll have the two firmwares to test if this is correct or not
Thanks again for testing and reporting back!
I did a test flight with Beta2 and here is a screen shot of the PRX_Dis and looks a lot better with one REAL distance trigger below 3m as its set for and no other ones except when Landing. Both test (Beta5 and Beta2) was done on full sunny days. So, its semes to be a lot more sensitive with Beta5.
Dennis
Hi @Dennis_Bowman,
Thanks for the testing. Instead of a test flight, how about two back-to-back tests on the ground?
I don’t think it’s possible that AP’s driver change is affecting the lidar’s sensitivity to sunlight because it doesn’t do any configuration of the lidar. The only explanation would be that some measurements are gained or lost.
@peterbarker do you think you could help investigate this one?
Not sure what you mean (back-to-back tests on the ground)?
Dennis
Hi @Dennis_Bowman,
So I think it would be good to do this kind of test:
- set LOG_DISARMED = 1 (to allow recording of data while the vehicle is disarmed)
- install 4.6.0-beta2 on the autopilot
- power up the vehicle for a couple of minutes to gather the lidar data
- install 4.6.0-beta5 on the autopilot
- power up the vehicle for a couple of minutes to gather the lidar data
I went through the code for the LD06 Lidar, (I think the LD19 uses the same driver?)I think the problem is this commit here where the method of reading the lidar was changed from averaging 2 samples in a row to just using the shortest distance, this causes it to pick up all the random interference
Okay, do i need to set the AVOID_ALT_MIN. to zero? its set to 1.4m now.
Dennis
I thought it was an average over 12deg. or 2deg. for Beta5?
Dennis
I think it was averaging good readings but now its using the closest. I have a custom mavlink adapters for mine and I still get a lot of issues in sunlight
Thanks very much for this analysis, that’s extremely helpful.
We will consider backing out this change unless we can get some input from the original developer.
I think its changed from this
sampled_counts ++;
distance_avg += distance_meas;
to
if (!_last_distance_valid || (_dist_2deg_m < _last_distance_m)) {
_last_distance_m = _dist_2deg_m;
_last_distance_valid = true;
Ping @mw46d - what are your thoughts on changing this over to be a median filter instead of taking the shortest?
The lidar has a “Confidence” field in its output so you can filter off low confidence returns. Without it the lidar is totally unusable outdoors there is noise in every direction. it’s a single byte, I had it set at 200 and it gave me the video i posted above, my next test is to try it set at 240 or 250 to see if it gets rid of the rest of the noise when in direct sunlight. From what I can see it’s not being used in the driver.
Thanks again for the testing, feedback and persistence and sorry for doubting your report initially, my judgement was clouded by an earlier unrelated report.
I think we will count this as a regression and will need to do something before we can roll-out 4.6.0 as stable.
@rmackay9
Im just looking back through it again, it might be averaging it here but in a slightly different way? I think its just been moved.
Please check if what I’m saying is correct, I’m no C expert, I might be totally wrong.
There is mention of the confidence byte here but I cant find it being used.
I wonder how much behavior of the old driver is related to problems that were fixed.
According to spec LD-06 is not the master of (direct) sunlight resistance, and that might be just lidar issue.
It might seem to work better with old driver, but in reality driver was just processing data in wrong way.
I have LD19 somewhere. Will try to find a moment to test it too. Also will try my old fix for 4.5.7, where I did something like this:
if (distance_m > distance_min() && distance_m < distance_max()) {
sampled_counts++;
distance_avg += distance_m * confidence_meas;
confidence_sum += confidence_meas;
}
…
distance_avg /= confidence_sum;
Was working fine, but I did not test it in direct sunlight
If You want to, You might try out my old fix that has code transplanted from RPLidar driver, has distance averaging with confidence taken into account and fixes same issue new driver fixed.
Branch is based on latest beta5 commit.