Reading parameters from DJI drone - ios

I have to make an iOS application for DJI family of drones, in Swift.
I went to the official web page, successfully integrated the SDK via CocoaPods, but I do have couple of questions:
How to get the current altitude of the aircraft?
How to get the current distance?
How to get the current speed?
Is there any way to read the internal memory size of the aircraft and what's the remaining space?
I've also managed to get the GPS signal via DJIFlightControllerState

Here's the link to the method for Altitude
To get the distance between the aircraft and some other point (ie the RC or Homepoint) you will need to get the Latitude and Longitude of all the points and use your own logic to calculate the distance from each. You can check out the Android Location class to accomplish this. Or you can use a widget in our UXSDK: DUXDistanceRCWidget
or the DUXDistanceHomeWidget
To get the speed of the aircraft is a similar concept - you can use our method getVelocity under FlightControllerState class for X,Y,Z and calculate the speed. Or again, we have a velocity widget in our UXSDK
To get memory size of your SD card you can look at the class mediaFile however information on the memory of the drone itself is not made available.

Related

Indoor Atlas: Get checkpoint list created

I just analysed on IndoorAtlas and tried the sample application using ios SDK. I got my location to be updating in the floor plan I have created when I move around.
I was wondering how should I get message when I reached a point where I have created a checkpoint within the floor. How should i notify user when I reach a place that I have created in floor plan.
I have checked if any function available in IndoorAtlas ios SDK so that I can get list of checkpoints available in that Floor.
Please let me know if there is any function or property available to get those done.
Thanks in advance.
the waypoints you use for mapping are at the moment just for the mapping purpose with MapCreator2, there's no API for fetching those and using for e.g. the use you describe. For that use case you could do for example geofencing.
BR,
Elina, IndoorAtlas

iOS NearBy devices

Hi I am creating two apps where each app needs to know the location of the other app. I am using corelocation for that. However I am not sure whats the best/efficient way of getting the nearby devices. I can create a database with co-ordinates using parsi api. However I think that would be a lot of work to calculate the shortest distance every few minutes. Any ideas? I have a map for each app and i want to display the shortest distance between the two users on the map.I am using google maps api for ios
The API to calculate distance is pretty lightweight. Internally you use the Haversine formula to calculate distance including the curvature of the Earth. From the iOS perspective though you simply do this:
CLLocation* previousPoint = [self.allLocations objectAtIndex:i-1];
CLLocation* currentPoint = [self.allLocations objectAtIndex:i];
CLLocationDistance distanceFromPrevPoint = [previousPoint distanceFromLocation:currentPoint];
You can easily iterate over the other devices in the zone. If you want to reduce the number of calculations, you could only calculate distances to devices in the same base latitude longitude (ignore minutes and seconds).
Since you're using Parse, you should be able to do a PFQuery for all place objects within a given range. See the documentation here: https://www.parse.com/docs/ios_guide#geo/iOS (Geo Queries)
If they're close enough (~30 meters) you can use iBeacons.
What would work the best depends on your particular app's needs.
Edit: Since you said your distance is too far, iBeacons won't work.
The brute-force way to do this is to run through all connected devices and calculate the (Pythagorean) distance to each one, and select the ones that are within your distance threshold. That's very time-consuming however.
Instead you might want to have each device report some sort of region code for each location (State? County? Zip code?) as the location changes. You'd use geocoding to generate the region information. You could have the reporting devices do the geocoding themselves, so they are only responsible for updating location information for a single device and you don't bog down doing geocoding. You'd report lat/long and region information to the server as it changes, with a "choke" to only report changes on significant changes, or once per minute, whichever is LESS frequent. (I remember reading in the docs that you are only supposed to submit a small number of geocoding calls or you get locked out and/or your app gets rejected.)
You'd collect the data in a central server.
Then you could start by requesting other users that match your current region (and possibly nearby regions) and then do distance calculations only on that small subset of your data that matches the region code.

How do I know what GPS provider is using

I developing iOS application working with user location. The question is
"I would like to know that current location is come from Wifi or 3g or else? I would like to know the provider."
Is this possible? I googled around with no luck.
Thanks in advance.
You can't know how it is getting it, but you can know the accuracy of the locations you receive. Every CLLocation object has a horizontalAccuracy property that you can check. It will indicate the margin of error in meters. Also it has a verticalAccuracy property for 3D locations.
First if the device has GPS and you choose CLLLocationAcuracyBest or BestForNavigation, then GPS is used as Location provider all the time.
If you dont want to use that modes, you can distuniguish the location Provider by:
Only GPS delivers the attributes "course/heading" and "speed".
No other (WLAN, GSM-cell) can provice course and speed.
Altitude theoretically could be provided by GSM-Cell (or Wlan), so it could be unsafe to use the altitude as GPS identification hint. I do not recomend using altitude.
While standing still course will also be invalid even when using GPS, while speed will be a valid 0.
A further very good working solution is to use the horicontal accuracy < 40 condition.
GSM Cell will have hor. accuracy much higher than 40m, eg. 1000m.
if you have horicontal accuracy < 30 its for sure form GPS
if you have a valid course: Its for sure from GPS
if you have a valid speed: Its for sure from GPS
In all other cases its a bad position, and it usually is not necarry for further finding wheter from bad GPS or good Wlan / GSM
I ran in to the same problem like you few months ago.
I found some similar questions on stackoverflow that have the same answers like:
your device will automatically send updated location information to your app wherether it from GPS, wifi, EDGE, 3G ...
depends on your code when you init your CLLocationManager

Finding current region with lat long in offline mode

I am currently working on an app which requires the current region in which the user is in.The worst part is app is completely off line.
My logic :
1.Take a screen shot of the city draw squares on that.
Store square 4 points (lat long values taken with respect to map) in DB.
With the lat long values got from gps i can easily find out lat lont belongs to what reason.
I am just wondering if anybody can suggest me better idea to work my app offline.
Thank you in advance ..
You will probably find you have problems getting a location if you have no network access. iOS uses assisted-GPS, which allows the device to both lock onto GPS satellites much faster than it might otherwise take, and also pull in other data from the network to quickly determine location.
Without network access you may not get a location reported back at all, especially if the app was being used indoors (vanilla GPS reception is typically very bad without line of sight). If you do get a location it may take several minutes for an accurate enough reading to be provided.
you can use the RouteMe library which is based on OpenStreetMap. this allows to download map data in advance.
If you want to work with screenshots (from a legal source) then you use the Helmert transformation to transform between gps and picture-pixel coordinazes.
you need at least 3 points in the picture-map for which you now the lat,lon coordinates.

getting the location and speed via mobile platforms

Is there any possibility of getting the location of a user, moving direction, and the speed via mobile platforms(client side programming like j2me) ? if there is availability in any platform please let me know the platform and please give me some study links to study about it?
regards,
Rangana
I'm not sure if there is an API for this, mainly because I don't think that this information (velocity) is available.
You can still figure it out though, and this would work on all cell phones that allow you to access their "current location".
Ping the phone for it's current location every n seconds (10,20,30 seconds, etc...)
Log the location of the phone at every ping (lat,long)
Determine the distance traveled from ping-to-ping. You may need to use vector resolution (http://www.physicsclassroom.com/class/vectors/u3l1e.cfm)
For example, if a phone moves 1000 meters over the course of a 30 second ping, that means:
1000 meters / 30 seconds = 33.333 m/s
Doing this, you can also determine acceleration, etc... This would not give you instantaneous velocity or acceleration, but instead average velocity and average acceleration.
Without GPS it is impossible to get the speed and exact location. You can however retrieve the base station location from several web services and determine your approximate location.

Resources