Page 1 of 1

baro/sonar automatic landing failsafe

Posted: Wed Mar 14, 2012 6:08 pm
by kos
hello,

is there an autolanding feature ? is this planned ?

also using baro/sonar , we can deduce the rpm to achieve hovering and feed the dynThrPID range accordingl,kind of inflight motor range calibration , could also provide a smother range near the deduced hovering rpm ...

Re: baro/sonar automatic landing failover motor calibration

Posted: Wed Mar 14, 2012 9:30 pm
by mbrak
hi

:twisted: :twisted: :twisted:

Please do not take it seriously

activate failsafe in sketch and modify the value in the formula.

go flying

switch off your tx

wait

the copter should descent now (maybe it could be a more or less hard landing)

/Please do not take it seriously

Re: baro/sonar automatic landing failover motor calibration

Posted: Wed Mar 14, 2012 9:41 pm
by kos
... i bet we can deduce the value

no more change in the code upon battery size or payload changes ;)

Re: baro/sonar automatic landing failover motor calibration

Posted: Tue Apr 17, 2012 8:39 am
by kos
mbrak wrote:go flying

switch off your tx


.. the only issue when you tx is off is drift control :D

dr.tom wrote:and by managing it in the code, the system is 'cleaner', no switches & wires going down the frame and landing gears...

true
copterrichie wrote:One idea would be to read the Z Axis of the Accelerometer, it should return to 1G on touchdown.


I change the failsafe routine to have autolanding using baro only,

with baro only we do not have the ground reference (we could land below initial BAROaltStart / BaroAltGround )

this should work better with a sonar
no need to read acc ?

Code: Select all

// baro only
# define GROUND_CONTACT  1 

// sonar
//#landingGearMounOffsett 15
//# define GROUND_CONTACT  (0>=(sonarAlt - landingGearMounOffsett)) 


    #if defined(FAILSAFE)
      if ( failsafeCnt > (5*FAILSAVE_DELAY) && armed==1) {             
        if (BaroPID>0){ 
          // under target altitude and moving up
          AltHold -= 35;  // set target altitude down
          failsafeCnt=5*FAILSAVE_DELAY; // until we reach target altitude again
        }else{
          //over target altitude
          if ((failsafeCnt > (5*FAILSAVE_OFF_DELAY) )  || GROUND_CONTACT ){
               //if we cannot reach target altitude , or landed
               // maybe initial throttle was too high, time to stop anyway
              armed = 0;   // This will prevent the copter to automatically rearm if failsafe shuts it down and prevents
              okToArm = 0; // to restart accidentely by just reconnect to the tx - you will have to switch off first to rearm
          }
        }
        failsafeEvents++;
      }
      failsafeCnt++;
    #endif
 



Code: Select all

if(setfailsafe==0){
        for(i=0; i<3; i++) rcData[i] = MIDRC;
        // if we are near hovering speed or in baro mode , do not change throttle
        // else ensure to engage failsafe with safe throttle
        if( (10>=(rcCommand[THROTTLE]-FAILSAVE_THR0TTLE)) && (baroMode==0)){
          rcCommand[THROTTLE]=FAILSAVE_THR0TTLE;
        }
        rcData[THROTTLE] = rcCommand[THROTTLE];
        setfailsafe=1;
        baroMode = 1;

      }

Re: baro/sonar automatic landing failsafe

Posted: Tue Apr 17, 2012 12:50 pm
by copterrichie
Kudos!

Re: baro/sonar automatic landing failsafe

Posted: Tue Apr 17, 2012 1:06 pm
by alexmos
Landing with baro is not good because it gives wrong data under 30cm altitude (pumping effect). I was tryed to landing in alt hold mode - very hard to do this. Only sonar works well near ground, but it is not installed for everyone. I think current failsafe routine is the best due to it's simplicity (and therefore good error-protection).

Only thing that will really helps - automatic finding hover throttle value on-the-fly. Because it is hard to set precise filesafe throttle level in config (and hard to re-configure after changing hardware configuration). It is not so hard if we have baro.

Re: baro/sonar automatic landing failsafe

