Login to disable ads!

Problems on scripting the Drone

Problems of AR Drone 2.0, Freeflight 2, Flight Recorder GPS, Qgroundcontrol... etc.
Post Reply
Flips
Newcomer
Posts: 2
Joined: 01 Dec 2019, 13:39
Drone Type: AR.Drone 2
Has thanked: 0
Been thanked: 0

Problems on scripting the Drone

Post by Flips » 01 Dec 2019, 13:43

Hey,
I am trying to create lessons for students on algorithmic using the AR.Drone 2.0. Therefore I want to lower the necessary understanding on programming to a bare minimum. Because of this I am rewriting the methods given in the node.js library ‘ar-drone’ from nodecopter. If my program is still small ( has only one method declaration) the method runs without any problem and the drone lifts off the ground. However the moment I make the script more complex by adding more methods(functions) the script stops to run properly, even if the methods itself should run without any problem. This also seems to happen in for and while loops. If the loops get more complex, the drone doesn’t run the script properly.
Does anyone know a solution for this or can give me a hint on where my problem resides.

This works... If I add more functions so this document it doesnt run anymore.

Code: Select all

var arDrone = require('ar-drone');
var client = arDrone.createClient();

	hebeAb();

function hebeAb(){
	client.takeoff();
}
Greetings Florian

Flips
Newcomer
Posts: 2
Joined: 01 Dec 2019, 13:39
Drone Type: AR.Drone 2
Has thanked: 0
Been thanked: 0

Re: Problems on scripting the Drone

Post by Flips » 10 Dec 2019, 16:12

So a week into my further research i can you the answer if anyone ever has the same problem.
Compared to the drone script runs rather fast and while Timeout-functions can be used, javascript runs asynchron and saves these invokes for later. Therefore if javascript already parsed the last line before the drone even "lift-off" it will send the signal to land again. So in order to use more complex structure one has to set Timevariables on each invoke. For loops its different. Javascript acknowledges the first interval for the timeout but ignores everyone after that. So there might be a loop that goes to 500 but every action is almost called at the same time, so there is no visible difference in the drone.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest