Going through the firmware I discovered a module, which is disabled by default, but sounds really interesting! It's the SITAW.C module, which is meant to detect a free fall and/or a tumbled situation while the drone is in the air. As long as a free fall is detected the module triggers the alt-hold mode, if the drone is not in a tumbled situation. It can easily enabled by removing the comment-doubleslashes in line 49:
#define SITAW_ENABLED
The first test (i just threw the crazyflie in the air) revealed, that the modules can detect a free fall or a tumbled situation. Good Job so far. The very problem (which is pointed out in the file-comments): "as soon as althold is enabled, we are not freefalling anymore". That means, the motors are activated and deactivated within milliseconds (cause as soon as there is no free fall anymore, the motors shut off). The Crazyfie can't be stabilized and it falls down with 99% of the original speed. Most times the CF flips due to a slightly stronger push of one motor. I understood, why it's deactivated by default.
But what a great opportunity, if the modules leads to a smooth landing! Lost connection while the CF is high in the air? No broken motormounts anymore. A strong windblow wants to flip your CF? Alright, it can be stabilized by SITAW.
But how to get the althold mode activated for - well, lets say 2 seconds? Maybe a timer would be useful. Fortunately there is already a good timer implemented in commander.c (there it is used to detect a timeout). So i decided to implement it into sitaw.c. The result: As I threw the CF in the air, it hovered autonomous for 2 seconds before falling down! After a second of falling the module was activated again, stabilizing the drone for a second time (this time 2 meters closer to the ground).
By implementing the Tumbled-Situation-Detection into this timer, the thrust is cut off immediately if the pitch/role-angle is over 60°. Useful, if the drone is upside down (I learned that the hard way - upside down ground crawling with 100% thrust costs motors and propellers..)
So far so good. I went outside and threw the CF up in the air. BAD IDEA! As the module detected the free fall, it activated the althold - and made the CF rise up in the air with constant speed and no control! After 2 seconds, the CF fell off the sky again, but after a short delay the CF rose again, this time with lower, but significant speed. I was able to catch the CF and bounded it to a cord. I tried that a few times, sometimes it worked well, sometimes the CF rose up in the air.
Conclusion:
- The SITAW module actually works! Tumbled Situation (pitch/role-angles over 60° will cut the thrust
- The control of the althold mode needs improvements. I used a timer (a free fall will activate the althold for 2 seconds)
- ONLY USE INDOORS! Activating the modified SITAW outside can lead to a uncontrollable flight!
- (you need to connect the CF to a client once to activate the SITAW module)
This is the first time I tried some programming (and my first post in this forum), so this solution might be a bit clumsy. Tell me what you think about the solution (hopefully in the attachments) and throw in some ideas!
