NOTE This article is Machine-Translated. If you have any questions about this article, please send an E-mail to DJI, we will correct it in time. DJI appreciates your support and attention.
Using drone flight control function of OSDK, you can set and obtain various basic parameters of the drone, control the drone to perform basic flight actions, and complex flight actions through the Joystick function.
OSDK has opened interfaces for setting basic parameters of drones:
The application with Message Subscription could help users to obtain information about the basic parameters of the drone:
The basic flying actions of drones include three types: lock, takeoff and landing, and back to home. Developers can use the interface provided by OSDK to control the drone perform the specified flight action.
Table 1. Basic Action
Type | Item | Details |
---|---|---|
Lock | Unlock | If the drone is unlocked, the drone ’s propeller will rotate at idle speed, but will not fly off the ground |
Lock | If the drone is locked, the propeller of the drone changes from idle to static state | |
Take off and Land | Auto take off | The drone will automatically take off 1.2 meters (the height cannot be adjusted) |
Automatic Landing | The drone will land automatically | |
Cancel Automatic Landing | The drone will stop landing during the descent and hover | |
Landing Confirmation | When the drone has landed a certain distance from the ground, users can use this function to confirm that the drone has landed on the ground | |
Forced Landing | Ignore the status of the landing surface and force the drone to land (the landing speed is faster) | |
Back To Home | Return | The drone will automatically return home |
Cancel | The drone will hover |
NOTE
- Different drones may have different heights when taking off, landing and returning. Please refer to the User's manual of the drone for details.
- After unlocked, if the takeoff command is not received, the drone will automatically lock and the propeller will stop rotating. If the drone fails to unlock, please query the reason for the unlock failure according to the error code.
Joystick is a comprehensive drone control function. When using the Joystick function, need set the Coordinate System, Horizontal Mode, Vertical Mode, Yaw Angle Mode and Self-Stability Mode at same time.
Body Coordinate System The Body Coordinate System uses the center of gravity as the origin, the direction of the head is the X axis, and the right side of the head is the Y axis. The Z axis is perpendicular to the X axis and the Y axis(follow the "right-hand rule"). In the body coordinates, the flying action rotates around the X axis, Y axis and Z axis,it also can be called roll (the drone only rotates around the X axis), pitch (the drone only rotates around the Y axis) And yaw (the drone only rotates around the Z axis).
Geodetic Coordinate System The Geodetic Coordinate System is also called the Ground Coordinate System or the Local Horizontal Coordinate System. In this coordinate system, the direction of the drone pointing to the north of the earth is the X axis, and the direction of the east is the Y axis. The X axis and the Y axis are perpendicular to each other, The Z axis points vertically below the drone.(follow the "right-hand rule"), the Z axis will adjust the angle according to the actual situation of the drone, so this coordinate system is also called "North-East-Earth (NED) Coordinates System".
NOTE If the mode of the position command is not 0, the drone will fly forward at the specified speed, otherwise, the drone will hover at the specified position.
Only in the speed control mode in the Horizontal mode, the developer can set the hovering mode of the drone:
The basic height concept of DJI's drone during the flight is shown in Table 2.
Table 2. Concept Of The Height
Relative Takeoff Altitude | Fusion Height | GPS Altitude | RTK Height | Relative Altitude | |
---|---|---|---|---|---|
Basic Concept | Altitude change of drone relative to take-off point | The barometer value is used as the initial value, using the fusion algorithm and the altitude value output with the help of the data from all sensors on the drone | Real-time ellipsoid height based on GPS satellite output | Real-time ellipsoid height based on RTK technology output | The distance between the drone and the object below it by using the ranging sensor on the drone |
Source | IMU (which may include vision sensors, GPS, and RTK) and barometers | IMU (which may include vision sensors, GPS, and RTK) and barometers | GPS satellite | RTK satellite | TOF or ultrasound and IMU |
Height 0 Points | The point where the drone takes off from the ground | Standard pressure sea level | WGS84 coordinate system | RTK coordinate system (C2000, WGS84 or user specified coordinate system) | The surface of hard objects (such as the ground) directly below the drone |
Application Usage Scenarios | Used to get the current flying height of the drone | For more precise and stable control of drones to perform flight tasks | Used to analyze flight missions and flight status of drones | Used in missions such as precision mapping and waypoint flight | For the safe landing of drones (obstacle avoidance and speed reduction) |
Effective Range | Several kilometers | Several kilometers | Several kilometers | Several kilometers | Within 10 meters |
How to Get | Get this information through DJI Pilot Mobile APP developed based on MSDK can subscribe to this information |
Mobile APP developed based on MSDK can subscribe to this information | Mobile APP developed based on MSDK can subscribe to this information | Mobile APP developed based on MSDK can subscribe to this information | Get this information through DJI Pilot Mobile APP developed based on MSDK can subscribe to this information |
Error | Yes, the altitude accuracy will be affected by the flying distance of the drone | Yes, the altitude accuracy will be affected by the flying distance of the drone | None | None | None |
Reliability | Unreliable | Unreliable | Basically reliable | Reliable | Reliable |
Noise Level | Low | Low | High | Low | Low |
Influencing Factors | Affected by temperature, humidity and air pressure | Affected by temperature, humidity and air pressure | Affected by the strength of GPS satellites, the short-term error is large and the long-term error is relatively small | Affected by the working status of the RTK satellite and the accuracy of the RTK base station, the overall error is small | The properties (such as texture and texture) of the surface of hard objects directly below the drone |
Developed with the Flight Control, developer need instantiate the object, then set the basic parameters of the drone, finally use the functions in Joystick.
Please instantiate the objects of the drone before using OSDK to develop applications.
FlightSample* flightSample = new FlightSample(vehicle); |
Use the interfaces in flightSample
andflightController
to set the basic parameters of the drone.
NOTE OSDK encapsulates the interface
flightController
inflightSample
, developer could usingflightController
orflightSample
to set the basic parameters of the drone.
flightSample->monitoredTakeoff(); |
To use the Joystick, developer need set the Joystick Mode and Corresponding Control commands first, and then execute the Joystick commands to control the drone. The following code use Joystick in flightSample-> moveByPositionOffset ()
control the drone move to the specified position in the horizontal and vertical directions.
FlightController::JoystickMode joystickMode = { |
NOTE If you do not change the settings in Joystick while the drone is flying, please set the Joystick mode only when the drone to perform the flight mission.
NOTE The position of the z axis in the "joystickCommand" is the absolute height relative to the height of the take-off point.
while (elapsedTimeInMs <timeoutInMilSec) { |