LOIT_SPEED Issue/Glitch?

I have found a strange behavior in Loiter Mode. I have been trying for days now to figure out how to change desired deceleration in Loiter mode (without the use of the brake). LOIT_ACC_MAX intuitively would be the correct parameter to change but seems to have no affect. Then by accident I found something strange.

LOIT_SPEED directly/linearly affects the desired deceleration curve of the aircraft? Here are two flights that show this. Note: For these tests LOIT_BRK_ACCEL = 0 as I don’t want it skewing the deceleration curve.

LOIT_SPEED: 600cm/s

LOIT_SPEED: 3000cm/s

Why is it doing this? The major issue here is by changing LOIT_SPEED it completely changes the flight characteristics in LOITER. With a high (say 3000cm/s) loiter the aircraft drifts around like its on ice and takes forever to go to the desired velocity set by the stick. It almost feels like Altitude Hold. Set LOIT_SPEED to 300cm/s and the aircraft feels likes it’s on ice picks and stops SCARY fast.
@rmackay9 Shouldn’t there be a parameter that sets the max acc/des regardless of what the LOIT_SPEED is set to? Making things more confusing, changing the Max Angle also affects the “desired” acceleration curve.


I think @Leonardthall is probably the best one to answer this question. It’s come up before I think from another user who wanted to limit the maximum loiter speed. I think the short answer is that you can’t reduce it much below perhaps 1/2 the vehicle’s maximum speed without odd effects.

It’s really too bad. Essentially LOIT_SPEED has to be set to 10-12m/s with max angle of about 35deg for loiter to have a good feel and response. I am not too worried about setting this below 10m/s. We interested in adopting Ardupilot on some of our larger aircraft but ween need LOIT_SPEED in the range of 20-25m/s. Unfortunately once your set this paramenter in the 20-25m/s range Loiter flies terribly and the aircraft “drifts” like crazy. @Leonardthall I would be very interested if there is any development on this issue?

Hi @DroneUnit

So the acceleration in Loiter is governed by two parameters, the maximum speed and maximum angle. For best performance you should do a flight on a calm day in AltHold and hold the aircraft at your desired maximum speed. If you take note of your speed and lean angle and use them in your loiter settings you will tend to get a nice feel.

To summarise how Loiter works:
The loiter lean angle defines the acceleration and deceleration of Loiter.
The loiter speed defines the speed that loiter will attempt to go when you have pushed full stick.
The LOIT_ACC_MAX parameter defines the maximum acceleration that the position controller can use to hold position when the aircraft is disturbed.
Then the break accel defines the additional deceleration that will be applied during breaking
Break Jerk defines how quickly this is applied
Break delay defines how long you must have the sticks in their dead zone before breaking will be applied.

The trick with Loiter is to match the lean angle and maximum speed to the natural characteristics in Alt Hold. The goal of loiter is to make the aircraft feel like flying around in Alt Hold on a calm day with the additional ability to add breaking.

The way people get into trouble is by setting the lean angle much higher than what is required for the maximum speed. This results in overly aggressive breaking. I like to set the maximum lean angle to be a little less than what is required to hold maximum speed.

The problem Randy is talking about is where a person wants a low maximum speed but relatively high accelerations.


Thanks fo responding to this. Everything you summarized is what I suspected. I think there is room for improvement here though. The way the code is written now works great for small Multirotors (id say less 10lb). The issue is it breaks apart once you get into heavier multirotors that inherently have the ability to travel faster (than a smaller multirotor) for a given pitch angle.

For example: We are really hoping to put Ardupilot on our 55-75lb aircraft. Ideally we want a LOIT_SPEED of 22-25m/s which the aircraft will easily do at a relatively low angle (haven’t actually checked it but I am guessing it is around 25deg in calm air). The power to weight ratio of these machines is only slightly over 2:1 therefore we need to keep the max LOIT_ACC_MAX around 35deg for safety. The problem is with this combination it makes the deceleration VERY slow which makes the aircraft feel more like its in Altitude Mode than Loiter. This causes a couple problems:
i) The aircraft drifts like its on ice around corners (If you were to yaw during forward flight it takes forever for the aircraft to get back flying in straight line)
Hopefully this image helps explain this:

ii) During slow speeds the aircraft takes forever to get to the “desired speed.” Like in my first post it takes roughly 10sec to go from 5.5m/s to 1.0m/s (with LOIT_SPEED = 3000). If you are trying to match the speed of a target who’s speed is constantly changing at low speed, it is very difficult (it’s feels as though you just flying in Altitude Mode). The other issue (relating back to point i) is if you need to make a small lateral adjustment the aircraft will continue “drifting” sideway after aileron stick input has been centered.

Note: I understand how the Brake works (it’s an additional deceleration), but hopefully I am explaining myself well enough that the brake does not help in this situation.

This one seems a little more complicated to me than the Jerk Acceleration post I started, but I feel like if these can be solved Ardupilots Loiter/Althold performance is going to be up there with the best. I am coming from several thousand flight on the DJI A3 controller and we are desperate to move away from DJI. Somehow their Max Angle parameter doesn’t affect the desired acceleration / deceleration curve, its just there as a safety parameter so it’s possible! Anyways thanks again.

