-
Notifications
You must be signed in to change notification settings - Fork 13.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EKF2 flow integration_timespan check is invalid #6282
Comments
@svpcom That's correct. I already asked @priseborough about that. The real PX4Flow sends flow messages at ~20fps, but the simulations runs at 100Hz. Not sure why the ekf limits the rate |
The EKF limits the rate for a number of reasons:
|
With the modified px4flow firmware in my PR I stabilize the flow output rate using a param to 10 hz. It is helpful for this. @ChristophTobler if you get a chance, take a look at the PR. I'd like to get this merged. I've had many users confirm as well as via my own testing that it is more robust indoors and outdoors. https://github.com/PX4/Flow/pull/86/files#diff-7624ab7c53eb9962990d9668d74d8608R198 |
@priseborough Ok, that makes sense. So I will adapt the way the optical flow messages get published. It will still use full fps but integrate over several frames and only publish at arount 10-20Hz. @jgoppert I will take a look at it. But I need to build a new PX4Flow quad setup first. |
@priseborough But now if we submit flow measurements with rate > 20Hz (for example 20.001Hz) we don't got any errors or warnings but instead all measurements will be silently ignored. I think we need to add some error reporting and add some guard interval to prevent occasional message drop due to flow rate fluctuations. |
@jgoppert Also with EKF2 + flow and without gps copter unable to takeoff (due to unfocused sensor). I think we need add the same workaround as LPE does. |
It won't ignore all messages, just the ones arriving sooner than the minimum allowed interval. |
In case of SITL (100Hz flow), all flow messages was silently ignored. Because flow->dt is optical_flow.integration_timespan which is a constant |
@svpcom it is not able to takeoff in the simulation or in real life? Because in the simulation it is |
In simulation (EKF2). With EKF2_AID_MASK 2 (flow on, gps off) it unable to takeoff. |
@svpcom yes that's the default setting for the ekf2 flow simulation and |
@ChristophTobler make posix_sitl_ekf2 gazebo_iris_opt_flow
|
The rate at which the ekf2 can accept observations, which sets the size of the buffers, is controlled by the EKF2_MIN_OBS_DT parameter. From memory it is defaulted to 20msec (50Hz) in master. |
@svpcom Just to make sure: You have changed the lines you mentioned in your issue? But once you takeoff manually position control works? |
@ChristophTobler Yes. I've removed check for 20Hz in EstimatorInterface::setOpticalFlowData and POSCTL became works after manual takeoff. |
@priseborough EKF2_MIN_OBS_DT is used only for magnetometer and altimeter. In case of flow data it supplied to EKF2 anyway and rejected in EstimatorInterface::setOpticalFlowData by hardcoded |
@svpcom That is incorrect. The optical flow max acceptance rate is set by _min_obs_interval_us. _min_obs_interval_us is set by _obs_buffer_length. _obs_buffer_length is set by EKF2_MIN_OBS_DT and the maximum of the various observation time delay parameters. |
@priseborough There are a second check which hardcode 20Hz (see code below) EstimatorInterface::setOpticalFlowData
|
@svpcom Yes there are two hard coded checks. You mentioned two files in the in the issue so en figured you had them both, my fault... So now that you changed these two checks, I guess |
@svpcom I checked the simulation again and if you change https://github.com/PX4/ecl/blob/master/EKF/control.cpp#L249 as well @priseborough Maybe it would be good to use parameters instead of hard coded For the flow calculation in the simulation: I'm adding a parameter to set the ouput rate of the flow. I guess a range between 5Hz and 20Hz would be good? |
I think the discussion is conclusive, can we move on to a proper and complete fix? |
As I suggested:
|
@ChristophTobler @priseborough With commit 967197a flow became works, but only to first flow focus lost (for example flight out of asphalt texture). When I came back to textured field I'm unable to switch to POSCTL mode. Flow data is good:
so it seems that something is broken in EKF2. How to reproduce:
|
I think we can close this since the actual issue is fixed. Overview on exsting issues in #6347 (comment) |
@priseborough For sierra, try this:
|
I've debug why ekf2 refuses flow measurements (using gazebo sitl) and found that we have:
in LPE: src/modules/local_position_estimator/sensors/flow.cpp
in EKF2: src/lib/ecl/EKF/estimator_interface.cpp
I think the check condition should be inverted in case of EKF2
The text was updated successfully, but these errors were encountered: