Just wanted to get a new email thread started to talk about the porpoising problem at high speeds with the new Alt_Hold controller.The inertial Alt_Hold is much better than it was before, but this problem is new. I had made attempts in the past to fly and high speeds in Alt_Hold which generally were unsuccessful, but I don't think it was prone to this porpoising problem.I think partially what is happening is that the Alt_Hold controller now is pushing the aircraft to higher speeds than ever before. I couldn't believe when I saw 100 km/h in a straight line on my little 450 heli. When you pitch it forward, the AH controller automatically dumps in tons of throttle, and this makes it accelerate to a very high speed.Typically when flying like this in Stab, I have difficulty doing the same thing, as my collective control isn't good enough and I either end up rising or falling, and have to abort the run. Now in AH, I can hold 45° forward pitch for long periods of time.However, I have had instances where I did get it up to a high speed in Stab, and I didn't see this effect, at all.I think what is happening is simply aerodynamics and controls theory.At high speed, the pitch response of the copter is very sensitive. Just the slightest thing threatens to pitch it back. I think this is made worse with the AH throttle controller, possibly giving little bursts of higher throttle. It tips the disk up just enough, and then the oncoming "wind" catches it and tips it back, which is a highly divergent control problem. Once it starts tipping, it's hard to catch.At the same time, when it pitches back, the lift is greatly increased, and the copter shoots up. The AH controller sees this lift, and dumps collective, at the same time as the pitch controller tries to push the nose back down. The pitch controller is aided because the collective just got dumped, so it over-responds. Likewise, the noise pitching down helps the AH controller to reduce lift, and it over-responds. So then we set up this generally diverging pitch/altitude oscillation.So what do we do?One idea I've had is to automatically reduce the gain on the Z-axis controller at higher speeds. Likewise, reduce the gain on the Stab_Pitch_P term. Notice, I suggest Stab_Pitch_P, not Rate_Pitch_P. I think maybe that controller should still be highly gained to try and prevent the rate error which leads to a pitch back. But once the pitch back has occured, I don't think the Stab controller should try to push it back so fast.Likewise, I think the Thr_Accel_P and I should be de-gained. I don't want them responding to the change in lift as much, instead, we should respond to actual altitude errors more. Presumably people won't be flying at 100 km/h, 2 m above the ground?Anybody else have ideas?Rob
--
Perfect mate!
INAV, RAW, and Pitch PID.
From: Robert Lefebvre [mailto:robert....@gmail.com]
Sent: Tuesday, 8 January 2013 8:53 AM
To: Leonard Hall
Subject: Re: [drones-discuss] Re: How to fix porpoising
Oh, INAV logging? I wasn't even aware of that one.
So how about INAV and Pitch PID logging? And Raw. Best case?
On 7 January 2013 17:20, Leonard Hall <leonar...@gmail.com> wrote:
Hi Robert,
What I do in these situations is I go into the code and I manually set PID loop on.
But even if you don't have any PID loops being monitored and just make sure the INAV message is on it would be great!
Thanks again,
Leonard
That would be great Robert,
Maybe you should wait for some better weather and do pass that you don't find too risky but still shows it. If that is possible at all.
In any case a calm day will make everything that much easier to diagnose.
There is no rush on this (from my end anyway) as I can't see this getting into 2.9. And I suspect that it won't be an easily solved problem.
Chat soon and thanks for your time and patience with this one!
Leonard
From: Robert Lefebvre [mailto:robert....@gmail.com]
Sent: Tuesday, 8 January 2013 11:21 PM
To: Leonard Hall
Subject: Re: [drones-discuss] Re: How to fix porpoising
Well, the error probably is less than 1m. 20 cm probably is what we are dealing with. The thing is, with the speed, and the frequency of it, it is actually quite bad. We might be talking +/-20cm at 2-3Hz at 50-100 km/h. I would not be surprised if it does not show up in the baro data. But what about inertial altitude estimation?
Unfortunately there was only so much I could do. It was dark and windy, and the effect can get very bad very quickly. I actually had to modulate the pitch to avoid it getting too bad because it can become so violent it could break up the heli. Also, I can only see the lights. So it was harder to judge how bad it was.
I'll look at the data more thoroughly today. Maybe I'll have to shoot video on the weekend. It's real, and it's bad, but maybe not what you were expecting to see. We won't be able to fly high speeds like this.
On 7 January 2013 23:58, Leonard Hall <leonar...@gmail.com> wrote:
How much variation are you seeing?
Your logs say that during the first two runs in Alt_Hold you only got more than 1m from your altitude set point once, and that was during a fast decent. I am talking about the calculated inertial altitude that is being used to control the height. In fact, during any single fast run where I can see you with full Pitch input, it only varies by about 20cm. (I only looked at the ones that lasted more than about 3 seconds
It is a little hard to tell exactly what is happening because the runs seem quiet short and there doesn't seem to be any obvious proposing that I can separate from your control input.
I am wondering if this is an aerodynamic effect that is pushing the Baro around. If this was the case, no amount of tuning would help, you would need to do something physical to change the way the air pressure is behaving around the APM.
Chat soon,
Hi Robert,
It looks like you understand things correctly. And yes it does look like you have angle boost. It might be worth trying without it and see if the oscillations are still bad. It is possible that this is a feedback between the angle boost and the pitch.
The Alt Hold can quiet happily work without the boost throttle and I couldn't tell the difference.
Thanks for explaining those logs and what you are seeing. I am looking over them again based on what you have said.
Chat soon,
Leonard
Ps. I just realised I was having the same problem with my replies.
--
Ok, I can see this now! And it is interesting.
Ok, here are some plots of the incident that Robert points out.
Quick summary of what the data shows:
· Small Pitch oscillations start at 128 seconds
· Tune results in 10 to 15 degree error between requested Pitch and Measured Pitch
· Oscillations increase to +- 10 degrees in both roll and pitch at 133 seconds
· Robert selfishly backs off the pitch to save his copter rather than see how bad this can get at 132.5 seconds :)
· Throttle bumps are seen at 128 seconds maxing out at 133 with peek to peek (pp) of 405
· Throttle boost is there but small
· Climb rate oscillations max out at 1.5 m/s pp
· Climb rate dt reaches 5.85 m/s/s (but gets to 15 m/s/s probably)
· Acceleration oscillation of 30m/s/s pp is seen
· Acceleration delta t reaches 130m/s/s/s
· INS Z_EF Corrections show oscillations due to large X, Y, Z correction factors. 8m/s/s pp
Alt_Hold Pid settings
THR_RATE_P: 6.000000
THR_RATE_I: 0.000000
THR_RATE_D: 0.200000
THR_RATE_IMAX: 300
THR_ACCEL_P: 0.250000
THR_ACCEL_I: 2.500000
THR_ACCEL_D: 0.004000
THR_ACCEL_IMAX: 500
Approximate throttle outputs based on observed inputs:
Rate_P: 112
Rate_D: 30 to 75
Accel_P: 375
Accel_D: 52
Accel_I: 4.12
So as Robert says, the velocity and Rate controllers look like the major contributors to the throttle jumps.
Ok, There may be a number of problems here. In no particular order:
· Pitch loop may not be stable enough at these speeds requiring only small kick to set it off. We can test this by doing the same thing with manual throttle and seeing if we can reproduce the problem (I suspect not).
· Alt Hold isn't stable enough, probably the accel loop, an maybe the velocity loop. Testing with Rate D set to zero Dropping the accel P and I terms then the Rate P and D terms may stop this from happening.
· Inertial navigation may be causing problems due to corrections being transformed from the body frame to the earth frame.
Solutions:
Well, the only thing I have been thinking about is a speed based filter on the acceleration error. So basically the corner frequency will be scaled by the velocity. At 10m/s it becomes 0.2 Hz filter. The problem with this is it needs to be the air speed, not the ground speed. This is also the problem with any control change that relies on a velocity measurement. We could also relate this to the airframe angle with a slow response. So we assume that at an angle of 30 degrees we will be doing 20m/s and get there in 6 seconds. We then use that relationship to define a speed guestimate. That speed could then be used to smoothly change the controller in some way.
Ok, food for thought.
Leonard
--
https://github.com/R-Lefebvre/ardupilot/commit/efcc6a7fdb1664f42413...
Basically what I've done is re-jig the AltHold controller for TradHeli. What I've done is this:
- Moved my Thr_Accel_FF to a Thr_Rate_FF instead. It is now acting off the desired climb rate rather than desired acceleration. This makes more sense to me. We know that if we are in manual collective, and we push full collective up, we get a fixed, finite, relatively stable climb-rate. There's a solid and linear connection between collective position, and climb-rate. An FF makes sense here.
- I turned off angle boost. This was a thing where, if you lean it over 45°, it automatically boosts the collective by 70% I think? 40%? Whatever the trig works out to. This is great if you were hovering, and then pitch it forward suddenly. But it's the wrong thing to do to hold altitude in a heli almost any other time. Flying fast forward, and slam it back to stop? You don't want angle boost or it will make it rise.
- If you have Throttle_Accel turned off, now you have the simple Thr_Rate_PID plus FF. So that part is easy. The FF give you a steady-state rate control. I will ramp up to accommodate the headspeed as it falls. P and D manage the error and acceleration. This is pretty simple to understand.
- Here's the tricky part: If you have Throttle_Accel turned on, the Thr_Rate controller calculates the P, I, D and FF terms, It sums the I and FF terms, and reserves those (this is "throttle_rate_soft_output"). It sums the P and D terms (and calls them "throttle_rate_pd_output"), and sends that to the Throttle_Accel PID. That PID uses the desired accel input, and does it's thing. It determines what to output for the accel. However, the total collective output is the sum of the accel_PID controller, and the throttle_rate_soft_output. I plan to leave the Accel_I at zero, and maybe the D was well.
So, it's slightly complicated and weird, but makes sense in my head. I have yet to test fly it.
Hi mate,
If the Accel loop isn't helping the heli, you could turn it off permanently!
The good landings are caused by the part of the control loop, the set point, and the integration term on the last part of the control loop. This could be done with the P->PID controller too.
Good work Robert!
--
--
Hi Robert,
Sorry I have been distracted with work at the lately. And I just got back from moving 9000 kg of wet concrete, with a wheel barrow, for a mate (that was my half, there was 18000 kg total). So I am a little pickled at the moment.
Maybe we can have a chat on Skype some time and discuss some of the possibilities with the variable frequency filter.
Chat soon,
Leonard
--
--
Hi Robert,
This is very close to what I was suggesting!
Do you want to chat via Skype?
To answer your question, the reason I did it this way is because I was more confident to do it this way than use the filter that Randy and I put together. Changing it over is on my list of things to do.
1) We filter the throttle output. OR scale the throttle Accel Gain (or both). The reason I say this is that the filtering may cause too much of a delay and cause oscillations. But we will have to try it and see.
2) Agree, a filter with a time constant of 5 seconds in your case (and I think that is probably reasonable generally).
3) Just change the filter on the Accel Error to be variable by dividing the output of the above filter in such a way you get the desired lower frequency cut off when at maximum. This isn't critical as this is all soooo non-linear anyway. I would suggest leaving the upper end 2 Hz and just choosing a lower end that stops the porpoising, maybe .1 Hz or .5 Hz.
--
Hi all,
I have put together a concept video of the loiter that Randy, Jonathan and I have been working on.
http://www.youtube.com/watch?v=nYMcT9wZgtU
Let me know what you think.
Leonard
--
Yeh, it is public.
From: drones-...@googlegroups.com [mailto:drones-...@googlegroups.com] On Behalf Of Robert Lefebvre
Sent: Tuesday, 15 January 2013 2:58 PM
To: drones-discuss
--
--
Hi Emile,
Yes, I think this is a compass offset problem. We think that the current flowing to the ESC's is causing the fields to be distorted and this is causing an error in the heading. This then means that the intertial navigation thinks we are moving in a different direction to what we are.
There are a number of things we can do to fix this problem that we are looking into.
Thanks for the feedback,
Leonard
--
--
--
--
--
My GPS gain is set to 1. Unfortunately I don't understand how the various DCM features work.
Thanks for the feedback!!!
--
Actually it should be able to tell the difference because if the wind is pushing it the inertial navigation will follow that and it won't cause an error between the intertal and the GPS. The error we are seeing is an error between the inertial navigation and the GPS caused by fast flight. We should see the same thing if the wind pushes us away at 10m/s as we see when we fly away at 10m/s.
So Robert, I think you are right. We should be able to use this to correct the compass.
--
--
--
--
--
Yes sorry, is suppose I missed the most important bit, even my lowly Naza will fly in IOC modes, (simple and supersimple equivalents) in 30 mph on a beach, straight lines whilst yawing heavily. So yeah they definitely fly the compass.
I have sniggered to myself about the ‘GPS cruise mode’ too, i bet its better, but not by much.
--
Yes sorry, is suppose I missed the most important bit, even my lowly Naza will fly in IOC modes, (simple and supersimple equivalents) in 30 mph on a beach, straight lines whilst yawing heavily. So yeah they definitely fly the compass.
I have sniggered to myself about the ‘GPS cruise mode’ too, i bet its better, but not by much.
From: drones-discuss@googlegroups.com [mailto:drones-discuss@googlegroups.com] On Behalf Of Robert Lefebvre
Sent: 15 January 2013 22:12
To: drones-discuss
Subject: Re: [drones-discuss] Loiter Concept
Ok, well that's good info Dave. I looked and looked for any examples of DJI products doing anything fast like what Leonard was demonstrating, and couldn't find it. And then I based what I said on their somewhat unclear marketing materials. They made a seemingly deliberate point of stating that the Ace One has this GPS Cruise mode. Possibly just trying to justify the $11,000 price. They describe GPS Atti as being different. They say that it holds position at center stick, but once you move the stick, it's basically just in stabilize mode.
If you say it can hold a line against a cross-wind, then that's interesting.
Maybe what's going on is more of the same. All of the Helicopter products are dumbed down compared to their multi-rotor equivalent. Neither the Naza-H or WK-H will RTL. Only the Ace One. But then the Naza-M will (IIRC) so figure that one out. Maybe the "GPS Cruise" is unique on the heli side, but they recreated it on the multi-rotor products? But just call it GPS Atti?
Robert, it's unusual I disagree, but DJI are possibly better than you think. I agree that their ' twist your compass till your quad doesn't toilet bowl' advice is crude, but it works. Loads of people have probs, friends of mine included, but with my friends, once I've verified the 'distance from Cog measurements' of the IMU and GPS/MAG in the software and got the unit straight, then it works a treat.
--
I completely agree.
--
--
Yes and no,
The distance error is:
DistanceError = ( 0.5*Accel*Time^2 ) * 2 * sin(Yaw_Error/2);
for constant acceleration, note that if the time is small the DistanceError will be smaller than the stationary GPS error.
And after a short acceleration reaching a velocity of V:
DistanceError = ( V*Time ) * 2 * sin(Yaw_Error/2);
All together:
DistanceError = ( V*Time + 0.5*Accel*Time^2) * 2 * sin(Yaw_Error/2);
So you are correct that the error is caused by an acceleration in the wrong direction. The actual distance error that we measure increases linearly with velocity.
So we could use the last equation to calculate the Yaw angle error. And it doesn't really matter if we are only doing the correction over a particular velocity because we don't care if we are stationary (as long as we are close).
--
--
You could run the servo outputs at 100 Hz but just set their position at 50 Hz or less. That might be simpler to implment.
Leonard
You could run the servo outputs at 100 Hz but just set their position at 50 Hz or less. That might be simpler to implment.
Leonard
--
You received this message because you are subscribed to the Google Groups "drones-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drones-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.