Problem using in-flight leveling



I've been trying to use the in-flight leveling function in my jdrones hexacopter, but can't ever seem to get it to work. After some trial and error, I've come to the conclusion that for some reason, the in-flight leveling only seems to be activated in my APM for 13 seconds - at least the green LED only flashes for that long, and the copter seems to go back to normal flight pretty quick while trying to calibrate it. Any thoughts as to why I'm having this problem and what I might be able to do to fix it?


Interestingly, it does take 20 seconds to arm in-flight leveling mode...


I'm going to try re-installing the firmware and see if that fixes the problem

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

Join diydrones

Email me when people reply –


  • I'm starting to feel like this is just a conversation with myself. Oh well; posting here what I've learned for posterity and future APM users. 


    So looking at the code, it does appear that activating auto_trim in channel 7 works exactly the same as activating in-flight leveling using the arming procedure. I've made those changes to the code, but haven't had a chance to use it yet (waiting for a windless day).


    Additionally, I found this line of code in 'motors.pde':


    if (arming_counter > AUTO_LEVEL_DELAY) { auto_level_counter = 155; arming_counter = 0;}


    By changing the value of 'auto_level_counter', you can influence how long the in-flight leveling procedure lasts. Because I was only getting 13 seconds out of my APM, I changed the value to 500 and now I get about 45 seconds.


    Still not sure why the timing of my APM seems to be so fast in this loop. Everything else 'seems' to work at the proper speed.




  • All,


    Still having problems getting in-flight leveling to last longer than 13 seconds in my hexacopter. From browsing the forum and the Wiki, it looks like I can set up the software to allow me to turn in-flight leveling on an off using channel 7. From the Wiki:


    Auto Trim

    #define CH7_OPTION CH7_AUTO_TRIM

    Allows you to hold trim the accelerometers of the copter when this switch value is high ( > 800).


    However, I have a few questions:


    1. First, does this do what I think it does. Does this, in fact, enable in-flight leveling?

    2. Once this in enabled in the code, I can't figure out how I would actually turn it off, since my radio doesn't generate pulse values less than about 1050. What am I missing here?

    3. Would this work more or less the same as the current in-flight leveling procedure (hold arm for 20 seconds)? In other words, with channel 7 'on' and thus the copter engaged in in-flight leveling, do I simply use the sticks to try and get the copter into a level flight, during which the APM will use my stick movements to adjust the accels. Once the copter is balanced, land the copter, turn channel 7 'off', and new settings will be saved to APM. Is that all correct?


    Any help you guys can provide would be most appreciated.

  • Nope, re-installing the firmware didn't fix the problem.....

This reply was deleted.


gotham liked gotham's profile
Hiroki Tanaka liked Hiroki Tanaka's profile
Oct 13
Derrick Davies liked lisa TDrones's profile
Sep 23