Giter Site home page Giter Site logo

puku0x / cvdrone Goto Github PK

View Code? Open in Web Editor NEW
201.0 28.0 94.0 344.89 MB

CV Drone (= OpenCV + AR.Drone)

Home Page: https://github.com/puku0x/cvdrone/wiki/How-to-build

License: Other

Makefile 0.62% C++ 98.92% Batchfile 0.46%
opencv ardrone c-plus-plus visual-studio

cvdrone's Introduction




Hi there! ๐Ÿ‘‹

I am a software developer at Findy Inc. working on Findy and Findy Team+.

I like developing web frontend applications and love to contribute to OSSs like Nx.

I am a big fan of Angular. I organize ng-fukuoka which is a local Angular community in Fukuoka.

My skills

Get in touch

cvdrone's People

Contributors

asmsuechan avatar gtmtg avatar puku0x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cvdrone's Issues

Virtual functions

I have one more request.
Would you please consider making all public and protected methods in ARDrone class as virtual ones?

I made a class derived from ARDrone and I had to overload the loopVideo method in order to send the video frames to the main program with push method, instead of the pull one you used. I couldn't do it without making this method virtual in ardrone.h.

If it doesn't break your idea of the code, making the methods virtual would add a possibility of writing own code based on ARDrone class without the need to modify the original code each time it is downloaded from github.

Once again, thanks for your work!

How to run a Windows example (2.0)

Good morning everyone!

