MahatmaX / YADrone

Yet Another Drone Framework (for the AR.Drone 2)
39 stars 40 forks source link

Flight time increases when using multiple move()-commands #20

Open andixd opened 10 years ago

andixd commented 10 years ago

I'm using the YADrone-Lib with Processing 2.2.1 to control my AR Drone 2.0.

When using multiple move()-commands it seems to add the past time to the time of the current command.

Example: cmd.move(10, 0, 0, 0).doFor(1000); cmd.move(0, 10, 0, 0).doFor(1000); cmd.move(-10, 0, 0, 0).doFor(1000); cmd.move(0, -10, 0, 0).doFor(1000);

This should move the drone forward, left, back and right (each for 1 second). The script executes each command at the right time (each after 1000 millis), but the drone doesn't react properly. In my case its more like 1 second forward, 2 seconds left, 3 seconds back, ... or sometimes even more confusing.

Most of the times it seems to work properly only once after first connecting with the drone. The following runs show that weird behavior.

MahatmaX commented 10 years ago

Hi, the move-function has been adopted from the ARDroneForP5-project, I personally have not yet tested it - and due to a lack of time I am currently not able to :-( - but there are some things you might want to try:

1) There are 2 move-functions (with 4 parameters):

You are using the latter. Actually, that one calls the first one, but transforms parameter. I would suggest to test the first one instead. Instead of e.g. cmd.move(10, 0, 0, 0) use absolute float values like e.g. cmd.move(0.5, 0.0, 0.5, 0.5) (all parameters must be in range [-1,+1]) and see what happens. The commands are scheduled like any other command, therefore I think the scheduling should be fine.

2) I mostly use forward(), backward(), goLeft(), goRight() instead. These should work fine for your case.

If you tested it, I would be glad if you get back to me and report your findings. If there is a problem with the move function, I would open an Issue on Github and try to solve that as soon as I have more time (in August).

Thanks for your report so far, Cheers Dirk

Am 23.06.2014 10:10, schrieb andiced:

I'm using the YADrone-Lib with Processing 2.2.1 to control my AR Drone 2.0.

When using multiple move()-commands it seems to add the past time to the time of the current command.

Example: cmd.move(10, 0, 0, 0).doFor(1000); cmd.move(0, 10, 0, 0).doFor(1000); cmd.move(-10, 0, 0, 0).doFor(1000); cmd.move(0, -10, 0, 0).doFor(1000);

This should move the drone forward, left, back and right (each for 1 second). The script executes each command at the right time (each after 1000 millis), but the drone doesn't react properly. In my case its more like 1 second forward, 2 seconds left, 3 seconds back, ... or sometimes even more confusing.

Most of the times it seems to work properly only once after first connecting with the drone. The following runs show that weird behavior.

— Reply to this email directly or view it on GitHub https://github.com/MahatmaX/YADrone/issues/20.