Greetings...all for the purpose of enabling real precision landing within logo waypoints (perhaps, eventually MAVLINK).
Just wondering if there's been any initiative along these directions:
1. adding a sonar sensor e.g., SFE's SEN-11309 or RTL-10427; OR a barometric sensor (not sure which is more accurate)
2. enhancing logo to include:
2.1. sonar detected altitude systems value for conditionals, e.g., IF_LE(ALT_ZNR, 0.5) m or cm
2.2. flare pitch up function to be used in conjunction, e.g., PITCH_UP(10)... SET_SPEED(x)... FLAG_ON(F_LAND)
2.3. a take-off position (USE_TAKEOFF_POS similar to USE_CURRENT_POS) and take-off angle (USE_TAKEOFF_ANGLE...)
I'd like to do these myself and can use some help and directions on the roadmap to take on what codes and classes (functions/data/identifiers/variables) are involved..
It'll be a bit of an uphill climb for myself and maybe a bit ambitious as haven't used c for quite a while for the past 20 yrs.. Some design materials on the WIKI might give me a good start, in addition to any directions from the group.
Best wishes.
Daniel
More on transfer functions later.
////////////////////////////////////////////////////////////////////////////////
// MAXBOTIX SONAR TERRAIN FOLLOWING AND LANDING FLARE
// Designed for use with the following device:-
// http://www.maxbotix.com/Ultrasonic_Sensors/MB1230.htm
// Can be used on INPUT 8 of the UDB4 if that is not used for other purposes.
// Will compensate for roll / pitch, subject to receiving a returned sonar signal.
//
// This option is for UDB4 only
// Height is returned 4 times / second in centimers in SERIAL_UDB_EXTRA PWM channel 8.
//
// NOTE: Requires Auto Pitch PID adjustment to be enabled.
// Auto Pitch PID will auto adjust your plane for the best possible PID control of height.
#define AUTO_ADJUST_PITCH_PID 1
// SONAR_STABILIZED_TERRAIN_FOLLOWING
// In stabilized mode, the plane will attempt to stay above a minimum sonar height from ground
// using Throttle and Pitch. If Throttle is cut to zero, the plane will glide in.
#define SONAR_STABILIZED_TERRAIN_FOLLOWING 1
#define SONAR_STABILIZED_MINIMUM_HEIGHT 2.0 // Meters. Minimum 1.0, Maximum 6.0
// SONAR LANDING FLARE
#define SONAR_LANDING_FLARE 0
#define SONAR_FLARE_DESCENT_RATE 0.3 // Meters / Second. 0.3 is default value.
#define SONAR_FLARE_START_HEIGHT 4.0 // Meters. Minimum 1.0, Maximum 6.0. Start High !
Best wishes, Pete
So really, all we need for that would be:-
Best wishes, Pete
In effect the algorithm that I plane to use today says "If you are landing, do not plough straight into the ground. When you see the ground, pitch up a little and glide".
Hi Pete.
What’s Lidar?
Hope you won't get tired of my dumb questions and requests.
Bill, from another viewpoint, the use of sonar in a LOGO control way can provide for a quick and easy testing opportunity ..through the landing scenarios, like Pete mentioned, with real-world results, e.g., probing the sonar device’s data feed integrity and consistency, the different approaches to best effect consistently soft auto-landing during its demanding stages, and so on. Thereafter, the component can be added to the DR algorithm as suggested, as well as in whatever alternative uses discovered during the testing.
Pete, you’ve got me holding my breath now. I’m also trying to rush my glider (adding the sonar sensor) for tomorrow, hoping for a favorable weather.
Progress: So far, I’ve applied the patches across all the codes down to my LOGO flight plan, incl. Ben’s suggestions. Everything compiled smoothly and looks promisingly good. As bonus this has helped me gain a bit more understanding of the structure of MP and how to go about adding simple enhancements. Thanks for the opportunity.
All the best.
~~~DO_ARG(CM_AUTOLAND,200)
FLAG_ON(F_ALTITUDE_GOAL)IF_LT_PARAM(190) // 190m is minimum landing strip lengthPARAM_SET(190)ENDFLAG_ON(F_LAND)PEN_UPUSE_CURRENT_POS // aim for the current flightplan x,y position target, SHOULD/WILL BE REPLACED BY TAKE_OFF_POSUSE_ANGLE_TO_GOAL // aim for the current flightplan angle target, SHOULD/WILL BE REPLACED BY TAKE_OFF_ANGLE//USE_CURRENT_ANGLEBK_PARAM // use parm to move back from target position as routine's landing span limitPARAM_DIV(8)PARAM_SUB(5)SET_ALT_PARAM // At 200 param, this is 20 m altFLAG_ON(F_LAND)PARAM_DIV(2)PARAM_SUB(2) // At 200 param, this is 8 m alt DOWNALT_DOWN_PARAMPARAM_MUL(8) // At 200 param, this forward by 64 mFD_PARAMPARAM_DIV(6)PARAM_SUB(3) // At 200 param, this is 8 m alt DOWNALT_DOWN_PARAMPARAM_MUL(8) // At 200 param, this forward by 64 mFD_PARAMPEN_DOWNIF_LT(ALT_SNR, 400) // After 128 m distance and cont. descend, check altitude using sonar data and if less than 4mFLAG_OFF(F_LAND) // throttle up for some flare trajectory to moderate descend,SET_ALT(5) // SHOULD/WILL BE REPLACED BY PITCH_UP/DOWN_(X ANGLE)ENDFLAG_ON(F_LAND) // Throttle off and continue powerless glide, SHOULD/WILL BE REPLACED BY THROTTLE_UP/DOWN_(X%)DO_PARAM(CM_LAND_SNR)
PARAM_ADD(16) // allocate about 80 metersPEN_UPUSE_CURRENT_POS // aim for the current flightplan x,y position target, TO BE REPLACED BY TAKE_OFF_POSUSE_ANGLE_TO_GOAL // aim for the current flightplan angle target, TO BE REPLACED BY TAKE_OFF_ANGLE//USE_CURRENT_ANGLEBK_PARAM // start exec. of script 80 meters from goalPARAM_DIV(3)FD_PARAMIF_LT(ALT_SNR, 270) // After 130 m If altitude from sonar is less than 2.7 mFLAG_OFF(F_LAND) // throttle up, flare andSET_ALT(4) // moderately level the descend slopeELSESET_ALT(3)ENDPEN_DOWNFLAG_ON(F_LAND)FD_PARAMIF_LT(ALT_SNR, 138)//FLAG_OFF(F_LAND)SET_ALT(2)ELSESET_ALT(2)ENDFD_PARAMIF_LT(ALT_SNR, 50)FLAG_OFF(F_LAND)SET_ALT(2)ENDFLAG_ON(F_LAND)
Hi Daniel,
Thanks for sharing that. I think you are well ahead of me on sophisticated Logo.
I see you are using a very different approach to the flight plan. You relying on GPS being accurate to within 1 meter for landing and sonar is used to confirm height at 1.38 m and 0.5m .
If GPS in your area is really that accurate, then Bill's comment about fusing sonar data into IMU position may be a neater solution in the long term.
I recomend using a fixed origin. That is highly recommend for consistency of position and altitude.
My flightplan was very different and assumed poor GPS altitude accuracy, and circumvented occasional false "out of range" readings on sonar on landing. I used sonar to just create a single state change to final flare.
I am really enjoying working with you on this. Thanks for pointing out the potential compile bug
I'll test the sonar branch for that.
I will change my Logo noun from SONAR_HEIGHT TO ALT_SNR to keep compatibility of scripts.
Ben, please confirm your view on that as we are adding to the Logo API.
Best wishes Pete
Ben the ALT_SONAR code in logo_flightplan.c uses conditional compiler directives in the ENUM and CASE statements. (see excertpt from patch below). I hope that is OK. (That is one of the advantages of using ENUM).
Best wishes, Pete
==============================
enum {~~~ALT_SONAR,~~~};~~~int logo_value_for_identifier(char ident)~~~case ALT_SONAR: // in cm
#if ( USE_SONAR_ON_PWM_INPUT_8 == 1 )
{return sonar_height_to_ground ;}#else{int sonar_height_to_ground = 0; // arbitrary value to test presence of sonar}#endif~~~
~~~IF_LT(LOGO_B_CHANNEL,3100) // Less than middle positionIF_GT(ALT_SONAR, 0) // use sonar if presentIF_LT(ALT_SONAR, 300) // if less than 300cm do autotakeoffDO_ARG(CM_CC_TAKEOFFRECT, 135)ENDELSEIF_LT(ALT, 3)DO_ARG(CM_CC_TAKEOFFRECT, 135)ENDEND~~~
~~~~IF_GT(ALT_SONAR, 0) // Sonar attachedIF_LT(ALT_SONAR, 400) // After 128 m distance and cont. descend, check altitude using sonar data and if less than 4mFLAG_OFF(F_LAND) // throttle up for some flare trajectory to moderate descend, apply a bit of brake as well,SET_ALT(4) // SHOULD/WILL BE REPLACED BY PITCH_UP/DOWN_(X ANGLE) and THRUST/THROTTLE..ENDELSEIF_LT(ALT, 4) // Use ALT if no sonar is attched, pray and cross your fingersFLAG_OFF(F_LAND)SET_ALT(4)ENDEND~~~~
Hi Pete, greetings all.
Wish you good flights and a great weekend!
////////////////////////////////////////////////////////////////////////////////
// Main Flight Plan
// ////// FUNCTIONS //////
#define RP_SWITCH 1
~~~~
#define CM_SET_ALT 10
#define CM_CW_AUTOTAKEOFF 11
~~~
#define CM_CW_RECTANGLE 14
#define CM_SET_SPEED 15
#define CM_RTSR_90 16
~~~
#define CM_AUTOLAND 19
#define CM_LAND_SONAR 20
// ////// PARAMETERS //////
#define PM_SHORT_RTGLLEG 120 // m
#define PM_LONG_RTGLLEG 140 // m
#define PM_TKOFF_SNRALT 300 // cm, takeoff sonar low alt. threshold
#define PM_TKOFF_GPSALT 3 // m, takeoff GPS low alt. threshold
#define PM_SRNDTURN_FD 10 // m
// LANDING
#define PM_LANDG_SPAN 200 // m, landing, approach to sonar managed soft touch-down
#define PM_LANDG_APRCH_GPSALT 4 // m, start of landing field LT/min. alt. threshold
#define PM_LANDG_APRCH_SNRALT 320 // cm, start of landing field sonar LT/min. alt. threshold
#define PM_LANDG_FSTSEG_SNRALT 280 // cm, FIRST SEGMENT landing sonar alt. threshold
#define PM_LANDG_SECSEG_SNRALT 180 // cm, SECOND SEGMENT landing sonar alt. threshold
#define PM_LANDG_TRDSEG_SNRALT 80 // cm, THIRD SEGMENT landing sonar alt. threshold
#define PM_LANDG_FSTSEG_GPSALT 3 // m, FIRST SEGMENT landing sonar alt. threshold
#define PM_LANDG_SECSEG_GPSALT 2 // m, SECOND SEGMENT landing sonar alt. threshold
#define PM_LANDG_TRDSEG_GPSALT 1 // m, THIRD SEGMENT landing sonar alt. threshold
#define PM_LANDG_APCHSEG_FD 2 // m, END OF LANDING APPROACH FD FLARE distance
#define PM_LANDG_FSTSEG_FD 3 // m, FIRST SEGMENT landing FD FLARE distance
#define PM_LANDG_SECSEG_FD 2 // m, SECOND SEGMENT landing FD FLARE distance
#define PM_LANDG_TRDSEG_FD 1 // m, THIRD SEGMENT landing FD FLARE distance
// SPEED control 9 32.4kph, 10 36kph, 11 39.6kph, 12 43.2kph, 13 46.8kph
#define PM_SPEED_LOWTRH 9 // m/sec, speed LT/min. alt. threshold
#define PM_SPEED_HIGHTRH 11 // m/sec, speed LT/min. alt. threshold
#define PM_TXTOGGLE_LOWTRH 2800 // TX 3pos-switch control LT/low threshold
#define PM_TXTOGGLE_MIDTRH 3400 // TX 3pos-switch control LT/mid-GT/high threshold
#define PM_TXKNOB_FSTQTL 2800 // TX knob/slider control LT/1st quartile threshold
#define PM_TXKNOB_SECQTL 3100 // TX knob/slider control LT/2nd quartile threshold
#define PM_TXKNOB_TRDQTL 3450 // TX knob/slider control LT/3rd-GT/4th quartile threshold
#define PM_DISTTO_HOME 160 // m min distance threshold to trigger auto RTH and land
#define PM_LANDRTGL_REPEATS 2 // number of semi-rounded rectangles before landing
SET_INTERRUPT(CM_SET_ALT) // SET ALT PER THROTTLE POSITION
~~~~
IF_LT(LOGO_B_CHANNEL,PM_TXKNOB_TRDQTL) //PARAM do wider circles PARAM , AUTOLAND
IF_GE(ALT_SONAR, 0)
IF_LT(ALT_SONAR,PM_TKOFF_SNRALT) // if less than 300cm do autotakeoff
DO_ARG(CM_CW_AUTOTAKEOFF,PM_LONG_RTGLLEG)
END
ELSE
IF_LT(ALT,PM_TKOFF_GPSALT) // if less than 3m do autotakeoff
DO_ARG(CM_CW_AUTOTAKEOFF,PM_LONG_RTGLLEG)
END
END
REPEAT(PM_LANDRTGL_REPEATS)
DO(CM_SET_SPEED)
DO_ARG(CM_CW_RECTANGLE,PM_LONG_RTGLLEG)
END
CLEAR_INTERRUPT
DO_ARG(CM_AUTOLAND,PM_LANDG_SPAN)
ELSE //_GT PARAM last quartile do TIGHT CIRCLES FOREVER
REPEAT_FOREVER
DO(CM_SET_SPEED)
DO_ARG(CM_CW_RECTANGLE,PM_SHORT_RTGLLEG)
END
CLEAR_INTERRUPT
END
~~~
TO (CM_CW_AUTOTAKEOFF) // Clockwise autonomous takeoff
IF_GT(LOGO_C_CHANNEL,PM_TXTOGGLE_MIDTRH)
FLAG_ON(F_TAKEOFF) // Agressive takeoff at higher speed
END
PEN_UP
USE_CURRENT_ANGLE // needs to be tested for RP orientation
USE_CURRENT_POS
PARAM_DIV(4)
BK_PARAM // use parm to move back from target position
PARAM_SUB(7)
SET_ALT_PARAM // at 110 param, ALT 20.5 m
PARAM_ADD(7)
PARAM_MUL(4)
FD_PARAM // FD 110
PEN_DOWN
DO(CM_SET_SPEED)
DO_ARG(CM_RTSR_90,PM_SRNDTURN_FD)
PARAM_DIV(4)
PARAM_SUB(2)
SET_ALT_PARAM // at 110 param, ALT 25.5 m
PARAM_ADD(2)
PARAM_MUL(4)
PARAM_DIV(3)
PARAM_ADD(5)
FD_PARAM // at 110 param, FD 41.66 m
DO_ARG(CM_RTSR_90,PM_SRNDTURN_FD)
PARAM_ADD(5)
SET_ALT_PARAM // at 110 param, ALT 46.66
PARAM_SUB(10)
PARAM_MUL(3)
FD_PARAM // FD 110
DO_ARG(CM_RTSR_90,PM_SRNDTURN_FD)
PARAM_DIV(2)
PARAM_SUB(4)
SET_ALT_PARAM // at 110 param, ALT 51
PARAM_ADD(4)
PARAM_MUL(2)
PARAM_DIV(3)
PARAM_ADD(5)
FD_PARAM // at 110 param, FD 41.66 m
DO_ARG(CM_RTSR_90,PM_SRNDTURN_FD)
PARAM_SUB(5)
PARAM_MUL(3)
IF_GT(LOGO_C_CHANNEL,PM_TXTOGGLE_MIDTRH)
FLAG_OFF(F_TAKEOFF)
END
END
~~~
// CLOCKWISE RECTANGLE ( matches CM_CW_AUTOTAKEOFF dimensions):
TO (CM_CW_RECTANGLE)
SET_INTERRUPT(CM_SET_ALT) // SET ALT PER THROTTLE POSITION
REPEAT(2)
FD_PARAM
DO_ARG(CM_RTSR_90,PM_SRNDTURN_FD)
PARAM_DIV(3)
PARAM_ADD(5)
FD_PARAM
DO_ARG(CM_RTSR_90,PM_SRNDTURN_FD)
PARAM_SUB(5)
PARAM_MUL(3)
END
CLEAR_INTERRUPT
END
~~~
TO(CM_SET_SPEED)
IF_LT(LOGO_C_CHANNEL,PM_TXTOGGLE_MIDTRH)
SET_SPEED(PM_SPEED_LOWTRH) // Light payload and wingloading cruising speed
ELSE //_GT PARAM
SET_SPEED(PM_SPEED_HIGHTRH) // Added payload and wingloading speed
END
END
~~~
TO(CM_SET_ALT) // Altitude control
LOAD_TO_PARAM(THROTTLE_INPUT_CHANNEL)
PARAM_SUB(2250) // Baseline throttle input: c. 1/4 throttle, 90m mid optimized for DX8
PARAM_DIV(4) // Scale: 5 eq. to 340m 1,115.49ft; 4 to 425m 1394.36ft; 3 to 566.66m 1859.12ft
IF_LT_PARAM(50) // Min. altitude 50 m
SET_ALT(50)
ELSE
SET_ALT_PARAM // Proportional to channel pos.
END
END
~~~
// ////// AUTONOMOUS SOFT LANDING PROGRAM ///////
TO (CM_AUTOLAND) // Landing final approach
FLAG_ON(F_LAND) // Start powerless landing glide
PEN_UP // CONTINUUM OF LAST LEG, ENFORCES SAME ORIENTATION OF AUTO-TAKEOFF
USE_CURRENT_POS // aim for the current flightplan
USE_ANGLE_TO_GOAL // aim for the current flightplan angle target,
BK_PARAM // use parm to move back from target position as routine's landing span
PARAM_DIV(10)
SET_ALT_PARAM // At 200 param, this is eq. to 20 m alt
PARAM_MUL(2)
FD_PARAM // At 200 param, this is eq. to 40 m
PARAM_DIV(4)
PARAM_ADD(2)
SET_ALT_PARAM // At 200 param, this is eq. to 12 m alt
PARAM_MUL(3)
PARAM_ADD(4)
FD_PARAM // At 200 param, this is eq. to 40 m
PARAM_DIV(10)
IF_GE(ALT_SONAR, 0) // Chk for a sonar attached, if none, value would be -1
IF_LT(ALT_SONAR,PM_LANDG_APRCH_SNRALT)
FLAG_OFF(F_LAND) // throttle up for some flar,
SET_ALT(PM_LANDG_APRCH_GPSALT)
FD(PM_LANDG_APCHSEG_FD)
FLAG_ON(F_LAND) // Throttle off
ELSE
SET_ALT(PM_LANDG_APRCH_GPSALT)
END
ELSE
IF_LT(ALT,PM_LANDG_APRCH_GPSALT) // Use ALT if no sonar cross your fingers
FLAG_OFF(F_LAND)
SET_ALT(PM_LANDG_APRCH_GPSALT)
FD(PM_LANDG_APCHSEG_FD)
FLAG_ON(F_LAND) // Throttle off and continue powerless glide
END
END
PARAM_MUL(10)
FD_PARAM // At 200 param, this is eq. to 40 m
PEN_DOWN
DO_PARAM(CM_LAND_SONAR)
END
TO (CM_LAND_SONAR) // Manage soft landing
PARAM_ADD(14) // about 75 meters landing stretch from goal
PEN_UP // ESTABLISH CONTINUUM WITH ABOVE
USE_CURRENT_POS // aim for the current flightplan x,y position target
USE_ANGLE_TO_GOAL // aim for the current flightplan angle target,
BK_PARAM // start exec. of script 80 meters from goal
PARAM_DIV(3) // Define three landing segments
IF_GE(ALT_SONAR, 0) // FST (first) landing segment
IF_LT(ALT_SONAR,PM_LANDG_FSTSEG_SNRALT)
FLAG_OFF(F_LAND) // throttle up, flare and
SET_ALT(PM_LANDG_FSTSEG_GPSALT) // moderately level the descend slope
FD(PM_LANDG_FSTSEG_FD) // flare dist PARAM
FLAG_ON(F_LAND) // Throttle off and continue powerless glide
ELSE
SET_ALT(PM_LANDG_FSTSEG_GPSALT)
END
ELSE
SET_ALT(PM_LANDG_FSTSEG_GPSALT)
END
FD_PARAM
PEN_DOWN
IF_GE(ALT_SONAR, 0) // SEC (second) landing segment
IF_LT(ALT_SONAR,PM_LANDG_SECSEG_SNRALT)
FLAG_OFF(F_LAND)
SET_ALT(PM_LANDG_SECSEG_GPSALT)
FD(PM_LANDG_SECSEG_FD) // flare dist PARAM
FLAG_ON(F_LAND)
ELSE
SET_ALT(PM_LANDG_SECSEG_GPSALT)
END
ELSE
SET_ALT(PM_LANDG_SECSEG_GPSALT)
END // If conditions not true, maintain the landing trajectory
FD_PARAM
IF_GE(ALT_SONAR, 0) // TRD (third) landing segment
IF_LT(ALT_SONAR,PM_LANDG_TRDSEG_SNRALT)
FLAG_OFF(F_LAND)
SET_ALT(PM_LANDG_TRDSEG_GPSALT)
FD(PM_LANDG_TRDSEG_FD) // flare dist PARAM
FLAG_ON(F_LAND)
ELSE
SET_ALT(PM_LANDG_TRDSEG_GPSALT)
END
ELSE
SET_ALT(PM_LANDG_TRDSEG_GPSALT)
END
FD_PARAM
END
AIRFRAME_TYPE AIRFRAME_VTAIL~~~WIND_GAIN_ADJUSTMENT 0~~~ALTITUDEHOLD_STABILIZED AH_PITCH_ONLYALTITUDEHOLD_WAYPOINT AH_FULL~~~#define ROLLKP 0.25#define ROLLKD 0.08#define YAWKP_AILERON 0.08#define YAWKD_AILERON 0.03#define AILERON_BOOST 1.00~~~#define PITCHGAIN 0.12#define PITCHKD 0.07#define RUDDER_ELEV_MIX 0.05 // reduced for breeze's vtail configuration#define ROLL_ELEV_MIX 0.05#define ELEVATOR_BOOST 0.50~~~#define YAWKP_RUDDER 0.08#define YAWKD_RUDDER 0.12 // 0.12#define ROLLKP_RUDDER 0.06#define ROLLKD_RUDDER 0.05#define MANUAL_AILERON_RUDDER_MIX 0.03#define RUDDER_BOOST 1.00(I'm wondering if any of these is fighting navigation and might be causing the drift?)
TO(CM_LTSR_90) // Right turn 90 degrees, semi round
REPEAT(9)
FD_PARAM // uses PM_SRNDTURN_FD defined param eq. to 10
LT(10)
END
END
TO(CM_RTSR_90) // Right turn 90 degrees, semi round
REPEAT(9)
FD_PARAM
RT(10)
END
END
Improving Control Gains:-
I notice from your Google Earth flights, with Logo waypoints shown alongside the flight track, that your plane is not really following the Logo path well. It is understeering all the time, by significant amounts. Here are some throughts about that ...
When tuning MatrixPilot control gains, it is vital to remember that there can be up to 3 Pilots flying the plane at the same time. Here is how the 3 Pilot dynamics work ...
In Manual:- Just you, the real human pilot is in charge of the plane.
In Stabilized (AH_NONE is true [Alittude Hold is off] :- The stabilization pilot tries to keep the plane level in pitch and roll. The manual pilot can also "mix in their controls". If the manual pilot turns right, the stabilization pilot tries to level the plane. But the mixing in the ailerons or elevator leaves a residual error, which means the plane settles in a bank or ascent/descent pitch.
Stabilization works against the manual pilot. Lot's of high gains for stabilization will make the plane difficult to turn. Low gains for stabilization are best. So the plane is still easy for the manual pilot to fly, but so the plane remains stable at all normal flight speeds. Lot's of new users turn the stabilisation gains upt to high. The plane should be easy to turn with stabilisation on.
In Autonomous Mode: There are three pilots. Autonomous Navigation Pilot, that tries to turn the plane against the wishes of the Stabilisation Pilot. And potentially the Manual Pilot can also "mix in commands" alongside those of the Autonomous Navigation Pilot. If the plane is easy to turn for the manual pilot in stabilized mode, then the plane will also be easy to turn for the Autonomouse Navigation Pilot (against the Stabilization Pilot) in Autonomouse Mode. Make sure the plane is not over-stabilized, otherwise the the Navigation Pilot will have a hard job turning the plane.
So the key to creating nice autonomous turns in MatrixPilot is to: a) Keep stabilisation gains reasonably low - test that in Stabilized mode using manual flight b) once stabilisation gains are correct, then adjust the navigation gains upwards make the plane turn more forcibly onto new navigation routes and directions when in Autonomous mode.
So which are the stabilisation gains, and which are the navigation gains ? The main navigation gain on my plane is YAWKP (I'm flying with ailerons.)
(A note in passing. Many classical RC planes are naturally stable by design. By careful about using "KD" gains where they are not really needed. I set quite a few of my KD turns to zero for my Alpha Axion (similar to an easystar) and for my Twinstar 2.)
Tuning up Control Gains used to be a laborious technique .... until MAVLink was implemented. I think that few people have used that yet, so it is still rather experimental, and best tested on cheaper / more disposable air frames.
With an Xbee connected to your plane, you can change the main gains of the plane, while it is in flight. It requires two people. One flying, the other using a PC with QgroundControl running, to change the gains in flight. The knowledeable pilot flies, and keeps their eyes on the plane,and verbally requests Gain changes. The second person makes the changes on the PC, transmits them to the plane, and confirms verbally the change. In one flight, you can tune up a plane perfectly. I first did this with Riccardo Kuebler in Switzerland last January (Thanks Ric !).
I enclose a comparison screenshot of my plane following an Oval Logo pattern where the straights of the oval are 100m, to show how I would hopet your plane could follow the Logo paths.
Improving Cross Tracking:-
I'm not sure if you are using the Cross Track Flag yet at all ? People have had mixed results over the years with cross tracking. But potentially, for landing on a runway, we should be using cross-tracking enabled navigation. This is specifically meant to stop the plane from drifiting to one side. I do not have much experience of either the code, algorithms, or usage of cross tracking, so I will leave it for others to comment on this area.
Best wishes, Pete
~~~~
IF_LT(ALT_SONAR,PM_LANDG_APRCH_SNRALT)FLAG_OFF(F_LAND) // throttle up for some flar,
SET_ALT(PM_LANDG_APRCH_GPSALT)
FD(PM_LANDG_APCHSEG_FD)
FLAG_ON(F_LAND) // Throttle off
ELSE
SET_ALT(PM_LANDG_APRCH_GPSALT)
END
IF_LT(ALT_SONAR,PM_LANDG_APRCH_SNRALT)IF_GE(WIND_SPEED_Z, PM_HEAD_WINDTRH) // HEAD WIND (?) THRESHOLD TO TURN ON THROTTLEFLAG_OFF(F_LAND)// Throttle ON
END
SET_ALT(PM_LANDG_APRCH_GPSALT)
FD(PM_LANDG_APCHSEG_FD)
IF_GE(WIND_SPEED_Z, PM_HEAD_WINDTRH)FLAG_ONF_LAND) // Throttle off
ENDELSE
SET_ALT(PM_LANDG_APRCH_GPSALT)
END
Hi Pete.
Very happy to see your flight’s repeated go-arounds and log data show delightfully consistent, perhaps conclusive results well aligned with the anticipated (descend and ascend) trajectories.
Congratulations.. it works! Well done!
All your efforts (including latest code modifications) have certainly covered a lot of positive ground in this initiative of including accurate soft landing capabilities in LOGO, using sonar.
I also would like to join Bill, in extending Ben well-deserved kudos, for LOGO, IMHO, an outstandingly powerful flight plan scripting function of MP.
Must say that the more I deal with (..gain understanding) LOGO, the more I appreciate the great mind behind it. (Currently, I’m attempting, more accurately, fumbling around, to introduce codes to capture during takeoff and use for landing: TAKEOFF~ ~POS and ~ANGLE…)
Perhaps, it’s now time to fuse sonar with navigation (“accurize”/optimize LOGO ALT~ related functions), as Bill recommends?
I hope for a weather break and opportunity to join you, further testing landing with sonar using attached scripts (pls. see attached snippets for details).
Unfortunately, relatively calm weather has recently become fast fleeting and rare with the onset of falls.
All the best.
Daniel