Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copter: fixed landing gear deploys and retracts when rangefinder is out of range #28414

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

4dri4anxD
Copy link

When the drone height exceeds the working range of the rangefinder, the status of the range finder is set to OutOfRangeLow even if the drone height is greater than the maximum distance the rangefinder can detect, this causes the drone height to be set to 0 and the landing gear to deploy and then retract and so on infinitely. In the modified part, the value detected by the rangefinder when it goes out of the working range defined by the parameters RNGFND_MIN_CM and RNGFND_MAX_CM is ignored to take into account other values.

…altitude exceeds the working range of the rangefinder

When the drone height exceeds the working range of the rangefinder, the status of the range finder is set to OutOfRangeLow even if the drone height is greater than the maximum distance the rangefinder can detect, this causes the drone height to be set to 0 and the landing gear to deploy and then retract and so on infinitely. In the modified part, the value detected by the rangefinder when it goes out of the working range defined by the parameters RNGFND_MIN_CM and RNGFND_MAX_CM is ignored to take into account other values.
@4dri4anxD 4dri4anxD changed the title Copter: fixed landing gear deploys and retracts in a loop when drone altitude exceeds the working range of the rangefinder Copter: fixed landing gear deploys and retracts when rangefinder is out of range Oct 15, 2024
@IamPete1
Copy link
Member

Do you have a log? Which rangefinder are you using. It sounds to me like it should be reporting OutOfRangeHigh not OutOfRangeLow if it is too high?

@4dri4anxD
Copy link
Author

Sure.
I agree it should be reporting OutOfRangeHigh, but its measurement becomes unpredictable over its maximum detection distance (which is 40 mts).
I'm using a Garmin LidarLiteV3-I2C
Landing gear is on RCOU9 on both logs
I'm attaching as well some screenshots of the graphs:

Rangefinder graph, in the middle part it flies higher than 40 meters and its measurement alternates between 0 and the actual value.
Capture
Landing gear graph (RCOU9), in deploys and retracts in a loop because it depends on the value of the rangefinder.
landing_Gear
This is the altitude of the drone (this is how rangefinder graph should look like):
altitude

After making the modifications, this is the result:
Rangefinder is the same, becoming unpredictable if flying higher than its maximum working distance:
rnffnd_corrected
This is landing gear, it deploys and retracts only when it should, because it is not depending on Rangefinder measurements when it goes out of range:
lg_corrected
And this is the real altitude of the drone:
real_altitude

Here are the logs:

Landing gear issue:
LandingGear_issue.zip

After code changes:
LandingGear_fixed.zip

Copy link
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look right to me.

A RangeFinder returning out-of-range-low should definitely be deploying landing gear!

You might propose using above-home for out-of-range-high, but it seems unusual too.

@4dri4anxD
Copy link
Author

4dri4anxD commented Oct 25, 2024

But RangeFinder is alternating between out-of-range-low and out-of-range-high when going higher than its maximum detection distance (40 mts).
Using above-home for out-of-range-high won't solve the problem since it will keep reporting out-of-range-low erroneously deploying landing gear when it should not.

Another solution could be only setting height_cm = 0 when reporting out-of-range-low AND height_cm (above-home) is less than RangeFinder min_distance_cm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants