ArduPilot / ardupilot

ArduPlane, ArduCopter, ArduRover, ArduSub source
http://ardupilot.org/
GNU General Public License v3.0
11.08k stars 17.64k forks source link

Rangefinder: Ground Clearance will be not substract #5153

Open Code-Tester opened 8 years ago

Code-Tester commented 8 years ago

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

rmackay9 commented 8 years ago

Thanks for the report.

We need to be consider a few things:

magicrub commented 8 years ago

Subtraction is for sure needed for plane but you bring up good points for copter.

On Nov 6, 2016 11:47 PM, "Randy Mackay" notifications@github.com wrote:

Thanks for the report.

We need to be consider a few things:

  • is it really important that the distance reported has the ground clearance subtracted? It's not completely clear (to me at least) why reporting the distance to the ground from the bottom of the landing gear is better than reporting the distance to the ground from the body of the vehicle (which is where the lidar/sonar is likely connected).
  • the precision landing probably actually wants the distance from the lens to the target, not the distance from the bottom of the landing gear although I'm not totally sure.
  • should the ground clearance be subtracted before or after applying the vehicle's lean angle correction?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ArduPilot/ardupilot/issues/5153#issuecomment-258767173, or mute the thread https://github.com/notifications/unsubscribe-auth/AEj7G14ijvN6pBIbjRJoSbLdHZK5tGH5ks5q7teBgaJpZM4KqbJo .

R-Lefebvre commented 8 years ago

Probably makes sense to have two data available. Ground clearance subtracted height, and then the raw sensor height (to be used for PrecLand).

On large aircraft, the sensor height can be quite high. In future, if we have really good distance data to the actual landing gear, could be used for things like positively not-auto-disarming while not actually landed.