HexAirbot / HexNanoMWC_HEX

A modified MWC2.2 flight control for Flexbot hex board.
54 stars 25 forks source link

FlexBot enters failsafe even if not flying (throttles at 0%) #3

Closed droidmonkey closed 10 years ago

droidmonkey commented 10 years ago

If you are connected to the flexbot and close the app, the throttles go to 100% for a short duration. Not sure if this is a problem with the app or the firmware. I am posting in both places to raise awareness.

droidmonkey commented 10 years ago

To reproduce this issue (on Android):

  1. Open Flexbot app and connect to flexbot
  2. Press the "unlock" button so the LED's turn on flexbot
  3. Close app and swipe on app history
  4. Your flexbot motors will turn on in 3-5 seconds
edalquist commented 10 years ago

I've observed the same behavior via iOS. Twice now I've switched apps and the motors when to 100% a few seconds later. Luckily (except for my fingers) I was holding the bot both times.

droidmonkey commented 10 years ago

I found the issue, doing a compare between MultiWii 2.2 and this code I found that they activated the fail-safe procedures. What that means is if comms are lost it will try to gracefully land the helicopter. Problem is this is undesirable behavior if we actually intend to end use of the copter.

This can be fixed in one of three ways:

  1. The app needs to issue a "DISARM" command before it closes
  2. The firmware needs to disable the fail-safe code entirely (comment out line 573 in config.h)
  3. Add more logic near lines 916-919 in HexNanoMWC_HEX.ino to prevent failsafe mode from activating (i.e., enter disarm mode) if throttles are less than a certain minimum value (i.e., not flying).

I can submit pull requests for either of these actions, what is the opinion of the Flexbot staff?

HexAirbot commented 10 years ago

In fact, in unlocked state,throttle went to 20% (failsafe throttle) for about 5 senconds after communication disconnected.

In most RC systems, if receiver is failed to get signal from transmitter, it switchs to failsafe mode.

In failsafe mode, the throttle is setted to a desired value.

Yeah, if the conncetion is turned off by users, it should switch off the motors instead of going to failsafe mode,.

But in some special cases, for example, the drone fights too far and the connection is failed, it should go to failsafe mode: set the throttle to a relatively small value for a few seconds and let the drone can come down softly, then switch off motors.

Maybe, it is too much that the failsafe throttle was 20%. Now the new code has refined failsafe mode. In the new failsafe mode, failsafe throttle will be 5% if the current throttle is more than failsafe throttle(most likely the drone is in flighting), and 0% if the current throttle is less than failsafe throttle.

It is still possible doing more work on failsafe mode, just like auto locking when the throttle is less than a small value for a few senconds, and as Droidmonkey said that the app needs to issue a "DISARM" command before it closes.

Thanks for reporiting the bug.

droidmonkey commented 10 years ago

Thanks, I updated the title of the issue. I will create a new issue for the app to add a disarm on close.

edalquist commented 10 years ago

I think the recent change to not go into failsafe if the throttle is already at 0 will resolve the problem. I'll try updating my bots and report back when I do.

dreadful commented 10 years ago

I tested the update and it seems to work. turn off throttle and close the app, nothing happens. turn the throttle way up and close the app, motors spin slower to come in for landing.

Thanks for the update guys! My fingers feel a little safer now =)