qgroundcontrol icon indicating copy to clipboard operation
qgroundcontrol copied to clipboard

RTK GPS feature enabled for Android builds.

Open mnaumov opened this issue 3 years ago • 5 comments

Hello! I have got RTK working on Android devices. Radio-link and RTK device connected to phone via tiny USB switch. It works correctly and QGC sends RTK messages to the vehicle. The only problem I could not solve: Case 1 (fail): Steps to reproduce: Both radio-link and RTK devices are connected. Disconnect RTK device. Result (problem): Radio-link disconnects. Re-plugging radio-link does not help, it is not visible in the list of connected devices anymore. Only re-plugging USB-switch allows to connect USB devices again.

Case 2 (pass): Steps to reproduce: Both radio-link and RTK devices are connected. Re-plug radio-link. Result: Radio-link connected successfully.

Tested on Samsung A32 only.

Conclusion: I suspect CdcAcmSerialDriver closes USB connection in a wrong way (may be it closes not dedicated USB RTK-device, but USB-switch connection). I'm a newbie at Android programming, hope community can help.

Changes performed:

  1. Multiple USB devices connected info. QGCActivity::availableDevicesInfo()
  2. Every UsbIoManager instance for every particular connected device now runs in a separate thread. UsbIoManager::start() added.
  3. QGCActivity::write() moved to async mode.
  4. GPSProvider::callback::writeDeviceData . Disable serial->waitForBytesWritten because it is not supported currently for Android.

Please review my changes and send me your questions, objections, comments.

Thank you, Michael Naumov.

mnaumov avatar Apr 08 '22 16:04 mnaumov

@mnaumov I was doing the same as I belive that RTK GPS can work on Android. I can join you in the efforts.

zdanek avatar Apr 09 '22 10:04 zdanek

@mnaumov see my (unfinished) work at my fork I did all changes enabling android only. You've enabled all mobile that means IOS too. In my opinion this is wrong as IOS propably has different serial port architecture / behaviour. Also I don't have IOS so I cannot be sure if it works. It's safe to enable RTK on Adroid only.

zdanek avatar Apr 09 '22 10:04 zdanek

@zdanek Hello Zdanek! Thank you for reply. I agree my changes should be enabled for Android only. Did you have a chance to test my changes related to multiple USB devices on Android? I have made RTK fully working with only single issue described above. I wonder does this issue present on another Android devices/Android versions. I tested it on an Samsung A31 (Android 11)

mnaumov avatar Apr 15 '22 17:04 mnaumov

is this PR ready to come in @mnaumov ?

mrpollo avatar Aug 17 '22 17:08 mrpollo

@mrpollo Hello Roman! I have tested my changes at real survey missions twice. I'm sure it would be useful.

mnaumov avatar Aug 17 '22 22:08 mnaumov

@mnaumov did you check PC build again with RTK, so we are sure it did not break? Does it still work on PC? Can you please confirm on which OS. I have Ubuntu. Whick OS do you have?

zdanek avatar Oct 10 '22 08:10 zdanek

Case 1 (fail): Steps to reproduce: Both radio-link and RTK devices are connected. Disconnect RTK device. Result (problem): Radio-link disconnects. Re-plugging radio-link does not help, it is not visible in the list of connected devices anymore. Only re-plugging USB-switch allows to connect USB devices again.

The android code for USB does not expect to support more than one USB device. This expectation is carried through in multiple parts of the code. It "might" be able to be changed to support multiple USB devices. But given how difficult it's been to get the existing code to work correctly with a single USB telemetry device I'm not super interested in possible breaking that for RTK support. At least not without some massive amount of testing and prove that the problem shown in Case 1 has been fixed.

Given all that. Closing until a much more details fix could come through.

DonLakeFlyer avatar Jan 14 '24 02:01 DonLakeFlyer