EKF Pixhawk Module

Hello all,
I have been trying for some time now to determine whether or not it is possible to use any pre-existing Extended Kalman Filter (EKF) module on the Pixhawk. I have found existing modules for ArduPilot here for “Copter and Plane”, but I am not sure if I can use it for the BlueROV2. From the first link, I stumbled upon more in-depth use of the filter and it’s parameters but no further documentation on running the filter (as a background process or otherwise). For example, following screenshot makes it sound quite simple to start the filter subprocess, but I have no clue as to where I should set this parameter (copy the line to a shell/Python script?)

I know Pixhawk and ArduPilot have the functions available to run the filter, does it translate to ArduSub firmware? And if so, how does one run the filter and get output?

Thanks all

Hello Milos,

Ardusub uses the EKF2 by default.

You can change these parameters in the parameters section of QGC.

Ardusub is part of Ardupilot, so most things are almost the same, only the necessary is modified.

The filter runs automatically and you can get the output with a lower sampling rate via Mavlink messages (AHRS to AHRS3, look at the code to see where the data comes from), or from the dataflash log (.bin file generated in the SD card) messages NKF1 to NKF9.

We have some directions for Log Analysis in Ardusub.com.

1 Like

Thank you very much @williangalvani . Looks like I have some more reading to do! I aim to write a script in Python that can run on the Pi on-board the ROV, using the EKF to improve/achieve localization (initially with no GPS at all and then maybe having the ROV resurface every now and then to get coordinates). I think the GitHub you linked will prove very useful, thank you very much!

@williangalvani While looking over the Mavlink messages for AHRS and AHRS3 and I had some followup questions I’m hoping you might be able to shed light upon. I noticed that there is another Mavlink message, AHRS2, with the same values as AHRS3 although it also includes 4 test variables (I’m not sure if they serve any practical purpose for properly using the EKF), and when I ran a loop to read both messages simultaneously they returned slightly different values. Should I stick with one versus the other?

Two of the fields of AHRS (DCM attitude estimator) that confuse me are the re-normalisation value (renorm_val) and acceleration weight (accel_weight). I’m not sure what they signify or how they may be useful for localization (or whatever purpose they serve).

I noticed while running the script on the stationary ROV that the latitude, longitude, and altitude values remained 0, presumably since they would rely on a third-party GPS and are not based off of relative position.

Finally, is it safe to assume that the gyro drift estimate values are essentially error estimates? I gave the ROV a straight line path at low PWM with Stabilize mode activated, and saw those values remained near zero, so I assumed as much.

Thank you again for all your previous help, my apologies for bombarding you with so many questions, I’m still very new to control theory and any information/advice helps!

Best,
Milos

1 Like