As many here I had severe alt_hold problems. Kept me from further testing loiter, RTL and missions. Today I'm happy to report that I have found the cause of my problems and the solution for it.
As some others here I had very noisy sonar data as you can see in the graph below. This explains why the hexa kept going up with aggressive throttle pulses : it responded to the erroneous low values of the sonar.
So why the noisy sonar data ???
I noticed that sonardata was ok when testing in CLI. Also I noticed that sonardata was fine until I started the motors. Then I got spikes of wrong low values. You can see in the graphs that the first altitude change give fine sonardata. This was when I picked the hexa up manually. When I started flying, bad sonardata.
Green is throttle, red is sonardata.
The sonar was mounted on the forward arm, very close to the esc and the motorwires.
I then tried to move the sonar to my cameramount :
And sonardata cleaned up and now the hexa hangs in the air as hanging by a thread. (see video). It quickly adjusts height when passing over plants. This is how my sonardata looks now:
So I strongly suspect that either the esc's or motorwires cause interference on the sonar sensor. If you experience the same problems, try placing the sonar away from esc's and wires.
Ha, I had Chris dangling his Quad from a broom stick to try and get some good data like this. Looks like your off the hook Chris!
LOL, I should have posted this later... Would have loved to see a video of Chris with his quad on a broomstick in the park. Film some faces and reactions of bystanders and it could make a good 'America's funniest homevideo'
Still, let me know if this also fixes your sonar data Chris ! I sure hope so.
I hope weather is reasonable tomorrow so I can test some missions. End of the week there's a big glider event at our rc-club and I'd love to give a little show in the evening with the hexa.
Plan is to let the hexa fly in the dark with leds on, make it do a short waypoints mission, and between 2 of the waypoints turn off the leds. All flying in auto ofcourse. But the spectators would surely think the hexa is lost when the light goes out, since I cannot see it anymore. Big surprise when it shows up again 20 or 30 meters further :-)
can you share the code which controls your relay with the tx?
Well done guys - amazing before and after result.
Now the quad community are all clammering to do a similar adjustment.
I think we all try to keep components and wiring neat and compact, which I guess lends itself to these kind of problems.
Shame we will miss out on a photo of Chris with ladder, broomand quad though.
More progress - wonderful.
Moved all my wires away from the sonar wire - came through the core of the power distribution and left the sonar on my standoff and alt hold is working for me now. Still a few spikes on my sonar log but it is now the best it has ever looked. I'm going to try Chris' solution getting the sonar away from the core and I'm thinking about trying a shielded signal wire also. Sounds like mounting on an arm is not optimal either.
I've updated the manual with my recommended mounting:
I can't believe I've been struggling with alt_hold for so long for such a dumb reason. Jason and I have been zeroing in on this for a while, but he kept trying to fix it in code. But over the past few days, we started thinking that the noise was too bad to fix with a filter and just as I was going to gather some data to prove it, u4eake beat me to it.
Community development at its best!
Just to confirm - I moved the sonar 3 inches away, added a 2 conductor with shield audio cable for the sonar cable and my flight was as Chris' - rock solid alt hold and loiter (5 meter circle) with no weirdness at all. Flew loiter for quite a while at 6 feet altitude and it was very impressive. Using 2.37 and the MB1200. Moving the ESC cables away from the sonar and data cable was not enough.
Jason - is 2.37 now the best to run or fall back to 2.36? Thanks...
Here is the plot of my flight (red sonar, green baro alt)