Code to autoland DJI matrice 100 - controls

I am working on developing program for autonomous control of DJI matrice drone. I like to have precise landing of DJI drone with tolerance of approx 5cm in X and Y axes. For this I am trying to control the drone until 50cm from ground and then immediately landing() function is called. But after the landing() function is called, I see that the drone moves in X and Y directions as well. Due to this landing within defined tolerance fails. Is there a way, that I may write an own code for autolanding program with different constraints.
Thanks.

you can use a combination of a few tools:
Use flightCtrl APIs such as positionAndYawControl documented here to command the drone in the z-axis, slowly reducing the z position desired
Monitor flight status using broadcast->getStatus() as documented here, and keep sending lower z-setpoints till the drone's flight status changes to M100FlightStatus::LANDING
Send disArm() command to turn the motors off and ensure that the status changes to M100FlightStatus::FINISHING_LANDING.
You might have to experiment a little with the z set points and the time duration to keep sending lower setpoints in order to get this to work.

Related

Is there any way to get live telemetry data from the DJI Mavic 2 Zoom to another unit, say a computer?

As part of a course on my university we've been given the task of taking the live wind telemetry from a drone and then feeding it to a neural network so that it gives better estimates than just using a sensor.
The research we've concluded so far tells us that our drone, the DJI Mavic 2 Zoom, is only compatible with the Windows SDK but not the onboard SDK.
Simply our question is; is there any way for us to send the raw wind speed and direction data from the drones sensors to a computer?
Create Android application with DJI Mobile SDK and send data from msdk to your computer with wifi.
The SDK only provides the wind warning level(0, 1 and 2). It does not provide any information regarding the direction from which the wind is blowing or the actual speed of the wind.
The aircraft tries to stay in it's current position on it's own, even if there is moderate wind blowing. However the drone does not tell the user how much it has to work in which direction to negate the effect of the wind.
I assume you're better off with accessing real time wind information for your position from a weather service on the internet, if that's available in your country.
I've done a wind meter app.
The best method is:
Fly against the wind
In virtualstick use angle mode, and set pitch and roll to 0 This will let the drone drift with the wind.
Slowly rotate the yaw.
Meassure the speed, when it stop increasing, the gps-speed gives you the windspeed and direction.
Warning, in strong wind you have to fly for quite a while against the wind.
The yaw rotation needs to be done due to the drone is never exactly leveled, and it will pick up speed at one direction. If turned, it cancel that out.
Send the info to a server over internet/wifi.
I've done this on an android phone connected the controller.
Windows api doesn't seem to support virtualsticks, which I find strange. In that case it must be done on android or ios, and trasnmitted to a server. I might be wrong since I never used the windows api.

[dji-sdk][onboard-sdk] Loosing GPS while in Onboard control flight mode

How does the DJI UAV (A3 or M600) behave if the GPS signal was completely lost during the flight and the setpoint was given as Horizontal command in ground_ENU frame.
According to this appendix:
Only when the GPS signal is good (health_flag >=3),horizontal position control (HORI_POS) related control modes can be used.
Only when GPS signal is good (health_flag >=3),or when Guidance system is working properly with Autopilot,horizontal velocity control(HORI_VEL)related control modes can be used.
Will the DJI switch to Attitude Flight mode?
Will you still have the authority to control over Onboard-SDK? And if yes, does this mean that you could control it only via HORI_ATTI_TILT_ANG mode?
Thanks!
I never test the full case which hook up the dji a3 and osdk and let it crash.
What I tested is using ground set up with A3 and turn off the ESC and motor. Run the mission and plot the GPS. But I moutned many other sensors to get the correct position/velocity command.
When next to the building. GPS went to crash on the building. The DJI GPS mission control follows that. The GPS from DJI sdk is denoted in the green line. I have to use aullixary visual and Lidar based navigation to get to correct position

DJI Mobile SDK Way point mission configuration in order not to brake at every waypoint

in our we Mission Planning APP based on Mobile SDK we need to define very dense way points (we have way points every 10 meters).
In that situation the aircraft behaviour is the following: once at the waypoint position it brakes and then accelarates again to go to the next waypoint.
Is there any configuration about the mission or about the way points able to avoid the stop at each waypoint?
It is not possible to set a target speed on each waypoint, however is it possible not to brake at every waypoint?
Thanks
It is actually possible to do all of what you want with DJI SDK.
DJIWaypointMission has a flight path mode property which takes two options: normal and curved. Normal flies the mission the way you expect, with stops between each waypoint. Curved however, will make the drone fly through the waypoints without stopping. The radius of the curve that the drone makes at each waypoint is configurable by changing the value at each waypoint.
DJIWaypoint has coordinate, altitude and heading fields which help specify the drone's position at that particular waypoint. It also has a gimbalPitch property which can help orient the pitch of the gimbal to what you want. The speed property will allow you to set the speed of the aircraft between two particular waypoints.
Now, instead of creating DJIWaypointActions to take pictures, what you can do is set the shootPhotoDistance property of each DJIWaypoint to some value greater than your maximum inter-waypoint distance. Doing this will instruct the drone to take one picture as soon as it reaches the waypoint (without stopping if your waypoint mission is curved).
So, in conclusion what you want to do is create a WaypointMission with a curved flight mode, and add the list of all your custom waypoints which have the shootPhotoDistance property set to a large distance.
The waypoint code uses stopping at each waypoint as the method to know that a waypoint has been reached. So programming the drone to go to a waypoint, the waypoint is reached, the drone stops, and then completes various actions such as taking a picture.
If you do not want the drone to stop at each waypoint then use a curved path instead of a normal path. However in this instance, since using a curved path, the drone does not stop but it is also not possible to complete actions such as taking a picture at each waypoint.
The usual method around this is to choose waypoints relatively far away from each other and then use timing to take a picture every couple of seconds.
In addition be careful of wanting waypoints every 10m. The issue is one of precision/accuracy of the GPS system unless you are using RTK. If you are not using rtk then a specific waypoint lat/lng can frequently vary by a couple of meters between each flight depending on satellite lock and other factors.

Remove GPS on matrice 100

With my team we are programming indoor flight for the matrice 100, and we don't have the use of the GPS.
Is it possible to remove it?
And sometimes at the floor level we have electromagnetic problems, and the drone refuses to turn on the rotors, are they any way to force it ?
We use guidance, and I have noticed even without GPS and with electromagnetic interference the drone is stable.
As of Mar 2018, on ALL DJI drones you need to have at least the compass connected in order to start flight.
Can't you just remove the GPS module from the M100? The module rises above the rest of the craft; it's that little white puck with "DJI" written on it in red.
Alternatively, I've heard of people covering it with tin foil to prevent the GPS signal from coming through.

Using windows phone combined motion api to track device position

I'd like to track the position of the device with respect to an initial position with high accuracy (ideally) for motions at a small scale (say < 1 meter). The best bet seems to be using motionReading.SensorReading.DeviceAcceleration. I tried this. But ran into few problems. Apart from the noisy readings (which I was expecting and can tolerate), I see some behaviors that are conceptually wrong - e.g. If I start from rest, move the phone around and bring it back to rest- and in the process periodically update the velocity vector along all the dimensions, I would expect the magnitude of the velocity to be very small (ideally 0). But I don't see that. I have extensively reviewed available help including the official msdn pages but I don't see any examples where the position/velocity of the device are updated using the acceleration vector. Is the acceleration vector that the api returns (atleast in theory) supposed to be the rate of change of velocity or something else? (FYI - my device does not have a gyroscope, so the api is going to be the low accuracy version.)

Resources