PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
8.41k stars 13.46k forks source link

[Bug] Vehicle Local Position is not reinitialized. #21805

Closed fbenti closed 1 year ago

fbenti commented 1 year ago

Describe the bug

I'm facing an issue with the vehicle_local_position. I run multiple offboard missions, simply taking off and landing. The altitude height is set to 1.5 m however the drone sometimes stabilizes around 4/5 meters. You can see attached the plots regarding 4 consecutive runs,

To Reproduce

Consecutive takeoff and landing

Expected behavior

I would expect the vehicle_local_position to be initialized at every run.

Screenshot / Media

log_212_2023-7-4-19-12-48 log_213_2023-7-4-19-13-52 log_214_2023-7-4-19-16-38 log_215_2023-7-4-19-17-18

Flight Log

https://logs.px4.io/plot_app?log=06ff42d2-05c0-4205-b67f-37ccff8b34da https://logs.px4.io/plot_app?log=b709e4c2-7f4a-4ad6-b58b-18f537a92291 https://logs.px4.io/plot_app?log=91df7265-c901-44d1-be01-68cdf2c190a9 https://logs.px4.io/plot_app?log=3fa0cc55-99eb-4df6-ae20-7c7687a75b65

Software Version

v1.14 beta

Flight controller

PX4_FMU_v5

Vehicle type

Multicopter

How are the different components wired up (including port information)

No response

Additional context

No response

fbenti commented 1 year ago

Is there a command to reset the vehicle_local_position estimator without the need of switching off the flight controller?

bresch commented 1 year ago

The origin of the local frame is set at boot and shouldn't be reset. Maybe one thing you didn't consider is that local_position.z is not by definition the altitude above ground nor above home, it's the altitude above the origin (they roughly match if you boot and takeoff at the same place but can also be quite different).

If you want to takeoff at some altitude above ground, just take the current Z position and add (or subtract since it's NED) the desired altitude above ground at each takeoff in your offboard code. If you have a range finder you could also control the "dist bottom" height.

Side note: the large altitude drift you see on the local position might be caused by a baro or GNSS alt drift

julianoes commented 1 year ago

This has been answered and there was no follow up. Closing.

DronecodeBot commented 8 months ago

This issue has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/origin-of-ekf2-and-local-position/36828/1