Regarding ps3 controller, I don't own one, so I can't say for sure. I remember reading somewhere that your device needs to be rooted, but that information might be outdated. Basically, if your controller works in other apps or games natively (i.e., without emulating touchscreen), it should work. (It would work with touchscreen emulation too, but then the official app would work just as well).

Making control smoother is at the top of my list. I'm thinking of using getFlat() method to determine deadzone instead of using a hardcoded value and making the output non-linear. It should improve precision and smoothness at low speeds.
This picture should explain it better:

joystick_curves.gif

Figure 1: joystick response as implemented by Parrot
Figure 2: what it should look like

I am using this app, and a PS3 controller, and most of the functions are enabled. It flies well...maybe an update for programming the controller our way? Thanks for the app...GREAT JOB!!

Forgot to tell you, the PS3 controller has to be connected to Android via USB to go cable. Go here:http://buy.thegameklip.com/
Comes with the cable, abd a clip that fastens to the PS3 controller, so you can attach your phone together with the controller easily. Hope this helps,
K

krfanning wrote:Forgot to tell you, the PS3 controller has to be connected to Android via USB to go cable. Go here:http://buy.thegameklip.com/
Comes with the cable, abd a clip that fastens to the PS3 controller, so you can attach your phone together with the controller easily. Hope this helps,
K

I have a bluetooth PS3 controller that works just great without the cord using the sixaxis controller app. The only thing I needed the cable for was the initial pairing and recharging. And yes, I had to root my tablet to make the controller and sixaxis work.

Great modified app indeed but I've found a few issues :
- sometimes stays stuck on the "loading" screen (before you get the video feed), can't figure out why
- the ARDrone has a "rough" behaviour, especially in "hover on" mode when you let go of the stick. I thought that was normal until I tried the AR.Pro app that offers much smoother flying for some reason. Both apps running on default settings.

A great feature would be - now that the hands are free - a sbs view of the video stream.
I think it should be possible to set up a button for SBS on/off in the preferences in order to use the drone with cardboard or similar.
What do you think about this?

Hey Darklo, this is great work. I have some questions, because i want to modify an apk with an existing controller support, just changing the controller configuration. Could you send me an email to gw82@arcor.de ?

The only reason Parrot keeps selling ARD 2.0 at this late stage in its lifecycle is because it fills the price gap between the Bebop and Rolling Spider.
It should be pretty obvious that there aren't going to be any more updates, neither firmware nor an app.
Director Mode on Android has been "coming soon" for what, 16 months now? At this point it should be rather "not coming, ever", and the FreeFlight app is now more or less in abandonware territory. But even though there are a number of excellent alternatives, if it could be improved, it could offer a lot of value.

So I thought it would be a good idea for the community to take over the development of the FreeFlight app and fix some of the longstanding bugs and introduce a couple of new features. Thanks to the amazing tools â€” smali and apktool â€” we're now able to freely modify the app and do (almost) anything. Editing smali code is very different from normal Java programming, and is a lot like assembly â€” you deal with registers instead of variables and control flow is affected by goto's and if-zero or if-not-zero jumps. But you can learn a lot about internal workings of Dalvik VM, and I actually had a lot of fun breaking the app apart and modifying it to my liking.

One feature that is an absolute must is hardware controller support (see controller mapping below). As it turns out, FreeFlight fully supports game controllers, as long as it runs on Nvidia Shield. There is literally a function isNvidiaShield() that is called every time a joystick or button event is processed:

As you probably guessed, if your device doesn't happen to be Shield, joystick movements and button presses are simply ignored. Well, that is simply ridiculous and our device choices should not be limited by Parrot's exclusive partnerships.Fortunately, it's also ridiculously easy to patch. The easy way, of course, would be to write "return true", but that wouldn't be very interesting. Better solution is to detect whether controller is plugged in when app is launched. Even better is to watch for hardware changes at runtime and modify the return value when controller is connected.
As two added bonuses, you get a different splash screen if you start the app with controller; the touch screen controls react to controller presence and disappear as necessary (it's only a transparency change, so it's still possible to fly using touchscreen with controller connected).

