Flowhold with MTF-01

Hello,

I am running ArduCopter V4.7.0 with Matek H743 Mini V3 and an MTF-01. I have set EK3 sources as follows:

SRC1_POSXY = 3
SRC1_POSZ = 1
SRC1_VELXY = 3
SRC1_VELZ = 3
SRC1_YAW = 1
SRC3_POSXY = 0
SRC3_POSZ = 2
SRC3_VELXY = 5
SRC3_VELZ = 0
SRC3_YAW = 1
SRC_OPTIONS = 0

When I fly in Loiter with GPS, I get an acceptable hold. When I fly in Loiter with MTF-01, I get wobble. The wobble will settle down, but I’d like to not have any wobble at all. I see there are ways to tune the flow hold on the page FlowHold Mode — Copter documentation but I am at a loss how to tune these parameters.

The objective is to have a solid Loiter that is locked in while flying in GPS-denied environments using the MTF-01.

I have uploaded a log of this flight here:

Any help or guidance is appreciated.

Thank you

From the wiki:

With many vehicles this mode results in wobbling and unstable position hold. If possible we recommend attaching a rangefinder and using regular Loiter instead

Try this calibration:

https://ardupilot.org/copter/docs/common-optical-flow-sensor-setup.html

The MTF-01 has a range finder useable up to 8m. Loiter alone is not holding position. However, when I activate flow hold, then loiter does hold position.

Try the Optical flow calibration that I linked above. Set RC10_OPTION,158 to run the test.

Thank you for your help Allister. I ran the flow calibration and still experience wobbling. As before, the wobbling does go away, but when I exit flowhold and go back to flowhold, the wobbling returns.

Here is the latest log.

As the wiki says, you should be trying in loiter mode, not flowhold. Then you can use the switch to cycle between GPS and optical flow.

I notice you have the script running and it is spamming the messages with “active source” messages. I also see that the flow calibration didn’t like the results.

2025-02-03 14:12:47.977 FlowCal: scalarx:-0.411 too low (<0.2)
2025-02-03 14:12:47.978 FlowCal: scalary:-0.402 too low (<0.2)

Try this:

Temporarily disable the script. (let’s get things working first, then add that back in)
Perform the flow calibration flight again, but stay in loiter mode. Use the switch (RCx_OPTION,90) to switch between GPS and Optical flow, while staying in loiter mode.

Did you watch the video of Randy doing the calibration? It’s in the link I posted above. Flow-Hold mode doesn’t use the lidar, even though you have one, so stay in loiter mode.

I also recommend that you set ARMING_CHECK,1.

Hi, thank you for your continued help.

Yes, I did watch the video of the calibration. The GPS hold in the video was much tighter than what I am seeing on my copter. It seems likely that is why my flow calibration was not good, which I could not see because of the spam messages as you pointed out. I will disable the script and do as you recommend.

I also realized that my GPS1_GNSS_MODE is set to 0. I am using the Matek M10Q, which despite its mixed reviews, does hit other GNSS systems. I will try flow calibration again and see if the selecting additional systems helps with Loiter with GPS.

I appreciate your input on Flow-Hold. I was thinking Flow-Hold was better than Loiter because it was behaving closer to what my objectives are. But, with you clarifying this for me, I will ditch Flow-Hold, retry flow calibration in flight, and stick with Loiter.

As far as arming checks, I have them disabled because for this project I need to have the ability to power up and fly in stabilize mode quickly. I suppose I could set the bitmask for a bare minimum arming check.

I will report back tomorrow.

Set ARMING_CHECK to 1, copter not ready to fly will at best fly poorly.

1 Like

I performed the inflight flow calibration this morning and appears that I got better scalar results.

When flying in Loiter using GPS I do not get a very good hold like I see in Randy’s video. I will create another thread requesting help there.

When flying in Loiter using the MTF-01 it does appear to loiter with no wobble. However, there is some horizontal drift. How do I dial this in so that the copter is actually stationary?

There’s a lot of issue with the GPS. Are you flying inside, or with a poor view of the sky? Turn the IMU back on in the logging in case there’s something more.

The horizontal drift with optical flow could be from a lot of factors. What kind of floor are you over? What is the light level?

FlowCal: Stopped

Maybe try the calibration again, in a site with better GPS signal and see if that helps.

Hi Allister, I was flying outside with clear/sunny skies in the parking lot of a building. I was flying over blacktop and concrete. I generally had 8-12 satellites. I was playing around with different bitmasks for GPS1_GNSS_MODE and landed on 65. There were several flights today with varying parameters and trying inflight flow calibration.

Since I was not having much luck with the inflight flow calibration (and also because it is dark and cold outside now), I am actually trying the log based flow calibration. While I have little to no idea what I am doing, I am plotting the graphs of OF.flowX and OF.bodyX and same for Y axis as described in Optical Flow Sensor Testing and Setup — Copter documentation.

As I work through the log calibration my graphs are starting to look better. My current scalars are 150 and -9, although I am still dialing it in. Basically I started with a scalar value, did the hand-held pitch and roll, logged it and watched the result, then tried a different number and am zig zagging my way to what looks good. Hopefully that’s what I’m supposed to be doing.

RE: GPS… I don’t know if you can see in that flight log, but I have been experiencing a lot of automated EKF switching, source 0 and source 1. Not like switching between GPS and Optical Flow, but between GPS sources. Is it switching between GPS and GLONASS? The drone twitches and then races to what I can only assume it believes is the current position. Quite frustrating. If you cannot see that in the log I already uploaded, I will try to upload a log when I go for the next flight in Loiter/GPS.

The graph from the flight log I looked at never went over 9. If you’ve had better luck later on with 65 (or try 5) then go with it.

You have the IMU data turned off in the LOG_BITMASK. Turn that back on and maybe that might help with what’s going on with the lane switching.

1 Like

Hi Allister,

I have uploaded a flight log from this morning. I experienced a lane switch and I attempted another inflight calibration after doing log calibration last night. I did a Loiter with GPS doing the inflight calibration and a brief Loiter with OpFlow and a very brief flight in Stabilize.

If you wouldn’t mind taking a look and see what you think about the lane switching. I am open to any other feedback you might have.

Thank you