Posted: Tue Apr 17, 2012 1:48 pm
by copterrichie
The simple fact of entertaining the idea of auto-landing is a major advancement in my opinion. I agree that the usage of sonar and the Z Axis of the Accelerometer for the final approach is the best solution at present.

Re: baro/sonar automatic landing failover motor calibration

Posted: Tue Apr 17, 2012 9:19 pm
by kos
with default settings the copter must lose 35cm in less of 20 second .. or shit happens :P

outdoor, high altitude and full initial throttle ..not ready yet

so, here is the indoor testing video : https://vimeo.com/40542705

Code: Select all

    
#define FAILSAVE_BARO_OFF_DELAY (FAILSAVE_OFF_DELAY+20)

#define FAILSAVE_PID_STEP 0 
#define FAILSAVE_ALT_STEP 35

//#define FAILSAVE_PID_STEP 15
//#define FAILSAVE_ALT_STEP 25

        if ((BaroPID-FAILSAVE_PID_STEP)>0){ 
          // under target altitude and moving up
          AltHold -= FAILSAVE_ALT_STEP;  // set target altitude down
          failsafeCnt=5*FAILSAVE_DELAY; // until we reach target altitude again
        }else{
          //over target altitude
          if ((failsafeCnt > (5*FAILSAVE_BARO_OFF_DELAY) )  || GROUND_CONTACT ){
              armed = 0;   // This will prevent the copter to automatically rearm if failsafe shuts it down and prevents
              okToArm = 0; // to restart accidentely by just reconnect to the tx - you will have to switch off first to rearm
          }
        }
 

Re: baro/sonar automatic landing failsafe

Posted: Thu Apr 19, 2012 10:37 am
by kos
alexmos wrote:Only thing that will really helps - automatic finding hover throttle value on-the-fly. Because it is hard to set precise filesafe throttle level in config (and hard to re-configure after changing hardware configuration). It is not so hard if we have baro.


I would realy like to have this working with any initial throttle value, without initial calibrating loop

- flying acro at full throttle , or fast descending with almost zero throttle
- failsafe, rx/tx down
- multiwii engage safe autolanding

what would the code look like ? your are using estVelocity ?

Re: baro/sonar automatic landing failsafe

Posted: Thu Apr 19, 2012 1:25 pm
by copterrichie
Watching in total Awe!

Re: baro/sonar automatic landing failsafe

Posted: Fri Apr 20, 2012 6:51 am
by UndCon
I saw your video like yesterday or so - well done!

I hope this gets implemented into the current dev asap.
//UndCon

Re: baro/sonar automatic landing failsafe

Posted: Fri Apr 20, 2012 2:16 pm
by kos
it only work if initialThrottle is near hovering throttle ( lets says +/- 100 to be safe) .. the clamp in the baroPID will not allow automatic baro/sonar landing if a full initial trohttle is applied .

this could be use for autlanding but not for every failsafe condition, unless there is an initial calibration loop
alexmos wrote:Only thing that will really helps - automatic finding hover throttle value on-the-fly.

Re: baro/sonar automatic landing failsafe

Posted: Wed Apr 25, 2012 9:51 pm
by copterrichie
I personally believe this Failsafe should be taken very seriously. Read this please.

http://multikopter.co.uk/forum/index.ph ... msearch__1


when one of these copters serious harm someone, we will wish we had.

Re: baro/sonar automatic landing failsafe

Posted: Wed Apr 25, 2012 10:14 pm
by kos
the main issue is "HowTo safely test the failsafe" ?

i think it is time for HIL :)

Re: baro/sonar automatic landing failsafe

Posted: Fri Apr 27, 2012 3:16 pm
by copterrichie
wkm fail safe and auto landing

http://www.youtube.com/watch?v=KMAXgGdgxjo

Re: baro/sonar automatic landing failsafe

Posted: Fri Apr 27, 2012 11:21 pm
by kos
to me this altitude hold and position hold , then return to home , then autolanding .. cool but :

remove the gps , will it still work .. ?
set initial input to full throttle , will it still work ?


for those who know about workflow pattern [1], what do you think about describing Flight Process Management in multiwii [2] ... that could be integrated in the wiki documentation page



1 : http://www.workflowpatterns.com/patterns/control/

2: https://pixhawk.ethz.ch/_media/software ... iagram.png