Monitor EKF status - await EKF initialized

Hi,

How do I monitor the state of the EKF? Specifically I want to check if it is done initializing such that we are ready to fly.

When booting the autopilot, the EKF needs some time to be ready to flight. If I try to arm it in this timespan, I get a human readable warning APM: PreArm: EKF2 still initialising. The question is then: How can I know know if the EKF is ready to arm through MAVROS? (or through Mavlink without MAVROS?)

I have tried two topics:
/mavros/estimator_status seems to be empty. No received messages.

/mavros/state has a field called system_status, but that seems to be set to 3 = STANDBY even when I get the error message APM: PreArm: EKF2 still initialising.

I don’t know if it is relevant, but I am trying to do GPS denied navigation, so the EKF initialization I am waiting for is the reinitialization after setting the origin with SET_GPS_GLOBAL_ORIGIN (mavrostopic: /mavros/global_position/set_gp_origin).

Any help would appreciated. :slight_smile:

Hello,

You can look on how we are doing it on the autotest : see here https://github.com/ArduPilot/ardupilot/blob/master/Tools/autotest/common.py#L3126 . I think that we also have test on copter to fly without GPS, so you will have an example !

Hi, thank you for the quick reply!

I see that autotest waits for some of the fields in the ESTIMATOR_STATUS message that mavros does not seem to publish any of ( on /mavros/estimator_status). Do you know if it is sent regularly?

Hi
I have same question.
Is there any way to get the EKF status right now?

Hi,

It is a long time since I had a look at this, but I don’t think I figured it out. I think I ended up abusing the arming functionality by repeatedly trying to arm and see if it armed.

This was a long time ago and things might have changed since then.

Why not just set FENCE_ENABLE ?

Would setting FENCE_ENABLE give the EKF-status?

Not directly, but you cant arm until EKF status is good and a Home position can be set.

Not sure if I understood what you meant. Can’t FENCE_ENABLE be set until EKF status is good?

No, that is not what he meant.

He meant, activate the fence parameter and reboot.

Now it will only arm if EKF is healthy

Ok, thank you. That would be a possible solution, at least to the problem I had.

It is not exactly the answer to the question, so I don’t know if it helps @RangeOfGlitching, but it is good enough for me.