ardupilot icon indicating copy to clipboard operation
ardupilot copied to clipboard

Copter: fix unconstrained avoidance backup speed

Open IamPete1 opened this issue 1 year ago • 4 comments

This fix is the result of a log where home changed altitude resulting in a huge breach of the max altitude fence. There was no fence action configured, however avoidance was enabled resulting in the vehicle trying to back away from the max altitude fence at 15 m/s. The configured climb rate limits were +-2.5 m/s.

image

Firstly this fixes the avoidance to constrain the velocity to AVOID_BACKUP_SPD parameter.

Secondly this constrains Z backup to half the set pos controller speeds. This helps keep the speeds in balance since the the avoid backup speed is probably set with XY speed in mind and could be too large for Z.

I have not tested this yet. We might want a minimal fix to just apply the backup speed in avoid for a backport.

IamPete1 avatar Apr 20 '24 20:04 IamPete1

Rebased and added a auto test which fails on master and passes with this PR.

IamPete1 avatar Apr 22 '24 13:04 IamPete1

I have reworked to take a pos control pointer from copter which allows the constrain to pos control limits to be done inside AC_Avoid resulting in a much smaller change.

AC_Avoid is also used by rover which will not set the pointer so will not try and use pos control.

A alternative method might be to add a pos control singleton.

IamPete1 avatar Apr 23 '24 13:04 IamPete1

I'm slightly surprised that the vertical speed limits weren't being applied in AC_PosControl but perhaps that's because we are not using "input shaping"

rmackay9 avatar Apr 23 '24 23:04 rmackay9

I'm slightly surprised that the vertical speed limits weren't being applied in AC_PosControl but perhaps that's because we are not using "input shaping"

The pos controller does not apply any limits, its on the caller to restrict what they ask for. I do think it should (https://github.com/ArduPilot/ardupilot/pull/24100) this is a case where having hard pos control limits would have been a good idea.

IamPete1 avatar Apr 23 '24 23:04 IamPete1

We discussed this on the call and agreed to use a new AVOID_BACKZ_SPD parameter.

rmackay9 avatar Apr 30 '24 00:04 rmackay9

Reworked to separate the speed limit into horizontal and vertical components. I also found I had omitted to apply the Z limit in the 3D case which I have now fixed.

IamPete1 avatar Apr 30 '24 19:04 IamPete1

@peterbarker, I think we can merge this unless you're comment above re the autotest is a blocker... so up to you.

rmackay9 avatar May 01 '24 02:05 rmackay9