New Loiter Mode - Alpha Testers Wanted

Thanks Chris, that’s great feedback.
Could you put the logs up?

No logs yet. They are b()rked. Merging my dev branch, and Randy’s branch, resulted in merge conflicts that I thought I fixed, but effectively broke the logging. We have not moved our helicopter development code to 3.6-dev yet (until this attempt). And I found some things in 3.6-dev that need to fixed (or locked out) first for TradHeli.

I have to discuss this with the other guys and figure out what direction we’re going to take. If this change to Loiter affects Auto too, then we have a problem.

The builds I posted will fly your helicopter, and allow you to try new loiter. But it is by no means anything but experimental firmware.

Edit:
I found two issues not related to New Loiter in those helicopter builds, one of which will cause a crash. I pulled them. If anybody downloaded them to try it, don’t fly it. We have some work to do on 3.6-dev before we get excited about experimenting with New Loiter with helicopters.

thanks Chris. Helicopters are hard!

They’re not hard at all if you look at them from an airplane standpoint. In hover they sort of share some characteristics with multi’s (very loosely). But that’s where the similarities end. In flight they fly like an airplane - the control inputs, short of collective management, are even like an airplane. They pitch up and down, roll, climb, dive and create lift in forward flight - just like an airplane. The only real difference is that the wing on a heli is rotary and used for propulsion thru cyclic pitch, on an airplane it’s fixed.

Let’s face it - current Loiter controller (and Nav controller) in Copter is far from ideal for heli’s. We really need the L1 Nav controller from Plane. And this New Loiter will be fun to test to see if I can arrive at a combination of settings for it that is suitable for helicopters and maybe get better performance on Auto flights.

I didn’t get a chance to play with settings in my first two flights. But the defaults were not ideal. How do you turn off that “braking” feature? Or least limit it to say 0.1G or something so you can get a smooth stop with a heli vs it acting like somebody just whacked it with a baseball bat? Maybe that can be tuned with the lean angle? As long as it doesn’t limit my acceleration coming off turns in Auto. I run 590-650 for WPNAV_ACCEL to keep the “leash” short and kind of, sort of, roughly get the heli to hit the waypoints @ 30m/s. But the current implementation still pretty much sucks for heli’s. It took me a long time to arrive at a setup that (kind of) works with the current controller. There’s a lot of stuff to test here. :grinning:

1 Like

@ChrisOlson,
In case it matters, I’ve just re-based the lthall-new-loiter5 branch on master including resolving the logging conflict.

Hi @ChrisOlson,

This should work fine with Heli with appropriate parameters. The trick is to not put it into a situation where it is climbs dramatically when you pull back in Alt Hold. While Heli’s behave like a plane at high speed they are the same as a multi at low speed. If you set Loiter up with that in mind I think you will get good results. In any case, if you were able to get Loiter working before then this Loiter will also work but with a more direct feeling on the sticks.

For Heli I would suggest keeping the maximum Loiter speed to about 15m’s
WPNAV_LOIT_SPEED 1500

Then set the maximum lean angle to be whatever you need to achieve 15m/s.
WPNAV_LOIT_ANGM 20 (It is in degrees at the moment)

Drop the deceleration down so you get a more gentle braking and slow the transition time.
WPNAV_LOIT_MINA = 50;
WPNAV_LOIT_TRAN = 1.0

You may also like to reduce the aggressiveness with which it corrects for position errors by dropping:
WPNAV_LOIT_MAXA to 250.

The issues you highlight with heli are all around the fact that heli transitions from a mode where the altitude is controlled primarily by the thrust with only a small coupling to pitch (or angle of attack), to a mode where it is primarily controlled by angle of attack and the thrust has little to do with it. We see this issue with a number of aircraft types including multi rotor aircraft with lifting surfaces. I have not formulated an acceptable solution but I am working on it.

Thanks for testing Chris I really appreciate it!

This is the param I was wondering about. Roughly 7 degrees of nose-down pitch is what’s required with my 600 test heli to cruise at 15m/s in no-wind conditions. But I can pull 20 degrees or more in hard acceleration. So if I set that to 7 how does it affect the heli’s lateral accel capabilities? And what effect does it have in Auto flight?

These are questions based on the fact that I haven’t tested it enough yet. But just curious up-front as to what to look for.

It does matter, and thanks! That was one of the things I had to fix and I br()ke it as I did it quickly and didn’t review your changes close enough to merge with Peter’s changes adding units. The other issue is that my test heli has a DDVP drive on the tail and that’s still broken in master. I fixed that in my test code and as soon as I have a working implementation of New Loiter for heli’s with everything working I’ll re-post the binaries so other interested folks can test it too.

I now have functioning helicopter builds for TradHeli New Loiter testers.

The logging works so you can report issues and provide logs. DDVP drives now work properly. I was going to remove InvertedFlight (CHx_OPT = 43) from this build because I found a problem with it. Some TradHeli users might not be aware that you can engage inverted flight in Loiter with helicopters in 3.6-dev. I decided to leave it in for now, but just don’t use it in testing New Loiter until we get a chance to look at the issues with it.

The primary function of loiter isn’t to thrash around and perform hard accelerations. Lets start by getting it working for precise placement of the aircraft during a landing or aerial filming situation. So start with a lean angle that is representative of what you would do if you were trying to fly around smoothly below 15m/s.

It does not affect auto flight. It does limit your acceleration to what you would get with a maximum lean angle of 7 degrees. I would suggest starting with 10 to 15 degrees based on what you have said. This will not restrict the aircraft’s ability to fight the wind.

I would suggest that you start with a maximum lean angle of 10 degrees and maximum speed of 15m/s. Then look at increasing up to something like 20 degrees and 30m/s (or whatever your top speed is at 20 degrees). In any case start slow and think of this as tuning the repositioning during landing in an RTL. Then you can push it.

Hi @Leonardthall

WPNAV_LOIT_MINA : This is the deccelration parameter for LOITER.

I am facing hard braking during auto missons.
Pixhawk 2.1
AC3.5.3
Quadcopter

What is decceeleration parameter for AUTO Mode . ?

@R_Q_Robert

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

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)” .

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

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.

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.

@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…):
ATC_ANG_V_P_MAX 0.0
ATC_ANG_V_R_MAX 0.0
ATC_ANG_V_Y_MAX 0.0

Position Controller Group - some of these have been moved from other groups in New Loiter:
PSC_ACCELZ_D 0.0
PSC_ACCELZ_FF 0.0
PSC_ACCELZ_FILT 20
PSC_ACCELZ_I 1.0
PSC_ACCELZ_IMAX 800
PSC_ACCELZ_P 0.30 (TradHeli testers be careful with this one - it is 0.5 default!!)
PSC_ACC_XY_FILT 2.0
PSC_POSXY_P 1.0
PSC_POSZ_P 1.0
PSC_VELXY_D 1.0
PSC_VELXY_D_FILT 10
PSC_VELXY_FILT 5
PSC_VELXY_I 1.0
PSC_VELXY_IMAX 1000
PSC_VELXY_P 2…0
PSC_VELZ_P 5.0

The new Loiter Controller Group params - new ones bold faced:
WPNAV_LOIT_ANGM 10
WPNAV_LOIT_DELA 0.0
WPNAV_LOIT_MAXA 637
WPNAV_LOIT_MINA 250
WPNAV_LOIT_SPEED 1500.0
WPNAV_LOIT_TRAN 0.5

Thanks!

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?

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!!

1 Like

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:

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
WPNAV_LOIT_ANGM = 5
WPNAV_LOIT_SPEED = 2000

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