Differential PILOT_SPEED_DN Lua script

It is a well known fact that when descending vertically, there is a lot of prop wash destabilization, so often one has to put a pretty conservative values of 1.5 to 2.5 m/s. However, if you descend with some horizontal speed, the copter never enters the downwash, and you can have much higher descent rates, 5 … 6 m/s. I believe DJI uses this technique.

I made a short script, where LUA increases the descent rate if the pilot inclines the copter forward by more than 10 degrees. The descent rate increases slowly and proportionally to inclination up to a preset maximum.

If the pilot returns to level flight, the descent rate is immediately reset to normal predefined descent rate.

Only forward inclination works, because it is much safer (you do not want to have extreme descents when flying backwards or sliding sideway, that is one of the potential crash reasons).

I have tested on my new built, seems to work fine.

It could be a good idea to integrate this is some future version of AP, because descents through prop wash are really complicated if the copter is not tuned rock solid.

function update ()
local pitch=ahrs:get_pitch()
local pitchdeg=math.deg (pitch)
local pitch_from=-10 – from this angle we will increase rate of descent. Will work only for negative values, i.e. when copter inclines forward
local pitch_to=-30 – this is the max angle, if the angle is higher, the max rate will not increase
local ch12=rc:get_pwm(12)
local ch11=rc:get_pwm(11)
local Pilot_VZ_Base=200 – this is the base descent speed, cm/sec
local Pilot_VZ_Max=500 – this is maximum descent speed
local Pilot_VZ_Delta=Pilot_VZ_Max-Pilot_VZ_Base

if (pitchdeg<pitch_to) then
     pitchdeg=pitch_to   -- limit maximum inclination for calculations    
end  
if (pitchdeg<pitch_from)  -- from this inclination we will increase the descent rate
       then
          local ddeg=-pitch_from+pitchdeg  -- ddge is the delta degree  --  
          local Pilot_VZ_Target=Pilot_VZ_Base+Pilot_VZ_Delta*-(ddeg/(-pitch_to+pitch_from)) --              
          local Pilot_VZ= param:get('PILOT_SPEED_DN')
      local Pilot_VZ_Step=(Pilot_VZ_Target-Pilot_VZ)/9 -- about 2..3 seconds to reach max descent speed
          -- gcs:send_text(2, Pilot_VZ_Target)
          -- gcs:send_text(2, Pilot_VZ_Step) 
    
          Pilot_VZ=Pilot_VZ+Pilot_VZ_Step
          if (Pilot_VZ>Pilot_VZ_Max) then  -- safety check, programmers are dumb!
             Pilot_VZ=Pilot_VZ_Max
          end

          if (Pilot_VZ<Pilot_VZ_Base) then   -- safety check, programmers are dumb!
             Pilot_VZ=Pilot_VZ_Base
          end
          param:set ('PILOT_SPEED_DN',Pilot_VZ)       
       
    else
         Pilot_VZ=Pilot_VZ_Base             
         param:set ('PILOT_SPEED_DN',Pilot_VZ)  
     end

 local test=param:get('PILOT_SPEED_DN')
 gcs:send_text(4, test)   


return update, 250

end

return update()
descent.lua (1.9 KB)

1 Like

There is also a script that automatically flies a circle to descent faster:

3 Likes

The script is much more complicated… And it relinquishes control from the pilot. I would prefer to refine my idea - you fly forward, you see where and how we are descending. When you spiral, you do not see anything.

May I ask why you have this only increase downwards velocity on pitch forward? Pitching backwards, rolling, or a combination should also remove the aircraft from descending in its propwash.

Because I always fly FPV, no automodes. In mountains we need some brain not to crash, so you can not (or should not) really descend fast unless you see where you are going.

Obviously one can modify the script to descend fast in any direction.

2 Likes