DroidPlanner / Tower

Ground Control Station for Android Devices
https://play.google.com/store/apps/details?id=org.droidplanner.android
Other
619 stars 554 forks source link

How to set GimbalApi #1684

Closed tongzahub closed 8 years ago

tongzahub commented 8 years ago

how to set GimbalApi on button OnClick

GimbalApi.getApi(dpApp.getDrone()).updateGimbalOrientation(90,90,90,null); GimbalApi.getApi(dpApp.getDrone()).startGimbalControl(null);

TShapinsky commented 8 years ago

the listener passed to startGimbalControl and updateGimbalOrientation must be non-null. You should start control before you attempt to update the orientation, the listener you use to startGimbalControl must be the same listener you use for all other communication with the GimbalApi until you stopGimbalControl. Also you may want to store the GimbalApi in a variable so that you don't have to get a new one everytime you make an Api call.

tongzahub commented 8 years ago

could you show me some example for this case? thank you

chaviw commented 8 years ago

You can take a look at this class https://github.com/DroidPlanner/Tower/blob/b47ef5305e5e91f9291bdb347a0462fc1524d49d/Android/src/org/droidplanner/android/fragments/widget/video/FullWidgetSoloLinkVideo.kt

It's in Kotlin but you should be able to figure out what it's doing. Essentially, the gimbal is manually controlled when the user touches the video stream view