Problem of rangefinder in Auto mode

I just tested in Relative mode here is what I get :

Then with the mode Terrain and the RNGFND_Gain to 0.8 :

And with the RNGFND_Gain to 1.2 :

As we can see as soon as I activate the Terrain mode the Rangfinder is cut in Auto mode whatever the value of the RNGFND_Gain.

I had a look at the log and I think the issue is that the rangefinder’s maximum distance has been set to 7m (RNGFND1_MAX_CM = 700) but in the mission, the altitude above terrain has been set to “8”. This will lead to a terrain failsafe being triggered.

Extra points to @fingadar for remembering that the EKF is not involved in terrain following!

It is strange because I make in general my tests at 3m in height, I enclose the last .log file 2020-05-2710-32-32.log which corresponds to the last test to be carried out in Frame Terrain and with the RNGFND_Gain to 0.8.
The problem is still present yet I am much less than 700cm from my Rangefinder_max ?

@chr89,

I’ve had a look at the log and it is a bit odd that it’s not climbing to 3m based on the rangefinder. Instead it seems to be descending.

Some things that would be good to try:

  • disable BendyRuler avoidance by setting OA_TYPE = 0
  • revert to 3.6.12 (or similar) to see if the proper persists or if this is a regression

By the way, a few other things:

  • RNGFND_GAIN has no effect in Auto mode. It’s only for Loiter, AltHold, PosHold etc.
  • The CTUN.DSalt becomes NaN in Auto mode. This is a known issue that we hope to resolve in future versions. In case it matters, it’s not really a bug, it’s just that the way AP doesn’t terrain following (aka surface tracking) is different in autonomous modes (like Auto, Guided, RTL) and more manual modes (like Loiter, PosHold, etc)

EDIT: thinking about this more, I’m pretty sure this is an issue in BendyRuler that we’ve fixed in Copter-4.0.4-rc1 that has just started beta testing.

2 Likes

Thank you Rmackay9

I just did a test this morning and everything works fine as soon as I deactivate BendyRuler, it’s perfect !

1 Like

@chr89, Excellent! Hopefully you’ll be able to re-enable it again with Copter-4.0.4.

1 Like

Would it be possible to activate the RNGFND_Gain parameter also in AUTO mode ?
Thank you

@rmackay9 , There is still an issue where the altitude RangeFinder does not work in auto mode when OA_TYPE is enabled with BendyRuler.
I have tested it on ac 4.0.5 stable and 4.1.0dev

Is there any other solution?

Hi, Sir good morning,

Your problem is resolved or not sir. I am also working with this feature only now. if you are ok with will resolve this issue.

Thanks and regards
Mohan

Hi, Sir good afternoon,

follow this link (https://ardupilot.org/copter/docs/terrain-following-manual-modes.html#terrain-following-manual-modes).
set

  1. CHx_OPT-75(surface) (place chX switch at low, and make mission)
    Note: reduce the OA_MARGIN_MAX as possible to your drone.
    Try with different alt like(2,3,4 etc)

Thanks and regards
Mohan

Hi
The problem of simultaneous use of altimeter and obstacle detection in AUTO MODE is still unresolved, thank you for your attention.

CHx_OPT-75(surface) (place chX switch at low,

Does low mean to activate the input value of the RC channel (on = pwm2000)? Or disable (off = pwm 1000)?
I’ll take it ON and try it. (This is Korea, so the time is night, I will try it tomorrow.)
Thank you

The value set by OA_MARGIN_MAX is currently 3. Looks no problem for test.
Thank you

USE 3 position switch. (1.switch is low conduction drone Down facing rangefinder is follow and
2.switch is mid: drone is maintain baro meter alt
3. switch is high: drone is taking upward rngfnd values.

make this 0.5 meter.

for me, this worked ok. but altitude does not maintain correctly. But object avoid is work well.

Thanks and regards
Moahn

ok sir good night, sweet dreams.

Thanks and regards
Mohan

Thank you for your attention.

When we have set pixhawk drone according to the basic guide of ardupilot. In “Loiter Mode”, two Rangefinders (Lidar) are can be used to maintain altitude (altimeter/lidar) and obstacle detection (forward/lidar) and all functions works perfectly.

However, in “auto mode” that activate the BendyRuler obstacle avoidance function, the obstacle avoidance function works, but the altitude maintenance function does not work. (It seems that altitude control through lidar is not performed and only barometer is used)

If altitude maintenance does not work correctly through the lidar, even after trying your advice, there seems to be no improvement from the initial question. Is it correct that I understand?

yes, you are right sir, what is the problem with this sir. why alt is not maintained in Auto?

Thank you
Mohan

-The CTUN.DSalt becomes NaN in Auto mode. This is a known issue that we hope to resolve in future versions. In case it matters, it’s not really a bug, it’s just that the way AP doesn’t terrain following (aka surface tracking) is different in autonomous modes (like Auto, Guided, RTL) and more manual modes (like Loiter, PosHold, etc)

According to randy macky’s answer @rmackay9

In Automode, CTUN.DSalt (altitude value obtained by rangefinder such as lidar) is not used (NaN), this is a known ISSUE and hopes to be fixed in future versions.

The latest ardupilot at the time this post was written was around 4.0.3
When I tested it, it wasn’t resolved in 4.0.5 stable and 4.1dev firmware. So I posted a question to see if there is another solution.

1 Like

Thank your expiations, Sir,

Thank you
Mohan

Can you affect the sensitivity of a LiDAR in Terrain missions? I need my unit to try to read through trees. This means to not read every branch (the trees have no leaves at the time) I’m trying to increase the amount of returns until the copter actually starts to adjust.