The Arduino says:
//This governs the descent speed during landing. 100 is equals approc 50cm/sec
#define LAND_SPEED 100
OK, my question is, will doubling the 100 to 200 make it land faster or slower??? Does 200 = 25cm/sec or does it mean 100cm/sec???
This is something I would rather not find out by trial and error
Anyone know?
Clarification of the #define LAND_SPEED meaning
-
- Posts: 100
- Joined: Thu Sep 10, 2015 11:29 am
Re: Clarification of the #define LAND_SPEED meaning
I had a look... Searching through all the files for LAND_SPEED I found this:
Which could be clarified a bit... It's subtracting the value of LAND_SPEED (which is stored in GPS_conf.land_speed) from AltHoldCorr every time it executes this block of code - once per LOOP_TIME.
The value of AltHoldCorr is then divided by 512 if its absolute value is greater than 512 and added to AltHold to get a new altitude hold target. The same process exactly is used to make adjustments to the altitude with the throttle stick when #define IGNORE_THROTTLE is set to 0.
The result here is that if AltHoldCorr is something like -520 as a result of the land speed being subtracted from the starting point of 0, it gets divided by 512 yielding -1.0156... this is then added to the Altitude hold (resulting in alt hold value getting smaller). I'm not quite sure this early in the morning why that gives a descent of 50cm/sec.
So... after all that... making the land speed number larger makes the landing speed faster!
Code: Select all
#if GPS
if (f.LAND_IN_PROGRESS) { //If autoland is in progress then take over and decrease alt slowly
AltHoldCorr -= GPS_conf.land_speed;
if(abs(AltHoldCorr) > 512) {
AltHold += AltHoldCorr/512;
AltHoldCorr %= 512;
}
}
#endif
Which could be clarified a bit... It's subtracting the value of LAND_SPEED (which is stored in GPS_conf.land_speed) from AltHoldCorr every time it executes this block of code - once per LOOP_TIME.
The value of AltHoldCorr is then divided by 512 if its absolute value is greater than 512 and added to AltHold to get a new altitude hold target. The same process exactly is used to make adjustments to the altitude with the throttle stick when #define IGNORE_THROTTLE is set to 0.
The result here is that if AltHoldCorr is something like -520 as a result of the land speed being subtracted from the starting point of 0, it gets divided by 512 yielding -1.0156... this is then added to the Altitude hold (resulting in alt hold value getting smaller). I'm not quite sure this early in the morning why that gives a descent of 50cm/sec.
So... after all that... making the land speed number larger makes the landing speed faster!
Re: Clarification of the #define LAND_SPEED meaning
I really suck at any code that isn't in the config.h sketch. Thanks Ed