I would suggest you give my setup approach a try. With the values you suggested of ~25 m/s and 25 degrees you can expect a stopping and cornering time of 5.5 seconds and a maximum acceleration of 4.2 m/s. There is no way for you to stop or turn faster than this unless you are happy to lean over much further.

I have found loiter works very well when setup properly on aircraft up to 250 kg. The aircraft I have next to me right now is 50 kg take off with 120 kg maximum thrust.

Hmm now I am confused. Not sure how you calculated the 5.5s. In my example above it took 12s to go from 5.5m/s - 0m/s (30m/s max speed / 35deg max angle).

If you saying it takes 5.5sec to go from 25m/s to 0m/s (25deg max), shouldn’t my example (30m/s max speed / 35deg max angle) take less than 5.5sec to go from 30m/s to 0m/s?

Edit: I thought more about what you said more about matching the max speed to max angle. I now get where you are going that this will give a certain feel to match Alt Hold. I now understand why my desired characteristics of Loiter are not being met (compared to a DJI controller). DJI’s implementation of Loiter/GPS Mode attempts to more quickly (but not too quick so that you feel disconnected) get the aircraft to the desired velocity based on the aileron/elevator (given a max loiter speed) position.
I feel your implementation is brilliant for people who are sport flying and want a smooth feel matching AltHold but with compensation against wind. I personally think DJI’s approach is much better for the majority of commercial work where the operator want the control system to more quickly adjust the velocity to the desired velocity (which also helps the aircraft more quickly get back to a straight trajectory after a corner).

Sorry, you are correct. The acceleration reduces as the aircraft accelerates due to the drag. The average acceleration should start at 4.2m/s/s but reduce to zero as it approaches 25m/s. So the average acceleration will be more like 2.1 m/s/s and therefore it will take something of the order of 11 seconds.

Applying breaking pressure on the sticks will result in 4.2 m/s/s plus the drag acceleration. So a full breaking maneuver will start at 8.4 m/s/s and reduce to 4.2 m/s/s as the aircraft reaches 0 m/s.

Cordinated turns will result in similar numbers.

Personally I find it crude and imprecise but I can understand how people that started with DJI equipment can become comfortable with it. As you move to larger aircraft you will need to fly the aircraft rather than shove it around. There is a reason that you can’t effectively fly anything other than small aircraft using DJI equipment. Ok there are a number of reasons :laughing:

It is interesting what you have said though. The early versions of loiter behaved the way you are suggesting here. It is funny how things go. I have not heard this from other x-dji pilots so I would be interested to hear others thoughts too. We will not be changing Loiter but there may be scope for a mode like this if an extremely clear and complete specification was put forward along with a strong usage case.

I suspect that as you move to larger aircraft your flying style will change to accommodate the slower yaw response.

I understand your point here.

It’s interesting but most people in the film world (around 55lb aircraft) still use DJI A3 FC (although many are desperate for another solution). Everyone I talk to who has tried Arducopter doesn’t know how to properly describe it but the common response seems to be it doesn’t feel as “precise”. The more and more I play around with Arducopter I think I am starting to understand why people may be saying this:

i) I think the Vertical Jerk limitation is simply what is causing all the “altitude control is unresponsive” comments I hear. This indeed is a big issue for film work when you need to quickly accelerate out of the way of something. (I thought more about this and wrote some comments in the respective post)

ii) The amount of natural “drift” around corners makes film work more difficult. Here is an example:

Without using numbers, if the pilot is going fast enough, he/she must give roll input around the corner to get the desired path in red. This results in required manual roll control to achieve the desired path making it more difficult to quickly align down the center of the road (usually resulting in a wavy flight pattern as the pilot corrects). If the aircraft drifted less, the pilot could more closely fly this path by just pointing the front of the aircraft where you want to go. But I understand some drift is required otherwise it would feel super unnatural which is how I am assuming the old Loiter worked. I tried PX4 a couple weeks ago. I am assuming they are still using a similar old Loiter Arudupilot methodology your referring to (let’s just say I wasn’t very happy haha).

iii) and the obvious, they don’t take the time or have the technical knowledge to properly set it up properly.

Anyways, really appreciate all the help and your time. We are excited to try the software on one of our film ships and see if we can make it work. I realize ii) is a complicated one, but really hopeful the altitude response time can be improve as I think this one may be the deal breaker more than anything for us currently.

Yes, i can definatly see this. Basically you need to do coordinated turns and this requires the pilot to be more skillful. The standards for loiter were basically set by people with a heli background, so very skilled pilots by today’s standards :slight_smile:

What we want is a loiter like mode that automatically does coordinated turns when yaw is applied. The problem with this is it will mean that the pilot will be much more constrained with more 3D flow profiles.

I wonder if I could add some sort of “auto turn” option on a switch in loiter. There may be some problems to deal with if the switch was flicked mid turn but that may be possible…

This makes me think of Drift mode.
But anyway, this whole discussion and the Loiter tuning tips are great and I’m going to make Leonards method the new normal instead of guessing.

Yes exactly but instead of mixing roll to yaw I would go the other way. Going from yaw to bank angle doesn’t have the discontinuity at zero like drift does. And it is something that could be turned on or off based on user preference.

I am thinking I may implement a switch for loiter setting so that you basically go as fast as you want loiter to go in Alt hold and pull a switch an it automatically sets the parameters.

Like Learn Cruise Speed in Rover. Great idea.