baro/sonar automatic landing failsafe

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
User avatar
kos
Posts: 286
Joined: Thu Feb 16, 2012 4:51 am
Location: Fr

baro/sonar automatic landing failsafe

Post 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 ...
Last edited by kos on Tue Apr 17, 2012 8:40 am, edited 1 time in total.

User avatar
mbrak
Posts: 136
Joined: Sat Dec 03, 2011 8:08 pm
Location: Germany, Lemgo

Re: baro/sonar automatic landing failover motor calibration

Post 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

User avatar
kos
Posts: 286
Joined: Thu Feb 16, 2012 4:51 am
Location: Fr

Re: baro/sonar automatic landing failover motor calibration

Post by kos »

... i bet we can deduce the value

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

User avatar
kos
Posts: 286
Joined: Thu Feb 16, 2012 4:51 am
Location: Fr

Re: baro/sonar automatic landing failover motor calibration

Post 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;

      }

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: baro/sonar automatic landing failsafe

Post by copterrichie »

Kudos!

alexmos
Posts: 108
Joined: Tue Aug 09, 2011 12:12 pm

Re: baro/sonar automatic landing failsafe

Post 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.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: baro/sonar automatic landing failsafe

Post 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.

User avatar
kos
Posts: 286
Joined: Thu Feb 16, 2012 4:51 am
Location: Fr

Re: baro/sonar automatic landing failover motor calibration

Post 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
          }
        }
 

User avatar
kos
Posts: 286
Joined: Thu Feb 16, 2012 4:51 am
Location: Fr

Re: baro/sonar automatic landing failsafe

Post 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 ?
Last edited by kos on Thu Apr 19, 2012 2:56 pm, edited 1 time in total.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: baro/sonar automatic landing failsafe

Post by copterrichie »

Watching in total Awe!

User avatar
UndCon
Posts: 293
Joined: Mon Feb 21, 2011 2:10 pm

Re: baro/sonar automatic landing failsafe

Post by UndCon »

I saw your video like yesterday or so - well done!

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

User avatar
kos
Posts: 286
Joined: Thu Feb 16, 2012 4:51 am
Location: Fr

Re: baro/sonar automatic landing failsafe

Post 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.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: baro/sonar automatic landing failsafe

Post 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.

User avatar
kos
Posts: 286
Joined: Thu Feb 16, 2012 4:51 am
Location: Fr

Re: baro/sonar automatic landing failsafe

Post by kos »

the main issue is "HowTo safely test the failsafe" ?

i think it is time for HIL :)

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: baro/sonar automatic landing failsafe

Post by copterrichie »

wkm fail safe and auto landing

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

User avatar
kos
Posts: 286
Joined: Thu Feb 16, 2012 4:51 am
Location: Fr

Re: baro/sonar automatic landing failsafe

Post 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

Post Reply