I went out and try the altitude hold mode with the LV-EZ0 ultrasonic sensor over a grass field. It worked like a dream up to about 3-4 meters, maybe some hiccups here and there, but very smooth overall.
However it happened to me three times that the copter rocketed into the sky, forcing me back into stabilize mode. This seemed to happen at about 4 meters, though don't take the number too strictly.
I think that the barometer might not be reliable, and, as it switches from ultrasonic to barometer, it flies off because its getting the wrong readings. How could I verify that this is indeed the case (and not something else) and how can I fix this?
Edit 1: The barometer is covered in foam.
If I understand the instructions correctly, altitude hold does not actually hold an altitude. I believe it invokes a constant throttle setting instead. So that if the copter is in stable hover, that will be maintained but if it is climbing when altitude hold is turned on, then it will continue to climb.
Maybe someone else can clarify this further.
That might be the case but that is not what is happening. I enable altitude hold mode in at a stable height. When I then increase its height in alt hold, it rockets up into the sky and won't come back unless I switch back to stabilize.
I am currently having the same issue. If you look under advanced parameters, there is a setting for throttle_mid and trim_throttle. You're going to want these to be essentially the same. Your throttle_trim is going to be calculated by the APM when you achieve a steady hover. When you switch to loiter/alt hold, there is a dead band of about 40-60% on the controller, and if your throttle_mid is out of that range, your quad will either shoot up or rapidly fall. Try setting your throttle mid as close as you can to trim_throttle, and that should hopefully help.
also, you could try making a connector like the one shown under "conducted electrical noise" in this link. I did that and it really helped reduce sonar noise.
I am already using the power filter, but the sonar was working fine anyway.
It does not rocket up into the sky when I switch to alt hold. It rockets up when I exceed a certain altitude when already in alt hold, which is about the height that it switches from sonar to barometer.
I had this problem with my APM1 (do not have a LV-EZ0 ultrasonic sensor).
When I tried to put it in alt_hold or loiter it rockeded in to the sky. I tried a lot of things, and the thing that worked was
putting the APM on foam. The rip-away sort you find in cases-stuffing like Pellycases.
I run 2.9.1
It is covered with a piece of foam. The problem lies elsewhere.
Do you have any logs of it doing this?
I used the foam as vibration-isolation. When I got put the APM on top of the foam the Quad stopped rocketing and staid in loither..
This is something I haven't tried yet. I am not able to try it any time soon but I will definitely keep it in mind.
Is it normal to put the APM on foam though?
I don't have logs of the event.
Yeah, it's a good way to reduce vibrations. Attaching it directly to the frame is also pretty good, from what I've read. I have mine sitting on 4 foam ear plugs and zip tied down, and the vibrations are pretty minimal. Other materials like moongel supposedly work well too.
The APM automatically logs all of its flights, so next time just upload the file and that should tell us if it's a barometer issue.