Altitude Hold/Advanced Failsafe solutions by NHA

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Goetz
Posts: 82
Joined: Sun Mar 04, 2012 3:40 pm

Re: Altitude Hold/Advanced Failsafe solutions by NHA

Post by Goetz »

robertha wrote:In my opinion have fixed throtle as a failsafe is a bit pathetic - when wrongly set (weight change - different batery, without camera), the copter will either fall as a brick or fly away - depend just on weight to thrust ratio - think the NH vario descent is an absolute minimum for failsafe.


That's really true. RTH worked already month ago..... .....a pitty it isn't in Main Branch...

Imho
Posts: 1
Joined: Mon Dec 02, 2013 12:18 pm

Re: Altitude Hold/Advanced Failsafe solutions by NHA

Post by Imho »

TBH, I'm struggling to understand the purpose of the throttle mid-point setting and initially using this mid-point when engaging BARO mode. Shouldn't the ALT PID loop kick in on engaging BARO mode and stabilise altitude?

Bear in mind that this is a question from the uninitiated, I only wish to understand the reasoning.

Fastrack
Posts: 23
Joined: Tue May 14, 2013 5:36 am

Re: Altitude Hold/Advanced Failsafe solutions by NHA

Post by Fastrack »

At this point I have RTH triggered via my receiver failsafe. I also have the built in crappy multiwii failsafe enabled incase the receiver bites the dust or gets disconnected.

However this method sounds amazing. Has worked stopped on it since the release of 2.3? It kinda looks like people have moved onto base flight?

The RTH failsafe is great but if I can not regain control it'll just hover there until the battery dies... Of course if there are any trees it'll just run into them as there's no altitude to climb too.

Ben

Moraes
Posts: 16
Joined: Wed Oct 15, 2014 6:24 am

Re: Altitude Hold/Advanced Failsafe solutions by NHA

Post by Moraes »

Hello buddies ,

Someone keeps using this code today ? There are some latest mod with these skills or this still the best ?

I already have installed on two AIOP ( V1.1 , and V2 ) , and not yet tested flight modes with gps and autoland , but I think I understood the setup , I have read enough this topic .

The main reason for this my message is that I try to upload the code for a Crius Se V2, and can not, it gives an error message : The sketch is too big .

Someone managed to install a Crius Se?

What modifications can I do to decrease the size of the sketch and fit in atmega 328 ?


Thanks in advance !

A hug from your Brazilian friend .

JM

Moraes
Posts: 16
Joined: Wed Oct 15, 2014 6:24 am

Re: Altitude Hold/Advanced Failsafe solutions by NHA

Post by Moraes »

Hello, Anyone help?

This mod is died?

You advise me to forget it and concentrate on the mwc 2.3 installation?

I'm also trying to put the pid tunning in rc potentiometer , but it is complicated ...


Thanks

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Altitude Hold/Advanced Failsafe solutions by NHA

Post by PatrikE »

Moraes wrote:What modifications can I do to decrease the size of the sketch and fit in atmega 328 ?

Without GPS enabled you can fit it in a 328.

For GPS Atmega 328 is dead!..
GPS after V2.3 is for Mega boards only.
328 is too small to fit the GPS code in..
Sorry.. :(

Unless a slimmed RTH and Pos Hold version can be made for smaller FC's
ex. The old version as define
Lots of people have the mini and nano based FlightControllers.

User avatar
shikra
Posts: 783
Joined: Wed Mar 30, 2011 7:58 pm

Re: Altitude Hold/Advanced Failsafe solutions by NHA

Post by shikra »

check out latest r1717 :)

Moraes
Posts: 16
Joined: Wed Oct 15, 2014 6:24 am

Re: Altitude Hold/Advanced Failsafe solutions by NHA

Post by Moraes »

Hi buddies,

Thank you for reply, I was already desperate for anyone to answer anything .

On the limitation of space , This mod works About Version 2.2 , But anyway , I did not have any trouble putting version 2.3 with gps in Crius SE with atmega 328 .

Nobody can give me tips to reduce this mod of this topic , the nhadriam , to fit a Crius SE ?

I would love to use this mod because doing failsafe return to home and autoland .


Thank you

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Altitude Hold/Advanced Failsafe solutions by NHA

Post by PatrikE »

I have made my own Failsafe RTH together with rbirdie001.
Feel free to test it.
Two defines close to the top of config.h

Code: Select all

#define ADV_RTH      true
#define SAFE_RTH_ALT 20    // Meters


If it's below SAFE_RTH_ALT the Copter will start climb to reach that altitude before returning.
Otherwise it will start returning at the current Altitude.

At home it will start to descend and land.
Attachments
MultiWii_FS_RTH.zip
(152.6 KiB) Downloaded 331 times

Moraes
Posts: 16
Joined: Wed Oct 15, 2014 6:24 am

Re: Altitude Hold/Advanced Failsafe solutions by NHA

Post by Moraes »

Hi,

Thanks, I will test.

Please explain work mode.

It´s 2.2 or 2.3? (edit, I believe its 2.3, right?, I´m reading the code now)

Have to activate and tune the original failsafe function in mwc?

It detects the signal of 4 channels to 985 us?

Is visible in Gui to test and confirm if trigger work?

How he descend in home point? Will doing minthrottle + 200 as the original failsafe?

He disarms after landing? As?

Sorry for so many questions, is to understand if I have to change other parameters and also to understand how should I expect it to work.

Hug,

JM

Moraes
Posts: 16
Joined: Wed Oct 15, 2014 6:24 am

Re: Altitude Hold/Advanced Failsafe solutions by NHA

Post by Moraes »

Hello Patrike,


Please Help me.

I uploaded your mod.

First I only used 2 parameters in the header config.h. I set "true" and set "10" meters.

CIMG2809 (Small).JPG


When I test in Gui, switched off tx and nothing happened.

I return to arduino, uncomment original section failsafe, setting 1200 to disarm motors (2 minuts) and minthrottle + 200 (later I will try best value to descend with my setup).

CIMG2808 (Small).JPG


And now, tested in Gui, after armed, if I switch off tx, I see Baro, MAg, GPShold And GPS Home armed. BUT disarm motors.

Yes, When I switch off TX, 1 sec later the failsafe work, but disarm motors, and If i switch on tx, still disarmed.

Please help me to understand whats wrong?

Thank you.

Ps. I will made one video to show this.

EDIT:

I tested one more time, making pictures to post here (upload video take more time), and now, the behavior was completely different.


Armed, switch of tx and FS work. armed baro, mag, and GPS HOLD. But the issue with disarming, vanish...

CIMG2811 (Small).JPG


CIMG2815 (Small).JPG


Tested one more time, And now.

Armed, switch of tx and FS work. armed baro, mag, and GPS HOME. The issue with disarming, still vanished...

CIMG2812 (Small).JPG


In this moment I thinked this because number of sats in gps. And made new several tests

But the issue disarm motors when arm failsafe, It occurs randomly. And GPS hold or home, also seems to happen randomly.

Im make videos, Uploading now, Soon post here.

Ok, The randomly behaviour disarming motor if FS activated:


And random, Expected correctly behaviour:


Can solve this problem?

Hugs

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Altitude Hold/Advanced Failsafe solutions by NHA

Post by PatrikE »

Hi Moraes,
It is made from Devcode newer than 2.3 but 2.3 Gui works.
You seem to have figured out the most questions i think.

Descending have a own routine Not minthrottle.
Will disarm after landing in Failsafe but not after normal RTH.

For your safety.
You need to move the copter away from home otherwise it's decides it's too close to your face to do a climb to altitude.

The RTH cycle.
Start climb in PosHold to RTH alt.(Mag hold)
Start RTH with nose pointing towards home.
At home radius.
Switch back to Poshold and nose in Staring Direction.
Start descending.
Land and lower motors to idle.
Disarm if in Failsafe.

If distance to home is to small it will make a RTH/Poshold at current altitude.
If no GpsLock Do the Old Failsafe landing Minthrotle +200.

Moraes
Posts: 16
Joined: Wed Oct 15, 2014 6:24 am

Re: Altitude Hold/Advanced Failsafe solutions by NHA

Post by Moraes »

Hi Patrike,

Thank you for your attention.

I'd love to use your firmware, but in relation to the problem I'm having, to disarm the motors when triggers the RTH?