Going back to this question (#22), as I'm also newbie with this and I'm stuck in the same issue.

In my case (using W8/10) is it needed to modify the 'makefile' in (...)\cvdroneEDIT\build\mingw to run the samples? In that case, do I have to replace, for instance, the "PROGRAM = " statement (appearing 'Test.exe') just for 'kalman_tracking.cpp'?

This is what I've done until now, unsuccessfully.

Thank you for your kind support!

Switch off video decoding

Hello,
For a school project, I use "cvdrone" to communicate with the ARDrone. But school PCs are slow, so I want to switch off the decoding of the video flux.
When I comment the function initVideo(), I can't takeoff the drone.
Someone know how to switch off the video decoding correctly?

Thanks

Detect tags

Hi,
Your cvdrone application is very useful to me in my project. I use your application code for reference. I liked the design how you developed.
I'm thinking to integrate April Tags detection libraries with this application. Can you help me on this, if you have already done similar kind of integration with your application?
Thank you so much in advance,

What happens when no commands sent to the drone?

I wonder what commands do you send to the drone to stay in the air when no user input is sent.

I have noticed that sometimes when drone starts flying(after takeoff command) it would simply rotate on its place, which does not always happen.

I am mainly running the drone in a loop which simply reads images (getImage command) and occasionally I send some move3d commands. And I do want the drone to simply hover when there are no commands sent to it. However, I am struggling to understand how.

Beside that, if for a while no commands sent it will just go up to the ceiling.

Simply said, sometimes the drone performs some random manoeuvres. Would be nice if you could say your opinion about it.

I saw another thread as well asking "how to make it hover", which had no responses. I understand that it could be something difficult to achieve and that is why I am not asking for an explicit way of solving but just your opinions.

Thanks,
Fiz

Multi-platform FTP Client

Old version of CV Drone can get "version.txt" from AR.Drone, why not the latest one can do it ?

TODO๏ผš

  • Implement FTP client
  • Get "version.txt" from port 5551 of AR.Drone.
  • Confirm it runs on Win/Mac/Linux.

REQUIREMENTS:

  • Knowledge of FTP
  • Beautiful codes
  • Your enthusiasm

I would appreciate if you contribute to CV Drone.

Regards,
puku0x

Dropping video frames results in frozen video stream

Hi,

thanks a lot for the good work! I am playing around with your test example, and I am facing a pretty weird bug/problem.

Essentially, in a very unreliable way, the video stream from the drone suddenly freezes, causing opencv to always show the very last frame grabbed. I have placed few debugging output here and there, and I have found out that when the freeze happens, in the method
ARDrone::getVideo
the statement
av_read_frame(pFormatCtx, &packet)
is never >= 0, hence no packets are parsed and the loop in
ARDrone::loopVideo
breaks.

I am not sure what could be the problem. I am on Ubuntu 14.04, Ar.Drone Ver. 2.4.8. Have you ever faced this problem? I have tried to change sleeping times (increasing/decreasing them), with no luck. Also, this is completely random. Sometimes I am able to fly and show video without any problem, but most of the time I can only show the video for few seconds. All other communication work fine. Another interesting behavior is that the program has about 5--8 seconds hanging time between when the Drone version is printed and when the first frame comes in (or at least is shown by opencv).

Thanks a lot for your help!

-Fabrizio

How to run an example.

Greetings.

Great job by the way.

I'm little bit new at this. I just saw your library and it seems excelent.

I have already run the make file in /cvdrone-master/build/linux. The output was test.a. However. I don't know what to do next. Can you give me a hint how I can compile and run one of the examples and how I could create my one program? Which are the linkers that I have to use? Thanks.

Autonomous flight

Hi everyone,

Apart from my previous problem, which I have not been able to resolve yet, I was wondering if there is any tool in this SDK to make the drone fly 'autonomously', this is, through the use of waypoints.

Thank you in advance, and have a nice day!

Send command to change Pitch, Yaw, and Roll values

Hi,

Many thanks for this great piece of work. Helped me a lot!

I am just wondering how I can send/create a new command to change pitch, roll, and yaw values. There is a function 'move3d' to change velocity but I am not sure how to change the other values!

I would be thankful if you can help me out.

Thank you very much,

Linker Error

Hello.
I am using cvdrone for my research.
I am using Linux 12.04 and I have ARDrone 2.0.
I successfully installed "makefile" (./test.a perfectly worked!).
As I tried to run sample code files in the sample folder, I am getting many errors.
For instance, as I compile:

include "ardrone/ardrone.h"

int main(int argc, char *argv[])
{
ARDrone ardrone;
return 0;
}

it gives me the following error:
/tmp/ccXbG4uI.o: In function main': test.cpp:(.text+0x33): undefined reference toARDrone::ARDrone()'
test.cpp:(.text+0x44): undefined reference to `ARDrone::~ARDrone()'

Could you help me? Thank you!

ardrone.getAltitude() not reading

Thanks for building great library

I got an issue about reading altitude value.

double altitude = ardrone.getAltitude();
printf("ardrone.altitude = %3.2f [m]\n", altitude);

the result after doing this code is : 0.0 only. Even i move the Ardrone around, but nothing change.

Please help me out
Thanks

ATAM integration

Hi all,

Thank you for using CV Drone !
This time, I would like you to help me.

Do you interested in SLAM ?
I'm fed up with making a sample which just detects a color marker and tracks it.

ATAM seems to be easy to integrate.
https://github.com/CVfAR/ATAM

It is high time to CV Drone to be high-leveled library, isn't it ?

Best regards,
puku0x

Battery percentage and altitude percentage is always 0

Hello,

Firstly thanks for the great library. I am having some problems with functions such as getBatteryPercentage() and getAltitude(). They always return 0(even though battery is fully charged).

Do you have any idea what could be a cause to this?

Thanks,
Fiz.

How to rotate the drone while maintaining it static

Hello everyone!

Thank you in advance for all the help provided not only through the construction of the repository, but also through your kind guidance in this forum.

I'm new in AR Drone programming (and **** in programming in general), and I just wanted to know whether it is possible to rotate the drone, for instance, 30 degrees by pressing one single key (I tried to type down higher numbers of vr than 1.0 without any success; I suppose it has to be related to the speed that the drone takes to accept this command ยฟ?).

Another question that comes to mind is simply how to manage to maintain the drone static in air after taking off. I have just changed all screws, but without any success also; the drone does whatever it wants and it takes a while to start obeying my instructions.

Thanks a lot, and have a nice day!

Link_Quality

Hey!

Id love to see the link quality on screen while flying and if possible, to save that in a log file.
I have near 0 experience with c++ but I'm trying my best,( so far I result only in getting errors.)
Any tips or even code for this?

Thank you!

Frame rate of cvdrone

When I compiled the default example of cvdrone, I get very low frame rate (everything appearing very slowly). My AR.drone version is (2.2.3). What's the issue!

Exception when recording is activated

When I try to cause the drone to record onto a usb stick using the my application throws an exception in opencv.
I believe this is caused during the decode/display of the coded stream.

I have reproduced this with the sample code for video recording. Console output from the videorecord sample code is pasted below.
AR.Drone Ver. 2.3.3
Press 'R' to start/stop recording.OpenCV Error: Bad argument (Unknown array type
) in unknown function, file C:\opencv\modules\core\src\matrix.cpp, line 698

However when I tried the recording functionality in my own application the exception is reported in array.cpp..

Note that the drone has started recording, when I examine the usb stick a new video file has been written to it which contains what I would expect.

When I get time I will see if I can pin down what is causing the exception.

I am running on Windows 8 64bit, using vs2012
Drone is a 2.0 version

Cheers,
Paul

multicolor tracking

hello there, you help me alot on my final project.

can you help me about tracking multicolor? because i need to track like green,blue,red, and black in ar drone camera.

thanks :)

ardrone.move3D(vx, vy, vz, vr): Doesn't go forward when giving valid vx value!

Hi, thanks for giving your great code ^^.

But I have a problem. Although I gave valid vx or vy value, my drone hardly goes forward or backward,
left or right. My drone rotates well(vr) and changes its altitude well(vz), but it doesn't go in parallel directions well, when using ardrone.move3D(vx, vy, vz, vr), with valid vx, vy values.
It seems that it slightly moves, but pretty hard to notice the movement.

Sending Move3D commands to multiple drones (more than 5)

Hi!

Thanks for the library. I am working on controlling multiple ArDrones (more than five) and I have been seeing some strange behaviour. When I attempt to control more than 5 drones, they all receive the take-off command, but when I attempt to send Move3D commands, the commands are either severely delayed or not received at all.

Do you have any suggestions on how to mitigate this problem? I noticed that you advised to sleep between sending commands for a single drone behaving strangely but would this approach work for several drones?

Thanks again for the API.

Connect to the drone wirelessly and have access to internet via Ethernet cable

Hoello Puku0x,

Thanks for your great work, I'm using it for a project that involves evading obstacles recognized via computer vision.

When I work I need to be connected to internet via an Ethernet cable because I receive some data from other source, also I need to be connected to the drone in order to give it the instructions of movement.

I tryed forcing the client_addr to be 192.168.1.2, the default IP that the device that connects to the Parrot AR Drone receives. But I din't managed to use the wireless interface as default. Do you have any clue of how to solve this?

Regards,
EdJuaz.

PD: Sorry, english isn't my main language.

SOLVED:

My bad, I had a mess with the routes. The problem was my computer.

Thanks.

Example vs2010

Hi Puku,

I compiled your example code and used your api.
But I have a small issue here.

Whenever I use your api, aswell as when I build the example, the process allocates more and
more memory. Around 150 kb per second...

Also the yaw value seems to sligtly increase over time....

Is that a known issue?

Also, in case you ever uncomment it, startrecord should look like this:
void ARDrone::startRecord()
{
if (version.major == ARDRONE_VERSION_2) {
sockCommand.sendf("AT_CONFIG_IDS=%d,"%s","%s","%s"\r", seq++, ARDRONE_SESSION_ID, ARDRONE_PROFILE_ID, ARDRONE_APPLOCATION_ID);
sockCommand.sendf("AT_CONFIG=%d,"video:video_on_usb","TRUE"\r", seq++);
printf("AT_CONFIG=%d,"video:video_on_usb","TRUE"\r", seq++);
Sleep(100);
sockCommand.sendf("AT_CONFIG_IDS=%d,"%s","%s","%s"\r", seq++, ARDRONE_SESSION_ID, ARDRONE_PROFILE_ID, ARDRONE_APPLOCATION_ID);
sockCommand.sendf("AT_CONFIG=%d,"video:video_codec","%d"\r", seq++, 0x83);
printf("AT_CONFIG=%d,"video:video_codec","%d"\r", seq++, 0x83);
Sleep(100);
}
}

But your code does not seem to support changing codecs once started....

Codec needs to be changed from:
H264_720P_CODEC = 0x83,
to:
MP4_360P_H264_720P_CODEC = 0x82,

And to stop changed back.

Regards,
Mr Nice

Multidrone Control

Hello,
Your cvdrone is awesome. I use your application code for reference.
Can you help me about making a multidrone control ? I'm doing a project about swarm quadrotor with tracking color as a position feedback. But I have a problem when trying to connect two or more AR.Drone to my laptop.
Thanx :-)

Can you build a linux version?

hi.
It is a great project. The code is simple but powerful. Now, I want to use it in Linux and I tried to migrate it to Linux. but there are some problems before me .

The biggest one is how to migrate the pthread code to the linux, like this:

// Thread for navdata
int flagNavdata;
HANDLE threadNavdata, mutexNavdata;
UINT loopNavdata(void);
static UINT WINAPI runNavdata(void args) {
return reinterpret_cast<ARDrone
>(args)->loopNavdata();
}

I am not familiar with pthread coding. I tried to change it with linux pthread function. but there is a "Segmentation fault" in running. I think it is caused by pthread. But I can not find the bug.

Thank you for your consideration and I will be looking forward to your reply.

crashing in Ubuntu 14 after some minutes!

hello dear friend
special tanks for Ur great source code for Ar.drone.2 in C++ .
its very useful work, specially for whom he want to use another library with ardrone sdk.
BTW...
i tested this code with AR.Drone2(version 2.4.8) on my both windowse (7 x64 with opencv3.0.1 installed on it) and Linux(Ubuntu x64 with Opencv2.4.9 installed on it)
it s running very nice in windows , but it cannot show images real-time in Linux and after some minutes it freezes the video...
i will happy if u could help me ;)
tnks

Connecting Drone based on Ip

Hello,

Thanks for the wonderful sets of libraries. They made my job a lot easier. Is there any way by to define the class of the drone using the ip address. As of now both the drones are connected to a common wifi network and have been assigned differnet ip's.

Thanks

Original Camera Image

Hi,
I want to know if we could get the original camera image rather than the scaled image.
Thanks
Venkatesh B.S.

Correcting English

Hi all,

Thank you very much for using CV Drone.
The library grew up as a useful one and helped many AR.Drone users.

However, I think I wrote a lot of wrong English in comment.

Of course, it is because of my lack of knowledge of English, but if it is possible, please help me.

Sincerely,
puku0x

velocity of drone

hi

i just want to check what velocity of drone is

i mean real velocity which is affected by various factors such as winds or something

so i think i need the value of accelerometer to get velocity

how can i get that value?? or could you tell how i can get moving distance without using gps?

thanks

Drone going sideways

Hi puku0x. Long time no see. I was trying to change the speed in "vx" with values less than 1, let's say for example a value of 0.2 or 0.3 or the counterpart of it. I noticed that the drone goes sideways, the drifting that it has is quite big, even with -1 and 1 the drone goes sideways.

I found out this doing a PD controller to control the "vx". Any help will be appreciated.

Thanks puku0x.

Andres F. E.

Crash in 64 bits version

Hello,

An issue is coming from a switch from 32 bits to 64 bits.
Here what I did to make you able to reproduce the issue:

  • Compile OpenCV 3.1 in 64 bits
  • Compile FFMPEG in 64 bits
  • Unzip the 64 bits library for pthread from the provided zip
  • Open the Visual Studio solution
  • Switch in the settings to 64 bits compilation
  • Change the dependencie's name to link
  • Compile and then execute

I did these steps with both Visual Studio 2012 and 2015 to get the below error:

The application was unable to start correctly (0x000007b).
Click on OK to close the application.

Regards.

Make file error

Hey, I am having make file error. I am not able to build Linux examples. the error is undefined reference to 'operator new (unsigned long)'. and architecture of optimized files are incompatible with i386 output.

Yaw

Hi. I don't know if you have notice that the motion Yaw does not have the same speed turning to the left than turning to the right.

I'm trying to do a controller and I'm having problems sending the commands. Thanks.

lopencv_contrib not found

Nice to see your blog!
I am a high-school student from Taiwan.
Also doing a cvdrone project recently, and found your open project inspiring.
When I managed to follow the instruction to install, I got the "lopencv_contrib not found" error.
I did install opencv both with macport and cmake; I've also add MODULE-PATH (opencv_contrib)to opencv by using cmake gui.
Thank you so much for reading my problem...
Any help will be appreciated!
Have a nice day!
Sincerely,
Alice

using opencv 2.4.9

HI, thank you for you sources.
I am working with opencv now, but I don't like the opencv3.0 and some of the library I want to use is not included in your source. How can I Use OpenCV 2.4.9 with your sources?

Thank you

unit of velocity

Hello!!
your AR drone code is really awesome
i just wonder what unit of velocity of drone?

and also roll, yaw and pitch

thank you!!!

Help with make error

Hello,

I am a novice and need help with an error I get when compiling cvdrone in lubuntu 14.0.3LTS.
The OS came with opencv 2.4.8 but I downloaded opencv 3.1 and compiled and install it.
Then when I compiled cvdrone it failed in last step with library opencv_hal not found.
I read that opencv_hal was depricated in opencv 3.1 and so uninstalled it
and compiled opencv 3.0 and installed it.
Now when I compile cvdrone with just "make" without any change to the unix makefile I get the error:
...
...
g++ -O2 -Wall -D__STDC_CONSTANT_MACROS -c -o ../../src/main.o ../../src/main.cpp
g++ ../../src/ardrone/ardrone.o ../../src/ardrone/command.o ../../src/ardrone/config.o ../../src/ardrone/udp.o ../../src/ardrone/tcp.o ../../src/ardrone/navdata.o ../../src/ardrone/version.o ../../src/ardrone/video.o ../../src/main.o -o test.a -O2 -Wall -D__STDC_CONSTANT_MACROS -lm -lpthread -lavutil -lavformat -lavcodec -lswscale -lopencv_calib3d -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_hal -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_video -lopencv_videoio -lopencv_videostab
../../src/ardrone/video.o: In function ARDrone::operator>>(cv::Mat&)': video.cpp:(.text+0x1ce7): undefined reference tocv::cvarrToMat(void const_, bool, bool, int, cv::AutoBuffer<double, 136u>)'
../../src/main.o:
In function main': main.cpp:(.text.startup+0x382): undefined reference tocv::cvarrToMat(void const
, bool, bool, int, cv::AutoBuffer<double, 136u>_)'
main.cpp:(.text.startup+0x482): undefined reference to cv::String::allocate(unsigned int)' main.cpp:(.text.startup+0x4a3): undefined reference tocv::imshow(cv::String const&, cv::_InputArray const&)'
main.cpp:(.text.startup+0x4ab): undefined reference to cv::String::deallocate()' main.cpp:(.text.startup+0x6c4): undefined reference tocv::String::deallocate()'
collect2: error: ld returned 1 exit status
make: *** [test.a] Error 1

Any ideas how to fix this ? Thanks a lot !

Help with Autonomous ARDrone

Hi,
I am working on ARDrone with CVDrone.

My problem is : without keyboard control, when i run the program, Ardrone automatically take off and then it sleep about 3 seconds : sleep(3000)
and then keep moving upward until the altitude is 2 m and stop there.

It looks simple but i was trying so many time. i could not make it work

Please need some helps.
Thanks much.

Not compatible with OpenCV 3.1

Hello,

On Windows with Visual Studio 2012 and 2015, after changing the dependency from OpenCV 3.0 to OpenCV 3.1, the code crashs before to start with the following message:

The application was unable to start correctly (0x000007b).
Click on OK to close the application.

And the library opencv_hal doesn't exists anymore in OpenCV 3.1.

Any hint on how to update from OpenCV 3.0 to 3.1?

Thanks in advance.

How to make the drone hover steady?

Hi,

Thank you so much for providing this great code. It is so easy to compile and play with it.

However, when I am not pressing any key, it start drifting. I want to keep the drone in the fixed point in the room when it start hover. Do you have a solution for that?

Bests,
Leon

About move3D command

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.

  • Daniel

No keys Control

i tried compiling the code on ubuntu 14.04, which gets compiled properly. i am also able to obtain a video feed, but it' doesn't accept any key. Nor i am able to takeoff nor i am able to exit. Any solution ?

Define for missing vsprintf_s

Hello puku0x,

Thanks for your code, this is exactly what I needed!

I compiled your code with MinGW compiler on Windows and everything went fine with one small exception. MinGW does not have vsprintf_s function, as it's Microsoft's extension.

Could you please add these lines to ardrone.h?

#ifdef __GNUC__
#define vsprintf_s vsnprintf
#endif

It won't break anything for VisualStudio users and I won't have to modify the code after each new revision.

av_free_frame not declared when using with ubuntu 12.04

hi, apparently i have installed ubuntu 12.04, then also had done with apt-get update, apt-get upgrade, install ffmpeg, install libopencv-dev, install build-essential and install libav-tools. then i proceed making file with make command under the build/linux directory. i had the error message saying that av_free_frame not declared from video.cpp. i need help with this.

Time Stamp

Hi,
I was able to access the time stamp using 'navdata.time.time' . One issue: I read the sensor readings every 30ms. Most of the time the difference between the time stamps is around 30ms however after around every one second the consecutive time difference is around 1.1 seconds. I am not able to understand this.
If you need additional details I can let you know.

----Checked:
I checked it and it seems the same problem win ROS too.
Not sure why it happens though

Thanks
Venkatesh B.S

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.