Please select Into the mobile phone version | Continue to access the computer ver.
android SDK gimbal move on Mavic Mini
95 2 3-30 14:23
Uploading and Loding Picture ...(0/1)
o(^-^)o
cprest1n
lvl.2
United States
Offline

Hi, I am trying to make the camera gimbal move via the SDK. I have tried several isolated tests and I get different errors but no success.

I am running the FPV demo and modifying it to try some gimbal stuff. The camera surface is working to get camera feedback from the drone.


First I checked the capabilities map and I get these responses:


ADJUST_PITCH  supported
ADJUST_PITCH_UPWARDS supported
ADJUST_YAW not supported
ADJUST_ROLL not supported


So I should be able to change the pitch.


I have tried various combinations of parameters. I am using 2.0 as my PITCH_DELTA


These params produce callback "success" but no measured or visible change.//        rBuilder.pitch(PITCH_DELTA);
//        rBuilder.mode(RotationMode.RELATIVE_ANGLE);
//        rBuilder.time(0.5);
This is closest to what is in the demo at https://github.com/dji-sdk/Mobile-SDK-Android/blob/master/Sample%20Code/app/src/main/java/com/dji/sdk/sample/demo/gimbal/MoveGimbalWithSpeedView.java



These produce rotate gimbal error "Execution of this process has timed out"

Rotation.Builder rBuilder = new Rotation.Builder().pitch(PITCH_DELTA)
                .mode(RotationMode.SPEED)
                .yaw(Rotation.NO_ROTATION)
                .roll(Rotation.NO_ROTATION)
//                .time(0);
                .time(0.5);

Note that I tried time 0 and time 0.5

These produce rotate gimbal error "Param Illegal":
       Rotation.Builder rBuilder = new Rotation.Builder().pitch(PITCH_DELTA)
                .mode(RotationMode.ABSOLUTE_ANGLE)
                .yaw(Rotation.NO_ROTATION)
                .roll(Rotation.NO_ROTATION)
.time(0.5);
Does anyone have any notes on what I'm doing wrong or a code snippet that can move the pitch of the gimbal on a Mavic Mini?





3-30 14:23
Use props
cprest1n
lvl.2
United States
Offline

side note: why is this bb software so brutal for formatting? All we need is one font for posts and a block mode for code. I've tried editing it three time and what you put in the edit box is not what comes out.... .arggh.
3-30 14:28
Use props
cprest1n
lvl.2
United States
Offline

If anyone else gets in this trap, the key is to look at the omnibus sample app Gimbal  Capabilities screen, NOT the Gimbal Move screen which doesn't work on my device.

Here's some fairly clean gimbal move code that works:

    private void changePitch(boolean up) {


        Gimbal gimbal = FPVDemoApplication.getGimbalInstance();
        if (gimbal == null) return;


        Number rotValue;
        if (up) {
            rotValue = ((DJIParamMinMaxCapability) (gimbal.getCapabilities().get(CapabilityKey.ADJUST_PITCH))).getMax();
        } else {
            rotValue = ((DJIParamMinMaxCapability) (gimbal.getCapabilities().get(CapabilityKey.ADJUST_PITCH))).getMin();
        }


        Log.d("TAG", "rotation Value for cap-driven min/max " + rotValue);


        Rotation.Builder builder = new Rotation.Builder().mode(RotationMode.ABSOLUTE_ANGLE).time(2);
        builder.pitch(rotValue.floatValue());


        final Rotation rotation = builder.build();
        gimbal.rotate(rotation, new CommonCallbacks.CompletionCallback(){
            @Override
            public void onResult(DJIError djiError) {
                if (djiError == null) {
                    Log.d("TAG", "rotate gimbal success");
                    showToast("rotate gimbal success");
                }else {
                    Log.d("TAG", "rotate gimbal error " + djiError.getDescription());
                    showToast(djiError.getDescription());
                }
            }
        });
    }

4-16 09:32
Use props
Advanced
You need to log in before you can reply Login | Register now

Credit Rules