Ekf3 optical flow sensor problem ( in loiter mode )

Please help me out , I didn’t understand how to solve this problem, When I want to flying with only Hereflow and TF02 Lidar then it was showing ‘’ PreArm : Need Position Estimate ‘’ in Loiter mode.
I’m using Copter 4.1 Beta6.
This Parameters I’ll set in AP EK3_SRC1_POSXY = 0
EK3_SRC1_POSZ = 2
EK3_SRC1_VELXY = 5
EK3_SRC1_VELZ = 0
EK3_SRC1_YAW = 1
I’m sharing the critical massage screenshot image link below;
https://drive.google.com/file/d/10eCXjH6eyzuujUmFp_Xa7DgrRrbnXoYY/view?usp=drivesdk

Maybe it is this?

To allow arming and taking off in Loiter without a GPS the GPS arming check should be turned off as shown below. Unchecking “All” and “GPS” and leave all other options checked.

Optical Flow Sensor Testing and Setup — Copter documentation

Thanks Derek :blush:. But this procedure didn’t work, that’s why posted it on forum.

Good evening,

Do you have a log, may be with LOG_DISARMED=1? I had some issues in the past that were associated to configuration. Three things to keep in mind:

  • Make sure that you set a home and an initial position. It can be done through MP or through Mavlink using a companion computer.
  • Check the orientation of your LiDAR. The RNGFNDx_ORIENT parameter must be set to 25.
  • The range finder measurement must be valid before starting to fly. For example, I was using at some point a sonar that required me to set RNGFNDx_MIN_CM=50. However, the sonar was only 40cm far from ground before take off, so it was not providing useful measurements. This triggered the position arming check message.

Also, be aware that if you use the LiDAR for altitude correction, your flight surface should be generally flat.

Hey Sergio,
Thanks for your opinion. But you told me another thing and I asked other thing. You’re answer is not expedient my question.

ok, I apologize. May be I was not very clear how what I mentioned was related to your issue. The first point is that when you use optical flow, the position for loiter mode is not provided directly by the sensor. So setting up an origin, or initial position is key. I have had the same message you have when I don’t do it. The position estimation does not happen without this. The second and third points are because, it also does not work if the range finder is not properly configured or it does not provide valid measurements. The distance to scene, provided by the range finder, is important for transforming pixel per seconds measurements from optical flow to m/s. It is important that your range finder works properly even before taking off. I also got the same message as you in the past because of that. The sonar case that I mentioned was an example; since the measurement was not valid because it was out of range, it did not have the distance to scene and it was not able to use the information from the optical flow. Finally, I got the same message once because I forgot to set the orientation of the range finder properly. It is improbable that this is your case, but it can happen.

Hi @Rohan,

Have you put an onboard log somewhere? Sorry if I’ve missed it somehow.

I suspect the issue is that you haven’t set the EKF origin. If you’re using Mission Planner you can right-mouse-button click on the map and set “Set Home Here” >> “Set EKF Origin Here”.

Hi @rmackay9
I have set the EKF origin, but facing same issue.
Here I am sharing the snap and data log,
Please find,
https://drive.google.com/file/d/119HOO8ubL9JxQl78CiETAOVgSP7AfiL7/view?usp=drivesdk
2 1-1-1980 5-30-00 AM.bin (564 KB)

Hi Rohan,

It doesn’t appear that the origin has been set. If the origin has been set we see an ORGN message in the log but it’s not there.

Could you set LOG_DISARMED = 1 and try again? This this is done then we should be able to see in the logs if the origin is being set or not or if it is failing for some reason.

-Randy

@rmackay9

I have done this modification, suggested from you. But still the problem exists. I am attaching the snap , please find.

https://drive.google.com/file/d/152isCimQUQvJER5UGJDcc18ycW8xrROy/view?usp=sharing

Hi @Rohan,

Thanks for your persistence. I really need a log though. A screen shot is helpful but it just doesn’t give me enough information to investigate the issue.

Hi @rmackay9
Sorry for that,
Here is my data log , please find,
https://drive.google.com/file/d/1nDRwd3IEvJ3-elRy2i2GkG-_5lcWvcRd/view?usp=sharing

@Rohan,

Txs for the log.

I think that the rangefinder is too close to the ground because its distance is being reported as 0.13m but the RNGFND1_MIN_CM is set to 30cm. I think this will stop the EKF from consuming its data.

Could you try reducing the RNGFND1_MIN_CM to 10 and try again?

Hey @rmackay9
Thank you.
Now my drone is working perfectly and smooth with HereFlow😌.

1 Like

Hi @rmackay9 ,

Do you need gps in order to set EKF origin? Would it be possible to set EKF origin if my drone is flying indoors?

Hi @limzw,

The EKF origin can be set using Mission Planner on the Data page. Right-mouse-button click on the map, then select “Set Home Here” then “Set EKF Origin Here”.

I’m shocked to see this isn’t written on our optical flow setup wiki page. Sorry about that. I’ve been planning to re-work the optical flow wiki pages for some time but I haven’t quite gotten to it yet.

Hi @rmackay9 ,

It actually is written there under “Second Flight”

I’ve tried it out but there doesn’t seem to be any visual indicators indicating that the EKF origin has been set, is this supposed to be the case?

@limzw,

Oh good. Once the EKF origin has been set the vehicle should appear on the map.

I guess everything works with a GPS but once you switch over to optical flow it stops working?

It is probably best at this point to post an onboard log file. You may need to set LOG_DISARMED = 1 to create one while the vehicle is disarmed.

Hi @rmackay9,

I’ve looked through the previous posts in this thread and i realised why setting EKF origin on the map does not show me a vehicle icon. It is due to my RNGFND1_MIN_CM being set to 30cm (tfmini settings), once my drone is elevated above that height, setting the EKF origin causes the icon to appear. (my drone has an extremely low height profile)

I have 2 questions that i would like to clarify:

Firstly, i realised that i am unable to change the ekf origin once it is set, is this supposed to be the case?

Secondly, how important is it for me to set the ekf origin to be exactly where my drone is on the map? In the event if i do not know the exact location of my drone due to the lack of GPS signal, does this mean i will not be able to make use of the optical flow sensor?

Thanks so much for the help!

@limzw,

Aha, great that you got it figured out.

The EKF origin can’t be moved once set I’m afraid. Home can be moved but the EKF origin can’t be. The EKF origin is not really important from a user point of view in any case though. It’s just an arbitrary place where all the EKF’s calculations are referenced from.

It’s not very important that the EKF origin be exactly correct. The issue will just be that the vehicle won’t appear in exactly the right place on the map. The vehicle’s position is used in the compass library to calculate the declination (the difference between magnetic North and true North) and also for the expected magnetic field length (used to sanity check the compass sensor values). As long as the vehicle’s position is within perhaps 10km or so of it’s actual position it will be fine though because the magnetic field doesn’t change very much over these kinds of distances.