hybridgroup / node-bebop

A Node.js client for controlling Parrot Bebop & Bebop2 quadcopters.
http://nodebebop.com
MIT License
146 stars 61 forks source link

Guys none of the node-bebop program ending they dont come out to prompt at all #43

Open manjuh opened 8 years ago

manjuh commented 8 years ago

Hi Everyone,

I wrote below script to calibrate drone calibrate.js `var bebop = require('node-bebop'); var drone = bebop.createClient(); drone.connect(function(){ drone.Calibration.magnetoCalibration(1);

drone.on("MagnetoCalibrationStateChanged", function(data) {
  console.log(data);

}); });`

I executed it using nodejs like below $ nodejs calibrate.js

The output is like below

{ xAxisCalibration: 0, yAxisCalibration: 0, zAxisCalibration: 0, calibrationFailed: 0 } { xAxisCalibration: 0, yAxisCalibration: 0, zAxisCalibration: 1, calibrationFailed: 0 } { xAxisCalibration: 0, yAxisCalibration: 1, zAxisCalibration: 1, calibrationFailed: 0 } { xAxisCalibration: 1, yAxisCalibration: 1, zAxisCalibration: 1, calibrationFailed: 0 }

After calibrating all axis program should end and come out to prompt. It doesnt happen, programs stays in loop with blank screen after shown output. I had to press Ctrl+C to stop program. Is there any solution to it?

Thanks and Regards ManjuH Once the calibration done it should

deadprogram commented 7 years ago

All of the programs that we have written keep running by intention, so they can listen for events. The connect() function starts a timer that sends PCMD commands to the drone here: https://github.com/hybridgroup/node-bebop/blob/feature/firmware-4.0/lib/bebop.js#L249

Some nice person, like you perhaps, can write a disconnect() that disconnects things, that way your scripts can connect, send the commands, and then stop timers etc. to disconnect.

Hope that helps!