mavlink / qgroundcontrol

Cross-platform ground control station for drones (Android, iOS, Mac OS, Linux, Windows)
http://qgroundcontrol.io
3.31k stars 3.63k forks source link

can't connect to Pixhawk via Bluetooth on Android #2910

Closed kd0aij closed 7 years ago

kd0aij commented 8 years ago

"service not available"

DonLakeFlyer commented 8 years ago

@dogmaphobic Should bluetooth work on Android?

dogmaphobic commented 8 years ago

What device? The TBS Crossfire works. At least it was working the last time I used it.

Gregsky commented 8 years ago

I'm using bluetooth with PX4 stack, it works fine on ASUS zenpad 7 but it does not connect on Galaxy Note4, I get "service not available"

dogmaphobic commented 8 years ago

I need to know what "Bluetooth" device is plugged to the Pixhawk.

kd0aij commented 8 years ago

Mine shows up as HC-06 and the chip is labeled BC417

dogmaphobic commented 8 years ago

This? I need to get one to test. The only Bluetooth device I have is the Crossfire.

hc-06

dogmaphobic commented 8 years ago

I found a datasheet for it. Did you have to set it up using the "AT" commands as described?

https://www.olimex.com/Products/Components/RF/BLUETOOTH-SERIAL-HC-06/resources/hc06.pdf

kd0aij commented 8 years ago

It's been 2.5 years since I got mine. Don't remember, but I probably did set the baud rate using an AT command first.

kd0aij commented 8 years ago

And that one looks almost identical to mine: http://smile.amazon.com/Kootek%C2%AE-Bluetooth-Serial-Module-Arduino/dp/B00DQ4A7O6?ie=UTF8&psc=1&redirect=true&ref_=oh_aui_search_detailpage

dogmaphobic commented 8 years ago

Got it in the mail today.

The good news, I can't get it to connect either. Meaning I could reproduce the issue and I can debug it. The bad news, I won't be able to do much for the next couple of weeks 8P

DonLakeFlyer commented 8 years ago

@dogmaphobic Do you think this is important enought to hold 3.0 release for?

dogmaphobic commented 8 years ago

Good question. Bluetooth was ever really tested using only the Crossfire. Today was the first time I connected something else. It took me an hour just to get the thing configured and paired with a Nexus 9. Bluetooth is inherently unreliable.

I don't think it's enough to hold 3.0 as I don't think that many people use it to begin with. Those who try, it will either work or not, which is quite standard with Bluetooth things, specially a $5 trinket from China.

kd0aij commented 8 years ago

@dogmaphobic update: can't connect via wifi using Moto G running Android 6.0, but Nexus 7 running Android 6.0.1 works fine

kd0aij commented 8 years ago

as of today, my Moto G won't connect via Bluetooth either. Any interest in why something that used to work is now broken? Or is BT deemed to be of no value for this application?

kd0aij commented 8 years ago

update: the free "BlueTerm" app connects to the BT dongle and displays data on both Nexus7 and MotoG

DonLakeFlyer commented 8 years ago

@dogmaphobic Did you ever get a bluetooth thingy? I don't have anyting to test with.

hsteinhaus commented 8 years ago

I have a similar problem with a HC06 bluetooth module on Android here (Beanstalk 6.0, Android 6.0.1 on Amazon Tate), see attached log file log.txt

I particularly wonder about the message "Using found rfcomm channel 0". When I use the HC06 under plain Linux, I have to bind to channel 1 to see the MAVLink data stream from the HC06.

Tower successfully connects to the drone on the same tablet, so I can definitely rule out any hardware or pairing issues. A cross test on my Sony Z3 (Android 6.0.1 again) reveals that the problem isn't specific to my tablet, either (same result, same log).

baucho commented 8 years ago

Same here i think! My galaxy tab s2 connects to bluetooth but noch data Coming! Tower works for me. tmp_5383-screenshot_20160910-095937-823459483 tmp_5383-screenshot_20160910-0959171781853601 tmp_5383-screenshot_20160910-095900-10041182 tmp_5383-img_2099-145230513 tmp_5383-img_2098740038905

DonLakeFlyer commented 8 years ago

@dogmaphobic Would be nice to figure this one out for 3.1 release. Lots of request for it.

DonLakeFlyer commented 7 years ago

Working now.

GlidLov commented 7 years ago

same here, "failed to connect service". Looking forward for it

DonLakeFlyer commented 7 years ago

@GlidLov Are you using the latest version of QGC?

GlidLov commented 7 years ago

@DonLakeFlyer yes. Trying again today, uninstalling and reinstalling latest from google play

DonLakeFlyer commented 7 years ago

That looks like the same board I tested with. I'll try it again today.

Patnetpatnet commented 7 years ago

I'm still not able to connect to BT via Android even with the new version. Just crashes the QGroundcontrol app on attempted connection to BT.

Siytek commented 7 years ago

I also have the same problem as Patnetpatnet, QGC just crashes when I try to open a BT connection. I set up connections to both my HC-06 and to my TBS Crossfire, both with the same issue. Running on a brand new Acer Iconia, running Marshmallow 6.0. Both the HC-06 and xFire work fine with QGC on my Mac. Tried Blueterm on the HC-06 and it connects successfully.

DonLakeFlyer commented 7 years ago

@dogmaphobic Do you time to look at this?

Siytek commented 7 years ago

Thanks for a quick response on re-opening the issue. Let me know if there is anything I can do to assist. Would it be worth me having a go at putting Qt on my Android device, compiling the source and seeing if I can feed back an error report?

dogmaphobic commented 7 years ago

