puku0x / cvdrone

CV Drone (= OpenCV + AR.Drone)
https://github.com/puku0x/cvdrone/wiki/How-to-build
Other
202 stars 94 forks source link

About move3D command #13

Closed danielbai closed 9 years ago

danielbai commented 10 years ago

Hi puku0x,

Your code did help me a lot with my current project. What you did is really a nice work. I have a question about moving control commands.

If I send 'ardrone.move3D(1, 0, 0, 0)' once, how far will the drone move forward? Do I need to keep sending this command in a loop in order to keep it moving ahead? I have tried to do it, the drone does move but it moves slowly and shakes. I mean it can't move smoothly. I would appreciate it if you could help me. Thank you.

puku0x commented 10 years ago

Hi Daniel,

Thank you for your comment.

AR.Drone doesn't move if you send move3D() just once, you should keep sending it.

It is also important to keep the interval of sending the command over 30[ms]. When your drone shows strange behavior, you should decrease the frequency of sending command.

while (1) {
    // Key input
    // NOTE:cvWaitKey doesn't keep 30ms when a key is pressed !
    int key = cvWaitKey(30);
    if (key == 0x1b) break;
    // Sending a command
    if (key == up) move3D(1,0,0,0); // go forward
    msleep(30);     // Like this, waiting 30[ms]
}

Regards, puku0x

danielbai commented 10 years ago

Hi puku0x,

Thank you very much, you really helped me solve a big problem!

Sincerely, Daniel