Thursday, March 31, 2011

New URBI Info

Take a look at this. It's an update from the guy that modified urbi for the AR Drone:

http://translate.google.fr/translate?hl=fr&sl=fr&tl=en&u=http%3A%2F%2Fwww.psykokwak.com%2Fblog%2Findex.php%2F2011%2F03%2F28%2F60-ar-drone-et-urbi-embedded

I think we can use urbi again, and even better, it's actually embedded on the drone in this more recent example. The site above is originally in French, but this link should provide a translated version. The post that I'm reading is dated March 28, 2011. The only question is weather or not the new urbi download he's providing works with the new firmware. The download is for urbi 2.6. I'm hoping it works.

This is the link to his urbi software package:

http://www.psykokwak.com/blog/images/ardrone/urbi-sdk-2.6-525.tar

This is the link to the howto video:

http://www.youtube.com/watch?v=Cdxq89CigcI&feature=player_embedded

There's more stuff on the translated french site:

http://www.youtube.com/watch?v=Wiv4rC-doJI&feature=player_embedded

Tuesday, March 29, 2011

Follow up to "Running an application on the drone"

So after working on my UDP client for a while (using a server to echo any commands received) I have been able to develop a working application for the drone that runs natively on it. The code has to be compiled for ARM and is through the CodeSourcery IDE.

Initially I had figured I'd make something that just runs a set of commands and then you would have to edit the source, recompile, etc. to get a different set of commands. Upon further review I decided this wouldn't be all that flexible and would generally be boring. So I wrote up a small command line app that takes commands directly from the standard input and sends them to the drone. Something like "takeoff" or "land" or "gaz .4". Today was the first day I was actually able to test the code and after a few minor changes it worked! I immediately found that I had the same issue with this code as we had had with nearly everything else we'd written for the Drone. We could do the usual takeoff and land and even adjust the Yaw and Gaz, but yet, as usual, we were unable to get the drone to move forward or backward. I dug into the AT command to make sure every bit of information was being sent correctly, and this seemed to be the case. Even other users in the community had used the same commands.

When developing the app I had figured I might run into this issue again, so I had written it so that a thread is immediately dispatched when the code is executed. This thread sends a simple AT command to the drone every 100ms or so, simply to keep the connection alive. In the past when we had looked at this issue before, Dave had found that with a constant "heartbeat" command, we were able to get Pitch and Roll working. Alas, this didn't seem to fix the issue in my case, or so I thought. So I had been sending a command that simply set the Yaw, Pitch, Gaz and Roll to their current settings. So the command had no visible effect on the drone but it did keep reminding it of its current status.

Upon further research I found that this issue had actually been come across by others and they had take a similar, yet slightly different, approach. They had used a heartbeat AT command but the command itself was different. Instead of setting those values mentioned, the simply trigger something called the "Watchdog", using AT*COMWDG=seq, where seq is the current sequence number.

At last, it worked! I was able to get the roll and pitch to change. I quickly realized that it wasn't sticking though and came to the conclusion that I should re-include the other heartbeat command I had used before, to constantly remind the Drone of its state. This fixed it and now the pitch and roll (and yaw and gaz...) stick!

One of the goals of this course was to get the Drone to perform a certain flight pattern on its own. Having to sit in front of the screen typing command after command was somewhat tedious and I thought I might develop a way for the program to read a file. The final scripting files are quite simple and are really the same as typing the commands, with each command one 1 line. I had some trouble getting this to work initially because I had forgotten about implementing a sort of "wait" functionality to pause between commands. Once that was up and running, though, I was able to write out some simple scripts to get the Drone moving.

Here are my sample scripts:

script1.ard:
takeoff
wait 7
land


script2.ard:

takeoff
wait 6
yaw .7
wait 5
yaw 0
wait 4
gaz .3
wait 7
gaz -.3
wait 4
pitch -.3
wait 2
pitch 0
land


script3.ard

takeoff
wait 7
pitch -.3
yaw .3
wait 2
land


These are simply text files and .ard was an extension I made up. I plan on testing this out further and will likely allow you to execute the program with a script as an argument instead of the current method of entering "file" then the script. Or maybe I'll keep both?

I'm also going to look into any startup scripts that the Drone has and look at the possibility of having the drone immediately run a set flight pattern when it starts.

AR Drone Demo Android App

I've been working on an Android app for the class that controls the drone and also directs the drone on simple preset flights. The app is about done, and I feel all I have to do is test it out a couple of times in a large room to fine tune the preset flights. The app also records and plays back drone movements. This part of the app still only works marginally well. I'm going to write a short explanation of how the controls for the app work, and put it on the wiki page of the google-code project.

For the time being, there's a version of the app that can be downloaded from the 'Downloads' page of the google code site. I have not yet put it on the Android market. The link to the 'Downloads' page is below.

http://code.google.com/p/ardrone-smash/downloads/list

Monday, March 21, 2011

Running an application on the drone

So I've taken up the project of trying to get something running on the AR Drone. The idea is that there will be an program that will be stored within the memory of the Drone that we can run and it hopefully will be able to send commands which the Drone will respond to. As a start, I was given some (non-working) code that would send UDP packets to a specific port on localhost. The thinking here is that since the Drone already received commands over UDP, it would make sense that an application running on the Drone would simply send commands to itself.

I was given a start with a basic client and server code in C++ that needed to be cleaned up and fixed before I could run it. Once I had gotten it running, I ran into different issues with the network buffers and buffer sizes where the commands weren't being sent as a complete string. Anyway things seem to be running relatively well now.

The server is basically an echo server and outputs anything that is sent to it. It appears to be receiving the entire command, as it should. The client is a basic command line program that lets you input specific commands, although only "land" and "takeoff" right now. Once we are back from break I will ftp the files onto the Drone and hopefully they will work!

Monday, March 14, 2011

more on dwc_otg.ko module

I built the module as per instructions from the earlier post, and edited the 'vermagic' number in the binary file with a hex editor. Hopefully it will still work. The link to the building instructions is here:

http://embedded-software.blogspot.com/2011/01/creating-testing-and-flashing-tbd.html?showComment=1298131219050#c8216733809012047042

The critical part I was missing was to execute

make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig

which gives you a group of config options that is different from those to be found just by typing 'make menuconfig'. With these options, select "System Type ---> Parrot drivers ---> PARROT6 USB driver (Synopsys)" . Then you can type

make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- modules

This will compile the modules, including the dwc_otg.ko module. Then you have to edit the 'vermagic' string as described in the link below:

http://www.rcgroups.com/forums/showthread.php?t=1335257&page=33

Then you ftp the module over and try the insmod command to see if it inserts.

$ ftp -n 192.168.1.1 (with no port num specified)
ftp> put dwc_otg.ko
ftp> exit

$ telnet 192.168.1.1
# ls /data/video
# mv /data/video/dwc_otg.ko /home/default/dwc_otg.ko

check to make sure that the file is large enough because 'ftp 192.168.1.1 5551' puts files in the /update directory, BUT the files have no contents.

# cd /home/default
# insmod dwc_otg.ko
# lsmod
(listing of inserted module)
# rmmod dwc_otg

So, so far it seems to work. Now we need to test the usb cable itself.

Sunday, March 13, 2011

AR Smash with Android GPS

At our last meeting I had an idea of having using the Android GPS with the drone. The idea was to build upon the existing AR Drone demo (which Dave has been using as well) and add GPS functionality. Well I've been working on it without a drone, just logging out when the drone would go forward, back, left and right. The problem I've run into though is that the GPS is far too inaccurate for something like this to really work. If I try to make it more accurate by adjusting the change in longitude and latitude that would be required for a "move" to take place, it becomes too much movement too fast. In fact, multiple different movements would be called even when the phone is sitting in one place. I'm going to continue playing around with this delta value in hopes that I can come up with something relative accurate, but at this point it seems somewhat unlikely. Now I'm understanding why the demo uses the accelerometer instead of the GPS.

dwc_otg.ko

This comment explains how to get the dwc_otg.ko module to compile.

http://embedded-software.blogspot.com/2011/01/creating-testing-and-flashing-tbd.html?showComment=1298131219050#c8216733809012047042

Friday, March 11, 2011

Steps to USB Serial Port

Before we can use the USB Serial connector (even if we know the electronics works) we need to compile the kernel module from the ARDrone/Parrot site. Instructions for doing this are at the site below.

http://embedded-software.blogspot.com/2010/12/ar-drone-usb.html

