ArduPilot / ArduPilot/ardupilot

Rangefinder: Ground Clearance will be not substract

Open
#5,153 3 comments 0 reactions 0 assignees View on GitHub
Copter
Dominant language
C++
Stars
15.9k
Forks
21.4k
Avg merge
3d 17h
Merged PRs (30d)
119

Description

#### Issue details
We defined a "Ground Clearance" in the parameters for the Rangefinder, but doesn't use this paramter in the code to calculate the difference for the real altitude.

Normally every Copter has a landing gear. And the Rangefinder is mounted higher than the bottom of the landing gear. And for that case we must substract the "ground_clearance_cm()" from the "rangefinder_state.alt_cm"

So my Idea:

in the ArduCopter/sensors.cpp we should change the follow line number 44:

from "int16_t temp_alt = rangefinder.distance_cm();"
to "int16_t temp_alt = rangefinder.distance_cm()-rangefinder.ground_clearance_cm();"

and also we should prevent negative values in the follow line number 51:
from "rangefinder_state.alt_cm = temp_alt;"
to "rangefinder_state.alt_cm = MAX(temp_alt, 0.0f):"

Also we must add a ground clearance in cm for the IR-Lock sensor in combination with precision landing.

**The current code assumes the same sensor level (LIDAR and IR-LOCK) and does not consider the ground clearance of the landing gear**

I think this is a big bug.

Hey guys what did you think about these solutions. Is it possible to fix this?

#### Version
ArduCopter V3.4-rc7

#### Platform
[ ] All
[ ] AntennaTracker
[ x ] Copter
[ ] Plane
[ ] Rover

#### Airframe type
Quad-Copter

#### Hardware type
Pixhawk V1

#### Logs
No Logs

Contributor guide

Open the contributing guide

Research direction

Start in ArduCopter/sensors.cpp at the rangefinder altitude calculation and review how rangefinder_state.alt_cm is assigned. Trace the related IR-LOCK precision-landing handling mentioned in the issue. Done means ground clearance is accounted for in the reported altitude, negative values are prevented, and the IR-LOCK case is covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot, robotics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.