This class contains components of the flight controller and provides methods to send different commands to the flight controller. This object is available from the Aircraft object which is a subclass of BaseProduct.
Starts IMU calibration. For aircraft with multiple IMUs, this method will start the calibration of all IMUs. Keep the aircraft stationary and horizontal during calibration, which will take 5 to 10 minutes. The completion block will be called once the calibration is started. Use the onUpdate method to check the execution status of the IMU calibration. It is recommended to reboot the device after IMU calibration. It is recommended to invoke reboot after IMU calibration.
Starts the calibration for IMU with a specific ID. Keep the aircraft stationary and horizontal during calibration, which will take 5 to 10 minutes. The completion block will be called once the calibration is started. Use the onUpdate method to check the execution status of the IMU calibration. It is recommended to reboot the device after IMU calibration.
Input Parameters:
@IntRange(from = 0, to = 2) int index
The IMU with the specific ID to calibrate.
@Nullable CompletionCallback callback
Completion callback to check if the calibration starts successfully.
Starts gravity center calibration. Keep the aircraft hover without wind during calibration. The completion block will be called once the calibration is started.
Input Parameters:
@Nullable CompletionCallback callback
The execution callback with the returned value(s).
Sets true to save log for pipelines. In order to improve developer's experience on SDK interconnectivity, Pipeline is designed to save log files locally when files are transferred, during which the speed is 475KB per minute. Please be careful with the device storage.
If there is a device connected to the aircraft using the Onboard SDK, this method will send data to that device. The size of the data cannot be greater than 100 bytes, and will be sent in 40 byte increments every 14ms. This method is only supported on products that support the Onboard SDK (Matrice 210 V1, Matrice 210 V2, Matrice 300 RTK, Matrice 100, Matrice 600, Matrice 600 Pro, A3, A3 Pro, and N3).
Input Parameters:
@Size(min = 1, max = 100) byte[] data
Data to be sent to the external device. The size of the data should not be larger than 100 bytes.
@Nullable CompletionCallback callback
The execution callback with the returned execution result.
Enables urgent stop mode. When urgent stop mode is enabled, the motor can be stopped by pushing sticks inner/outer simultaneously at any time. Use with caution. Supported only by Phantom 4 RTK.
Input Parameters:
boolean enabled
true to enable urgent stop mode.
@Nullable CompletionCallback callback
Callback that receives the setter execution result.
Starts aircraft takeoff. Takeoff is considered complete when the aircraft is hovering 1.2 meters (4 feet) above the ground. Completion block is called when aircraft crosses 0.5 meters (1.6 feet). If the motors are already on, this command cannot be executed.
Input Parameters:
@Nullable CompletionCallback callback
The execution callback with the returned execution result.
Starts aircraft precision takeoff. Precision Takeoff is considered complete when the aircraft is hovering 6 meters (20 feet) above the ground. Completion block is called when aircraft crosses 0.5 meters (1.6 feet). If the motors are already on, this command cannot be executed. This feature need vision assisted positioning enabled on.
Input Parameters:
@Nullable CompletionCallback callback
The execution callback with the returned execution result.
Stops aircraft takeoff. If called before startTakeoff is complete, the aircraft will cancel takeoff (startTakeoff completion block will return an error) and hover at the current height.
Input Parameters:
@Nullable CompletionCallback callback
The execution callback with the returned execution result.
Stops auto-landing of the aircraft. If called before startLanding is complete, then the auto landing will be canceled (startLanding completion block will return an error) and the aircraft will hover at its current location.
Input Parameters:
@Nullable CompletionCallback callback
The execution callback with the returned execution result.
Confirms continuation of landing action. When the clearance between the aircraft and the ground is less than 0.3m, the aircraft will pause landing and wait for user's confirmation. Can use isLandingConfirmationNeeded in FlightControllerState to check if confirmation is needed. It is supported by flight controller firmware 3.2.0.0 and above.
Input Parameters:
@Nullable CompletionCallback callback
The execution callback with the returned value(s).
Reboot the core component of the aircraft. It is recommended to invoke this method after IMU calibration. For Matrice 300 RTK, reboot the aircraft. For Mavic Mini, DJI Mini SE, reboot the airlink. For Maivc Air 2, reboot the battery. Others, reboot the flight controller.
Input Parameters:
@Nullable CompletionCallback callback
Completion callback that receives the execution result.
Enables/disables virtual stick control mode. By enabling virtual stick control mode, the aircraft can be controlled using sendVirtualStickFlightControlData. Not supported by Mavic Pro when using the WiFi connection.
Input Parameters:
boolean enabled
true to enable virtual stick mode.
@Nullable final CompletionCallback callback
The execution callback with the returned execution result.
true if Virtual Stick advanced mode is enabled. By default, it is false. Assuming GPS signal is good, advanced mode will allow aircraft to compensate for wind when hovering. For the Phantom 4, collision avoidance can be enabled for virtual stick control if advanced mode is on, and collision avoidance is enabled in FlightAssistant. Only supported by flight controller firmware versions 3.1.x.x or above. CAUTION: It will be reset to false when the flight controller is reconnected.
Set true to enable Virtual Stick advanced mode. By default, it is false. Assuming GPS signal is good, advanced mode will allow aircraft to compensate for wind when hovering.
For the Phantom 4, collision avoidance can be enabled for virtual stick
control if advanced mode is on, and collision avoidance is enabled in FlightAssistant.
Only supported by flight controller firmware versions 3.1.0.0 or above.
Sends flight control data using virtual stick commands. The isVirtualStickControlModeAvailable method must return true to use virtual stick commands. Virtual stick commands should be sent to the aircraft between 5 Hz and 25 Hz. If virtual stick commands are not sent frequently enough, the aircraft may regard the connection as broken, which will cause the aircraft to hover in place until the next command comes through.
Sets the aircraft flight orientation relative to the Aircraft Heading, Course Lock, or Home Lock. See the Flight Controller User Guide for more information about flight orientation. Not supported by Mavic Mini, DJI Mini 2, DJI Mini SE and Mavic Air 2, DJI Air 2S.
Enables/disables tripod mode. Tripod Mode drops the aircraft's maximum speed to 2.2mph (3.6kph), and significantly reduces the control stick sensitivity of the remote controller to give the user the precision needed for accurate framing. When tripod mode is enabled, missions, terrain follow mode, course lock, and home lock are not allowed. Tripod mode is not allowed if the aircraft is running a mission. If GPS or vision positioning aren't available, tripod mode cannot be enabled. If the GPS and/or the vision system is providing the flight controller with velocity information, the aircraft will be able to automatically compensate for wind. If however, position information is not available, manual intervention will be required. User should beware that any manual compensation will be limited due to the reduced maximum velocity and sensitivity. If GPS and vision position become unavailable while in tripod mode, it is advisable to alert the user and disable Tripod Mode. Not supported by Mavic 2 Enterprise Advanced.
Input Parameters:
boolean enabled
true to enable tripod mode.
@Nullable CompletionCallback callback
The execution callback with the returned execution result.
Enables/disables cinematic mode. In Cinematic Mode, you can shoot more stable and smooth photos and videos. Aircraft yaw speed will be lower and braking distance will be longer. It's only supported by Mavic Pro, Spark, Mavic 2 Zoom and Mavic 2 Pro.
Input Parameters:
boolean enabled
true to enable cinematic mode.
@Nullable CompletionCallback callback
The execution callback with the returned value(s).
Adjusts the braking sensitivity when cinematic mode is enabled. Higher sensitivity can shorten the braking distance in cinematic mode. It's supported by Mavic Pro, Spark, Mavic 2 Zoom and Mavic 2 Pro.
Input Parameters:
int brakeSensitivity
Brake sensitivity in cinematic mode.
@Nullable CompletionCallback callback
The execution callback with the returned execution result.
Gets the braking sensitivity when cinematic mode is enabled. Higher sensitivity can shorten the braking distance in cinematic mode. It's supported by Mavic Pro, Spark, Mavic 2 Zoom and Mavic 2 Pro.
Input Parameters:
@NonNull CompletionCallbackWith<Integer> callback
The execution callback with the returned value(s).
Enable/disable terrain follow mode. The aircraft uses height information gathered by the onboard ultrasonic system and its downward facing cameras to keep flying at the same height above the ground.
Input Parameters:
Boolean enabled
true to enable terrain follow mode.
@Nullable CompletionCallback callback
The execution callback with the returned execution result.
Sets the control mode of the flight controller. It is highly recommended you keep the default value of SMART. See ControlMode for details. Only supported by stand-alone A3.
Enable/disable Auto Quick Spin. When the gimbal reaches a yaw movement limit, the aircraft will automatically rotate 360 degrees to unwind the gimbal, allowing it to continue moving in the yaw direction. This method is only available when the aircraft is flying at least 3m above the ground. It is only supported by Inspire 2.
Input Parameters:
boolean enabled
true to enable Auto Quick Spin.
@Nullable CompletionCallback callback
The execution callback with the returned value(s).
voidsetAircraftHeadingTurningSpeed(@NonNull HardwareState.FlightModeSwitch mode, int speed, @Nullable CompletionCallback callback)
Package:
dji.sdk.flightcontroller
Description:
Setting a larger value increases the yaw speed of the aircraft when the control sticks are pressed. The settable range of speed changes according to the mode. When the mode is normal, the speed range is (20,90). When the mode is sport, the speed range is (20,130). When the mode is tripod, the speed range is (20,30). Only supported by Mavic Air 2, DJI Air 2S.
Setting a larger angle increases the yaw buffer when the control sticks are pressed. The value should be in the range [1, 100]. Only supported by Mavic Air 2, DJI Air 2S.
Do not turn on the Propeller Cage switch if propeller cages are not mounted. By enabling the Propeller Cage switch, you will set the Force Landing battery level to 15% and disable Wind Check and Propeller Check. When propeller cages are installed, no other accessories (except for official ND filters) can be attached. Only supported by Mavic Mini, DJI Mini 2, DJI Mini SE.
true to change the Tripod(T) mode toggle to Attitude mode toggle from the remote controller. You should called setMultipleFlightModeEnabled to enable multiple flight mode first, otherwise this interfaces take no effect. if this mode is enabled, once you switch the mode toggle on remote controller to Tripod(T) mode, aircraft will enter Attitude mode, in this mode, aircraft is easily distured and drifts horizontally in consequence, you have to manully hover the aircraft. Also, the active braking system is inactive. It is supported only by Matrice 300 RTK.
Input Parameters:
boolean isOpen
true to change the Tripod(T) mode toggle to Attitude mode toggle from the remote controller.
When GPS signal low, aircraft unable to auto hover and takeoff restricted. If you want to unlock takeoff without GPS , ensure there no people or obstacles within 2 m around the aircraft, and pay close attention to operating the remote controller at all times to avoid collisions.
This mode should only be enabled when using accessories like propeller guards and the aircraft is flying in wind-free environments. Shown as payload mode in DJI fly. Only Supported by DJI Mini 2.
Enables the coordinated turn. Improves aerodynamic efficiency. The aircraft is flying in the direction of the turn, without sideslipping. Only supported by M300 RTK and M350 RTK.
The selection of satellite positioning system is only supported when the RTK positioning function is turned off, and cannot be modified in the air. If RTK positioning function is turned on, aircraft uses GPS, GLONASS, Galileo, and BDS data to determine location. Only supported by M300 RTK and M350 RTK.
Sets the maximum flight radius limitation of the aircraft. The radius is calculated from the home point. The maxRadius value must be in the range [15, 8000] m.
Input Parameters:
@IntRange(from = 15, to = 8000) int maxRadius
Maximum flight radius of the aircraft.
@Nullable final CompletionCallback callback
The execution callback with the execution result returned.
Sets the home location of the aircraft. The home location is where the aircraft returns when commanded by startGoHome, when its signal is lost or when the battery is below the lowBatteryWarning threshold. The user should be careful setting a new home point location, as sometimes the product will not be under user control when returning home. A home location is valid if it is within 30m of one of the following:
initial take-off location
aircraft's current location
current mobile location with at least kCLLocationAccuracyNearestTenMeters accuracy level
current remote controller's location as shown by RC GPS.
Sets the minimum altitude, relative to where the aircraft took off, at which the aircraft must be before going home. This can be useful when the user foresees obstacles in the aircraft's flight path. If the aircraft's current altitude is higher than the minimum go home altitude, it will go home at its current altitude. The valid range for the altitude is from 20m to 500m. But if the aircraft is M300 RTK or M350 RTK, the limit can beyond 500m.
Input Parameters:
@IntRange(from = 20, to = 500) int height
The aircraft's default go home altitude.
@Nullable CompletionCallback callback
The execution callback with the returned execution result.
Sets the FailSafe action for when the connection between remote controller and aircraft is lost. It is supported by Mavic Mini, DJI Mini 2, DJI Mini SE and Maivic Air 2.
Sets the low battery warning threshold as a percentage. The percentage must be in the range of [15, 50]. It is not supported by Mavic Mini, DJI Mini 2, DJI Mini SE, Mavic Air 2 and DJI Air 2S.
Input Parameters:
@IntRange(from = 15, to = 50) int percent
Low battery warning percentage.
@Nullable CompletionCallback callback
The execution callback with the returned execution result.
Sets the serious low battery warning threshold as a percentage. The minimum value is 10. The maximum value is value from getLowBatteryWarningThreshold minus 5. It is supported by Mavic Mini, DJI Mini 2, DJI Mini SE.
Input Parameters:
@IntRange(from = 10, to = 45) int percent
Serious low battery warning percentage.
@Nullable CompletionCallback callback
The execution callback with the returned execution result.
Enables/disables Smart Return-To-Home (RTH) feature. When it is enabled, aircraft will request to go home when remaining battery is only enough for completing the go-home action. For Mavic Mini, DJI Mini 2, DJI Mini SE, the aircraft will return to home point when the remaning battery is low.
Input Parameters:
boolean enabled
true to enable smart RTH.
@Nullable CompletionCallback callback
Completion block that receives the setter execution result.
voidgetSmartReturnToHomeEnabled( @NonNull final CompletionCallbackWith<Boolean> callback)
Package:
dji.sdk.flightcontroller
Description:
Determines whether Smart Return-To-Home (RTH) feature is enabled or not. When it is enabled, aircraft will request to go home when remaining battery is only enough for completing the go-home action.
Input Parameters:
@NonNull final CompletionCallbackWith<Boolean> callback
Completion callback that receives the execution result.
Confirms or cancels the Smart Return-To-Home (RTH) request. When Smart RTH is enabled, the aircraft will request to go home when the battery is only enough for going home. Before executing the go-home action, the aircraft will wait for the confirmation from users with 10 seconds count-down. If the "confirmed" parameter is false, the request is canceled and the aircraft will not execute go-home action. Otherwise, go-home action will start. Smart RTH will be triggered only once during the same flight. Flight controller with firmware version lower than 3.0.0.0 does not support confirming the Smart RTH request. User can either cancel the request or wait for the countdown to start go-home action. It is supported by Mavic Mini, DJI Mini 2, DJI Mini SE, DJI Air 2S and Mavic Air 2.
Input Parameters:
boolean confirmed
true to confirm the request and the aircraft will start go-home immediately.
Gets the mapping between the flight modes and the flight mode switch positions on the remote controller. Elements 0, 1, and 2 of the returned array map to POSITION_ONE, POSITION_TWO, and POSITION_THREE of the getFlightModeSwitch. The value of each Enum item represents the corresponding value of the RemoteControllerFlightMode Enum representing the flight mode. The mapping is fixed for the Phantom series, Inspire series, Mavic Pro, and M100. For N3, A3, Matrice 600, and Matrice 600 Pro the mapping is firmware dependent. With firmware version 3.2.11.0 or above, the mapping can be customized in DJI Assistant 2.
Enables/disables multiple-flight mode. When multiple-flight mode is enabled, user can change the aircraft's mode to P/F/A/S mode by toggling the switch on the remote controller. If it is disabled, the aircraft will be in P mode.
Input Parameters:
boolean enabled
true to enable multiple-flight mode.
@Nullable CompletionCallback callback
Completion callback that receives the execution result.
Determines whether multiple-flight mode is enabled. When multiple-flight mode is enabled, user can change the aircraft's mode to P/F/A/S mode by toggling the switch on the remote controller. If it is disabled, the aircraft will be in P mode.
Input Parameters:
@NonNull CompletionCallbackWith<Boolean> callback
Completion callback that receives the execution result.
Enables novice mode. When novice mode is enabled, the flight speed will become slower and less responsive handling. For Phantom 4 Pro, enabling novice mode will enable the infrared time-of-flight (TOF) sensors on the left and right.
Input Parameters:
boolean enabled
true to enable novice mode.
@Nullable CompletionCallback callback
Completion block that receives the execution result.
Determines whether novice mode is enabled or not. If novice mode is enabled, the flight speed is slower and less responsive handling. For Phantom 4 Pro, enabling novice mode will enable the infrared time-of-flight (TOF) sensors on the left and right.
Input Parameters:
@NonNull CompletionCallbackWith<Boolean> callback
Completion callback that receives the execution result.
Defines how vertical control values are interpreted by the aircraft.
Enum Members:
VELOCITY
Sets the virtual stick vertical control values to be a vertical velocity. Positive and negative vertical velocity is for the aircraft ascending and descending respectively. Maximum vertical velocity is defined as 4 m/s. Minimum vertical velocity is defined as -4 m/s.
POSITION
Sets the virtual stick vertical control values to be an altitude. Maximum position is defined as 500 m. Minimum position is defined as 0 m.
Defines how manual roll and pitch values are interpreted by the aircraft.
Enum Members:
ANGLE
Sets the roll and pitch values to be an angle relative to a level aircraft. In the body coordinate system, positive and negative pitch angle is for the aircraft rotating about the y-axis in the positive direction or negative direction, respectively. Positive and negative roll angle is the positive direction or negative direction rotation angle about the x-axis, respectively. However in the ground coordinate system, positive and negative pitch angle is the angle value for the aircraft moving south and north, respectively. Positive and negative roll angle is the angle when the aircraft is moving east and west, respectively. Maximum angle is defined as 30 degrees. Minimum angle is defined as -30 degrees.
VELOCITY
Sets the roll and pitch values to be a velocity. In the body coordinate system, positive and negative pitch velocity is for the aircraft moving towards the positive direction or negative direction along the pitch axis and y-axis, respectively. Positive and negative roll velocity is when the aircraft is moving towards the positive direction or negative direction along the roll axis and x-axis, respectively. However, in the ground coordinate system, positive and negative pitch velocity is for the aircraft moving east and west, respectively. Positive and negative roll velocity is when the aircraft is moving north and south, respectively. Maximum velocity is defined as 15 meters/s. Minimum velocity is defined as -15 meters/s.
Defines how manual yaw values are interpreted by the aircraft.
Enum Members:
ANGLE
Sets the yaw values to be an angle relative to the north. Positive and negative yaw angle is for the aircraft rotating clockwise and counterclockwise, respectively. Maximum yaw angle is defined as 180 degrees. Minimum yaw angle is defined as -180 degrees.
ANGULAR_VELOCITY
Sets the yaw values to be an angular velocity. Positive and negative angular velocity is for the aircraft rotating clockwise and counterclockwise, respectively. Maximum yaw angular velocity is defined as 100 degrees/s. Minimum yaw angular velocity is defined as -100 degrees/s.
Control mode of the flight controller. It determines how the pilot can control the aircraft. By default, it is in smart control mode.
Enum Members:
SMART
Smart control mode. The aircraft can stabilize its altitude and attitude in smart mode.
MANUAL
Manual control mode. The aircraft will not stabilize its altitude and attitude in manual mode. This mode is for advanced pilots only, and should only be used when the pilot understands the risk of operating in this mode. Any damage to the product when operating in this mode will not be covered under warranty.
Flight modes that map to the flight mode switch on the remote controller.
Enum Members:
P
Positioning mode. GNSS and Vision Positioning Systems are used for positioning if they are available. For products without F mode, intelligent functions such as missions and intelligent orientation control can be performed in P-mode.
S
Sport mode. The maximum flight speed and responsiveness of the aircraft is increased in this mode.
A
Attitude mode. The GNSS and Vision Positioning Systems are not used for positioning. The aircraft only uses the barometer to maintain altitude. If receiving a GNSS signal, the aircraft can automatically return home if the Remote Controller signal is lost and if the Home Point has been recorded successfully.
G
Gentle mode. The sensitivity and speed of aircraft will be substantially decreased in gentle mode.
M
Manual mode. The aircraft will not stabilize its altitude nor attitude in manual mode. This mode is for advanced pilots only, and should only be used when the pilot understands the risk of operating in this mode. Any damage to the product when operating in this mode will not be covered under warranty. It is supported by stand-alone A3 and N3 and can be enabled in Assistant 2.
F
Function mode. Performs the same as Positioning mode with intelligent functions such as missions and intelligent orientation control enabled.
T
Tripod Mode. This mode drops the aircraft's maximum speed and significantly reduces the control stick sensitivity of the remote controller to give the user the precision needed for accurate framing. It is only supported by Mavic 2.
State of Smart Return-To-Home (RTH). It is only used when Smart RTH is enabled.
Enum Members:
IDLE
Smart RTH is not triggered yet in the current flight. The Smart RTH state will be reset to this value when the aircraft lands.
COUNTING_DOWN
Smart RTH is triggered and the aircraft is counting down. If no response is received within 10 seconds or the user confirms the request, the aircraft will start to go home and the state will change to EXECUTED. If user cancels the request, the state will change to CANCELLED.
EXECUTED
Smart RTH is already executed in the current flight. The state will not be reset until the aircraft lands.
CANCELLED
Smart RTH request is cancelled by the user. The state will not be reset until the aircraft lands.
The aircraft will fly forward automatically at a certain speed after entering Fixed-Wing Mode. Push the left stick up to ascend and down to descend. Push either stick left or right to rotate the aircraft. Push the right stick up to accelerate and pushing down will exit Fixed-Wing Mode. See the Flight Controller User Guide for more information.
Returns the component index. Index is zero based. A component will have an index greater than zero when there are multiple components of the same type on the DJI product, and one of the components already has the index 0. For instance, M210 can have two gimbal mounted cameras, and will therefore have two gimbal components with indices 0 and 1, and two camera components with indices 0 and 1. For Matrice 600, there are printed numbers on the battery boxes. The Battery component instance with index 0 corresponds to battery compartment number 1. For Inspire 2 and M200 series, Battery with index 0 corresponds to the battery on the port (left hand) side of the aircraft. For M210, M210 RTK, M300 RTK and M350 RTK, Camera and Gimbal with index 0 corresponds to the camera and gimbal on the port (left hand) side of the aircraft. Lidar with index 0 corresponds to the lidar(Zenmuse L1) on the port (left hand) side of the aircraft.
Gets the serial number of the component. Depending on the component, this serial number might not match the serial number found on the physical component.
Returns the firmware version of the component. Each component will have a different firmware version, the combination of which will form the package firmware version getFirmwarePackageVersion found in BaseProduct.
Input Parameters:
@NonNull CompletionCallbackWith<String> callback
The execution callback with the value(s) returned.