There are two challenges, one being the actual compiling of the module with the changes mentioned, and the other being compiling the same module for the arm processor on the ARDrone. I've downloaded the source and made the changes to the 'dwc_otg_driver.c' file but I've had trouble compiling it. The basic problem is that if I type 'make modules' a few kernel modules are built, but not the dwc_otg.ko module. (I have downloaded the arm cross-compiler, but have not had a chance to use it yet -- I thought I'd try regular compiling first.)

I went into the kernel configuration screens, typing 'make menuconfig'. I pretty much scoured the various menus but could not find the option for 'dwc_otg'. I tried out several things that I felt were close to the option I was looking for without any luck.

I think this 'dwc_otg.ko' module is very basic and needs to be present in order for the usb port on the Drone to work as a serial port. I have posted a comment on the blog mentioned above asking the 'E/S and I' guy for help. We'll see if he responds.

Droid Incredible and Eclipse

/home/username/bin/android-sdk-linux/platform-tools/adb kill-server
/home/username/bin/android-sdk-linux/platform-tools/adb start-server
/home/username/bin/android-sdk-linux/platform-tools/adb devices

these are commands you might have to run as root to get eclipse to recognize the Droid Incredible.

Tuesday, March 8, 2011

AR Drone 1.6

Once again 1.6 has defeated us. I tried to get it working. Made some headway by stealing a few files from 1.5 but it ended up just causing more problems. It looks like at least while on Linux 1.6 literally wont compile for android. It seems that there are a few syntax errors and other things that just generally don't work. I decided to go back to 1.5 and after a little bit of trouble I was able to get it working. I got the emulator up and running and tested it on the drone. It works. I am now sticking with 1.5. Also I have the drone and will bring it back Thursday or Friday.

Sunday, March 6, 2011

Broken Drone Bumper

I broke one of the AR Drone plastic bumpers today. I'm referring to one of the circular bumpers that are part of the plastic cover. It wasn't a bad break, and I immediately patched it up with tape. I can't say it's as good as new, but it flies just the way it used to. If it's a problem with school I'll buy a new cover. I think they're inexpensive. I felt pretty bad about it when I did it. I wasn't being particularly hard on it or anything, though. My apologies to everybody.

usb/serial cable

This weekend I received the last of the parts for the usb/serial cable. This one is the device that actually transfers the ttl level signals to RS-232 signals. That's at least what I think it does. It's very cool, with its own little circuit board. It will require some special kernel module compiling to work. I think we can get to that after we have an assembled cable. Oh, btw, I believe there's no soldering to be done to connect this particular part. We will need wire, and we will have to solder the wires to the terminals for the small connectors that we've already got...

Friday, March 4, 2011

firmware

Since we already have the newer firmware installed, I vote we keep it for a while and at the same time keep the web location of the older firmware. For the time being we can work with the newer firmware, and if the older is needed later on for some reason we can always go back then.

Old firmware

http://www.ardrone-flyers.com/wiki/V1.1.3

Wednesday, March 2, 2011

urbi doesn't work since firmware update

Since the firmware update Urbi doesn't work. I get output identical to the following.

[00000740] *** ********************************************************
[00000743] *** Urbi SDK version 2.3 rev. 9a84600
[00000756] *** Copyright (C) 2005-2010 Gostai S.A.S.
[00000756] ***
[00000756] *** This program comes with ABSOLUTELY NO WARRANTY. It can
[00000757] *** be used under certain conditions. Type `license;',
[00000757] *** `authors;', or `copyright;' for more information.
[00000757] ***
[00000757] *** Check our community site: www.urbiforge.org.
[00000757] *** ********************************************************
[00000936] ARDrone_0x9bc19c8
before setLocale()
before ardrone_tool_setup_com(NULL)
before ardrone_tool_init(...)
Starting thread navdata_update
Starting thread ardrone_control
Thread navdata_update in progress...
before ardrone_input_add(NULL)
Input device myControl added
Starting thread my_video
Video stage thread initialisation
[00000964] true
[00000996] *** Waiting connection.
Timeout
Tag 19 is not a valid navdata option tag
[Navdata] Checksum failed : 0 (distant) / 25300 (local)
Tag 19 is not a valid navdata option tag
[Navdata] Checksum failed : 0 (distant) / 25733 (local)
Tag 19 is not a valid navdata option tag
[Navdata] Checksum failed : 0 (distant) / 25528 (local)
Tag 19 is not a valid navdata option tag
[Navdata] Checksum failed : 0 (distant) / 25771 (local)
Tag 19 is not a valid navdata option tag
[Navdata] Checksum failed : 0 (distant) / 25495 (local)

I've tried recompiling the urbi ARDrone module with the following patch, but it doesn't work. (The patch applies cleanly and the module actually compiles, but later doesn't work).

https://projects.ardrone.org/issues/show/67

So my question is, what are our options? Does an older version of the firmware exist on line? If it did, could we even install it without bricking the drone? I am going to write to the guy who first published the urbi module for the ARDrone, but until I hear from someone like that I'm just going to work on Android apps.

Tuesday, March 1, 2011

A Sample Android App and Java classes

I have created a sample Android app that is now available on our google SVN repository. As of now the app is very simple, with a simple button and logo. Upon clicking the button the Drone will take off, hover for 5 seconds and then land. This can be expanded out pretty easily and is a good starting point. Most of the logic actually occurs in an external AR Drone class. I hope the final version will take off, fly a certain path, then land.

We have been working with different java classes to try and get better control over the drone but have been struggling so far to find a class that sets the pitch and roll to what we want. All of the classes we're using use AT commands to tell the drone what to do. One would expect a command that sets the pitch and roll to set those values but that doesn't seem to be happening. Instead either nothing happens at all or the change isn't made until we start the drone agan and, thus, it takes off into a different direction (usually right into the wall). We had limited progress with this issue today but found that settings the pitch right before liftoff will have an effect, similar to the one just mentioned.

Upon reading through the SDK documentation we saw that the drone will auto-disconnect if you don't send it a command for 2 seconds. We're thinking of implementing something similar to what Dave has in his Urbi example, where there is a loop that constantly sends the drone commands.

Finally, I put together an extremely basic logo for our final application. And by basic, I mean that it was put together in 5 minutes or less. Enjoy.