Even if you have a Shield, you've probably noticed that joystick deadzone is very large (0.3 out of 1). If you push the stick slightly, nothing happens. If you push more, the drone suddenly lurches forward. As a result, controlling the drone becomes more difficult than it should be.
Again, this is easy to patch. In this version hardcoded deadzone is removed, and the code relies on the value provided by Android. In addition, joystick response curves are now non-linear, improving precision at low speeds.

Another issue that also affects Shield owners is that the left stick is disabled in accelerometer mode (when you press and hold the shoulder button). This is correct if pitch/roll stick is on the left, but in left-handed mode this prevents you from controlling yaw and altitude, so this artificial limitation is also patched out.

Unlike touchscreen controls, where you can keep the finger on the roll/pitch button as the drone flies level, there is no equivalent for hardware controller. Well, here is a first: FreeFlight app with hover lock toggle! Click the pitch/roll thumbstick (left or right, depending on your settings) and the drone will no longer overcorrect as you release the stick, instead it will continue to glide smoothly. Click the stick again to turn hover lock back on. You'll see a brief message "Hover ON" (or "OFF"), so it's easy to tell which mode is active.

Here is a complete list of changes:

increased max zoom in map downloader from 16x to 19x

reduced joystick dead zone from 0.3 to 0.075

increased param:video:codec_fps from 25 to 30 and param:video:max_bitrate from 1500 to 4000

fixed controller not working after being disconnected and reconnected again

better handling of left-handed mode

despaghettification of joystick code

nonlinear joystick response curves

removed hardcoded joystick deadzone, now the code uses only the value provided by Android

added combined yaw toggle to gas/yaw thumb stick

fixed restarting of com.parrot.freeflight.academy.services.restoremedia.RestoreFlightMediaService when exiting the app using back button

Controller mapping:
Since the Shield controller uses standard gamepad layout, every compatible controller should work. I tested with a Wikipad.
nvidia-shield-mapping copy.jpg

Please note that if you use "left-handed mode" (equivalent to RC Mode 2), both sticks and shoulder buttons are swapped. In that case, L1 (left shoulder) switches cameras and R1 (right shoulder) enables accelerometer. The easier way to think is that whatever stick you use to pitch/roll your drone, the shoulder button on the same side switches accelerometer control.
Triggers are unaffected, LT is video and RT is photo.

You may notice in the above image that Parrot labeled the X button as a "secret feature" in their original blog post. Well, the Shield owners have discovered that the button does in fact nothing. And now after decompiling the code, I can conclusively say that there is indeed no secret feature.
Although it's a small thing, Parrot lied to the customers. The good thing is that we can implement whatever we like, so I invite everyone to vote what the secret feature should be!

Patch notes:
As I don't have access to Parrot's private key, the APK is signed with the key from official SDK. As a result, instead of replacing the official app with patched version, you'll have to uninstall the official app first.

If you want to patch the APK yourself and make sure that I didn't bundle any malware, you can. The attached zip contains the shell script that does decompilation, patching, rebuilding and signing the APK. You should place the original named com.parrot.freeflight.apk in the same folder.

Requirements:

Linux or OS X (Windows users will need to get patch.exe from diffutils and translate the shell script to a .bat file)

I need your help, the modified application to control the dron with the gamepad of ps3 is no longer available in the dropbox in the topic of this forum. Could someone upload it to some page in order to download it?

Last edited by AR.Tommy on 02 Apr 2017, 13:49, edited 1 time in total.
Reason:Moved your post into the thread. Please do not create new topics. Thank you.

The poster of this thread explains the patch in his first post. The needed files to patch the app yourself are uploaded to the forum and the download still works. You can create a patched version of the app by yourself.

AR.Tommy wrote:The poster of this thread explains the patch in his first post. The needed files to patch the app yourself are uploaded to the forum and the download still works. You can create a patched version of the app by yourself.