ARDrone 1.0 win32 program source code and ARDrone 2.0 C # control program source code-PC-controlled aircraft

Source: Internet
Author: User
Tags visual studio 2010

The ARdrone1.0 program does not fully support the current ArDrone2.0 and receives less than 2.0 of the image data! )

The ARDrone2.0 program also has (by Demon_su), which is attached to the end. (2012.10.22)

ARDrone1.0

ARDrone1.0 win32 source program Configuration

ARDrone is a French-made unmanned aircraft. It is a flying toy and is called a four-axis aircraft. If you don't know what this is, you can check Baidu. Because the lab teacher is interested in this new thing, he bought the plane (RMB for all, and RMB for Kinect) and asked me to get the airplane program under windows, that is, use a notebook to control the plane. In this way, the lab can combine the original project with it, which will be very interesting. The code in the SDK has found too many errors. I don't know why they have published the Code with so many problems.

On the opposite side, I went to many websites and found almost all the ARDrone control programs related to the PC, but I didn't find a controlling plane running. After connecting to an airplane with an iphone or ipad, the firmware of the airplane is automatically updated to the latest version (firmware 1.7.10 and SDK is 1.8). Is it because the firmware version is too new and cannot be identified by any software? Huang Tianyan pays off, finally found a blog http://blog.csdn.net/lxiaoxiaot/article/details/6673700 on csdn

However, according to the strange modification method on the blog, the more I don't change it, the more problems I have to modify. Because vs2010 is used, there is a problem with how to modify it. Later, kinghuangjin (the name of the CSDN blog) told me that he had modified it according to his blog method, but he still could not fly. He gave me several programs, but I still cannot use them. I am very grateful for the help he has provided and it is very painful to modify the program. (The Code cannot be fully understood, but the change is not complete ). Leave a message to the blogger. The blogger will reply to me and send me new source code.

ThanksLxiaoxiaotContribute the modified Code. However, this code is still problematic. Here, I will provide a link for downloading my modifications. It took about five days to solve this problem!

This article is divided into four parts: one configuration, two corrections, three of them, and four appendices. The configuration part ensures that you can successfully compile the program. The correction part is aboutLxiaoxiaotModify the code and introduce the Aircraft Control Section. Others talk about some immature solutions to the combination of the ardrone program and other projects. The appendix describes download websites and reference websites.

 

Part 1: Configuration

If you use the same configuration as vs2008, you 'd better download the lxiaoxiaot code and then modify it.

1. Install Direct SDK (Figure 1), and Visual Studio 2010

Http://www.microsoft.com/download/en/details.aspx? Displaylang = en & id = 6812

2. Copy the Parrot folder to D: disk or another disk (you can download it from the address given in the appendix and decompress it)

(Figure 2)

Http://download.csdn.net/detail/guoming0000/3965482

3. Open ARDrone. sln under D: \ Parrot \ Examples \ Win32 \ VCProjects \ ARDrone

4. Modify ArDrone_properties.vsprops (note that there is a file with the same file name but different extensions. You should know to open it with vs2010 or any notepad ). Modify the Value of ARDroneLibDir and Win32ClientDir according to the storage address of the Parrot folder (preferably not on the desktop ). Here:

<UserMacro

Name = "ARDroneLibDir"

Value = "D: \ Parrot \ ARDroneLib"

Repeated menvironmentset = "true"

/>

<UserMacro

Name = "Win32ClientDir"

Value = "D: \ Parrot \ Examples \ Win32 \ sdk_demo \ Sources"

/>

Close vs2010, and then open ArDrone_properties.props (note the extension)

<ARDroneLibDir> D: \ Parrot \ ARDroneLib </ARDroneLibDir>

<Win32ClientDir> D: \ Parrot \ Examples \ Win32 \ sdk_demo \ Sources </Win32ClientDir>

Follow the modification just now, modify it again, save it, disable vs2010, and then enable it. (Whether necessary or not, this is an insurance)

5. Add the include directory and library directory

Perform operations on Win21Client first

 

(Figure 3)

 

(Figure 4)

$ (DXSDK_DIR) \ Include

$ (ARDroneLibDir) \ SDL \ include

(The ARDroneLibDir here is not very familiar, that is, the file was added just now. You can click the "macro (M)>" button to see if the address is correct)

(Figure 5)

$ (ARDroneLibDir) \ SDL \ lib

$ (DXSDK_DIR) \ Lib \ x86

