There’s been changes like inverted flight added (heli only), the FF was moved to AC_PID, etc…
I pulled upstream for my 3.6-dev branch to get it up-to-date, going to build it and fly it tomorrow to make sure the problem does not happen there again.
I’m a little leery of the inverted flight change. I wanted to remove it anyway, as I have no use for it in a UAV heli, and it doesn’t work properly. So I might remove it, rebuild this branch without it and see if there’s something there that is interacting with something here that is causing issues.
@Leonardthall a couple times you’ve mentioned concerns about navigation performance. What are we looking for related to this concern? What part of the controller, and is there tunable parameters to address the concern? I got pretty promising results from New Loiter after turning the VFF down on my last test flight. Makes a big difference when the heli is stable and not on the edge of oscillation. It responded nicely (in New Loiter) to the cyclic, nice smooth braking, horizontal position accuracy was good. I could see it can be tuned any way you like it. The problems I’ve had with it so far, I’m now 100% convinced is something unrelated. Once I find and fix that I want to tune New Loiter to my liking, then try an auto flight with it.
Simply put, I am not here looking for complements, I am looking for problems and mistake
There is now a formal D term based on the velocity error where before there was a hard coded D term based on the requested velocity.
I want to be sure that we get the right defaults that will give the majority of people a good starting point. So provided there is no issue with the position controller then the next major worry is the default selection of loiter speed, lean angle, and breaking settings.
The first time we released loiter we made the mistake of listening to people that were scared of any auto mode being allowed to move too quickly. As a result loiter did not feel good at all on the defaults and most people never understood that you need to increase the maximum speed considerably to make it feel natural. I want to make sure this Loiter does not suffer the same issues.
Then there is always the chance of a basic mistake some where.
From what I see there is a relationship made between the set loiter lean angle and the speed. Your instructions were to fly the aircraft at the lean angle and enter the speed that it tops out at at that lean angle. This could be done for heli, but it will be a pretty shallow lean angle and quite high speed. Is this still ok with the design of the controller? I think we need a few degrees anyway. 6 or 7 degrees gives me ~23 m/s.
The braking settings, I think, are pretty much self-explanatory. The MINA and MAXA works like Old Loiter. And we have a delay and transition time to set. I was using 0 for the delay and .5 for transition, which seemed to work pretty good at slower speeds. If the heli is cruising at 20 m/s, however, and I let go of the stick it had better not exceed the 6 degrees in nose-up braking or it will pull some serious G’s. If it is allowed to go to the frame angle max setting, that is a problem for heli’s at higher speeds. They will produce G-forces that will rip a camera and gimbal right off the belly of the aircraft.
So those G-forces can be controlled or set with the MINA param. We’ll see how much of a “coasting” we get at reasonable G-forces in braking if the frame angle is not limited by other than the ANGLE_MAX.
I think I can test all this with the VFF turned down, and maybe get some of my response back by turning up the angular accels.
So now, the next question - what happens (as far as the design of the controller) if I set my angle to say 10, but limit the speed to 5 m/s, as was the default with OId Loiter? Does this screw up some calculations for lean angle vs acceleration and velocity? Or should it still work fine?
@ChrisOlson and @Leonardthall let’s not get ahead of ourselves. Something has unintentionally changed stabilize mode. We should not move forward until we figure this out. I will look at this tonight. @Leonardthall my thought would be to run simple step inputs in stabilize mode thru the 3.6-Dev and then your new loiter branch. The outputs to mixer should be identical, right?
@bnsgeyer if you look at the RATE messages when the heli is oscillating in Stabilize we’re getting a huge overshoot of the target rate. Only heli uses velocity feedforward, not used by multi. So I think that’s where to look for the root cause, is in the vff path, as other folks have flown the firmware with multi with no issues. Being that’s unique to helicopter, I think that’s where. Haven’t identified why yet, though.
I would agree but there are no changes that were made in the rate controller where the feedforward feature is contained. So I plan to use the SITL (if I can reproduce this in the SITL) to try to narrow this down to first, that it is specific to Helis and then further narrow it to a specific change that was made.
To get an oscillation with a flybar the autopilot has to be trying to damp the output, and that damping interferes with the flybar because one doesn’t know what the other is doing. Although I have not tested it, I have a hunch this issue will not happen with a FBL head.
I get that. The rate request that goes to the rate controller comes from the attitude controller. Since there haven’t been changes to the rate controller, I can only surmise that the attitude controller is culprit.
BTW Looking thru the code I noted an inconsistency in the input_shaping_rate_predictor method. I added a note in the commit of the PR to bring it to @Leonardthall attention. I don’t think this is contributing to the issue you found.
I tried the code in my 626 heli with FBL head. The issue does not happen with FBL and the rate messages look good without changing anything from the 3.5 tune.
I looked back thru the history of the flybar over the last year flying AC3.3.3 to 3.4.6, to 3.5.3 to now 3.6-dev. I may have been over-tuned a bit on rate all along. I was using .25 pitch/.28 roll for a very long time with AC3.3.3. I notice I changed that to .22 both axes for AC3.4.6. I went back to .25/.28 for AC3.5, and of course, flew 3.6-dev with those settings.
It required dropping the pitch to .18 to get rid of the oscillation in the New Loiter test build (the pitch axis was causing it). Since I do not see any change with a FBL I have a new theory -
there is a lag in response with a flybar because the control system is steering the flybar and the flybar steers the head. I found a natural resonant pitch frequency in this heli that interacts with the control frequency and causes a feedback issue. Natural resonance can happen with any helicopter in other situations like ground resonance. And can happen with a flybar at certain rotational speed (headspeed) and control input frequency, which causes the flybar to oscillate, and of course, shakes the living snot out of the heli.
Before we continue searching for something critically wrong with the attitude controller let me do a test by changing the flybar weights and see if it solves it.
This is true, and there may be some changes in this firmware that caused this resonance issue to appear. That’s why I want to try it with different flybar weights. If it goes away, we are looking at something that created the feedback at the resonant pitch frequency of the frame. Changing the flybar weights will cause the flybar to resonate at a different frequency. Correct?
What I’m saying is we have a coupling of the frame pitch frequency, the flybar frequency, and the control frequency. Since this is a flybar I can easily change one of those frequencies to substantiate or disprove my theory.
yes but it doesn’t change the fact that something changed in the code amplified the attitude feedback enough to have the controller resonate with the flybar. So changing the flybar weights will just change the VFF value required to cause it to resonate. Regardless we need to understand why. On a flybarless head it doesn’t have enough inherent damping to cause this issue. You may find in the case of a FBL head that you can’t put as much P gain or maybe resonance would happen at lower I gain values.
Agreed. I just flew a test flight with 3.6-dev in Stabilize, Loiter, and Pos Hold to get a decent log that’s not 16MB. I tried to excite the heli into an oscillation but was unsuccessful again with 3.6-dev. It straightens out by itself. No changes to the heli, same “tune” as 3.5.
I am at a loss. There is big changes in New Loiter and have to manually make some settings because params got moved. Some of them, like the default velocity gains are doubled from what they are in 3.6-dev. Another one, the ACCEL_Z_P, there is no upgrade path for the change so it defaults back to multi setting of 0.5. It will slam your heli into ground as soon as you switch to New Loiter unless you catch it and fix it. I do not know what else has been tweaked.
Since it didn’t seem to make any difference to my FBL heli I decided to test New Loiter with it today. I found an immediate problem with it as far as a “flying” mode for heli’s. So I set the angle to 10, the speed to 20, MINA at 50, MAXA at 350, Delay at 1, Transition at 1. I was pretty happy with the slow speed handling and precision hovering. Not so happy with the flying qualities. The first thing (and I should’ve realized this) is that when I tried a high-speed coordinated turn it wouldn’t bank past 10 degrees and had to tail-turn it. At 15-20 m/s need 45-50 degrees of bank angle to make a decent turn. So that was bad.
You can turn up the angle to 45 and then you can command WAAAY too much acceleration from a heli for how smooth the braking is if you suddenly let go of the cyclic. Can adjust the delay and transition, then it’s too slow for slow speed. The best combo for smoothness seemed to be 10 degrees and 20 m/s, and might even be better with the speed set to 30 m/s.
I tried some tweaks to Pos Hold as a comparison by setting the braking angle to 8 degrees and braking transition to 4 degrees/sec. Got about the same precision accuracy in slow speed maneuvering and braking. But Pos Hold shines as a “pilot’s mode” for flying. The “feel” is identical to what you tuned for in Stabilize. Can make nice coordinated turns. From a high-speed run can do a normal flare and slow the heli, or let go of the cyclic and the 8 degree braking is perfect to bring it to a nice gentle stop with no recoil.
For me, Pos Hold came out the clear winner for a heli. It feels like YOU have control of the heli instead of making requests for it to do something. And unlike New Loiter it doesn’t try to “out-think” the pilot by having too many artificial adjustments.
That just my very subjective opinion after finally getting to fly it today. This is that log from 3.6-dev
Was this using my changes? That is one of the other questions I have but wanted to get the basics sorted first. Does Pos Hold still work fine?
With Pos hold you are basically flying around in Alt_Hold until you let go of the sticks so you are effectively flying manually a lot of the time. Pos Hold is specifically targeted at old school pilots (who can really fly) that want to be able to stop and let the aircraft hold it in position when they are not flying it. I am not surprised that you like it better than Loiter .
Lets try to keep our eye on the prize here:
Are the changes to the Pos controller working properly. Modes: Auto, Loiter, Pos Hold, RTL ect.
Is the new Loiter controller working well and what should the defaults be. (This is something that people familiar with the performance of the old controller should focus on perhaps)
Why does this firmware excite an oscillation in flybarred heli?
Yessir. Pos Hold works beautiful, and yes, this was with your changes.
I did not try Auto or RTL today. I played with it a good portion of the afternoon to sort out the settings in New Loiter to see what happens with various frame angles, speeds, transition and delay. I found out just about anything works, some are smoother than others. I think I found that the best compromise between slow speed and “flying” speeds for a heli is to use
10-12 degrees and 20 m/s
30-50 for MINA - need to keep this fairly low so at higher speeds it doesn’t try to use too much frame angle to meet the minimum acceleration when slowing down
350 for MAXA - I found this provides pretty decent acceleration, but not too severe. Uses the full allowable angle, and won’t build speed so quickly that if the pilot suddenly releases the stick from full acceleration that it causes a huge upset in braking
1 second for Delay - if you’re using it for flying you don’t want to let up on the stick and have it enter transition to braking right away if you’re not going stop. I tried 2 seconds and that’s not quite fast enough for slow speed where you move the heli and then want it to brake and stop. So 1 second seemed here to be a good compromise. It makes it smoother than Old Loiter by being able to let up on the stick for a split second, then lean back into it.
1 second to transition to braking. This simply makes it smoother. And again, it’s a compromise between what you want for higher speed flight, vs what you want for slower speed. The higher you set this, the smoother it is. Lower it and it gets more like Old Loiter.
I was aiming for smoothness in all situations, but still provide a suitable setting so if you fly it at higher speed it’s not quite as severe as Old Loiter in being “jerky” using the MINA acceleration.
Had no problem at all with position holding and rejection to wind. When the heli comes to a stop it will tend to “hunt around” a bit just like it does with Old Loiter as it “settles in” to it’s hold position. The “hunting” amounts to maybe 6" or so. And if you let it hover normal GPS drift will cause it to move a bit, then move back. I am using the postition controller gains set as follows:
VELXY_D 0.25 (I lowered this one)
I did not try Alt Hold, but flew Pos Hold, which is pretty much the same thing. I really like Pos Hold. It is completely natural for flying (other than collective management sucks). From transition from New Loiter to flying, the heli just leans and goes, levels out and cruises, click in a few notches of elevator trim to hold cruise attitude and go flying It is awesome. No artificial braking, no acceleration limits. Transition from forward flight to braking/hover is smooth with the angle set at 8 and 4 degrees/sec on the angle change when it comes to a stop. Transition back to New Loiter is smooth as silk. Did I say this mode is awesome for an augmented mode? It is. The only thing that could make this mode better is if the collective was returned to normal (like Stabilize) when flying, then return to Alt Hold/Loiter when you stop. That would make it totally awesome.
Side Note: Have not used Pos Hold with a heli much because I crashed a heli with it back in 3.4.2. Took off before the runup timer was complete, switched to Pos Hold, instant crash. Glad I tried it today. I like it.
We do not know that yet. I have a theory as to what is exciting it. I intend to test that theory tomorrow. But the root cause remains a mystery yet. It does not seem to affect the FBL heli in any way whatsoever. I was reluctant to try it with the FBL heli because it’s much more expensive, heavier, much more powerful, much faster machine. But I’m glad I did because I was able to finally test the firmware.
What I learned is that whatever defaults are used for multi’s will work for a heli (I tried a 45 degree angle and 1500 cm/s for the speed). That’s not really smooth because the heli will hit the MAXA right away, then hit the speed limit and has to nose up a bit to arrest the acceleration. But it will not crash a heli. Best is to have the angle shallower and speed faster for the most desirable flying characteristics (at least here). It’s smoother. The only thing for defaults for heli I think is the position controller gains, which may be different from multirotor. I can make a commit to the PR if you want me to, to have the defaults for heli to what I think they should be. Or you can do it, either way.
So my conclusion is that:
New Loiter provides all the same functionality as Old Loiter
It can be set as smooth and calm, or as aggressive as you want it
The adjustable braking makes it smoother for flying around with it.
It is still not the best mode for flying around with with a heli, but it works
I did not see any problem with position accuracy
I will try an auto and RTL tomorrow with it.
We will continue to try to identify the problem with the excitation of a flybar, and the auto flight test will tell me if whatever is causing that has any effect on the tuning of a FBL. It certainly didn’t in manual flight today and I had the heli up to ~60 mph a couple times in Pos Hold. That mode rocks - no speed limit!
So I looked at this in the SITL. Unfortunately I could not show that the output from the rate controller was any different between 3.6-dev and the new loiter firmware. So there is no smoking gun yet. I will think about this and see what Chris comes up with tomorrow. On a side note I have the frequency sweep software compiled and loaded. Hope to get in a few sweeps tomorrow to start characterizing RC heli’s.
@bnsgeyer I figured out the problem with the flybar oscillation. I still do not know why the New Loiter firmware excited it. But the problem was that I had replaced the main rotor blades on the heli from stock Aligns to Rail 696’s. This increased the main rotor diameter to 1550mm, running 400fps blade tip speed. The flybar was too light to have enough authority to steer it. So I made a combination of two changes - increase the torque from 75% to 78% to increase the blade tip speed to 420fps. And put 700 flybar and paddles on it.
Being an avid flybar pilot, this is one of those slap the forehead moments where if you have a problem with a flybar you should ALWAYS look at the mechanical side first. Because a flybar, properly tuned, will handle having a rope tied to one skid and jerk on it with a car and the heli will fight it without breaking a sweat with no computer control involved. You can even do the “stick quiver” and the flybar should fight it and remain stable.
After looking at the log closer, timing of the attitude changes vs RCOUT, it was apparent that the control system was reacting TO it, trying to stabilize it, and not causing it. That made it worse, but was not the root cause.
So have to apologize for raising a false alarm on that one. That was my fault, and just not thinking. After fixing it, I flew the heli with New Loiter with no issues.
I know, and I can’t explain that. What I did notice is that when I tried the 3.6-dev version (not New Loiter) and tried to excite it, the heli would go thru maybe 3-5 cycles in pitch oscillation before it straightened out. With 3.6-dev-NewLoiter it just broke loose and there was no stabilizing it. I don’t think there’s any difference with interaction from changes in the position controller, as I don’t think that’s used in Stabilize flight mode. I’m not real familiar with the position controller so in this morning’s flight test, after I got this fixed, I played with the position controller gains some more to get an idea of how they affect the performance. They are quite “touchy” and I can get anything from the heli hovering, making a 6 foot diameter circle in New Loiter, to holding position pretty well.
It is very hard to compare without being able to switch back and forth. So I got out my Synergy 696 with ArduHeli 3.5.3 in it and flew it to compare. That makes it easier to see what the difference is, and I don’t think I have New Loiter quite as precise as Old Loiter (yet). Haven’t heard any other feedback on how precise New Loiter is in position holding from other testers, so don’t know what I’m shooting for. It looks ok until you side-by-side compare it with Old Loiter where the heli “locks in” like it’s mounted on the end of a pole. So still playing with it.