PX4 / PX4-ECL

Estimation & Control Library for Guidance, Navigation and Control Applications
http://dev.px4.io
BSD 3-Clause "New" or "Revised" License
477 stars 508 forks source link

Allow global position to be published after setting origin #1001

Closed ecmnet closed 1 year ago

ecmnet commented 3 years ago

Sending a set_gps_global_origin message to EKF2 via MAVLINK sets the NED origin as reported by EKF2 but does not switch to publish global position. This would be helpful in use cases where no GPS is available but LPOS is provided by other means. Reason for this is, that the flag _NED_origin_initialised is not set to true inEkf::setEkfGlobalOrigin.

Doing so in elf_helper.cpp would work as long as the parameter EKF2_DECL_TYPE is set to 0. Otherwise an invalid look up of the magnetic declination results an invalid EKF2_MAG_DECL value.

dagar commented 3 years ago

This is probably sufficient for initial testing, but ultimately I think we should also handle getting valid GPS after it's been set manually.

https://github.com/PX4/PX4-ECL/blob/5d34d7a24ef72b826c320a3259ee0ec68b1936df/EKF/gps_checks.cpp#L82-L108

priseborough commented 3 years ago

It appears that the only change required to achieve the stated objective of this PR are the two lines in ekf_helper.cpp. Can you please remove other fixes not required for the publishing of global position and submit them separately

atyshka commented 3 years ago

Any progress on making the changes to get this merged? Would very much appreciate this feature for indoor positioning

dagar commented 3 years ago

ECL has been absorbed into PX4-Autopilot, can you recreate this PR over there?

https://github.com/PX4/PX4-Autopilot/tree/master/src/lib/ecl

ecmnet commented 3 years ago

I just did a short test with V1.12.0 - it still works fine. Will create a new PR.

priseborough commented 3 years ago

We need to be careful that there are not consumers of the global position message that interpret availability of the global position message as indicating validity.

priseborough commented 3 years ago

The https://github.com/PX4/PX4-Autopilot/blob/master/msg/vehicle_global_position.msg message has no validity flag for LLH so consumers will assume valid for controller use if present.

TODO: check how dead_reckoning flag is being used.