felixge / node-ar-drone

A node.js client for controlling Parrot AR Drone 2.0 quad-copters.
http://nodecopter.com/
MIT License
1.76k stars 428 forks source link

Throw LowBatteryException #6

Open rmetzler opened 11 years ago

rmetzler commented 11 years ago

AR Drone does not take off if the battery is low (afaik less than 20%). Client code does not receive any Exception about that

felixge commented 11 years ago

So I think we need a patch for Client.prototype._handleNavdata that does that. Any takers?

saibayadon commented 11 years ago

I'd like to write it! Should Client.prototype._maybeEmitError be used? But i think that another event might be good... emit('lowbattery')?

felixge commented 11 years ago

No, IMO in this case the 'error' event should always be emitted and cause a crash if nobody is listening for it.

What do you think?

saibayadon commented 11 years ago

It was my initial tougth. Will work on this tonight. Also, i haven't checked, but is there a way to get the actual battery value? I'd be nice to have a .lowBattery(fn) thing.

saibayadon commented 11 years ago

Hey, Felix. What do you think would be the best way to check the drone state before taking off? Or how would you approach this? Having some troubles figuring out a (good) way to do it.

felixge commented 11 years ago

Not sure yet ... need to look into this once I have a bit of time again.

yocontra commented 11 years ago

lowBattery event added in #18

Resseguie commented 9 years ago

Sorry, coming in late here but have a question. What is specific to this issue that wasn't handled in #18?

Is this issue only concerned with checking battery state before takeoff?

(And use the lowBattery event to allow clients to handle it during flight?)