Search in sources :

Example 1 with GimbalControlRequest

use of com.jiushuo.uavRct.entity.mqtt.GimbalControlRequest in project uav_mobile_app by jiushuokj.

the class MyMqttService method gimbalControl.

private void gimbalControl(final MqttMessage message) {
    Log.i(TAG, "gimbalControl: ");
    GimbalControlRequest request = JSON.parseObject(new String(message.getPayload()), GimbalControlRequest.class);
    Rotation rotation = new Rotation.Builder().mode(RotationMode.values()[request.getMode().ordinal()]).pitch(request.getPitch()).roll(request.getRoll()).yaw(request.getYaw()).time(request.getTime()).build();
    for (Gimbal gimbal : aircraft.getGimbals()) {
        Log.i(TAG, "gimbalControl: gimbals--->" + gimbal);
    }
    aircraft.getGimbals().get(0).rotate(rotation, new CommonCallbacks.CompletionCallback() {

        @Override
        public void onResult(DJIError djiError) {
            makeDefaultResponse(djiError, message);
        }
    });
}
Also used : ProtoGimbal(com.jskj.mobile.state.ProtoGimbal) Gimbal(dji.sdk.gimbal.Gimbal) GimbalControlRequest(com.jiushuo.uavRct.entity.mqtt.GimbalControlRequest) CommonCallbacks(dji.common.util.CommonCallbacks) DJIError(dji.common.error.DJIError) Rotation(dji.common.gimbal.Rotation)

Aggregations

GimbalControlRequest (com.jiushuo.uavRct.entity.mqtt.GimbalControlRequest)1 ProtoGimbal (com.jskj.mobile.state.ProtoGimbal)1 DJIError (dji.common.error.DJIError)1 Rotation (dji.common.gimbal.Rotation)1 CommonCallbacks (dji.common.util.CommonCallbacks)1 Gimbal (dji.sdk.gimbal.Gimbal)1