Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getFlightController returns null always, when working with simulator as explained in the demo #15

Open
Dhana-Krishnasamy opened this issue May 3, 2018 · 1 comment

Comments

@Dhana-Krishnasamy
Copy link

I'm following this sample: https://developer.dji.com/mobile-sdk/documentation/android-tutorials/GSDemo-Google-Map.html

However I see getFlightController is returning null, while mobile is connected to the controller and simulator is running, drone is connected to the mac.

Problem line:

mFlightController = ((Aircraft) product).getFlightController();

@vkkeeper
Copy link

vkkeeper commented Jul 2, 2021

Just a workaround (yes, this is dirty hack, and I know, this is obviously, but may help someone to save time a bit).

                   FlightController flightController = null;
                    for (int i=0; i<3; i++) {
                        //TODO: SDK bug? https://github.com/DJI-Mobile-SDK-Tutorials/Android-GSDemo-GoogleMap/issues/15
                        flightController = ((Aircraft) product).getFlightController();
                        if (flightController!=null)
                            break;
                        else {
                            try {
                                Thread.sleep(300);
                            } catch (InterruptedException e) {
                                e.printStackTrace();
                            }
                        }
                    }
                    if (flightController==null)
                        throw new Error("Cannot get flightController");

I'm sorry. After a month of getting this error, I can say, that this is not a solution at all. If you didn't get a FlightController at a first call, you, probably, never get it.
Sorry again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants