Fly-By-Wire Low Altitude Limit!

Hi there!


I've always wanted to take part in arduplane development, so I finally have chance to do it =)


Here you can find info on how to do the same


I have chosen this one -

8) Minimum altitude feature for modes >= FBW - Add a feature where the user can specify a minimum altitude that the autopilot will not go under when in higher modes

just because I was implementing some anti-crash functions on my own.


So here my little demo. APM is in FBW-B mode and I hold pitch all the way DOWN! until the very end of video. The jumps you will see is my code bringing the plane back to safe altitude. Minimum alt was set 30 meters above home altitude, so you can see ground. Enjoy and post your ideas!


UPDATE: Here is new video (new algorithm, no jumps): 


And my patch has been applied to the ArduPlane source! =))) Man, I wish I could have a job related to drones...

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones


  • I've added wiki page about this feature. Can be found here.

  • Excellent work getting your code into APM YureZzZ, I'm looking forward to the next release so I can test it out.


    Do you have any plans for your next project? ;)



  • Have you thought about using Bee Vision stuff? It is small and could be pretty accurate.

  • Moderator

    sorry if I sound like I am teaching... I know you understand all the technology, I only share my thinking because I get excited to share the idea that goes with it, and so have to share my understanding of how it might work so we both are talking about the same thing.


    I have learned good things from listening to you about this. And thank you for working on the low altitude limit!

  • Moderator

    Most IR sensors just do not have the range. They should work great for the last part of the landing, and also for very low terrain following (they will not, however work well for collision avoidance... you can easily fly into a pole or a tree ... too short distance, even if it was not a narrow beam.)


    But once you have a laser, since it is not sound, and it is not optical processing, because it is light, you can move it very fast side to side, and record the angle and distance. Now you have LIDAR. And LIDAR is outstanding for trees, hills, buildings, glass, people, birds, other airplanes, terrain following (if you dedicate it and point it the right direction, but I would not because I can only carry one, and it is more valuable for other things) and for environment mapping. But the problem is, LIDAR is expensive, and not just in terms of money. You have to drive a powerful laser, and also drive a servo or motor all the time, and pretty fast, if you are not a quad and if you want good enough data to fly fast. So you cannot expect to have 360 degree LIDAR; but you can mix these sensors, and even control all of them from one board ... and just give a packet of data to the APM with i2c, and record the mapping data in more detail to a chip on the controller board or something. 


    If you have just a little more processing power, you can also build a confidence table with the mapping data, and let the collision board "predict" obstacles based on previous readings. Then you can fly faster than your sensors can detect, if you have reason to believe that environment has not changed much. If you think about it, it is what humans do ... imagine you are training for a race, you walk the course, also in parker, winter olympic sports - learning the turns... same thing. But what is important for us is imagine the what it could do for videographers like TBS, for fast movie filming (rather than program the path, you tell it to map the environment, then you give it a basic path, and tell it to stay away from obstacles, and it can go faster and faster, until it can race with the stuntman as he falls....


    Well, anyway, lots of ideas. But I have basic problems to solve, so those ideas are only good to plan the next tiny step.

  • Moderator

    It is for the plane and the quads. For my problem and also for the future, I want to promote "sense and avoid" technologies because in the US and other places, UAVs will soon fall into two categories... those with sense and avoid, and those without. And I want hobbyists to have options (including transceivers, too) not just the commercial and government UAVs... 


    I agree... about lasers and IR, but I also think sonar has many problems, too. I have many of them, and they cannot detect small objects (tree branches) until you get very close. They also take too long, for fast moving vehicles, it is sound, out and back, and if you are flying at 30-90 Kt/h, a typical range many planes here, and the object is maybe a tree w/o leaves - maybe 2-8cm wide at the top, how far away can it detect? Not far enough to turn, I think.... but I haven't tested yet. But here is my bigger worry, and I have not tested them, but I suspect since the sonar is sound, that flying into air at 30+ Kt/h, that the sonar might just not work at all. I was going to test in my car, but I do not want to drive towards something at 30mph to see if the sonar detects... I only have max 70m to test, or about 30m before I have to turn or stop. So I was just going to build it and use my quad to start testing. And in any case, I know that there is a plan to try sonar for landing flare, so that is more argument to at least try with a sonar for now.


    I think, maybe, optical flow sensors will be a good plan, during the day time. But with my plan to use a separate processor board, I can, in theory, use all four for different purposes. I can use a laser for long distances in front and maybe pointing down (on the bottom of the camera, for accurate survey data collection)  I can make a lidar for the forward motion, and collect mapping data of obstacles at that elevation. I can use IR and sonar for landing altitude control for minimums, and laser for higher elevations, with the baro, and also to help calibrate the baro maybe?) and I can use optical flow sensors for collision avoidance (and fall back to ultrasound and lasers for night flights


    But of course these are just ideas, and I will never get to all of them, and hopefully I will have better ideas. But I can have ideas all day long.... I have to keep building too... which is why I said that my specific problem is not solved with this sonar idea, to add to your Low Altitude limit (and also because there will be many challenges, even if I can make it work.... I know this from other robot projects years ago... if you add simple algorithms for input and behavior, sometimes very strange things appear to happen for conditions you did not think of. 


    And that is the most interesting thing about robotics for me. When it begins to sense its environment, and you try to give it a general set of rules, and see how it behaves in the real world with real sensors and messy places.

  • Ok, now I got it. First of all, I think IR and lasers are useless in this case, because of the trees =) Ultrasonic could work if you'll have enough time and distance to fly up and down according to the surface(is it is for quad, then it is  going to work anyway, IMHO).


    So if I were you - I would just plan WP's in such way that no matter where the plane is - it will be higher than the highest point(in your case - tree). And for landing part - you just program it to descent over some place and land.


    To conclude, ultrasonic sensor could be a really good help for auto-landings, but not as terrain follower.

  • Moderator

    For the I2c OSD, I have a design and a prototype, but I am not finished building the prototype yet. I only started yesterday. But it is all "known problems", nothing new to solve, so it is just a matter of implementation. So I am pretty confident about it. There are some plans I have for it that go beyond my design/prototype but I am not worried about those right now. I will be happy just with the basic version first. 


    The OSD has other features, too, but I want to be sure I can do it before I share about them. Many things I am not pleased with in other OSDs that finally made me (two days ago) decide to return to an older plan to build my own. I gave up on the plan and bought several commercial boards, but now all of them sit in my junk drawer because I do not like something about each one.


    I have too many plans, that is why I decided to buy, not build, originally. But now I just cannot live with the existing OSD problems anymore. Like the input problem. I picked i2c because it makes the most sense to me for the APM, and also because most Arduino boards have i2c, and I cannot use serial, do not want to use USB master/slave, and if I used raw analog or digital pins, I would just end up recreating i2c, because I want a bus for many devices.... you get the idea, I am sure. But it is only one of the problems I am thinking about for my OSD.



  • Moderator

    I do have a very specific goal, but I recognize even if all these things are done and work well, it does not yet solve this problem completely. But it helps with this goal, like research, and also helps with a general problem. First, the general problem. I was running X-plane to test some missions - but the ground was not level. And I was trying to do some auto flights, with lift off and landing (same and different places) and I made a serious mistake. The ground along my approach is higher than everywhere else, including my take off. I used many WPs to guide the plane in for a very smooth looking pattern, to reduce the altitude slowly so I could be sure it hit those altitude levels (I believe altitude changes in the WP are more like "suggestions" because they are navigation commands, you can use the set altitude command but it is not like it can start circling when it is half-way into the approach...)


    Anyway, I crashed into the side of a hill. I did not see the hill from the overhead map, and it is only a little hill, but it is about 40 feet higher than where my landing is, and I thought that I wanted to be around 30 feet high in my glide path towards the run way.... big mistake... but it was in X-plane.


    That is the general problem. If we could change the minimum (and later, also set a max) altitude limit, then not only can we do very interesting (and dangerous, to the plane) nap of the earth videos like TBS, but in auto - but we can also make much easier auto landings... like some airports (SFO? HKG?) where you have to jump over a mountain and almost dive to the deck to land....


    My specific problem, and my goal, is to allow the aircraft to fly at a cattle ranch, at 20-25 feet. It must fly a search pattern. But there is +120 and -60 elevation across the property. And there are dense groups of trees, and a few short buildings. And a few tall trees. 


    But I must stay as close as possible to 20-25 feet as I can be. And it is far too complex for me to program the elevation into MP with a mission. Also, it changes, because trees grow, and google elevation is not accurate enough, the coordinates are not always matching in all places, as you know also. Better to detect the actual ground, if possible. But as you can tell, this plan above is not good enough. But it will be a good start?


  • Mike, 

    what is your final goal of this project?


    Also, lasers is not good idea - they have too narrow beam, which I think is going to give erroneous readings depending on surface they point on.


    I2C OSD is really neat, have you got any success?

This reply was deleted.