Timeline mission not work after takeoff, just hovering
281 0 2021-8-10
Uploading and Loding Picture ...(0/1)
o(^-^)o
djiuser_ReXrNeLbXwzl
lvl.1

Hong Kong
Offline

I am going to use UXSDK and the timeline feature. So I tried some tests with a timeline on the UXSDK sample repository
Below is my timeline init function. When I start timeline, the drone takeoff, but not moving anymore. just it is hovering on the air
Please help me what is the problem with my code. Thanks

private void initTimeline() {

    double baseLatitude = 22;
    double baseLongitude = 113;
    Object latitudeValue = KeyManager.getInstance().getValue((FlightControllerKey.create(HOME_LOCATION_LATITUDE)));
    Object longitudeValue = KeyManager.getInstance().getValue((FlightControllerKey.create(HOME_LOCATION_LONGITUDE)));

    if (latitudeValue != null && latitudeValue instanceof Double) {
        baseLatitude = (double) latitudeValue;
    }
    if (longitudeValue != null && longitudeValue instanceof Double) {
        baseLongitude = (double) longitudeValue;
    }

    List<TimelineElement> elements = new ArrayList<>();

    missionControl = MissionControl.getInstance();

    //Step 1: takeoff from the ground
    elements.add(new TakeOffAction());

    //Step 2: Go 1 meters from home point
    elements.add(new GoToAction( 1));

    //Step 3: reset the gimbal pitch to below of drone in 2 seconds
    Attitude attitude = new Attitude(-90, Rotation.NO_ROTATION, Rotation.NO_ROTATION);
    GimbalAttitudeAction gimbalAction = new GimbalAttitudeAction(attitude);
    gimbalAction.setCompletionTime(2);
    elements.add(gimbalAction);

    //Step 4: shoot a single photo
    elements.add(ShootPhotoAction.newShootSinglePhotoAction());

    //Step 5: reset the gimbal pitch with 5 seconds delay
    Attitude attitude_reset = new Attitude(0, Rotation.NO_ROTATION, Rotation.NO_ROTATION);
    GimbalAttitudeAction gimbalAction_reset = new GimbalAttitudeAction(attitude_reset);
    gimbalAction_reset.setCompletionTime(5);
    elements.add(gimbalAction_reset);

    //Step 6: fly forward 2 meters
    elements.add(new GoToAction(new LocationCoordinate2D(baseLatitude + 2 * ONE_METER_OFFSET, baseLongitude), 1));

    //Step 7: Set the gimbal yaw to right of drone in 2 seconds
    Attitude attitude_right = new Attitude(Rotation.NO_ROTATION, Rotation.NO_ROTATION, 90);
    GimbalAttitudeAction gimbalAction_right = new GimbalAttitudeAction(attitude_right);
    gimbalAction.setCompletionTime(2);
    elements.add(gimbalAction_right);

    //Step 8: shoot a single photo
    elements.add(ShootPhotoAction.newShootSinglePhotoAction());

    //Step 9: Set the gimbal yaw to left of drone in 2 seconds
    Attitude attitude_left = new Attitude(Rotation.NO_ROTATION, Rotation.NO_ROTATION, -90);
    GimbalAttitudeAction gimbalAction_left = new GimbalAttitudeAction(attitude_left);
    gimbalAction.setCompletionTime(2);
    elements.add(gimbalAction_left);

    //Step 10: shoot a single photo
    elements.add(ShootPhotoAction.newShootSinglePhotoAction());

    //Step 11: Land Drone
    elements.add(new LandAction());

    if (missionControl.scheduledCount() > 0) {
        missionControl.unscheduleEverything();
        missionControl.removeAllListeners();
    }

    missionControl.scheduleElements(elements);

    View autoButton = findViewById(R.id.auto);
    autoButton.setVisibility(View.VISIBLE);
}
2021-8-10
Use props
Advanced
You need to log in before you can reply Login | Register now

Credit Rules