(If you have some knowledge about SDL, it is a simple open-source image display project, which is already placed in a folder, so you don't need to download it or ignore it, it only involves the display part)

Perform the same operation on ArDroneAPI.

6. After the configuration is complete, set Win32Client to "set as startup project" for compilation!

After is connected to the computer, the way in http://ardrone.parrot.com/parrot-ar-drone/zh/support/update

Install the configuration in the above process. Do you want to disable the firewall? I disabled it anyway. (It doesn't matter if there is no specific verification in time rush ). After the connection is successful, the program will be run. It is recommended to play it in an open outdoor location. (Hold a large notebook =)

If you have any questions, you can try again. Or join the Parrot AR. Drone discussion group: 177273140. If I have any other problems, the group will solve them for you.

 

ARDrone1.0 win32 Part 2: Correction

My code is modified on the basis of lxiaoxiaot. If you get his code down, there will be a problem during compilation and there is a need to modify it. First, an error will be reported in the vp_ OS _signal_dep.h file, indicating that the pthread. h header file cannot be found. Baidu said that this file is a file in linux, but windows does not. Observe the first few lines of vp_ OS _signal_dep.h and soon find that the macro definition must be changed. Comment out # define USE_PTHREAD_FOR_WIN32 and open the # define USE_WINDOWS_CONDITION_VARIABLES macro definition in the comment (that is, remove ).

Then open gamepad. cpp, find the C_RESULT open_dx_keyboard (void) function, replace one of the functions with fDIKeyboard-> SetCooperativeLevel (hDlg, DISCL_BACKGROUND | DISCL_EXCLUSIVE); that is, replace the keyboard event of the front-end listener, in this way, no matter when you press the keyboard (naturally, after you have run the program), the program will capture your key events. I don't know why the program is correct. I think it is possible that the display window is always preemptible to the front-end, so we cannot press the buttons in the cmd window, so the front-end capturing will be useless. You also need to try it for yourself. For me, I need to capture buttons in the background.

There are thousands of lines of programs that fully involve fields I have never done. In addition, I don't like the tedious C language, so I don't even want to read them. Find the C_RESULT update_dx_keyboard (void) function, which is the function for capturing Keyboard Events. The GetDeviceState function checks the keyboard status every 20 ms. You can take a closer look at this function. DIK_NUMPAD2 these macros starting with DIK _ are the values corresponding to the keyboard. I have already put some control ideas in the ardronekeyboard control. txt file. These days are very windy and indoors, so I have not tried any of the commands. I don't know if I am right or wrong. The keyboardState variable stores the numeric array of those keys. You can change it so that it can be controlled without using the keyboard. As to the method used, the next section provides a simple idea.

 

Part 3: Others

Since PC is used, it is generally necessary to combine airplanes with existing projects, so it is just fun to purchase 2000 of airplanes. In fact, the plane is not very fun, and the battery of Apsara is useless. If we need to communicate with the c/c ++ program, the simplest way is to use the "Clipboard" of windows ", here are several functions, clipboard () function under matlab.

Data = 'Copy the string content to the clipboard ';

Str = mat2str (data );

Clipboard ('copy', data );

% Str2 = clipboard ('paste ');

GetClipboardData under MFC, which is available in the Win32TestPure folder. It is troublesome to use. Search for it by yourself. In this way, inter-process communication can be realized. Then, you can combine the original project with him. As for how to implement it, I have my own thoughts. I didn't take that step. Here I only provide simple solutions.

If you have any questions, please leave a message. (Before, after. Time is too busy.) due to lack of learning skills, this article has not been verified by myself. If there are any errors, please correct them. If you have other better ideas, please share them. We wish you a merry Christmas ~

 

ARDrone1.0 Part 4: Appendix

Reference website:

Domestic professional 4-Axis Flight Website: http://www.ourdev.cn/bbs/bbs_list.jsp? Bbs_id = 1025

Official Website: http://ardrone.parrot.com/parrot-ar-drone/usa/

Lxiaoxiaot code (some, problems need to be modified): http://download.csdn.net/detail/lxiaoxiaot/3833619

----------------- If this split line is not added, the following error link can be found --------------------------------------------------------------

My code (ARDrone source program, small modifications on lxiaoxiao, c ++ clipboard program, and word in this article ):

Http://download.csdn.net/detail/guoming0000/3965482

 

Direct Keyboard Input: http://dev.gameres.com/Program/Control/Dinput.htm

ARDrone2.0 C # control and Image Display programs

This code is composed of Demon_su

Below is the run

C # download code (vs2012)

Welcome to the QQ group: 224061928 for ARDrone development and discussion

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.