Servers by jDrones

New Loiter Mode - Alpha Testers Wanted


(Leonard Hall) #21


It is WPNAV_ACCEL drop it to 500 or lower. I would not go below 250 generally.

(R Q Robert) #22

I have already set it to 100 but still hard braking is seen .

One thing i notice is when the quad brakes near the Waypoint , it pitches up to 20-30 degrees for braking. And MP says “Reached Waypoint # 1 (etc)” .

(R Q Robert) #23

By the way in RTL mode quad reurns Home with smooth braking .

(Matt) #24

I was only able to get one flight in yesterday. Using a solo with the speed about 1500cms and Max angle 30 degrees. Or really anything in that general vicinity. The copter seems to brake way too hard. It accelerated smoothly to maximum speed. Then I let go of the stick. It brakes pretty hard, making a rather dramatic throttle surge. If the .ax speed is set slower, say 10-15 mph, that doesn’t happen.

(Chris Olson) #25

I noticed this on the first two flights I flew with it, with a heli. But based on Leonard’s recommendation on how to “tune” it I think I have a better understanding of how it works. I think the key is here:

My primary use of Loiter is for stationary hovering work, or limited maneuvering where I want the autopilot to hold the aircraft’s position so I can concentrate on other aspects of the flight such as hooking a tethered load, or running the payload. If I’m going to fly it at any speed I typically switch to Alt Hold or Stabilize. So I have to try this again with different settings taylored to what I use Loiter for.

(Chris Olson) #26

@Leonardthall or @rmackay9 would you be able to give testers a sort of briefing, explaining what these different params do, and how to tune them so we have a better understanding during testing?

Attitude Controller Group - angular velocity pitch/roll/yaw (not part of this testing, but still…):

Position Controller Group - some of these have been moved from other groups in New Loiter:
PSC_ACCELZ_P 0.30 (TradHeli testers be careful with this one - it is 0.5 default!!)

The new Loiter Controller Group params - new ones bold faced:


(Leonard Hall) #27

Hi Robert, just to be clear, you are using Randy’s release here and you don’t have this problem with the old code right?
Could you please provide a log for me to look at?

(Leonard Hall) #28

Hi all, thank you for your help and patience!!

We are seeing feedback that the breaking is too high. There are two things that cause this but I will leave explanations at the end and start with the rules of thumb. (I will discuss Heli stuff with you separately so just use this for understanding @ChrisOlson)

Speed and angle settings (Heli should start much more conservatively)

WPNAV_LOIT_SPEED should be set at what you consider your maximum comfortable speed in Alt Hold.
WPNAV_LOIT_ANGM should be the angle you need to hold to maintain that speed.

Initially turn all breaking off (Heli should do this to start with @ChrisOlson ).
WPNAV_LOIT_DELA = 2; (starts breaking after 2 seconds to make it obvious what is breaking when it is on)
WPNAV_LOIT_TRAN = 1 (the time it takes to add the breaking)
WPNAV_LOIT_MINA = 25 (the amount of breaking in cm/ss that is added, small to focus on the active loiter performance. We will tune this after)

Ok, so now the additional braking has been removed so any breaking you see is caused by the lean angle being too high for the maximum speed. So if the copter breaks sharply after letting go of the sticks you need to decrease your WPNAV_LOIT_ANGM or increase your WPNAV_LOIT_SPEED. Start by reducing the angle until you don’t get breaking then have a play with increasing both again if you want it more aggressive.

I hope we can find a nice set of defaults that mean most users don’t have these issues.

The other thing to keep in mind is we have made some changes to the way the Position controller works. The default settings should result in very similar performance to what we had before with the main difference being that the Vel D term can now be set and works on both the velocity error not just the request. I don’t think we should have to play with this at this stage… I hope.

Ok, so the explanation of the lean angle, velocity combination causing breaking.

So what happens is you have a maximum lean angle that you can request. Then added to this is the loiter controller output based on your position and velocity error and I term build up.

So when stationary the position controller is just doing work to fight the wind then you add lean angles onto it to do slow position corrections. So you get a direct, low delay link to the aircraft like in Alt_Hold and automatic fighting of the wind.

When you push the sticks over hard and start to build speed the loiter controller starts to add this fake drag that mimics what is happening in reality. The result is that when you reach the maximum speed the fake drag prevents any further build up in the desired velocity in the position controller.

In layman’s terms at full pitch forward the position controller will make sure you are doing exactly WPNAV_LOIT_SPEED. To do this it may have to remove some pitch if the speed is set too low or increase some pitch if the speed is set too high.

At this point your stick input still maps directly to the attitude plus the added angles from the pos controller. So if you let go of the stick the aircraft will pitch back by WPNAV_LOIT_ANGM. If the pos controller needed to reduce the pitch angle to achieve WPNAV_LOIT_SPEED then you get some immediate breaking. If it had to increase the pitch angle then you will find it does not pitch back to full level then settles slowly to level as the pos controller I term unwinds. I find the best feeling for the pilot is found in the second case.

