hi,
recently i've started programming ar drone with your great API. now i want to play some enjoying tasks. i have my algorithm for detecting objects. now my question is: if i can detect specialy object, then how can i interact with that, obviously my task is landing an ar drone on specialy object. if i can detect the object precisely so how can i command to ar drone land on that object. you can imagine that i can detect that object in real time. any help or document, i'll appreciate.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I agree with you, detecting things and let the drone react to that are the most interesting tasks for me, too. In general it is not so complicated, but there are some annoying traps which makes things complicated.
Well, I have some helpful documents, but they are in german, so it might be a good idea to create an interactive tutorial here.
Lets focus on reacting on markers, detected by the camera at the front, as seen at firstTagDetection.py at the tutorial, for the beginning to get a feeling for this task.
I would suggest to create a program, which lets the drone always look to the marker. Rotating and altering the drone are the best movements for the beginning.
You will recognize that the marker detection isn’t working very good – the detection looses the marker sometimes. Its a problem of the drone, that’s why I prefer own detection-methods...but that’s an other story. Anyway, you need to react to that (also later, when using OpenCV) by assuming, where the marker should be.
You will also see, that the drone might starts to shake or wave, if the movements are to aggressive. Here you need a PID-control-system. By using rotating and altering, there is almost no inertia-reaction, so you just need a P-control-system here.
if i'm right the PID controller has made for controlling shake or wave??
i'm studing machine vision and i'not familiar enough with drones.
my question has little difference. let me acknowledge the my algorithm is robust enough to detect. but i dont know how i must tell drone to go for object. is it possible to write a code e.g moveForward() or moveRight or something like that which can track(simply) object??? or i must read more about drones or something like those???
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Sayad,
the drone-related stuff is not very complicated, you don't need to read everything :-)
Did you manage to grab pictures from the drone's cameras, so that you can run your algorithm ? It's not a big deal, if you didn't.
Well, your algorithm is able to detect an object, and I assume that your algorithm returns a position where the object/marker is located on the picture.
Let's assume, the object has to be in the center of the picture, that's on position X=1280/2=640 and Y=720/2=360, if you use HD-mode.
Your marker was detected on...let's say X=600 and Y=400, that's a bit on the left and a bit below the center.
I suggest to focus on the x-axis here. So just move the drone to the left (e.g. moveLeft(0.25) or move(-0.25,0,0,0)). That's a simple P-controller.
You will notice that the marker will be never in the middle this way, if the drone moves to the left, it will (normally) move to far and correct this by moving to the right. That's the waving I talked about.
The trick is, to find the best speed to move. Its a lame trick, because its pretty simple:
If you are to slow, there is nearly no waving, but it takes ages setting the drone to the right position, If you are fast, the movement is more dynamic, but there is a significant waving. Thats good, because you can fix this by implementing a D-controller, but lets talk about that later.
If you move to fast, the waving becomes stronger, the longer you try to correct your position...that's not good.
I suggest to focus on one dimension (e.g. x-axis (here left/right)), you can use later the same algorithm for Y, Z and rotation.
Next step: get rid of the waving by implementing a D-controller.
Hope you understand why I am still talking about controllers. Feel free to ask if you have questions or something is unclear. You can also send me a personal message if you like.
Good luck,
Philipp
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hi,
recently i've started programming ar drone with your great API. now i want to play some enjoying tasks. i have my algorithm for detecting objects. now my question is: if i can detect specialy object, then how can i interact with that, obviously my task is landing an ar drone on specialy object. if i can detect the object precisely so how can i command to ar drone land on that object. you can imagine that i can detect that object in real time. any help or document, i'll appreciate.
Hello Sayad,
I agree with you, detecting things and let the drone react to that are the most interesting tasks for me, too. In general it is not so complicated, but there are some annoying traps which makes things complicated.
Well, I have some helpful documents, but they are in german, so it might be a good idea to create an interactive tutorial here.
Lets focus on reacting on markers, detected by the camera at the front, as seen at firstTagDetection.py at the tutorial, for the beginning to get a feeling for this task.
I would suggest to create a program, which lets the drone always look to the marker. Rotating and altering the drone are the best movements for the beginning.
You will recognize that the marker detection isn’t working very good – the detection looses the marker sometimes. Its a problem of the drone, that’s why I prefer own detection-methods...but that’s an other story. Anyway, you need to react to that (also later, when using OpenCV) by assuming, where the marker should be.
You will also see, that the drone might starts to shake or wave, if the movements are to aggressive. Here you need a PID-control-system. By using rotating and altering, there is almost no inertia-reaction, so you just need a P-control-system here.
Wikipedia explains it pretty good: https://en.wikipedia.org/wiki/PID_controller
This PID-control-systems are important for e.g. letting the drone following you or compensating the lag in video-transmission. I suggest to talk about that later.
I posted some code and a video here:
https://sourceforge.net/p/ps-drone/discussion/general/thread/ee9cd802/
The shown control-systems are exactly the same I used to make the drone follow or react to objects.
Hope this helped to start, if you have any further questions, you are welcome to ask :-)
Happy coding,
Philipp
thank you very very much for your help
Last edit: sayad_yaghoobi 2017-06-27
if i'm right the PID controller has made for controlling shake or wave??
i'm studing machine vision and i'not familiar enough with drones.
my question has little difference. let me acknowledge the my algorithm is robust enough to detect. but i dont know how i must tell drone to go for object. is it possible to write a code e.g moveForward() or moveRight or something like that which can track(simply) object??? or i must read more about drones or something like those???
Hi Sayad,
the drone-related stuff is not very complicated, you don't need to read everything :-)
Did you manage to grab pictures from the drone's cameras, so that you can run your algorithm ? It's not a big deal, if you didn't.
Well, your algorithm is able to detect an object, and I assume that your algorithm returns a position where the object/marker is located on the picture.
Let's assume, the object has to be in the center of the picture, that's on position X=1280/2=640 and Y=720/2=360, if you use HD-mode.
Your marker was detected on...let's say X=600 and Y=400, that's a bit on the left and a bit below the center.
I suggest to focus on the x-axis here. So just move the drone to the left (e.g. moveLeft(0.25) or move(-0.25,0,0,0)). That's a simple P-controller.
You will notice that the marker will be never in the middle this way, if the drone moves to the left, it will (normally) move to far and correct this by moving to the right. That's the waving I talked about.
The trick is, to find the best speed to move. Its a lame trick, because its pretty simple:
If you are to slow, there is nearly no waving, but it takes ages setting the drone to the right position, If you are fast, the movement is more dynamic, but there is a significant waving. Thats good, because you can fix this by implementing a D-controller, but lets talk about that later.
If you move to fast, the waving becomes stronger, the longer you try to correct your position...that's not good.
I suggest to focus on one dimension (e.g. x-axis (here left/right)), you can use later the same algorithm for Y, Z and rotation.
Next step: get rid of the waving by implementing a D-controller.
Give this mentioned thread a chance:
https://sourceforge.net/p/ps-drone/discussion/general/thread/ee9cd802/
Here you will find a nearly out-of-the-box-solution...or at least an inspiration, how to solve your task as fast as possible.
Hope you understand why I am still talking about controllers. Feel free to ask if you have questions or something is unclear. You can also send me a personal message if you like.
Good luck,
Philipp
tnx phillip
i read that and i'll inform you the result