Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARDrone 2 support #2

Open
wants to merge 61 commits into
base: master
Choose a base branch
from
Open

ARDrone 2 support #2

wants to merge 61 commits into from

Conversation

jjh42
Copy link

@jjh42 jjh42 commented Jun 6, 2013

I'm not sure if you're interested in maintaing this library. These are the changes I had to make to get it working with my ardrone 2. I've also added unit tests and support for testing on travis-ci.org

@jjh42
Copy link
Author

jjh42 commented Jun 6, 2013

Oh I should have - the starting point was @adetaylor 's fork.

@krsapkota
Copy link

Hi!
I am just being able to get around 5 FPS of decoded video. The raw video is being fed at the good rate but the decoded output (from ar2video.py) is too slow. Is there a way this can be sped? I am talking about H.264 decoder using ffmpeg.
Thanks

@jjh42
Copy link
Author

jjh42 commented Jul 19, 2013

what is taking up all the CPU time - python for ffmpeg? If its ffmpeg it
may be difficult.

On Fri, Jul 19, 2013 at 12:27 PM, krsapkota notifications@github.comwrote:

Hi!
I am just being able to get around 5 FPS of decoded video. The raw video
is being fed at the good rate but the decoded output (from ar2video.py) is
too slow. Is there a way this can be sped? I am talking about H.264 decoder
using ffmpeg.
Thanks


Reply to this email directly or view it on GitHubhttps://github.com//pull/2#issuecomment-21271799
.

Jonathan J Hunt j@me.net.nz http://www.me.net.nz
"Science is the belief in the ignorance of experts" Richard Feynman

@pythonmobile
Copy link

Any chance this code will be maintained?

@jjh42
Copy link
Author

jjh42 commented Jan 2, 2014

@pythonmobile our fork of this repo is here.
https://github.com/braincorp/python-ardrone

It works (for us) consistently with the v2 of the AR Drone (we have not tested v1).

@gambitrix
Copy link

Code does not work on my parrot drone 2.0. I run it, and the lights just turn red. No video feed, nothing. Any suggestions ?

@adetaylor
Copy link

Not off the top of my head - I'd suggest putting in lots of prints to work out how far it's getting and exactly which step causes the lights to turn red.

@gambitrix
Copy link

Thank you for the prompt response. Ok I will try that. Im just trying to run the demo file and it seems to be failing. Ill try and see where its getting stuck. Im guessing you had no issues with your connection ?

@gambitrix
Copy link

It doenst seem to be getting stuck in any code, the video feed pops up with changing FPS but its just a black screen.

@adetaylor
Copy link

Yeah I had lots of issues, since the code didn't support the AR.Drone 2 at all until I started hacking at it :-) But that was a long time ago and the code has moved on since then.

@gambitrix
Copy link

I literally just baught the drone today as I am going to be using it for my thesis. Im quite worried now that I cant get it to work with the 2.0. It works fine with the 1.0 but the video feed is not fast enough for what I need it for. Is there anything you could suggest or help with? Im really desperate at the moment.

@gambitrix
Copy link

Not sure if this is useful information but when the lights on the drone go red, the print out says warning: root connection established. I dont think that sounds like an issue though

@adetaylor
Copy link

Nope, just go debug it. Assuming you know some Python you ought to be able to get it working. Trace that you're getting responses from the AT commands sent by the script. As I said, see which one of the commands makes the lights go red (maybe use sleeps in between the steps). Debug through the backchannel where video comes back. I'm sure you'll get it working… but you might have to put some effort in!

@gambitrix
Copy link

OK thanks for the reply. Im guessing you got it working for the Parrot Drone 2.0 ? Its just strange that its not working now.

@adetaylor
Copy link

Yes, works fine on my AR.Drone 2.0. Not very strange. I expect there are firmware differences, timing differences, protocol differences, or just luck differences which account for this. This is not fully supported released software, the AR.Drone 2.0 support has probably only been used by 3 or 4 people ever, all of whom have spent time working out whatever issues occur for them. You'll need to do the same. Good luck!

@gambitrix
Copy link

Ok thank you for the help, I really do appreciate it. Just one last thing, im guessing that the lights turning red on the drone are a result of a communication protocol issue ? Just so that I know where to start looking for the possible issues.

@adetaylor
Copy link

I think so, but I can't remember for sure. It might be that it's caused by the drone going into its own 'danger' mode.

