Changing Home make Altitude incorrect

I’m flying in terrain that changes a lot, I fist noticed one day while flying that I had a constant altitude error that the autopilot never closed on. I didn’t think much of it, until today when I got the mavProxy simulator running and was easily able to re-produce the issue, then I started digging into the arduplane code for the pixhawk.

What I think that I am seeing is that there is a concept of an origin, that is set in 3D space when GPS is first acquired. if you then move home 100m in altitude, then this origin does not change, but the reference for the altitude error does. The end result is that the airplane will not longer fly to the commanded altitude and the altitude error reported remains constant at 100m up or down in the same direction that home moved.

The origin is a bit convoluted in the code, but it seems to me, that the origin should be changed to the home location every time that a new home is uploaded. Anyone have any thoughts on this. I’m seasoned in both c++ and autopilot code, but I’m used to having intimate familiarity with the code and this seems a bit difficult to trace through. Anyone have any suggestions?

Thanks
Josh

1 Like

Hi Josh
I just want let you know that I noticed something similar. On some flights I have a constant positiv error, sometimes a constant negative one. Just some meters but I was wondering because I never changed any parameters.
One time I aborted a mission because the airplain seamed to never reaching loiter_to_alt altitude.
Sebastian

Yeah, at first I thought maybe is was due to the Kalsman correction changing as the day warmed up, but when saw it using the MAVProxy Sim, I believe there is a ghost in this particular machine.

I changed the title of this, I tested it today, launched on a hill side. Changed home to the bottom of the hill, then landed at the bottom of the hill. When I landed the airplane though it was about 50m underground. Any thoughts on why this alt discrepancy happens when you change the home location?