I found the change that is causing the crash: #4349

It changed how the configuration is handled. The Bluetooth driver is now using a NULL pointer for its configuration and crashing. I need to understand what the change was for before I can find a fix.

Siytek commented 7 years ago

I just compiled QGC in Qt and deployed to my tablet. I checked that the addition from #4565 was present before compiling, the following line was present in BluetoothLink.cc

, _config(qobject_cast<BluetoothConfiguration*>(config.data()))

Still crashing on opening the BT connection. Application output errors as follows

D QGroundControl: (null):0 ((null)): LinkManager mavlinkStatus:channel:flags 0xe12ec9d0 2 2
F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x18 in tid 30176 (QtThread)

"org.mavlink.qgroundcontrol" died.

Apologies if I'm doing something dumb here, I'm new to Qt! :)

dogmaphobic commented 7 years ago

I just compiled QGC in Qt and deployed to my tablet.

If you are building yourself, you can launch it through the debugger and see where it crashes.

DonLakeFlyer commented 7 years ago

@Siytek If you're new to Qt and you figured out how to get an android build to build and deploy then that's huge! That combination can be quite the pain. Anyway, if you could get the crash in the debugger and find the crash point that would be awesome.

Siytek commented 7 years ago

Thanks @DonLakeFlyer, I'm quite well rehearsed with lower level stuff, I'm a hardware guy really (electronic engineer as a day job) but would like to improve my programming/embedded skills. There's some pretty good documentation so didn't have too much problem deploying to Android.

Sure, I was just in the process of reading up on the debugger but had to go out and do some socialising. I'll continue tomorrow and try find the point in which the crash occurs.

Siytek commented 7 years ago

@DonLakeFlyer @dogmaphobic I've been scratching my head for a few hours now, when I deploy the debug build, it successfully runs on the target but debugging fails with the error

Debugging starts Failed to contact debugging port.Debugging has finished

Debugging works ok with the Qt example project, I can set breakpoints etc. Did I miss something?

DonLakeFlyer commented 7 years ago

Have you turned on developer mode on your device?

On Feb 19, 2017, at 8:54 AM, Simon notifications@github.com<mailto:notifications@github.com> wrote:

@DonLakeFlyerhttps://github.com/DonLakeFlyer @dogmaphobichttps://github.com/dogmaphobic I've been scratching my head for a few hours now, when I deploy the debug build, it successfully runs on the target but debugging fails with the error

Debugging starts Failed to contact debugging port.Debugging has finished

Debugging works ok with the Qt example project, I can set breakpoints etc. Did I miss something?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/mavlink/qgroundcontrol/issues/2910#issuecomment-280931666, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFmsczcjC6bW0fhLY0qV109UzExnqGEiks5reHPZgaJpZM4Hk7Cs.

Siytek commented 7 years ago

Yes USB debugging is active on my device, it works fine with one of the Qt sample applications. I am probably getting a bit off topic here with Qt related issues, ill head over to QGC in Google groups to start a new topic.

DonLakeFlyer commented 7 years ago

it works fine with one of the Qt sample applications

Yeah, sorry I missed that. Maybe Gus will have some ideas.

DonLakeFlyer commented 7 years ago

I can repro the crash, but I can't catch it in the debugger either.

DonLakeFlyer commented 7 years ago

Actually I can't repro the crash. Here's why:

Once I deleted QGC completely from the device and then really deployed a new version from QtCreator using master it all worked.

Also just discovered that daily builds are not getting pushed up correctly. They are a week old. So daily builds don't have the fix.

Siytek commented 7 years ago

@DonLakeFlyer you are correct! Makes perfect sense, I deleted the original installation, debugging now working for me and BT didn't crash - I didn't assign an adapter nor try a connection but I now get the disconnect button available after pressing connect. Ill try it on the plane tomorrow.

DonLakeFlyer commented 7 years ago

Great. Let us know if everything is working for you now and we can close this one out.

Patnetpatnet commented 7 years ago

Does the latest QGC in Google Play now have a BT Android fix? Or does one have to go this circuituitous route? Not clear. BT issues have been outstanding for a long long time btw. Thanks,

DonLakeFlyer commented 7 years ago

@dagar I just went to play store dev console and it says there is no APK in beta testing. Am I looking at the wrong place, or is something out of whack. Want to make sure Android beta is up to date with latest daily.

Siytek commented 7 years ago

I just deployed a release build on my tab and I am pleased to report Bluetooth is now working as expected! At a glance, all instruments and information now seems to be displaying as expected in QGC. Thanks for resolving this issue, I'm excited to go try my tablet in the field now!

DonLakeFlyer commented 7 years ago

Thanks for testing folks.

FYI: Still trying to figure out Android daily builds from Google Play.

Siytek commented 7 years ago

Did you manage to get daily builds sorted? @Patnetpatnet if you really want a copy with working Bluetooth and it's not going to be available on Google Play just yet, I can have a go at sending you a compiled version of the latest code.

dagar commented 7 years ago

The Android Google Play beta (daily build) isn't currently auto updating, but you can install it manually. https://s3-us-west-2.amazonaws.com/qgroundcontrol/builds/master/QGroundControl.apk

Patnetpatnet commented 7 years ago

Thanks! Will test this weekend.

hackra76 commented 7 years ago

The version of Google play beta is 3.1.3, but the version posted here is 3.1.2-277.... Couldn't this be the reason why it is not updating ?

DonLakeFlyer commented 7 years ago

Did you manage to get daily builds sorted?

As far as I know google play still does not have the right daily build. @dagar ?