I hope this makes sense!

Thanks again for all your help!!

(Chris Olson) #29

This was kind of the challenge on today’s test flight, in attempt to get this right. I really need ~10 degrees allowable for fighting wind, etc. in hover. If the wind is from the starboard, for instance, I am holding 3.5 degrees of roll (hover roll trim) to counter tail thrust. Plus maybe another 3 degrees to fight the effect of the wind. That only leaves 3.5 degrees to put in additional roll to move the heli to the right.

It is opposite with wind from port side. Now the wind is countering tail thrust so the 3.5 degrees (give or take) is not needed for hover roll trim, the heli isn’t hovering right skid low (all heli’s do this, depending on main rotor rotation direction), so things respond more evenly.

If I put the heli into a 10 degree nose down pitch attitude in no-wind conditions it sucks gas and hauls … well, you get the idea. That is a LOT for a helicopter. I actually measured it today to see where we’re at. At 15 m/s target speed it accelerates pretty hard at 10 degrees to reach that speed, and cruises almost nose on the horizon - maybe 2-3 degrees of nose-down pitch. 10 degrees of nose-down in constant acceleration on a straight run it hits 23m/s in 12 seconds and is still accelerating. In order to see what the cruise speed is at 10 degrees nose-down I went back to some of my logs where I’ve flown high-speed surveys at 27 m/s and it varies from 7-10 degrees of nose down pitch, depending on wind. At that speed a pullup of 5 degrees nose up is SEVERE hard deceleration. At 5 m/s 5 degrees of nose-up is about right. As it leaves translational lift in deceleration and transition to hover, the nose-up can be increased gradually in a “flare” to where it may be increased to 10 degrees as it comes to a stop, and then goes to hover attitude.

With a heli this has to be done gently and smooth or it recoils quite badly. If you throw in 10 degrees of nose-up @ 15m/s you just changed the AoA of the wing and it wants to climb and start a loop. To maintain constant altitude in a 10 degree nose-up stop it has to momentarily dump collective to arrest the climb, then feed the collective back in to hold altitude as it settles to hover attitude. That, along with leaving translational lift state suddenly (like stalling the wing on an airplane), is what causes the bad recoil.

So that’s why I asked about the params, and was wondering what the relationship is between WPNAV_LOIT_ANGM and WPNAV_LOIT_SPEED. Now I understand it better from your description, so can do more experimenting :sunglasses:

(Leonard Hall) #30

Hi Chris,

WPNAV_LOIT_ANGM is the maximum lean angle that the pilot inputs. The position controller can increase it up to ANGLE_MAX depending on your other limits.

So in short: WPNAV_LOIT_ANGM only affects the pilot input and is completly separate from the angle needed to fight wind or hover roll trim.

Based on what you are saying, maybe you need to set

I really need to get a heli so I can see this for myself!! They must be very slippery in forward flight!!

(Chris Olson) #31

You mean you’d join our ragged troop of heli enthusiasts? :grinning:

Yes, heli’s are pretty darned efficient in forward flight. Just to illustrate how subtle the controls are with a heli, here’s a graph of a slower speed auto flight on a figure 8 test course with target speed at 10m/s, showing speed vs pitch. I’m looking at these because these are the more typical speeds for Loiter. Here we see the heli is accelerating from ~8m/s to ~10m/s from waypoint 3 to 4 and the nose down pitch attitude averages 2 to 3 degrees in gentle acceleration. It goes to about 5 degrees nose down to make the turn (was trying to tune “ag turns”), and then about nose on the horizon to slow the heli for the next waypoint (next frame)

Then we go from waypoint 4 to 5 where it slows a bit to make a turn and the deceleration attitude is approximately nose on the horizon (noted above). Then it starts accelerating again and momentarily goes to -5, and while I didn’t include the next frame, this is the longest part of the test course when it gets back to 10m/s its pitch attitude is back to 2-3 deg nose down.

Very, very subtle changes in pitch attitude that you can barely see with a solid-mounted camera on the heli shooting video. I chose this one to illustrate because I happen to have video from that very flight. I was changing WPNAV_SPEED on-the-fly, winds aloft about 20 km/h and if you notice the top of the video in comparison with the horizon you can see how little it changes. You’ll see one point where I turned the WPNAV_ACCEL down and the heli flares momentarily to slow down, and that is the biggest pitch change of the whole flight at about 7 degrees (3 degrees nose down to 4 degrees nose up).

Another thing to watch in this vid is at the end when I bring it to stop in hover. I switched out of Auto to Acro in the turn when I peeled off the test course and you can sort of see the momentary “glitch” when I did that. But notice the approach speed and then how much I have to flare it to come to a stop. You can barely see the pitch change.

I think this is what will make heli’s a real challenge, and quite interesting, to try to tune a lean-angle based controller. I think New Loiter will work with a heli - we just need to keep the speed down to maybe 5m/s in Loiter, 10 max. Set the WPNAV_LOIT_ANGM to maybe 10 or 12 so the pilot has desired response. And let the controller limit the pitch to fit WPNAV_LOIT_SPEED. That will be my next test. :grinning:

(Jagger) #32

@ChrisOlson, @Leonardthall.

Can we just wire you guy’s brains diretly to the internet to save you having to waste time writing this all down?

I’m learning loads in this thread.Thanks you.

(Chris Olson) #33

Well, this morning’s test flight with a heli was still not successful. I tried it with the braking turned on and off but got the same result - as soon as I engage Loiter the heli starts a wild rocking and rolling. And the actual vs desired pitch and roll track pretty well during the New Loiter Hula Dance. I thought this was due to the braking before, but using @Leonardthall settings to turn it off still didn’t make a difference.

On one attempt I tried to stabilize it manually, but that’s a no-go - it’s uncontrollable in Loiter yet. I’m able to produce logs this time - got that working now

For this test I set the angle to 10 and the speed to 300. I studied the log to try to figure out why it won’t hold position, and I don’t have a good enough understanding of how it works yet.

Without an autopilot on the heli, the way it’s acting is just like a novice pilot doing what we call “chasing it”. Most multirotor pilots will wad up a straight flybar within 10-15 seconds of takeoff, if they don’t get flight instruction from a pro training with slaved instructor/student radios. It responds way faster than what they’re used to, so they’re always “chasing it” and their control inputs are too far behind what the heli is doing. So they over-correct and get it going in wild gyrations until the instructor takes over and says, “watch how I do this”.

The heli I am testing with now is a flybar so it is a very gentle, graceful, docile, stable machine (relatively speaking in the world of heli’s). But I’m going to try some mods to the bellcranks and swash linkages to get it to respond more like a multi to see if that makes a difference in at least getting it to hover stable with New Loiter. We still can’t use much frame angles (as I hopefully demonstrated in my post showing how little frame angle on a heli changes in normal flight). But I can slow down the control response.

(Rob_Lefebvre) #34

Now you know why I like them.

Uses the same power to fly at 20 m/s as it does in a hover. And that with a very aerodynamically dirty fuselage.

(Dave) #35

I gave this a try on my PixRacer mini quad (210) and it performed very well. It was too windy to really tune it but with the following parameters I liked how it flew.

Looks like a winner to me, I’m looking forward to some more tweaking.

(Leonard Hall) #36

Hi @ChrisOlson,

There has been a change in the pos hold controller that mean your position controller is unstable now with the default settings. Did you have the aircraft doing missions before?

Looking at your log it is clearly oscillation of your position controller. Drop all these values by 50% until the wobble goes away.

I suspect those values will work but if they don’t keep dropping them until it does not wobble in Loiter.

Chat soon…

(Chris Olson) #37

Yes. It flew high-speed missions fabulously stable.

OK cool. I tried an experiment that sort of backs this up. I reduced the mechanical rate on the heli so it’s more like a multi in handling. It now flies like a drunk pig. BUT - I got it to hold a (sort of) hover with New Loiter by doing that. It still does the New Loiter Hula Dance, but not as radical as it did before. I found I can excite it up to 12-13 degrees of roll with the sticks and then the autopilot really starts over-correcting. I engaged Auto Land in that state to see what it would do. It was almost comical watching it land doing the New Loiter Hula :grinning:

I’ll set the mechanical rates back so it flies like a heli again, and start playing with the position controller gains…

(Chris Olson) #38

@Leonardthall got promising results on my next test flight by reducing the position controller gains. Finally can provide a video of a heli hovering with New Loiter. The heli holds position fairly well. The reason it was moving around is because I was moving it with the cyclic. Again, with a heli it only takes 1-2 degree of attitude change for it to go.

For other heli testers the starting settings to get it to fly for further tuning is:


Notes on these starting settings for heli:

  • the braking delay and transition seems to be fine here left at defaults
  • if you want more braking turn up the MINA value
  • if you want faster stick response turn up the MAXA value
  • 10 degrees for WPNAV_LOIT_ANGM should be plenty to start with. Most heli’s are going to hit 100+km/h at that frame angle
  • if you want to fly faster than 10m/s with a heli I would not use this mode. Helicopter pilots normally do not need (or even like) GPS positioning for manually flying a heli. So switch to Stabilize or Acro if you want to crank it up.

Hope this helps the heli testers to have a safe starting point.

(Chris Olson) #39

@Leonardthall how does the changes in the Loiter and Position controllers in this test code affect Position Hold?

(Leonard Hall) #40

Hi Chris,

Position hold basicly switches to loiter whenever you centre the sticks with a similar braking maneuver as Loiter. I actually took the Pos Hold breaking settings as the initial defaults for the new breaking settings in Loiter.

So if Loiter works well then Pos Hold will work well.

I would be more concerned about the navigation performance as that too is based on the same changes to the position controller. The only real difference I think is the D term is now applied to the velocity error instead of just the velocity request.