Have you seen this video?
https://www.youtube.com/watch?feature=p ... nH4mV7M7v4

Thank you so much.

JM

Moraes
Posts: 16
Joined: Wed Oct 15, 2014 6:24 am

Re: Altitude Hold/Advanced Failsafe solutions by NHA

Post by Moraes »

As yet I was able to use the code Patrike, I've been trying to solve the problems encountered with the original code in this topic, although abandoned, it seemed to me it was very good solutions.

And here's a video I made, which tests two identical boards, with the same code and the same settings, but different engines and frames. One is working relatively well, the other does not hold position and I doubt if the RTH okay, nor tested the autoland aind on the second board.

Have suggestions?



Thanks,

JM

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Altitude Hold/Advanced Failsafe solutions by NHA

Post by PatrikE »

The way it disarms in the video is a sign on that it's Home and landed.
You need to move the copter away from Home Position before it activates a RTH.

Make a test without propellers.
Arm the Copter.
Move it ~10 meters away.
Turn off TX(Failsafe).
It should now increase throttle to start climb and return.

If it behaves like that you can do it with props next.

Moraes
Posts: 16
Joined: Wed Oct 15, 2014 6:24 am

Re: Altitude Hold/Advanced Failsafe solutions by NHA

Post by Moraes »

PatrikE wrote:The way it disarms in the video is a sign on that it's Home and landed.
You need to move the copter away from Home Position before it activates a RTH.

Make a test without propellers.
Arm the Copter.
Move it ~10 meters away.
Turn off TX(Failsafe).
It should now increase throttle to start climb and return.

If it behaves like that you can do it with props next.


Hi Patrike,


Its make sense... Why I dont think this??? :lol: :lol: :lol: :lol:

I Try and report.

Its possible map one aux channel to trigger autoland?

Thank you so much.

hug,

JM

romandesign
Posts: 5
Joined: Thu Dec 11, 2014 2:10 am

Re: Altitude Hold/Advanced Failsafe solutions by NHA

Post by romandesign »

Hi, I'm a newbie and have a newbie question: I was looking for a way to implement failsafe autoland with a cheap controller for the first quad I'm going to build (no GPS, so just autoland on loss of radio, and shut down motors, no RTH). I thought that multiwiii board would do that as it has a barometer, however it seems that it can't do that by default and I found this thread. Looks great, but it seems old, and the versions have progressed quite far since then. What are my options? Is there a better solution than this? Or do I have to use old version from herejust so it works? Looks like r23 is the latest... Or is there a way to implement this with a new version? Or any alternative solution?

Any advice appreciated. Thanks.

romandesign
Posts: 5
Joined: Thu Dec 11, 2014 2:10 am

Re: Altitude Hold/Advanced Failsafe solutions by NHA

Post by romandesign »

PatrikE wrote:The way it disarms in the video is a sign on that it's Home and landed.
You need to move the copter away from Home Position before it activates a RTH.

Make a test without propellers.
Arm the Copter.
Move it ~10 meters away.
Turn off TX(Failsafe).
It should now increase throttle to start climb and return.

If it behaves like that you can do it with props next.


Hi Patrike, does your mod work if there is no GPS - just as a failsafe autoland, without RTH part? How to program it?

romandesign
Posts: 5
Joined: Thu Dec 11, 2014 2:10 am

Re: Altitude Hold/Advanced Failsafe solutions by NHA

Post by romandesign »

I've just read this above for one of the earlier releases: "- Autoland works only with GPS / valid GPS data"
Does it mean that autoland on failsafe can only work if GPS is present? What if I have no GPS at all - this code won't work? I really need immediate autoland on failsafe (descend, RMP lowered, disam) without RTH opr GPS. Is it possible?

Moraes
Posts: 16
Joined: Wed Oct 15, 2014 6:24 am

Re: Altitude Hold/Advanced Failsafe solutions by NHA

Post by Moraes »

I believe the NHA failsafe solutions do autoland without gps

Look this:

Code: Select all

 /********                          Failsafe settings                 ********************/
    /* Failsafe check pulses on four main control channels CH1-CH4. If the pulse is missing or bellow 985us (on any of these four channels)
       the failsafe procedure is initiated. After FAILSAFE_DELAY time from failsafe detection, the level mode is on (if ACC or nunchuk is avaliable),
       PITCH, ROLL and YAW is centered and THROTTLE is set to FAILSAFE_THROTTLE value. You must set this value to descending about 1m/s or so
       for best results. This value is depended from your configuration, AUW and some other params.  Next, afrer FAILSAFE_OFF_DELAY the copter is disarmed,
       and motors is stopped. If RC pulse coming back before reached FAILSAFE_OFF_DELAY time, after the small quard time the RC control is returned to normal. */
    #define FAILSAFE                                  // uncomment  to activate the failsafe function
    #define FAILSAFE_DELAY     5                      // Guard time for failsafe activation after signal lost. 1 step = 0.1sec - 1sec in example
    #define FAILSAFE_OFF_DELAY 2500                    // Time for Landing before motors stop in 0.1sec. 1 step = 0.1sec - 20sec in example
    #define FAILSAFE_THROTTLE  (MINTHROTTLE + 200)    // (*) Throttle level used for landing - may be relative to MINTHROTTLE - as in this case

  /*****************                Failsafe descending to the ground by BARO          *********************************/
  /* For vario-controlled descending instead of having a fix throttle value, uncomment FAILSAFE_ALT_MODE. This allows to descend with preset vario.
     When flying on high altitudes, and would like to descend faster than apply FAILSAFE_SAFE_ALT and FAILSAFE_FAST_VARIO.
       This case will let copter descend faster from high altitude till reach the safety altitude, after will slow down to slow vario.
     If you have GPS and would like to have RTH activated when in failsafe, uncomment FAILSAFE_RTH_MODE. Please note that in this case FAILSAFE_ALT_MODE doesn't have to be uncommented,
       if GPS signal is weak, failsafe will work in FAILSAFE_ALT_MODE.
     Both with work only with FAILSAFE uncommented! Also Please note that both modes will work even if SUPPRESS_BARO_ALTHOLD is uncommented, so you can still save some space with better failsafe alt handling!

     Please note that FAILSAE_OFF_DELAY is still active for security reasons, so set up long time enough to be able to RTH before this timer ends because motors will stop!!!*/
 
    //#define FAILSAFE_ALT_MODE             // uncomment for descending with constant vario if in Failsafe - use with FAILSAFE and define the FAILSAFE_SLOW_VARIO
    #define FAILSAFE_SLOW_VARIO   25      // in cm/s - slow desceding speed under SAFETY_ALT, this is default is SAFETY_ALT is not used.  - maximum 250!!!
    #define FAILSAFE_FAST_VARIO   80     // in cm/s - fast desceding speed over SAFETY_ALT, maximum 250!!!
    #define FAILSAFE_SAFETY_ALT   200     // in cm   - safety altitude, where to slow down descending before landing, in cm!!!

    #define FAILSAFE_RTH_MODE             // if GPS present and ready, copter starts RTH when signal lost. When signal is back, control is back again.
    #define FAILSAFE_RTH_VARIO    100     // in cm/s - vario for RTH function for failsafe, maximum 250!!!
    #define FAILSAFE_RTH_ALT      800    // in cm   - minimum RTH altitude for failsafe. If copter is higher than this, it will keep altitude.
    #define FAILSAFE_RTH_HOME     400     // in cm   - home altitude for RTH, copter will descend to this altitude and wait.
    #define FAILSAFE_RTH_DELAY    10      // in s    - safety delay, after reaching HOME altitude, it'll land in FAILSAFE_ALT_MODE when safety delay terminates.

    #define FAILSAFE_DETECT_TRESHOLD  900     //Failsafe threshold (in us)

  /


I think you need uncomment Failsade alt mode.

romandesign
Posts: 5
Joined: Thu Dec 11, 2014 2:10 am

Re: Altitude Hold/Advanced Failsafe solutions by NHA

Post by romandesign »

Moraes wrote:I believe the NHA failsafe solutions do autoland without gps
I think you need uncomment Failsade alt mode.


Thanks. I hope it works. Do you thing NHA r23 is good, safe and stable (bug-free) software to build my first quad with HobbyKing MultiWii 328P controller? Am I really missing anything not using latest versions?

One other thing - does multiwii with this software has voltage checking with beep when too low?

Post Reply