Marico

  • **
  • 52
How get relative to ground altitude?
« on: July 15, 2021, 10:24:37 pm »
Hello,
Is there any way to display (on a gadget) altitude relative to ground calculated from GPS (from formula: current alt - armloc alt)?  All available altitude related gadgets display altitude values in "non friendly" units (like baro in pressure or GPS gadget shows alt  above sea level).

Re: How get relative to ground altitude?
« Reply #1 on: July 15, 2021, 11:30:30 pm »
This requires a sonar or something similar.  A sonar sends a sound pulse and measures the time it takes to bounce back.

Sonar only works when within range of the ground (a few meters).  That range depends on what the ground is made of.  Soft thick grass has short range.  Cement has long range.

I wrote some test code that uses sonar and when the sonar is within range (the sonar tells you if it within range) then the absolute altitude was changed into altitude above ground.  The result was that you could fly up and down a hill or steps using the current altitude hold/vario flight modes.

I found that you cannot use a cheap sensor because the prop noise fools a cheap sensor that is out of range into saying that it is staying at that max range instead of saying it is out of range.  I bought a good sensor that uses some of the same technology that cars with radars use to avoid hearing other similar cars, but had moved on to other projects by the time it arrived.   ::)

A quick search on the wiki returned these links which themselves contain some links:

theothercliff (me) video of climbing stairs and link to code repo
  (look earlier in this thread for some links)
https://forum.librepilot.org/index.php?topic=3390.msg23410#msg23410

mr_w sonar code branch and discussion
  (I think it only updates the sonar altitude number which is not currently used for flying?)
https://forum.librepilot.org/index.php?topic=767.msg5504#msg5504

Marico

  • **
  • 52
Re: How get relative to ground altitude?
« Reply #2 on: July 15, 2021, 11:50:57 pm »
This requires a sonar or something similar.  A sonar sends a sound pulse and measures the time it takes to bounce back.

Why not use GPS? Is on the board already.
Couple years ago I made a small GPS+mcu+3 digit display module, there was a button for set base altitude  at ground level before fly. During fly it substracted stored base level from current level and stored  such calculated maximum value for later reading. Many OSD systems show (relative to ground) altitude calculated from GPS. That's all I need.

Re: How get relative to ground altitude?
« Reply #3 on: July 16, 2021, 01:45:48 am »
Sorry, I focused on "relative to ground" and first thought is that GPS/baro doesn't do this on the side of a hill.

PFD on FlightData page is relative to HomeLocation.

System -> DataObjects -> PositionState is relative to HomeLocation.

I recall that OSD also does this for you so it shows friendly numbers in goggles.

Just re-get HomeLocation before you take off (so that HomeLocation == ArmLocation == TakeoffLocation).  With USB or OpLink telemetry connected, a good GPS sat count, and aircraft sitting where you will take off, go to Configuration -> Attitude -> Settings -> HomeLocation and press the Clear button.  In a few seconds it will display the new HomeLocation.  The only problem with this is if you are using Waypoint flight, and your waypoints are relative to HomeLocation, you just moved all the waypoints.

Marico

  • **
  • 52
Re: How get relative to ground altitude?
« Reply #4 on: July 16, 2021, 03:03:46 pm »
I recall that OSD also does this for you so it shows friendly numbers in goggles.

I have an old OSD module which requires a typical NMEA GPS. AFAIK Revolution can output telemetry data on selected ports.
Is this telemetry data just "emulate" real GPS output, so I can connect Revolution telemetry output to GPS input in my OSD? Or Revolution require dedicated OSD module (MinOPOSD)?

Re: How get relative to ground altitude?
« Reply #5 on: July 16, 2021, 07:04:27 pm »
LibrePilot can send telemetry in either UAV/OpenPilot/LibrePilot/MinOpOsd format or MSP/MultiWii/MWOSD format.

OSD firmware can be downloaded/built and flashed for these FC telemetry protocols or for direct GPS (NMEA/?UBLOX?) connection.  FC telemetry does not contain messages in normal GPS format.  You must pick an OSD firmware that matches your data.

There is a LibrePilot variant of MWOSD firmware for best compatibility with MWOSD protocol.

There are others here that know more about OSD than I do.

I would look for recent firmware that supports the LibrePilot variant of MWOSD for my OSD hardware.

If you have MinimOSD hardware, here is a good thread with everything you need for it:
https://forum.librepilot.org/index.php?topic=4938.0