Actions

Overview

The Action class provided by the SDK exposes a number of methods to perform actions such as turning the motors on/off, takeoff and land, RTL (return-to-land), and other flight control functions.

The following code snippets demonstrate how to use the Action class in the SDK for various functions. 

  1. Arm the drone
    CoreManager.shared().action.arm()
                .do(onError: { error in
                    //Arming failed
                }, onCompleted: {
                   //Arming succeeded
                })
                .subscribe()
                .disposed(by: disposeBag)
    
  2. Disarm the drone
    CoreManager.shared().action.disarm()
                .do(onError: { error in
                    //Disarming failed 
                }, onCompleted: {
                    //Disarming succeeded
                })
                .subscribe()
                .disposed(by: disposeBag)
    
  3. Return to launch - land at the takeoff location
    CoreManager.shared().action.returnToLaunch()
                .do(onError: { error in
                    //Return to launch failed
                }, onCompleted: {
                    //Return to launch succeeded
                })
                .subscribe()
                .disposed(by: disposeBag)
    
  4. Initiates takeoff and hovers at the takeoff altitude.
    CoreManager.shared().action.takeoff()
                .do(onError: { error in
                    //Takeoff failed
                }, onCompleted: {
                    //Takeoff succeeded
                })
                .subscribe()
                .disposed(by: disposeBag)
    

Please refer the API documentation to learn more about the APIs supported by the Action class.