Comments

5 comments

  • DJI Developer Support
    Could you tell me what SDK you are using? Or what aircraft are you using?
    0
    Comment actions Permalink
  • MountainTreeBook

    Hi, 

    dji-sdk:4.16 and Mavic 2. 

    0
    Comment actions Permalink
  • DJI Developer Support
    After successful registration, you can get the connected aircraft by getProduct(note that you need to convert the product object to aircraft), then get the gimbal object by aircraft.getGimbal, and then set the listeners to the obtained gimbal object, the code is as follows: aircraft.getGimbal().setStateCallback(new GimbalState.Callback() { @Override public void onUpdate(@NonNull GimbalState gimbalState) { stringBuffer.delete(0, stringBuffer.length()); stringBuffer.append("PitchInDegrees: "). append(gimbalState.getAttitudeInDegrees().getPitch()).append("\n"); stringBuffer.append("RollInDegrees: "). append(gimbalState.getAttitudeInDegrees().getRoll()).append("\n"); stringBuffer.append("YawInDegrees: "). append(gimbalState.getAttitudeInDegrees().getYaw()).append("\n"); showStringBufferResult(); }}); The same logic is used for IOS , only the interface used is different.
    0
    Comment actions Permalink
  • MountainTreeBook

    thank you, this to be put inside main activity?

    0
    Comment actions Permalink
  • DJI Developer Support
    It can be placed in any activity, but it should be noted that setting the listener again will overwrite the previous one.
    0
    Comment actions Permalink

Please sign in to leave a comment.