Ok, so there are a number of issues and misunderstandings here.
First up there are two things at play here, there is the kinematic trajectory that the Loiter controller generates based on your stick inputs. Then there is the position controller tune and it’s ability to adjust the pos/vel/accel of the aircraft, finally there is the expectations of how the pilot wants Loiter to “feel”.
We don’t. This P gain shapes the jerk profile of the breaking mauver. We use half the setting used in the position controller because we can safely assume the aircraft is capable of following that. If half the P gain of the position controller is too large then you have bigger problems. The P term here only defines the last portion of the breaking mauver, in particular how quickly the aircraft levels after it finishes decelerating.
A quick explanation of Jerk may be required. Jerk is the rate of change of acceleration and is closely linked to the rate of change of lean angle. You can not go from a 5m/s/s breaking maneuverer to stationary instantly. It takes a finite period of time to reduce the deceleration from 5 m/s/s to 0 m/s/s.
One of my very early posts covers the square root controller:
If follows from the point above, if the position controller has been tuned up perfectly then any value of P larger than that used by the position controller will result in attitude changes that the aircraft is not able to follow. In short, you can’t increase P above the best value unless you have a shitty tune to begin with.
Ok, a quick side to explain what breaking in loiter actually is. Loiter has been designed to be able to fly like Alt_Hold when there is no wind. It works on a theoretical drag model of the aircraft that generates a ideal velocity/acceleration based on your stick inputs and the aircraft speed. Therefore when you let go of the sticks the aircraft will decelerate to a stop based on the theoretical drag coefficient. This is great for very precise control of the aircraft combined with the ability to do fast transits between locations. So the problem is this breaking strength gets progressively less as you slow down, just as we see in Alt_Hold. It is often desirable to have a more assertive stop over and above the natural drag deceleration to provide a clearer feedback to the pilot that the aircraft has stopped. This additional breaking acceleration is what this part of the code does.
Yes:
You can set it to zero.
When using assertive breaking values to provide a clear: “I am stopping now”, “I have stopped now” feedback to the pilot. With the delay set to zero the aircraft initiates a breaking maneuver each time the sticks pass through zero. This makes it very difficult to make precise adjustments at slow speeds. By adding a 1 second delay (my preference) the pilot can make precises adjustments that take the sticks into and out of the dead band knowing that the aircraft will not grab the park break until the sticks are released for a second.
So loiter has a natural breaking feel when you bring the sticks back to centre or near centre, an aggressive breaking when you pull the stick back away from the direction of travel, and a “park break” when you move the sticks to centre and after the break delay.
Try to make the aircraft do a slow 1m circle over 30 seconds with aggressive breaking and you will see what I mean.