You could try grabbing my version of the code instead:
https://github.com/adetaylor/python-ardrone
Maybe you'll have more luck?

Now you mention it, I have a sneaky feeling that this fix might have been similar to what you need:
adetaylor@be409d0

That's included in my branch so if you get mine, maybe it will work. Maybe.

Because there are not many people who care about this right now, none of us have made the effort to merge all the different forks. Yet.

@gambitrix
Copy link

Thank you kindly for your help. Ill try it out right away. I wonder why so few people are interested in this? I would have thought people would go nuts to be able to write their own python scripts to fly their drones autonomously

@adetaylor
Copy link

Progress… see if you can control the drone with the various keys listed inside demo.py. I have a feeling that 'return' does a take off but see what is inside the script.

For video, I'd recommend checking to see if ffmpeg is running on your PC using ps (I assume you're running this on Linux or Mac; it's probably never been tried on Windows, but if so, taskmgr). That's a key part of the video pipeline.

@gambitrix
Copy link

The thing flies and responds to commands, its just the video feed thats blank. Responds to take off. I am running Ubuntu and I just installed ffmpeg before trying to run this code. Im guessing then that the issue lies with ffmpeg ?

@gambitrix
Copy link

I installed ffmpeg from a PPA. When I use ps to check the processes. I see ffmpeg in ps list

@adetaylor
Copy link

So the pipeline works like this:

  • Drone sends video in insane PAVE format, which is H.264 wrapped in a crazy format
  • Python handles socket connection and unwraps PAVE format data, to get pure H.264
  • H.264 data gets sent to ffmpeg in a pipe
  • ffmpeg sends raw frame data back in a pipe
  • Python reads that raw frame data and converts to numpy arrays
  • numpy arrays converted to PyGame surface and displayed on the screen.

It could be going wrong at any one of those stages, but that should give you enough information to figure out how to debug it. A good start would be to use top or similar to see if ffmpeg seems to be using lots of CPU (implying it's doing decoding). Wireshark would also be a good tool to ensure video data is actually arriving from the drone.

@gambitrix
Copy link

That helps so much. Thank you for your time and effort. ffmpeg seems to be decoding, since it seems to be using about 15 percent CPU when the code is running, so ill try and see if I can look further down the line to see where the issue lies.

@gambitrix
Copy link

Hi adetaylor, once again thank you for all of your help. I am in the final stages of submitting my project. I have a quick question though regarding the library. Do you know if there is a way I can set nav data ? So how it satnds at the moment is that I can receieve the nav data from the drone, the idea is to then use a PID controller, calculate the new params and then use some sort of nav data set method to make the drone react to the new nav data that I have set. Is there a way to do this ? Or is the only way of controlling using this library to send left/right up/down and the speed?

Regards

@adetaylor
Copy link

I think you'll probably have to command the drone to fly to the new position that you want, using suitable turn and move commands. Regrettably it's a physical object not just a sprite in a game…

@Trigun001
Copy link

Also worked with this code heavily for my thesis. I made quite a number of changes and tried about 10 different video decoding methods. Consistently get 30 fps but with a 0.5 second latency. It is almost certainly introduced when decoding with FFMPEG. The C-based IDE offered by Parrot is much closer to 0.2 seconds. If anyone can solve it, it seems to be one of the final issues this project is facing.

@Temennigru
Copy link

1- To solve the red light problem run the script twice. That seems to work for me.
2- Does anyone know how to switch the camera to the vertical one? I've tried running at(at_zap, 2) but it doesn't seem to work.

@Ellebkey
Copy link

Hello im using this library, has some issues establishing the conection sometimes, but overall it works pretty good, the only problem that i get right now is when i trying to change the configurations of the drone. For example:

drone.at(at_config,"control:altitude_max", "5000")
drone.at(at_config,"control:outdoor", "TRUE")

but when i call the configurations does not change. Am i doing something wrong?

@adetaylor
Copy link

Hi @Ellebkey, glad to hear it's kind of working. I personally can't remember enough about this to speculate why that might not be working but maybe others can. Some neuron at the back of my head says that a more complicated exchange of messages might be required in order to actually set a config. You might want to see if any of the other APIs in the library end up sending at_config and see how they do it. But the neuron might be fibbing to me, and that might be a complete red herring. Sorry if so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants